Skip to main content

How can I add device name in the iBeacon advertising data?

DA14580

3 years ago

Posted by ustbzhangm 0 points 5 replies
0 upvotes

Hi,all.
I want to add device name in the advertising data.
As the maximal length of the advertising data is 0x1C (0x1F-3) bytes.
And the iBeacon data structure is:
uint8_t adv_header[2]; //static for ibeacon
uint8_t company_id[2];
uint8_t data_type; //static
uint8_t beacon_length; //static
uint8_t uuid[16]; //Configurable
uint8_t major[2]; //Configurable
uint8_t minor[2]; //Configurable
uint8_t tx_power;
The iBeacon structure occupy 0x1B (27) bytes.
And then, only one byte (0x1C-0x1B) left that can be used.
So, how can I add the device name in the iBeacon advertising data?
3ks

3 years ago

PM_Dialog

Hi ustbzhangm,

 

Could you please let me know which project are you using in order to advertise ibeacon packet?  Are you using the beacon project or any example of the SDK> Depending how you are using the SDK and which example you are using be aware that the SDK will append any extra data that don’t fit in the advertising string in the scan response data. In the first indication (advertising indication) the advertising data will populate the data, and then in the second indication (scan response indication) the scan response data will populate the struct. In order to catch the scan response data, you should configure your device as GAPM_SCAN_ACTIVE to get a scan response. Could you please clarify which scan mode are you using in your application? GAPM_SCAN_ACTIVE or GAPM_SCAN_PASSIVE configuration?

 

Thanks, PM_Dialog

3 years ago

ustbzhangm 0 points

Hi, PM_Dialog.
Thank you very much.
Yes, I want to advertise ibeacon packet. And I want to advertise extra data at the same time.
I use the Dialog reference design Battery powered Beacon project. There is no space in 'cmd->info.host.adv_data[ ]' to hold extra data.
Can I put the extran data in the 'cmd->info.host.scan_rsp_data[ ]' ? If I want to advertise the device name, Can I put the '\x05\x09\x54\x45\x53\x54' in the scan_rsp_data? And this will work?

3 years ago

ustbzhangm 0 points

I have tested again.
In connectable mode, I can add the device name data in the response data packet. And it worked, I can get the device name while scanning by cellphone.
But in non-connectbale mode, I add the device name data in response data packet. The BLE device can not work normally. Because I can not scan the device.

3 years ago

ustbzhangm 0 points

I find a articl:
Non-connectable mode A device in this mode either does not send advertising packets at all or it sends ADV_NONCONN_IND or ADV_SCAN_IND advertising packets (see Table 2-1). In both cases, the device is, as the mode name implies, not connectable, meaning that no centrals may establish a connection with it.
But I can not find "ADV_SCAN_IND" mode in the DA14580 SDK. Can the DA14580 work in ADV_SCAN_IND mode?

3 years ago

PM_Dialog

Hi ustbzhangm,

 

The ADV_SCAN_IND packets (scannable undirected advertising) are non-connectable packets and you will be able to send scan response data in the case of a scan request. In order to activate those kind of packets in the SDK you will have to set the scan response data and the SDK will send those kind of packets. But, be aware that there is no detection if the scanner is configured as GAPM_SCAN_ACTIVE, and as a result the peripheral will always have the receiver open. This means that when the peripheral transmitting data during the advertising event, it will also open the receiver for hearing scan requests.  So the device will always send scan responses when it gets a scan request.

 

Thanks, PM_Dialog