Skip to main content

BluetoothRemoteGATTCharacteristic

BFChainInterfaceBluetoothRemoteGATTCharacteristicLess than 1 minute

BluetoothRemoteGATTCharacteristic describes the interface of a certain service of the Bluetooth device, which is a built-in object and can only be obtained through BluetoothRemoteGATTService.getCharacteristic();

;(async () => {
  const bluetoothRemoteGATTCharacteristic 
    = await BluetoothRemoteGATTService.getCharacteristic(uuid)
})();

Property

  • service

    The service to which the current characteristic described by the attribute belongs;
    The value of the attribute is of type BluetoothRemoteGATTService;

  • uuid

    The identifier of the current feature; the type of the attribute value is a string;

Method

Event

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;
      const uuid = bluetoothRemoteGATTCharacteristic.service
    }
  })
  .catch(err => console.error(err))

Platform Compatibility

Property/Method/EventAndroidIOSDesktop-DevDesktop
serviceX
uuidX
readValueX
writeValueX
getDescriptorX
event characteristicvaluechangedX

BluetoothPlugin

BluetoothRemoteGATTService

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