How can I change the device name in scan response during runtme

3 posts / 0 new
Last post
jknorr
Offline
Last seen:3 years 8 months ago
加入:2016-09-30 11:57
How can I change the device name in scan response during runtme

在我的应用程序(基于BLE的设备DSPS) reads the device name from a host connected to the UART. The read operation is started on starup and takes a few seconds. The device name is read in the functions app_easy_gap_non_connectable_advertise_start_create_msg() and app_easy_gap_undirected_advertise_start_create_msg() in app.c so far I am correct. It seems to me, that these functions are only called once during initialization. Is there any way to set or change the device name for the scan response after the initialization?

Thanks for your help.

Device:
MT_dialog
Offline
Last seen:2 months 2 weeks ago
Staff
加入:2015-06-08 11:34
Hi jknorr,

Hi jknorr,

The scan response data can be changed during run time the same way you can change your advertising string, meaning that you will have to stop advertising change the data and start advertising again with the updated data. The DSPS application doesn't have a mechanism in order to update its advertising data, so the device simply starts the advertising procedure with the data as is in the NVDS structure which in turn they are populated from the user_config.h function. So in order to update scan response data you will have to stop the advertising under a certain condition (usually its a timer but it can be anything you would like) and set a new message in the scan response data in the gapm_start_advertise struct. You will be able to find an example in the ble_app_barebone example (the example is for changing the advertising data but the same procedure applies for the scan response data as well). Check in the user_barebone.c file the user_app_adv_start() function.

Thanks MT_dialog

jknorr
Offline
Last seen:3 years 8 months ago
加入:2016-09-30 11:57
Hello,

Hello,
it is working!
Thanks for your help.