This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
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

How to change Frequency of Notification(Subscription) of read value in BLE Central Example Code?

In BLE Central Example like HRS and RSCS,

Central has Enabled the notification  when event handler find Case : BLE_RSCS/HRS_C_EVT_DISCOVERY_COMPLETE.

But what if we want to read the value in fixed timed interval. Which function we need to use?

Also I found that Enable notification function reads value only if that value changes.

What changes will be require if we want to read/notify that value also if it is not changing ?

I am using nRF5_SDK_17.0.2 with nRF52840-DK Board 

  • Hi

    It is up to the device sending the notifications (the GATT server) to decide when to send them, and the Bluetooth specification doesn't define any way for the client to control this. 

    You could define a custom characteristic that allows the client to tell the server how often it should send notifications, but if you want to implement a standard GATT profile then this will not be compliant. 

    It sounds a bit odd that you wouldn't get notifications when the value is the same, I thought this should be implemented out of the box. Do you have more information about this 'Enable notification' function that you are using?

    Is this a part of the standard examples?

    Best regards
    Torbjørn

  • Thank you for quick Response.

    I am talking about ble_rscs_c_rsc_notif_enable()

    I am trying to implement it on Standard Example first than I will implement on other custom application.

    Do we have any Example on this " custom characteristic that allows the client to tell the server how often it should send notifications" ?

  • Hi

    Vipul2988 said:
    Do we have any Example on this " custom characteristic that allows the client to tell the server how often it should send notifications" ?

    No, we don't have an example for this unfortunately. 

    If you want to implement a custom application using a custom Bluetooth service I would recommend starting out with the ble_app_uart and ble_app_uart_c examples instead. 

    They show you how to set up the Nordic UART Service (NUS), which allows you to send strings of varying length from one device to the other. 

    With this service it is quite straight forward to implement a custom command that lets the client instruct the server when to send notifications. 

    You can also extend the example by adding more characteristics, in order to set up separate characteristics for sensor information and control information for instance. 

    Best regards
    Torbjørn 

  • Hello,

    I was checking ble_app_uart_c Example and I did not find any time related thing on the same. 

    I found BLE_NUS_C_EVT_NUS_TX_EVT which is indicating that the central received something from a peer.

    But no idea about how to change the timer thing.

  • Hi

    I would recommend starting by reading this blog on the app_timer module. It is based on an older SDK, but the app_timer module hasn't changed much in recent versions. 

    By setting up a repeated app_timer in your code you can use this to schedule notifications at a fixed interval, and you can change the interval by stopping and starting the app_timer with different settings. 

    Best regards
    Torbjørn

Related