@onbright/bluetooth-sdk
Advanced tools
Comparing version 1.1.20 to 1.1.21
@@ -1,6 +0,53 @@ | ||
declare enum ServiceType { | ||
WIFI_BLUE = 0, | ||
THEME_BLUE = 1 | ||
interface Communication { | ||
onMatchingService(services: WechatMiniprogram.BLEService[]): WechatMiniprogram.BLEService | null; | ||
onMatchingServiceCharacteristic(): BLEDeviceCharacteristicsMap; | ||
onMatchingConnectDevice(devices: WechatMiniprogram.BlueToothDevice[]): WechatMiniprogram.BlueToothDevice | null; | ||
} | ||
type BLEDeviceCharacteristicsMap = { | ||
write: string; | ||
notify: string; | ||
}; | ||
declare class ConnectHandler { | ||
private status; | ||
private callback; | ||
private currentDevice; | ||
private disconnectTime; | ||
private mtu; | ||
private maxMTU; | ||
private communicationService; | ||
private communicationWriteCharacteristic; | ||
private communication; | ||
constructor(communication: Communication); | ||
connect(device: WechatMiniprogram.BlueToothDevice, isOTA: boolean): boolean; | ||
setMaxMTU(mtu: number): void; | ||
disconnect(): void; | ||
setCallback(callback: ConnectCallback | null): void; | ||
getConnectedDevice(): WechatMiniprogram.BlueToothDevice | null; | ||
getCommunicationService(): WechatMiniprogram.BLEService | null; | ||
getCommunication(): Communication; | ||
getCommunicationWriteCharacteristic(): WechatMiniprogram.BLECharacteristic | null; | ||
getMTU(): number | undefined; | ||
isConnectedOrConnecting(): boolean; | ||
isConnecting(): boolean; | ||
isConnected(): boolean; | ||
private _registerConnStatusListener; | ||
private _getBLEDeviceServices; | ||
private _getBLEDeviceCharacteristics; | ||
private _notifyBLECharacteristicValueChange; | ||
private _disconnect; | ||
private _connectFailed; | ||
private _connectSuccsed; | ||
} | ||
interface ConnectCallback { | ||
onDisconnect?: ConnectDisconnectCallback; | ||
onFailed?: ConnectFailedCallback; | ||
onSuccess?: ConnectSuccessCallback; | ||
onMTUChange?: DeviceMTUChangeCallback; | ||
} | ||
type ConnectDisconnectCallback = (result: WechatMiniprogram.BlueToothDevice) => void; | ||
type ConnectFailedCallback = (result: WechatMiniprogram.BlueToothDevice) => void; | ||
type ConnectSuccessCallback = (result: WechatMiniprogram.BlueToothDevice) => void; | ||
type DeviceMTUChangeCallback = (result: WechatMiniprogram.BlueToothDevice, mtu: number) => void; | ||
declare class BluetoothManager { | ||
@@ -12,12 +59,12 @@ private _ConnectHandler; | ||
private init; | ||
setConnectHandler(connectHandler: ConnectHandler): void; | ||
addBluetoothEventCallback(callback: BluetoothEventCallback): void; | ||
removeBluetoothEventCallback(callback: BluetoothEventCallback): void; | ||
sanDevice(): void; | ||
isConnected(): boolean; | ||
isConnected(): boolean | null; | ||
getConnectedDevice(): WechatMiniprogram.BlueToothDevice | null; | ||
connectDevice(device: WechatMiniprogram.BlueToothDevice, isOTA: boolean): boolean; | ||
connectDevice(device: WechatMiniprogram.BlueToothDevice, isOTA: boolean): boolean | null; | ||
disconnectDevice(): void; | ||
setScanTime(scanTime?: number): void; | ||
setServices(services: Array<string>): void; | ||
setConnectService(serviceType: ServiceType): void; | ||
sendData(deviceId: string, data: Uint8Array): boolean; | ||
@@ -52,5 +99,4 @@ private _SendData; | ||
GenerationRule: typeof GenerationRule; | ||
ServiceType: typeof ServiceType; | ||
}; | ||
export { _default as default }; | ||
export { type BLEDeviceCharacteristicsMap, type Communication, _default as default }; |
{ | ||
"name": "@onbright/bluetooth-sdk", | ||
"version": "1.1.20", | ||
"version": "1.1.21", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "build": "tsup", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
270859
3860