Skip to content

Characteristic Reading

aliberski edited this page Jan 8, 2025 · 5 revisions

To read a characteristic one must call one of functions:

characteristic.read(transactionId: ?TransactionId): Promise<Characteristic>

or

device.readCharacteristicForService(
  serviceUUID: UUID,
  characteristicUUID: UUID,
  transactionId: ?TransactionId
): Promise<Characteristic>

or

bleManager.readCharacteristicForDevice(
  deviceIdentifier: DeviceId,
  serviceUUID: UUID,
  characteristicUUID: UUID,
  transactionId: ?TransactionId
): Promise<Characteristic>
  • transactionId: TransactionId—optional TransactionId which can be used in bleManager.cancelTransaction() function.
  • serviceUUID: UUID—the UUID of service that contains the characteristic to read
  • characteristicUUID: UUID—the UUID of characteristic to read

The promise is resolved when the value of the characteristic is successfully read

or

service.readCharacteristic(
  characteristicUUID: UUID,
  transactionId: ?TransactionId
): Promise<Characteristic>
Clone this wiki locally