Page 1 of 1

Is there a NimBLE GAP event to accept or refuse a connection?

Posted: Mon Jan 13, 2025 10:08 pm
by Just Me
Hi,

I have a light which I would like to control over BLE. Because it's just a light, I don't want to get trapped into bonding and security stuff (have browsed issues with its implementation) and I need this to run reliably. In the end, if sb "hacks" this device, they will turn on or off a decorative light which is not so dangerous for me.

So, the idea is to make a peripheral which will not advertise itself. The central will know this peripheral's address, directly connects to it (with no GAP scan) and will just write to a known characteristic attribute which will then control the light.

What I struggle with is the peripheral side where I cannot find a NimBLE GAP event which would be fired right when a central tries to connect and inside which I could decide whether to accept the connection.

Is there a NimBLE GAP event which I could use to accept or refuse a connection based on its address (where I could verify if it's my remote control)?

I have found e.g. the BLE_ERR_CONN_REJ_BD_ADDR error code which would be per definition good reason for rejection (of all devices but my remote control). But I don't know at which event return it.

Re: Is there a NimBLE GAP event to accept or refuse a connection?

Posted: Thu Jan 16, 2025 12:26 pm
by Just Me
There is most likely no such event.

I'm moving my focus on ESP NOW. It's very easy to implement. If that won't work reliably, I'll get some CC1101 or similar IC transceiver.