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

Is it possible to refuse a connection from a central device?

I'm developing a project based on the Nordik UART Service and I wouldn't use pairing as in the example.

However I have some problem when a central device is already connected to my nRF52, if I try to connect a second central, I don't have any refuse but some sort of timeout from my second central.

It's actually possible to refuse a pairing by responding BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP on a BLE_GAP_EVT_SEC_PARAMS_REQUEST, is it possible to do something similar with connection to clearly signal to a new central device that the peripheral isn't accessible or the only asumption is that the advertisement will stop after a connection ?

Thanks

Parents
  • The delay has nothing to do with the already connected peripheral or central, you've not understood the message flow in BLE for connections.

    Connection is ONLY attempted as a response to an advertisement packet (a connectable one) so when you ask a central to connect to a peripheral what it actually does is scan for advertising packets from that peripheral and when it sees one, sends the connect request. So in this case the peripheral has connected and it's stopped advertising so the second central never sees an advertising packet, never sends out a connection request and eventually times out.

    It should be clear then there is nothing you can do on the peripheral to deal with this. The peripheral doesn't even know a second central is trying to connect to it because the second central hasn't done anything yet.

    So what you need to do is fix the central to time out faster.

  • Understood, so this behavior is related to Android in my case. Thank you for the help

Reply Children
No Data
Related