detect ble disconnect

This commit is contained in:
liamcottle 2025-02-11 23:40:34 +13:00
parent af6403bf6a
commit c09ad0514c

View file

@ -42,6 +42,11 @@ class BleConnection extends Connection {
async init() {
// listen for ble disconnect
this.bleDevice.addEventListener("gattserverdisconnected", () => {
this.emit("disconnected");
});
// connect to gatt server
this.gattServer = await this.bleDevice.gatt.connect();