• Taro.onBLECharacteristicValueChange(CALLBACK)
    • 示例代码

    Taro.onBLECharacteristicValueChange(CALLBACK)

    使用方式同 wx.onBLECharacteristicValueChange

    示例代码

    1. import Taro from '@tarojs/taro'
    2. Taro.onBLECharacteristicValueChange(res => {
    3. console.log(`characteristic ${res.characteristicId} has changed, now is ${res.value}`)
    4. console.log(res.value)
    5. })

    API 支持度

    API微信小程序H5React Native
    Taro.openBluetoothAdapter✔️
    Taro.closeBluetoothAdapter✔️
    Taro.getBluetoothAdapterState✔️
    Taro.onBluetoothAdapterStateChange✔️
    Taro.startBluetoothDevicesDiscovery✔️
    Taro.stopBluetoothDevicesDiscovery✔️
    Taro.getBluetoothDevices✔️
    Taro.getConnectedBluetoothDevices✔️
    Taro.onBluetoothDeviceFound✔️
    Taro.createBLEConnection✔️
    Taro.closeBLEConnection✔️
    Taro.getBLEDeviceServices✔️
    Taro.getBLEDeviceCharacteristics✔️
    Taro.readBLECharacteristicValue✔️
    Taro.writeBLECharacteristicValue✔️
    Taro.notifyBLECharacteristicValueChange✔️
    Taro.onBLEConnectionStateChange✔️
    Taro.onBLECharacteristicValueChange✔️