This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Refreshing the p_adv_report->data.p_data when changing the device name on the peripheral side

SDK15.0.0/SEGGER/Windows

Hi, I ran this example: https://github.com/NordicPlayground/nRF52-ble-long-range-demo.

Note: Added NRF_LOG_INFO("%s", p_adv_report->data.p_data); under void on_adv_report() under line 339 to print out the device name

Upon changing the device name(under sdk_config.h) to “destiny98” on the peripheral side, and then reloading the central side, it prints on the debug terminal "destiny98" on the central side. The advertising packet sends over the RSSI value stored in rssi_value and the device name is stored under p_adv_report->data.p_data over at the central side. On the peripheral side, I changed the device name to “destiny1” and built and ran the peripheral again and was in a non-connectable advertising state. The central side does not erase "destiny98" stored under the variable p_adv_report->data.p_data and this is observed on the debug terminal as it was still printing "destiny98". This means that the advertising variable was not cleared every time the device name was changed on the peripheral side. Later on, an attempt to reset the advertising variable did not work by setting p_adv_report->data.p_data = ""; . This means that on the Central side, the advertising variable is readable but not re-writable.

Are there ways to get around this?

Parents
  • Hello,

    The event data is only valid while you are in BLE_GAP_EVT_ADV_REPORT event, and it gets updated when you receive a new event from the stack. What about the RSSI, does it still get updated?

  • The RSSI gets updated but not the device name.  

    For clarification, how I interpreted what you have mentioned is that upon calling the BLE_GAP_EVT_ADV_REPORT function, the event data is valid, valid here means the function will take in the event data variable. The part on event data gets updated when I receive a new event, a new event here refers to changes to the rssi value and peripheral device name?

    How can I then get the central side to refresh the device name? I was thinking along the line of using sd_ble_gap_adv_data_set() but I am not clear of the perimeters or if I am right to use this function.

Reply
  • The RSSI gets updated but not the device name.  

    For clarification, how I interpreted what you have mentioned is that upon calling the BLE_GAP_EVT_ADV_REPORT function, the event data is valid, valid here means the function will take in the event data variable. The part on event data gets updated when I receive a new event, a new event here refers to changes to the rssi value and peripheral device name?

    How can I then get the central side to refresh the device name? I was thinking along the line of using sd_ble_gap_adv_data_set() but I am not clear of the perimeters or if I am right to use this function.

Children
Related