Skip to content

Commit 7e9143e

Browse files
Give the responsability to dispose the device to connectAndGetAllServices method.
1 parent 3f683f6 commit 7e9143e

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/bluetooth/BluetoothManager.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ export class BluetoothManager implements IBluetoothManager {
5151

5252
async disconnect(device: BluetoothManager.Device) {
5353
await device.disconnect();
54-
device.dispose();
5554
}
5655

5756
// Method to add a device to the list
@@ -151,6 +150,8 @@ export namespace BluetoothManager {
151150
this.native.addEventListener('gattserverdisconnected', event => {
152151
this.isConnected = false;
153152
this.disconnected.emit(true);
153+
this.dispose();
154+
this.isDisposed = true;
154155
});
155156
const server = this.native.gatt;
156157
if (server) {

0 commit comments

Comments
 (0)