diff --git a/src/integrations/bluetooth/bluetooth.service.spec.ts b/src/integrations/bluetooth/bluetooth.service.spec.ts index 61f552a2..c00ef62e 100644 --- a/src/integrations/bluetooth/bluetooth.service.spec.ts +++ b/src/integrations/bluetooth/bluetooth.service.spec.ts @@ -357,7 +357,7 @@ Requesting information ... ); }).rejects.toThrow(); - expect(peripheral.disconnect).toHaveBeenCalled(); + expect(mockExec).toHaveBeenCalledWith(expect.stringContaining('reset')); expect(peripheral.removeAllListeners).toHaveBeenCalled(); }); diff --git a/src/integrations/bluetooth/bluetooth.service.ts b/src/integrations/bluetooth/bluetooth.service.ts index 8b792d6d..7fbdce9b 100644 --- a/src/integrations/bluetooth/bluetooth.service.ts +++ b/src/integrations/bluetooth/bluetooth.service.ts @@ -77,8 +77,8 @@ export class BluetoothService { `Failed to connect to ${peripheral.address}: ${e.message}`, e.trace ); - peripheral.disconnect(); peripheral.removeAllListeners(); + await this.resetHciDevice(this.lowEnergyAdapterId); this.unlockAdapter(this.lowEnergyAdapterId); throw e; }