diff --git a/src/bleClient.ts b/src/bleClient.ts index 34de6b0..e09c802 100644 --- a/src/bleClient.ts +++ b/src/bleClient.ts @@ -164,8 +164,9 @@ export interface BleClientInterface { /** * Disconnect from a peripheral BLE device. For an example, see [usage](#usage). * @param deviceId The ID of the device to use (obtained from [requestDevice](#requestDevice) or [requestLEScan](#requestLEScan)) + * @param options Options for plugin call */ - disconnect(deviceId: string): Promise; + disconnect(deviceId: string, options?: TimeoutOptions): Promise; /** * Get services, characteristics and descriptors of a device. @@ -488,9 +489,9 @@ class BleClientClass implements BleClientInterface { return isBonded; } - async disconnect(deviceId: string): Promise { + async disconnect(deviceId: string, options?: TimeoutOptions): Promise { await this.queue(async () => { - await BluetoothLe.disconnect({ deviceId }); + await BluetoothLe.disconnect({ deviceId, ...options }); }); } diff --git a/src/definitions.ts b/src/definitions.ts index b32b217..65986b4 100644 --- a/src/definitions.ts +++ b/src/definitions.ts @@ -295,7 +295,7 @@ export interface BluetoothLePlugin { connect(options: DeviceIdOptions & TimeoutOptions): Promise; createBond(options: DeviceIdOptions & TimeoutOptions): Promise; isBonded(options: DeviceIdOptions): Promise; - disconnect(options: DeviceIdOptions): Promise; + disconnect(options: DeviceIdOptions & TimeoutOptions): Promise; getServices(options: DeviceIdOptions): Promise; discoverServices(options: DeviceIdOptions): Promise; getMtu(options: DeviceIdOptions): Promise;