cybt343026-01 ibeacon的应用如何设置设备名称

公告

大中华汽车电子生态圈社区并入开发者社区- 更多资讯点击此

Tip / 登入 to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
YaTr_3516311
Level 5
Level 5
25 sign-ins First solution authored 100 replies posted

Hi,

我想在cybt343021-01的模块上实现ibeacon的应用。现在已经了ibeacon的应用通过下面的代码和19 0e 01 19 00 31 01 02 15 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 11 22 aa bb 01的hci命令

YaTr_3516311_0-1650004351561.png

这是测试结果。但是我想显示device name。但是根据adv的最大长度是31bytes(我的应用已经用了30byte(3 bytes,BTM_BLE_ADVERT_TYPE_FLAG, 27bytes BTM_BLE_ADVERT_TYPE_MANUFACTURER)),那我现在要如何实现这个device name的应用呢

YaTr_3516311_1-1650004662834.png

YaTr_3516311_2-1650005129587.png

 

 

 

0 点赞
1 解答
lock attach
Attachments are accessible only for community members.
Owen_Zhang123
Moderator
Moderator
Moderator
5 questions asked 500 solutions authored 250 sign-ins

我在hello_sensor的demo上测试,没有问题啊。请参考附件的截图和code。

IMG_0066.jpeg

在原帖中查看解决方案

0 点赞
7 回复数
Owen_Zhang123
Moderator
Moderator
Moderator
5 questions asked 500 solutions authored 250 sign-ins

请试一下,用下面的API把设备名称放在scan response packet中看手机上能否显示:

/**
*
* Function wiced_bt_ble_set_raw_scan_response_data
*
* Set scan response raw data
*
* @param[in] data_mask : number of scan response data element
* @param[in] p_data : scan response raw data
*
* @return status of the operation
*
*/
wiced_bt_dev_status_t wiced_bt_ble_set_raw_scan_response_data(UINT8 num_elem,
wiced_bt_ble_advert_elem_t *p_data);

0 点赞

YaTr_3516311_0-1650269443364.png

方法一

YaTr_3516311_1-1650269476705.png

 

方法二

方法一和二都用(19 0e 01 1B 00 31 01 02 15 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 11 22 aa bb 01 74 72)测了一下,没有名字出现。并且方法一没法让手机app识别出ibeacon的信息内容

0 点赞
Owen_Zhang123
Moderator
Moderator
Moderator
5 questions asked 500 solutions authored 250 sign-ins

请问你是要做一个普通的广播设备还是ibeacon?

ibeacon需要遵循苹果公司的协议,数据包如下,不需要添加设备名称,30 byte的数据包就可以了:

Owen_Zhang123_0-1650277977007.png

 

0 点赞

要用ibeacon。如下图那样,既能实现ibeacon,又有名字可以实现,有什么方法吗

YaTr_3516311_1-1650328611489.png

 

 

0 点赞
lock attach
Attachments are accessible only for community members.
Owen_Zhang123
Moderator
Moderator
Moderator
5 questions asked 500 solutions authored 250 sign-ins

我在hello_sensor的demo上测试,没有问题啊。请参考附件的截图和code。

IMG_0066.jpeg

0 点赞

发现问题了。我之前用的是 BTM_BLE_ADVERT_NONCONN_HIGH,就不行。wiced_bt_start_advertisements( BTM_BLE_ADVERT_UNDIRECTED_HIGH, 0, NULL )就可以的。能解释一下吗

0 点赞
Owen_Zhang123
Moderator
Moderator
Moderator
5 questions asked 500 solutions authored 250 sign-ins

BTM_BLE_ADVERT_NONCONN_HIGH类型,指的是non-connectable和non-scannable。不可连接,不可扫描,所以只能接收到广播包,不能收到scan response包。

0 点赞