I have an Android application running with RxAndroidBle library and I want to change it to Nordic-Ble-Android library. I'm not that good with Bluetooth and the actual version of the app is not developed by me so I'm in trouble trying to make it work.
Our connection with the wireless bluetooth sensor is following a few steps:
- The APP establishes a connection with the wireless sensor
- The APP send a request connection command frame to wireless sensor
- The APP send a command to the wireless sensor to start blinking
- User tap on a button on the app to confirm that the APP is blinking
- The APP send one more command to confirm the connection and now it's done
If the user does not confirm that the sensor is blinking, the wireless sensor will automatically timeout within 10 seconds.
I'm successfully establishing a connection with the sensor using this method:
The issue is writing characteristcs after that, It seems that I'm doing something wrong.
The current version of the connection with RxAndroidBle is written below:
You can see that it's using the connection to write the characteristic that sends the request command frame within .flatMapSingle
Also, the command to startBlinking is inside the .subscribe method. You can see as well that it's not using any service at all to use the characteristic rxCharacteristicUUID, and looking on Blinky and Toolbox examples given, it seems that I have to initialize the characteristic using gatt.getService, and I got confused because there is no need to use a service for these commands on actual application.
I tried to do exactly like this snippet, but using Android-Ble-Nordic library, but I could not really understand how I have to do that.
Below is my entire version of my BleManager following the examples given on Android-nRF-Blinky and Android-nRF-Toolbox.