bluerange-io / bluerange-mesh

BlueRange Mesh (formerly FruityMesh) - The first completely connection-based open source mesh on top of Bluetooth Low Energy (4.1/5.0 or higher)
https://bluerange.io/
Other
288 stars 109 forks source link

Non-fruity mesh device disconnects immediately a short while after connection #186

Closed PriyeshNema closed 2 years ago

PriyeshNema commented 2 years ago

Hi team,

I'm trying to connect a non-fruity mesh device (ble peripheral) with a fruity mesh device (as ble central). Peripheral device mandates pairing/bonding here.

I created a module to filter the advertising packets and initiate connection using BleGapConnect(), connection happens, but it immediately disconnects. From the logs, looks like from

ConnectionManager.cpp -> GapConnectionConnectedHandler() -> logt("WARNING", "No pending Connection");

fruityMesh disconnects the connections which are non-fruityMesh.

Is there a way to safely handle this situation? Please suggest

Thanks,

siretty commented 2 years ago

Hello @PriyeshNema,

in order for your 'custom' connection to be recognized you will have to implement a connection class (as an example you can take a look at the MeshAccessConnection) and especially implement the ConnTypeResolver (https://www.bluerange.io/docs/fruitymesh/Connections.html) which can select and instanciate the correct connection type.

Kind regards Daniel

siretty commented 2 years ago

You will also have to reference your resolver function in a special section of the binary. For the MeshAccessConnection this is done via the following line

uint32_t meshAccessConnTypeResolver __attribute__((section(".ConnTypeResolvers"), used)) = (u32)MeshAccessConnection::ConnTypeResolver;

in the beginning of the MeshAccessConnection.cpp file. The function MeshAccessConnection::ConnTypeResolver is static (i.e. has no implicit this parameter).

siretty commented 2 years ago

This issue is being closed after 14 days of inactivity. Please feel free to re-open it!