How can I add scan response data to the SDK example ble_app_beacon?
How can I add scan response data to the SDK example ble_app_beacon?
Hi!
The approach might vary depending on what version of the SDK you are working with.
Maybe you could provide a little more information?
SDK version, what device, softdevice version etc. is useful information to add in your questions.
However, you can take a look at our advertising tutorial, and the chapter about the Scan response data.
The tutorial is from one of the older SDK but the approach will be similiar.
Also, the ble_app_uart example adds data to the scan reponse packet, so you can get an idea of how it's done.
Let me know if you have any further questions.
Best regards,
Joakim.
Hi!
The approach might vary depending on what version of the SDK you are working with.
Maybe you could provide a little more information?
SDK version, what device, softdevice version etc. is useful information to add in your questions.
However, you can take a look at our advertising tutorial, and the chapter about the Scan response data.
The tutorial is from one of the older SDK but the approach will be similiar.
Also, the ble_app_uart example adds data to the scan reponse packet, so you can get an idea of how it's done.
Let me know if you have any further questions.
Best regards,
Joakim.
I use SDK 15.0.0, softdevice S132, board nRF6827 Rev. 1.2.1 (nRF52 Development kit), PCA 10040, Segger embedded studio for ARM Release 3.34a
I have looked into the ble_app_uart example, but I cannot find the line(s) where the scan response data is set.
I receive
Advertisement data: 02:01:05:0C:09:4E:6F:72:64:69:63:5F:55:41:52:54 (here at the end is Nordic_UART)
Scan response data: 11:07:9E:CA:DC:24:0E:E5:A9:E0:93:F3:A3:B5:01:00:40:6E
But where is the scan response data in the code?
Thanks for your help!
Hi.
If you take a look at line 613-614 of the main.c file.
The ble_app_uart adds the 128-bit UUID to the scan response packet.
If you didn't already, I would suggest that you take a look at the tutorial I referred to in my previous answer.
Best regards,
Joakim.
But in that way, I can only change the bytes "01:00" at the end of the scan response data.
For example:
static ble_uuid_t m_adv_uuids[] = /**< Universally unique service identifier. */
{
//original: {BLE_UUID_NUS_SERVICE, NUS_SERVICE_UUID_TYPE}
{0x5678, NUS_SERVICE_UUID_TYPE} //Now 78:56 in the scan response data
};
Where can I change the first 14 bytes? Is that a 128 bit UUID? Where is it set?
(I looked at your tutorial, but the API's of the older SDKs are different from version 15. And the older SDKs have no support for Segger Embedded Studio)
Thanks for your help!
Not sure what you are trying to acheive here?
Do you want to change the 128-bit UUID that is already added to the BLE stack's table?
You can take a look at the ble_advdata_t struct to see which data can be added to the scan response data.
As an example:
If we want to transmit the TX-power level in the scan response packet (And not the Vendor Specific UUID) of the ble_app_uart example:
static void advertising_init(void) { uint32_t err_code; ble_advertising_init_t init; int8_t tx_power = -4; memset(&init, 0, sizeof(init)); init.advdata.name_type = BLE_ADVDATA_FULL_NAME; init.advdata.include_appearance = false; init.advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE; //init.srdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]); //init.srdata.uuids_complete.p_uuids = m_adv_uuids; init.srdata.p_tx_power_level = &tx_power; init.config.ble_adv_fast_enabled = true; init.config.ble_adv_fast_interval = APP_ADV_INTERVAL; init.config.ble_adv_fast_timeout = APP_ADV_DURATION; init.evt_handler = on_adv_evt; err_code = ble_advertising_init(&m_advertising, &init); APP_ERROR_CHECK(err_code); ble_advertising_conn_cfg_tag_set(&m_advertising, APP_BLE_CONN_CFG_TAG); }
Let me know if I misunderstood something or you have further questions.
Best regards,
Joakim.