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 ?

  • 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.

  • Have a look into it ,in this case i haven't done Re-initializing the advertising packets , please share me the sample so that i can modify

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    /**
    * Copyright (c) 2014 - 2018, Nordic Semiconductor ASA
    *
    * All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without modification,
    * are permitted provided that the following conditions are met:
    *
    * 1. Redistributions of source code must retain the above copyright notice, this
    * list of conditions and the following disclaimer.
    *
    * 2. Redistributions in binary form, except as embedded into a Nordic
    * Semiconductor ASA integrated circuit in a product or a software update for
    * such product, must reproduce the above copyright notice, this list of
    * conditions and the following disclaimer in the documentation and/or other
    * materials provided with the distribution.
    *
    * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
    * contributors may be used to endorse or promote products derived from this
    * software without specific prior written permission.
    *
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Reply
  • Have a look into it ,in this case i haven't done Re-initializing the advertising packets , please share me the sample so that i can modify

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    /**
    * Copyright (c) 2014 - 2018, Nordic Semiconductor ASA
    *
    * All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without modification,
    * are permitted provided that the following conditions are met:
    *
    * 1. Redistributions of source code must retain the above copyright notice, this
    * list of conditions and the following disclaimer.
    *
    * 2. Redistributions in binary form, except as embedded into a Nordic
    * Semiconductor ASA integrated circuit in a product or a software update for
    * such product, must reproduce the above copyright notice, this list of
    * conditions and the following disclaimer in the documentation and/or other
    * materials provided with the distribution.
    *
    * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
    * contributors may be used to endorse or promote products derived from this
    * software without specific prior written permission.
    *
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Children
  • Please study the code. We can't help you if you don't know what the code is doing. 

    In your code the adv data is initialized in advertising_init().

    You can't call advertising_init() again but you can call ble_advertising_advdata_update() to update. 

    In addition, when you call any Softdevice API please check for the return code.