Description
In my current project I am trying to use your Android-nRF-Mesh-Library together with this library to implement BLE Mesh node provisioning in an Android project. While my implementation mostly works I am facing issues trying to rediscover the services on the Mesh device after provisioning is done and the mesh provisioning service gets replaced with the mesh proxy service.
Upon first connection to the device when initially connecting to the BLE device to provision it, I call ClientBleGatt#discoverServices()
to populate the services list (otherwise the most recent value in the ClientBleGatt#services
state flow contains no services and stays that way). This works fine and I can obtain a reference to the Mesh provisioning service.
After provisioning is complete I now want to use the Mesh proxy service to configure the node. At this point calling ClientBleGatt#discoverServices()
again breaks the app as the code gets stuck on this mutex lock:
Since I couldn't figure out why the mutex stayed locked I tried manually unlocking it using reflection, though in this case the code only progresses a bit further since the onServicesDiscovered
callback never gets called.
While the ClientBleGatt#services
flow does emit a new list of services after the provisioning is complete, it is identical to the list beforehand and still only contains the provisioning service.
I was able to make the provisioning and configuration work by disconnecting and reconnecting to the device, and only calling ClientBleGatt#discoverServices()
on the new ClientBleGatt
object after the reconnect. In this case the Mesh provisioning service gets returned correctly and is fully functional. Sadly this reconnection step introduces a new point of failure into the app, as the reconnect is a bit unreliable and likes to fail for no discernible reason. Furthermore the reconnecting step constitutes around 50% of the entire time of the provisioning + configuration process, which is another great reason to get rid of it.
Is it possible to rediscover the services without the code getting stuck? Are there any potential issues in my code that could cause this issue?