diff --git a/src/secure-dfu.ts b/src/secure-dfu.ts index cc9c7aa..a31d453 100644 --- a/src/secure-dfu.ts +++ b/src/secure-dfu.ts @@ -24,7 +24,6 @@ */ import { EventDispatcher } from "./dispatcher"; -import { UuidOptions } from "./uuid-options"; const CONTROL_UUID = "8ec90001-f315-4f60-9fb8-838830daea50"; const PACKET_UUID = "8ec90002-f315-4f60-9fb8-838830daea50"; @@ -119,6 +118,13 @@ export interface BluetoothLEScanFilterInit { namePrefix?: string; } +export interface UuidOptions { + service?: number | string; + button?: number | string; + control?: number | string; + packet?: number | string; +} + /** * Secure Device Firmware Update class */ @@ -409,6 +415,10 @@ export class SecureDfu extends EventDispatcher { filters: Array, uuids: UuidOptions = this.DEFAULT_UUIDS ): Promise { + uuids = { + ...this.DEFAULT_UUIDS, + ...uuids + }; if (!buttonLess && !filters) { filters = [ { services: [ uuids.service ] } ]; } @@ -436,6 +446,10 @@ export class SecureDfu extends EventDispatcher { * @returns Promise containing the device if it is still on a valid state */ public setDfuMode(device: BluetoothDevice, uuids: UuidOptions = this.DEFAULT_UUIDS): Promise { + uuids = { + ...this.DEFAULT_UUIDS, + ...uuids + }; return this.gattConnect(device, uuids.service) .then(characteristics => { this.log(`found ${characteristics.length} characteristic(s)`); diff --git a/src/uuid-options.ts b/src/uuid-options.ts deleted file mode 100644 index f8133a4..0000000 --- a/src/uuid-options.ts +++ /dev/null @@ -1,6 +0,0 @@ -export interface UuidOptions { - service?: number | string; - button?: number | string; - control?: number | string; - packet?: number | string; -}