Checking if a client is connected to GATT server

Good day,

is there a way to check if a client is connected to GATT server/service? Would like to send a data after device gets reconnected.

i am using PCA10040 with SDK17.1.

thanks

Parents
  • Hi there,

    You can register the service UUID with the discovery module. You'll then be notified when the GATT Client does a service discovery of that service. For example, the ble_app_uart_c example registers the nus service with the discovery module by using ble_nus_c_on_db_disc_evt() in db_disc_handler(). If you look at the implementation of ble_nus_c_on_db_disc_evt() in ble_nus_c.c you'll see that the function checks if the NUS was discovered and then check what characteristics that was discovred. You can copy this approach for your own custom service and register it with the discovery module likewise. 


    I hope that helped,
    regards
    Jared 
Reply
  • Hi there,

    You can register the service UUID with the discovery module. You'll then be notified when the GATT Client does a service discovery of that service. For example, the ble_app_uart_c example registers the nus service with the discovery module by using ble_nus_c_on_db_disc_evt() in db_disc_handler(). If you look at the implementation of ble_nus_c_on_db_disc_evt() in ble_nus_c.c you'll see that the function checks if the NUS was discovered and then check what characteristics that was discovred. You can copy this approach for your own custom service and register it with the discovery module likewise. 


    I hope that helped,
    regards
    Jared 
Children
No Data
Related