This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

changing the BLE device name, BLE service and GATT Characteristics dynamically

Hi, I am using nRF52832 module (GAP peripheral, GATT server) with nRF5SDK, ble_app_uart_pca10040_s112 application.

I need some help on dynamically changing the BLE device name, BLE service and GATT Characteristics.

What I tried:
In main(), I initialized only the UART module. Once UART is up, the nRF module receives data from an application chip (MCU).
In uart_event_handle function, I use a function call to process the received data and set the BLE device name accordingly, inside this function call I am initializing BLE stack, GAP parameters, GATT Init, Services Init followed by BLE advertisement.

This way, I was successfully able to set BLE device name and Services dynamically. However, after few minutes of communication with a GATT client, incorrect/incomplete data is being transmitted to that peer device.

Is it good to initialize BLE this way? If not, what should be done?

Also, I have found few of the forum discussions on how to change the BLE Device name in run time, but not seen anything related to changing GATT characteristics dynamically.
Please help, Thank you in advance.

  • Hi,

    It is possible to add BLE service and characteristics dynamically, but it is not possible to remove them. It is required to send a service change notification to let the gatt client know that the attribute table has been updated.
    Regarding the device name, it is possible to change device name using sd_ble_gap_device_name_set().

    Best regards,
    Dejan

  • I would like to mention that I wanted to change the BLE service and characteristics dynamically so that nRF module connects with different GATT client in run time. In this case, may I know how service change notification would help? Please share any references if possible.

    What I tried:
    In main(), I initialized only the UART module. Once UART is up, the nRF module receives data from an application chip (MCU).
    In uart_event_handle function, I use a function call to process the received data and set the BLE device name accordingly, inside this function call I am initializing BLE stack, GAP parameters, GATT Init, Services Init followed by BLE advertisement.

    This way, I was successfully able to set BLE device name and Services dynamically. However, after few minutes of communication with a GATT client, incorrect/incomplete data is being transmitted to that peer device.

    Is it good to initialize BLE this way? If not, what should be done?

    Also, I would like to know if this method which I followed is correct or not. 

    Please help, Thanks.

  • Hi,

    Could you show relevant part where the function call is located and how you use it?
    Is this the same function call through which you receive data, make initializations and advertisements?

    Best regards,
    Dejan

  • Hi, herewith I have attached the pseudo code for my custom application. Please check it.

    nrf52832_pseudocode

  • Hi,

    In general, what you have described might work. However, it might not be possible to change dynamically services and characteristics without updating attribute table and that would require terminating the connection. On the other hand, there is no such limitation on dynamically updating the device name.

    Best regards,
    Dejan

Related