Namespace: BluetoothEvent

miot/Bluetooth~BluetoothEvent

蓝牙事件名集合

Example

import {BluetoothEvent} from 'miot'
   const subscription = BluetoothEvent.bluetoothServiceDiscovered.addListener(
      (bluetooth, ...services)=>{
         ...
      }
    )
   ...
   subscription.remove()
   ...

Events

bluetoothCharacteristicDiscovered

蓝牙特征发现事件

Parameters:
Name Type Attributes Description
bluetooh IBluetooth

蓝牙设备

service IBluetoothService

蓝牙特征

characters IBluetoothCharacteristic <repeatable>

发现的蓝牙特征

bluetoothCharacteristicDiscoverFailed

蓝牙特征发现失败事件

Parameters:
Name Type Description
bluetooh IBluetooth

蓝牙设备

service IBluetoothService

蓝牙特征

error *

错误信息

bluetoothCharacteristicValueChanged

蓝牙特征值变更事件 notify, read

Parameters:
Name Type Description
bluetooh IBluetooth

蓝牙设备

service IBluetoothService

蓝牙服务

character IBluetoothCharacteristic

蓝牙特征

value *

数值

bluetoothConnectionStatusChanged

蓝牙断开连接

Parameters:
Name Type Description
bluetooh IBluetooth

发生连接打开关闭事件的蓝牙设备

isConnected boolean

当前连接状态

bluetoothDeviceDiscovered

蓝牙设备扫描发现事件

Parameters:
Name Type Description
bluetoohData json

-扫描发现的蓝牙设备数据

bluetoothDeviceDiscoverFailed

蓝牙设备扫描发现失败事件

Parameters:
Name Type Description
error *

错误信息

bluetoothSeviceDiscovered

蓝牙服务发现事件

Parameters:
Name Type Attributes Description
bluetooh IBluetooth

蓝牙设备

service IBluetoothService <repeatable>

发现的蓝牙服务

bluetoothSeviceDiscoverFailed

蓝牙服务发现失败事件

Parameters:
Name Type Description
bluetooh IBluetooth

蓝牙设备

error *

错误信息

bluetoothStatusChanged

蓝牙开关状态变更事件

Type:
  • event
Parameters:
Name Type Description
isEnabled boolean

当前状态