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

How to notify several characteristics in central

Hi, I am using ble_app_hrs_c as the base for central. I have included 5 characteristics in the peripheral and central side. How to make ble_nus_c_rx_notif_enable() to notify when any of the 5 characteristics is updated? At the moment, ble_nus_c_rx_notif_enable has only this: return cccd_configure(p_ble_nus_c->conn_handle,p_ble_nus_c->handles.nus_rx_cccd_handle, true);

How do I change it so that I get notification even when nus_rx_wheel_status_handle also receives a notification? My ble_nus_c_handles_t looks like this:

typedef struct {
    uint16_t                nus_rx_wheel_control_handle;      

    uint16_t                nus_rx_wheel_control_cccd_handle; /**< Handle of the CCCD of the NUS RX characteristic as provided by a discovery. */
    uint16_t                nus_rx_wheel_status_handle;	
    uint16_t                nus_rx_wheel_status_cccd_handle;	
    uint16_t                nus_rx_wheel_battery_handle;	
    uint16_t                nus_rx_wheel_battery_cccd_handle;		
    uint16_t                nus_rx_wheel_information_handle;	
    uint16_t                nus_rx_wheel_information_cccd_handle;		
    uint16_t                nus_rx_wheel_debug_handle;	
    uint16_t                nus_rx_wheel_debug_cccd_handle;		
    uint16_t                nus_tx_handle_wheel_control;      /**< Handle of the NUS TX characteristic as provided by a discovery. */
    uint16_t                nus_tx_handle_wheel_status;	
    uint16_t                nus_tx_handle_wheel_battery;	
    uint16_t                nus_tx_handle_wheel_information;		
    uint16_t                nus_tx_handle_wheel_debug;		
} ble_nus_c_handles_t;

The code works fine when I enable notification for one character at a time.

  • 3.I'm note sure if you mean by write here. If you mean that you have a characteristic on your peripheral and your peripheral application writes into it with sd_ble_gatts_value_set() the central will not get any notification. If you mean that you have a characteristic on your peripheral and your peripheral application writes into it with sd_ble_gatts_hvx() the central will get a notification. Usually a write is something that the client is doing to the server, where the characteristic is. Please try to use the correct terminology, if not is very difficult to understand what you mean. If you are not sure what the different terms mean, add a new question, and ask.

    4.I meant using write command to write to the CCCDs, not to the characteristic values.

  • The logic that I mentioned in the previous post did not work because, I was not able to sync between central and peripheral (meaning, peripheral transmits too soon and central misses some).

Related