完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
如题,求解。将UUID值设为变量,然后扫描得到。。。可以吗? 如果可以的话怎么做?
|
|
相关推荐
3 个讨论
|
|
|
你好,
可以在广播中设定UUID,但是无法设置为一个变量,因为我们事前是把UUID作为一个属性列表都做成一个数组在蓝牙初始化之前加入到服务里面。 属性列表你可以参考simpleGATTprofile.c文件: static gattAttribute_t simpleProfileAttrTbl[SERVAPP_NUM_ATTR_SUPPORTED] = [ // Simple Profile Service [ [ ATT_BT_UUID_SIZE, primaryServiceUUID ], /* type */ GATT_PERMIT_READ, /* permissions */ 0, /* handle */ (uint8 *)&simpleProfileService /* pValue */ ], // Characteristic 1 Declaration [ [ ATT_BT_UUID_SIZE, characterUUID ], GATT_PERMIT_READ, 0, &simpleProfileChar1Props ], // Characteristic Value 1 [ [ ATT_BT_UUID_SIZE, simpleProfilechar1UUID ], GATT_PERMIT_READ | GATT_PERMIT_WRITE, 0, &simpleProfileChar1 ], // Characteristic 1 User Description [ [ ATT_BT_UUID_SIZE, charUserDescUUID ], GATT_PERMIT_READ, 0, simpleProfileChar1UserDesp ], // Characteristic 2 Declaration [ [ ATT_BT_UUID_SIZE, characterUUID ], GATT_PERMIT_READ, 0, &simpleProfileChar2Props ], // Characteristic Value 2 [ [ ATT_BT_UUID_SIZE, simpleProfilechar2UUID ], GATT_PERMIT_READ, 0, &simpleProfileChar2 ], // Characteristic 2 User Description [ [ ATT_BT_UUID_SIZE, charUserDescUUID ], GATT_PERMIT_READ, 0, simpleProfileChar2UserDesp ], // Characteristic 3 Declaration [ [ ATT_BT_UUID_SIZE, characterUUID ], GATT_PERMIT_READ, 0, &simpleProfileChar3Props ], // Characteristic Value 3 [ [ ATT_BT_UUID_SIZE, simpleProfilechar3UUID ], GATT_PERMIT_WRITE, 0, &simpleProfileChar3 ], // Characteristic 3 User Description [ [ ATT_BT_UUID_SIZE, charUserDescUUID ], GATT_PERMIT_READ, 0, simpleProfileChar3UserDesp ], // Characteristic 4 Declaration [ [ ATT_BT_UUID_SIZE, characterUUID ], GATT_PERMIT_READ, 0, &simpleProfileChar4Props ], // Characteristic Value 4 [ [ ATT_BT_UUID_SIZE, simpleProfilechar4UUID ], 0, 0, &simpleProfileChar4 ], // Characteristic 4 configuration [ [ ATT_BT_UUID_SIZE, clientCharCfgUUID ], GATT_PERMIT_READ | GATT_PERMIT_WRITE, 0, (uint8 *)&simpleProfileChar4Config ], // Characteristic 4 User Description [ [ ATT_BT_UUID_SIZE, charUserDescUUID ], GATT_PERMIT_READ, 0, simpleProfileChar4UserDesp ], // Characteristic 5 Declaration [ [ ATT_BT_UUID_SIZE, characterUUID ], GATT_PERMIT_READ, 0, &simpleProfileChar5Props ], // Characteristic Value 5 [ [ ATT_BT_UUID_SIZE, simpleProfilechar5UUID ], 0, 0, simpleProfileChar5 ], // Characteristic 5 configuration [ [ ATT_BT_UUID_SIZE, clientCharCfgUUID ], GATT_PERMIT_READ | GATT_PERMIT_WRITE, 0, (uint8 *)&simpleProfileChar5Config ], // Characteristic 5 User Description [ [ ATT_BT_UUID_SIZE, charUserDescUUID ], GATT_PERMIT_READ, 0, simpleProfileChar5UserDesp ], ]; 加入到广播里面你需要修改广播包数据: // GAP - Advertisement data (max size = 31 bytes, though this is // best kept short to conserve power while advertisting) static uint8_t advertData[] = [ // Flags; this sets the device to use limited discoverable // mode (advertises for 30 seconds at a time) instead of general // discoverable mode (advertises indefinitely) 0x02, // length of this data GAP_ADTYPE_FLAGS, DEFAULT_DISCOVERABLE_MODE | GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED, // service UUID, to notify central devices what services are included // in this peripheral 0x03, // length of this data GAP_ADTYPE_16BIT_MORE, // some of the UUID's, but not all #ifdef FEATURE_OAD LO_UINT16(OAD_SERVICE_UUID), HI_UINT16(OAD_SERVICE_UUID) #else LO_UINT16(SERIALPORTSERVICE_SERV_UUID), HI_UINT16(SERIALPORTSERVICE_SERV_UUID) #endif //!FEATURE_OAD ]; Michael Qian |
|
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
590 浏览 0 评论
1645 浏览 0 评论
2084 浏览 0 评论
为啥BQ7693003DBTR芯片在和BQ769X0盒子通讯时收不到信号?
1537 浏览 0 评论
DSP 28027F 开发板 XDS100v2调试探针诊断日志显示了 Error -150 (SC_ERR_FTDI_FAIL)如何解决
1376 浏览 0 评论
AT32F407在USART2 DMA发送数据时,接包接到了要发送的数据,程序还是处于等待传输完成的标识判断中,为什么?
1788浏览 29评论
2817浏览 23评论
请问下tpa3220实际测试引脚功能和官方资料不符,哪位大佬可以帮忙解答下
1746浏览 20评论
请教下关于TAS5825PEVM评估模块原理图中不太明白的地方,寻求答疑
1662浏览 14评论
两个TMP117传感器一个可以正常读取温度值,一个读取的值一直是0,为什么?
1676浏览 13评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-12 07:20 , Processed in 0.594591 second(s), Total 41, Slave 34 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
2039