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

How the Service Discovery Works?

Hi, What will happen when we press the service discovery button in the master control panel? do we get any event like BLE_GAP_EVT_CONNECTED? I couldn't find any detail regarding this in the documents i have. Please provide me some information on this. I need to implement one logic, when i get service discovery request, which may consume 10 to 20 sec time. Is it possible?

Regards, Balaji

  • You don't get any events on a service discovery being done from a Central device, since there isn't anything you can do about it anyway. The GATT Table is entirely contained inside the softdevice's memory, and hence there shouldn't be any reason to notify the application about it.

    You should therefore either trigger your action on the CONNECTED event, or on a write to a particular characteristic. Is there any specific reason this won't work for your use case?

  • Thanks for your reply, Actually we planned to give access to the central device after pressing the button. Now what we can achieve is we need to press the button on the device side first, then master need to request for the service discovery to access the services, But our actual requirement is when the master request for the service discovery that time only we need to press the button to ensure that we are giving access to the correct master.

  • It sounds as if you should rather use this button press to start advertising. If your device is not advertising, it's not possible to connect to it.

    If you use bonding, you could also use whitelisting to normally only make the device connectable for known Centrals, but when the button is pressed also allow new devices to connect.

Related