Is there a NimBLE GAP event to accept or refuse a connection?
Posted: Mon Jan 13, 2025 10:08 pm
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.
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.