Notifications don't stop when the disconnection is triggered by the device side
robsonos opened this issue · 2 comments
Describe the bug
Notifications don't stop when the disconnection is triggered by the device side. Future BleClient.startNotifications
won't work for future reconnections in that situation. Using BleClient.stopNotifications
inside onDisconnect
doesn't help as the device is already disconnected at that point.
To Reproduce
Steps to reproduce the behavior:
- connect to a device
- call
BleClient.startNotifications
- power cycle the device
- try to connect again
BleClient.connect(device.deviceId, async (disconnectDeviceId: string) => {
try {
await BleClient.stopNotifications(
disconnectDeviceId,
CONSTANTS.UUID16_SVC_BATTERY,
CONSTANTS.UUID16_SVC_BATTERY_CHAR_BATTERY_LEVEL,
);
await BleClient.stopNotifications(
disconnectDeviceId,
CONSTANTS.UUID128_SVC_NORDIC_UART,
CONSTANTS.UUID128_SVC_NORDIC_UART_CHAR_TXD,
);
} catch (error: any) {
console.warn(`onDisconnect: ${error.message}`);
}
}),
Expected behavior
Notification should stop when the disconnection is triggered by the device side
Plugin version:
- @capacitor-community/bluetooth-le: 3.1.1
I cannot reproduce this. On which platform is this happening (iOS or Android)? Can you share the native logs?
It looks like this issue didn't get the information it needed, so I'll close it for now. If I made a mistake, sorry! I am just a bot.
Have a great day!
Capacitor Community Bot 💙