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

changing the device name via nrf toolbox app

Hi ...

i want to change the device name dynamically, i read my questions related to it , still not working . Here , gap_param_init i have set the flag to change the device name , i am disconnecting , then stop advertise  , and again i am  starting  to advertise . this is my loop , if i started again to advertise i am getting the same device_name only ,please guide me

Parents
  • Hi, 

    Please state which SDK you are working on.

    How do you start your advertising packet ? If the device name is changed, you would need to reinitialize the advertising packet to have the new data being advertised. 

    The device name setting in GAP service is not updated automatically to the advertising packet. 

    Also there is a chance that the phone will cache the advertising packet, you better use the NRF Connect on PC to verify the advertising packet's data.

  • sdk 15.2 ..yes i am doing ..reinitating the advertise .. 

    i am using adv stop , adv start ..is it correct ?

Reply Children
  • No it's not correct. You need to initialize the advertising packet, setting up the advertising data again. 

  • How to do that?? Can you share the sample code, that will be helpful for me 

  • Please study the code that you used for advertising. Which example are you using ? 
    Usually the advertising data is setup inside advertising_init()

  • if my condition gets true  i am calling the set_devicename function .. what i want to include this code please guide me Hung bui

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    static void setDeviceName(deviceStatus_t status)
    {
    ble_gap_conn_sec_mode_t sec_mode;
    BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode);
    sd_ble_gap_device_name_set(&sec_mode, (const uint8_t *)DEVICE_NAME_LOW, strlen(DEVICE_NAME_LOW));
    bsp_board_led_on(BSP_BOARD_LED_1);
    sd_ble_gap_adv_stop(m_adv_handle);
    sd_ble_gap_adv_start(m_adv_handle, APP_BLE_CONN_CFG_TAG);
    }
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Please send the full code, do you have the call to setup adv data: sd_ble_gap_adv_set_configure() ? Please have a look at the message sequence chart here.