View: 2137|Reply: 4

[BLE SDK] 使用ble芯片作为central时,如何对广播名称和广播uuid进行过滤,而不是通过mac过滤?

[Copy link]

8

Threads

16

Replies

88

Credits

Credits
88
Posted on 2025-11-26 12:07:51 | Show all posts |Reading mode From 广东深圳
Information
Notes:   建议参照本版块置顶帖内容输入必要信息
Chip model: tc321x
SDK & version: 4.0.2.2
请问使用ble芯片作为central时,对于想要连接的从设备,如何对广播名称和广播uuid进行过滤,而不是通过mac过滤?



能否提供下api接口;和api接口对应h文件;

谢谢;

0

Threads

40

Replies

161

Credits

Credits
161
Posted on 2025-11-26 15:36:31 | Show all posts From 上海
你好,

如果需要过滤广播名称和广播uuid需要解析结构体event_adv_report_t中的data,广播名称和广播uuid都位于此data中

具体的data格式取决于对方peripheral的data格式,telink demo中的tbl_advData数组中的相关格式亦可参考

8

Threads

16

Replies

88

Credits

Credits
88
 Author| Posted on 2025-11-26 16:39:05 | Show all posts From 广东深圳
TL_YWY 发表于 2025-11-26 15:36
你好,

如果需要过滤广播名称和广播uuid需要解析结构体event_adv_report_t中的data,广播名称和广播uuid都 ...

你好,感谢回复;
这个数组中只有mac有6个字节足够存储mac addr,剩下的几个变量只有1个字节,也不是指针,既不够存储uuid uint16_t,也不够存储广播名称十几个字节的字符串,
这个结构体显然不对呀,一点也不符合从机广播包的格式;

如果我用mac地址可以用这个结构体,可是我现在想用uuid和广播名称的话,这个结构体显然不对呀?

  1. /**
  2. *  @brief  Event Parameters for "7.7.65.2 LE Advertising Report event"
  3. */
  4. typedef struct {
  5.         u8        subcode;
  6.         u8        nreport;
  7.         u8        event_type;
  8.         u8        adr_type;
  9.         u8        mac[6];
  10.         u8        len;
  11.         u8        data[1];
  12. } event_adv_report_t;
Copy code

7

Threads

5

Replies

91

Credits

Credits
91
Posted on 2025-11-26 16:58:14 | Show all posts From 广东深圳
TL_YWY 发表于 2025-11-26 15:36
你好,

如果需要过滤广播名称和广播uuid需要解析结构体event_adv_report_t中的data,广播名称和广播uuid都 ...

老铁,期待回复
谢谢支持

0

Threads

40

Replies

161

Credits

Credits
161
Posted on 2025-11-26 20:02:35 | Show all posts From 上海
本帖最后由 TL_YWY 于 2025-11-26 20:12 编辑

老铁,

这个结构体中的data[1]不是你看到的只有一位,底层会分配内存去放相应的data
把这个data打印出来看看就明白啦

Credit rules for this forum

Follow our WeChat
Privacy Policy|Telink Developer Community

For copyright infringement reports, complaints or suggestions, please email forum@telink-semi.com

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.|沪ICP备17008231号-1 |沪公网安备31011502403548号

inThis forumPostBack to top