Closed eotin closed 2 days ago
Update : If I close and create a new instance of Server Manager that extends BleServerManager between 2 commands, it works well.
Have you tried to just reconnect to the server? What ConnectionState are you in when this error happens?
Hi, sorry for the late response.
I have 2 hints:
this.removeNotificationCallback(this.dataCharacteristic);
this.disableNotifications(this.dataCharacteristic).enqueue();
The notification callback is cleared automatically and the dataCharacteristic
is no longer valid, as the device has disconnected.
// Refresh device
this.refreshDeviceCache().enqueue();
instead you may use extend this method and return true: https://github.com/NordicSemiconductor/Android-BLE-Library/blob/fa970a356454a5a2f164e62219e8c988707e5dfc/ble/src/main/java/no/nordicsemi/android/ble/BleManager.java#L613-L615
Hello everybody,
First of all, thanks for your amazing work on this library.
I encounter a strange behavior with notifications and would like to understand what I'm doing wrong. I've 2 android devices, one Gatt Server, one Gatt Client. From the client I write a characteristic to the server to tell him that I want to get a file from him. Then the server send me his file as bytes[] by notifying the client that data is available.
Let's consider this part of the server side that send me data :
As you can see, i send a first packet containing meta data of the file, and then i send the notification for the whole array of bytes, with the split function.
On the client side, I've enable the notifications and added a notification callBack to the characteristic the server is notifying.
The first time I launch the command, everything is going well as i'm receiving all the notifications. in the background i get the different array of bytes and rebuild my file.
But i can stop this command and relaunch it if i wish. When i stop the command, i disconnect my client from the server. In my clientManager i 'have this piece of code :
Then i re-launch the command. But this time i only get one notification in my Notification CallBack, but the server did the same and should have send me a lot of other notifications.
I cannot understand why my client is not notified anymore ...
Thanks for your help.