import { IBleAdapter, LPA_AdapterInitOptions, LPA_AuthorizeOptions, LPA_BleDevice, LPA_BleDeviceConnectOptions, LPA_BleDiscoveryOptions, LPA_ConnectionStateChangeResult, LPA_Device, LPA_DeviceRequestOptions, LPA_GattCharacteristic, LPA_GattService, LPA_GetCharacteristicsOptions, LPA_GetServicesOptions, LPA_NotifyCharacteristicOptions, LPA_ReadCharacteristicOptions, LPA_ReadResult, LPA_RequestOptions, LPA_Response, LPA_SetMtuOptions, LPA_SetMtuResult, LPA_WriteCharacteristicOptions } from "lpapi-ble"; interface CharacteristicValueChangeRes { /** * 蓝牙设备 ID */ deviceId: string; /** * 特征值所属服务 uuid */ serviceId: string; /** * 特征值 uuid */ characteristicId: string; /** * 特征值最新的值 * * @note * VConsole 无法打印出 ArrayBuffer 类型数据 */ value: ArrayBuffer; } type CharacteristicValueChangeListener = (result: CharacteristicValueChangeRes) => void; export interface IConnectionInfo { deviceId: string; connected: boolean; connectStateChange?: (res: LPA_ConnectionStateChangeResult) => void; } export declare class BleAdapter implements IBleAdapter { private static _instance?; private mConnectionMap; private mIsAdapterOpened?; private mShowWriteLog?; private mCharacteristicValueChangeMap?; private mCharacteristicMap; /** * 设备搜索回调函数。 * 1. 第二次搜索蓝牙设备的时候,第一次搜索的回调可能会继续回调,所以在二次搜索的时候通过修改该属性来取消第一次的回调; * 2. offBluetoothDeviceFound 不一定会生效,并且有些平台可能还没有该函数; */ private mDeviceFoundAction?; /** * 蓝牙适配器状态变化通知回调函数。 */ private mAdapterStateChange?; static getInstance(): BleAdapter; /** * 蓝牙授权认证。 * 企业微信暂不支持。 */ authorize(options?: LPA_AuthorizeOptions): Promise>; openAdapter(options?: LPA_AdapterInitOptions): Promise>; closeAdapter(options?: LPA_RequestOptions): Promise>; resetAdapter(options?: LPA_RequestOptions): Promise>; startDiscovery(options?: LPA_BleDiscoveryOptions): Promise>; stopDiscovery(options?: LPA_RequestOptions): Promise>; getFoundDevices(options?: LPA_RequestOptions): Promise>; connect(options: LPA_BleDeviceConnectOptions): Promise>; private resetCharacteristicValueChange; disconnect(options: LPA_DeviceRequestOptions): Promise>; getConnectedDevices(options?: LPA_RequestOptions): Promise>; setBleMtu(options: LPA_SetMtuOptions): Promise; getGATTServices(options: LPA_GetServicesOptions): Promise; getGATTCharacteristics(options: LPA_GetCharacteristicsOptions): Promise; onBLECharacteristicValueChange(characterId: string, callback: CharacteristicValueChangeListener): void; offBLECharacteristicValueChange(cid: string): void; read(options: LPA_ReadCharacteristicOptions): Promise; notify(options: LPA_NotifyCharacteristicOptions): Promise>; write(options: LPA_WriteCharacteristicOptions): Promise>; } export {};