getCharacteristic method

Future<WebBluetoothRemoteGATTCharacteristic> getCharacteristic(
  1. String characteristicUUID
)

Get a characteristic from this service.

characteristicUUID is the UUID (lower case) of the characteristic to get.

  • May throw SecurityError if the characteristic's UUID is on a blocklist.

  • May throw NetworkError if the GATT server is not connected.

  • May throw InvalidStateError if service is null.

  • May throw NotFoundError if the characteristic was not found.

NOTE: Some characteristics are on a block list, and are thus not available. The complete blocklist can be found here: https://github.com/WebBluetoothCG/registries/blob/master/gatt_blocklist.txt

See:

Implementation

Future<WebBluetoothRemoteGATTCharacteristic> getCharacteristic(
    final String characteristicUUID) async {
  final promise = _JSUtil.callMethod(
      _jsObject, "getCharacteristic", [characteristicUUID.toLowerCase()]);
  final result = await _JSUtil.promiseToFuture(promise);
  return WebBluetoothRemoteGATTCharacteristic.fromJSObject(result, this);
}