Class: Toybox.BluetoothLowEnergy.Characteristic

Overview

Encapsulates a characteristic on a service

Since:

API Level 3.1.0

Instance Method Summary collapse

Instance Method Details

getDescriptor(uuid as BluetoothLowEnergy.Uuid) as BluetoothLowEnergy.Descriptor or Null

Retrieves the Descriptor with a specified UUID

Parameters:

Returns:

  • BluetoothLowEnergy.Descriptor

    The Descriptor represented by the UUID provided or, null if the descriptor does not exist or the UUID has not be registered.

Since:

API Level 3.1.0

getDescriptors() as BluetoothLowEnergy.Iterator

Retrieves an Iterator over the Descriptors discovered in the characteristic

This will only provide descriptors that have been registered using BluetoothLowEnergy.registerProfile()

Returns:

Since:

API Level 3.1.0

getService() as BluetoothLowEnergy.Service

Retrieves the Characteristic's Service

Retrieve the Service that this characteristic belongs to

Returns:

Since:

API Level 3.1.0

getUuid() as BluetoothLowEnergy.Uuid

Return the UUID of the Characteristic

Returns:

Since:

API Level 3.1.0

requestRead() as Void

Requests a read operation on the characteristic

Once the operation is completed BleDelegate.onCharacteristicRead() will be called on the registered BleDelegate with the status of the operation

Support for long reads is not implemented.

Since:

API Level 3.1.0

requestWrite(value as Lang.ByteArray, options as { :writeType as BluetoothLowEnergy.WriteType }) as Void

Requests a write operation

Once the operation is completed BleDelegate.onCharacteristicWrite() will be called on the registered BleDelegate with the status of the operation

Support for long writes is not implemented. Requesting a write on a characteristic longer than 20 bytes will cause a BluetoothLowEnergy.InvalidRequestException

Parameters:

  • value(Lang.ByteArray)

    New value to store.

  • options(Lang.Dictionary)

    A Dictionary containing write options

    • :writeType(Lang.Number)

      A BluetoothLowEnergy.WRITE_TYPE_* indicating the write type to use when writing to the characteristic. Cannot be null.

Since:

API Level 3.1.0

Throws:


Generated Apr 17, 2024 9:40:37 AM