Hi,
I’m looking through the documentation to find a way (and playing with code) to try and work out how to have the device name advertised in the advert packets (on BLE) rather than scan response packets so that devices using passive scanning
can determine the device name but not having any luck. The documentation for the BT_LE_ADV_OPT_USE_NAME bit states:
Include the GAP device name automatically when advertising.
By default the GAP device name is put at the end of the scan
response data.
When advertising using @ref BT_LE_ADV_OPT_EXT_ADV and not
@ref BT_LE_ADV_OPT_SCANNABLE then it will be put at the end of the
advertising data.
If the GAP device name does not fit into advertising data it will be
converted to a shortened name if possible.
The application can set the device name itself by including the
following in the advertising data.
@code
BT_DATA(BT_DATA_NAME_COMPLETE, name, strlen(name))
@endcode
So how would one put it in the advertising data without using extended advertising? The code I’m using is advertising using:
static const struct bt_data ad[] = {
BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)),
};
bt_le_adv_start(BT_LE_ADV_CONN_NAME, ad, ARRAY_SIZE(ad), NULL, 0);
Where the device name is 19 bytes which should fit in a normal non-extended adverts advertising packet. I do not want to use extended adverts and I’ve checked the bits that are set by using BT_LE_ADV_CONN_NAME which are bits 0 and 3, for
BT_LE_ADV_OPT_CONNECTABLE and BT_LE_ADV_OPT_USE_NAME, the scan response bit is not set and a null pointer is suppled for scan response data to the advertising function, so why is it placing the device name in scan response data still?
Thanks,
Jamie