diff --git a/ble/services/BleProtocolService.ts b/ble/services/BleProtocolService.ts index 679e039..1fb2014 100644 --- a/ble/services/BleProtocolService.ts +++ b/ble/services/BleProtocolService.ts @@ -139,10 +139,12 @@ export class BleProtocolService { } } - public async send(deviceId: string, type: COMMAND_TYPES, data: object | ArrayBuffer, onProgress?: (progress: number) => void): Promise { + public async send(deviceId: string, type: COMMAND_TYPES, data: object | ArrayBuffer | Uint8Array, onProgress?: (progress: number) => void): Promise { let payload: Uint8Array; if (data instanceof ArrayBuffer) { payload = new Uint8Array(data); + } else if (data instanceof Uint8Array) { + payload = data; } else { const jsonStr = JSON.stringify(data); payload = new Uint8Array(Buffer.from(jsonStr));