Skip to content
This repository has been archived by the owner on Dec 15, 2024. It is now read-only.

Commit

Permalink
fix: allow to delete host connection when dongle is not connected
Browse files Browse the repository at this point in the history
  • Loading branch information
ert78gb committed Nov 9, 2024
1 parent f36b97e commit 980cb37
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/uhk-agent/src/services/device.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -661,11 +661,14 @@ export class DeviceService {

try {
await this.stopPollUhkDevice();
const dongleHid = await getCurrentUhkDongleHID();
let dongleUhkDevice: UhkHidDevice;
try {
dongleUhkDevice = new UhkHidDevice(this.logService, this.options, this.rootDir, dongleHid);
await dongleUhkDevice.deleteAllBonds();
if (isConnectedDongleAddress) {
const dongleHid = await getCurrentUhkDongleHID();
dongleUhkDevice = new UhkHidDevice(this.logService, this.options, this.rootDir, dongleHid);
await dongleUhkDevice.deleteAllBonds();
}

await this.device.deleteBond(convertBleStringToNumberArray(address));
this.logService.misc('[DeviceService] delete host connection success', { address });
await snooze(1000);
Expand Down

0 comments on commit 980cb37

Please sign in to comment.