Skip to main content

BluetoothRemoteGATTCharacteristic.readValue()

BFChainInterfaceBluetoothRemoteGATTCharacteristicreadValueLess than 1 minute

Methods to read characteristic values

BluetoothRemoteGATTCharacteristic.readValue()

parameters

  • none

return value

Return a Promise, resolve object a DataView object

Example

  import { bluetoothPlugin } from "@plaoc/plugins";

  bluetoothPlugin
  .open()
  .then(res => {
    if(res.success){
      const options = {
        acceptAllDevices: true,
        optionalServices: ["00003802-0000-1000-8000-00805f9b34fb"],
      }
      return bluetoothPlugin.requestAndConnectDevice(options)
    }
  })
  .then(res => {
    if(res.success){
      const bluetoothRemoteGATTServer = res.data;
      return bluetoothRemoteGATTServer
      .getPrimaryService("00003802-0000-1000-8000-00805f9b34fb")
    }
  })
  .then(res => {
    if(res.success){
      const bluetoothRemoteGATTService = res.data;
      bluetoothRemoteGATTService.getCharacteristic("00004a02-0000-1000-8000-00805f9b34fb")
    }
  })
  .then(res => {
    if(res.success){
      const bluetoothRemoteGATTCharacteristic = res.data;
      return bluetoothRemoteGATTCharacteristic.readValue()
    }
  })
  .then(res => {
    if(res.success){
      // value === res.data
    }
  })
  .catch(err => console.error(err))

Platform Compatibility

Property/Method/EventAndroidIOSDesktop-DevDesktop
readValueX

BluetoothRemoteGATTCharacteristic

Comments
  • Latest
  • Oldest
  • Hottest
Powered by Waline v2.15.7