Class RemoteCharacteristic

implements Attribute
A remote characteristic belonging to a remote service.

Class summary


discovered-descriptors -> List
The list of discovered descriptors on the remote characteristic.
read -> ByteArray
Reads the value of the characteristic on the remote device.
wait-for-notification -> ByteArray
Waits until the remote device sends a notification or indication on the characteristics. Returns the notified/indicated value.
write value/Data -> none
Writes the value of the characteristic on the remote device.
subscribe -> none
Requests to subscribe on this characteristic.
unsubscribe -> none
Unsubscribes from a notification or indications on the characteristics. See subscribe.
discover-descriptors -> List
Discovers all descriptors for this characteristic.
mtu -> int
The negotiated mtu on the characteristics.
handle -> int
The handle of the characteristic.
operator == other/any -> bool
Whether this object is equal to the other.
stringify -> string
Stringifies this object.
is-closed -> bool

Methods

Discovers all descriptors for this characteristic.
This method adds all discovered descriptors to the list of discovered descriptors of the characteristic, regardless of whether a descriptor with the same UUID already exists in the list.

The list of discovered descriptors on the remote characteristic.
Call discover-descriptors to populate this list.

The handle of the characteristic.
Typically, users do not need to access the handle directly. It may be useful for debugging purposes, but it is not required for normal operation.

mtu -> int
The negotiated mtu on the characteristics.
On MacOS this is the maximum payload.
On ESP32 this is the raw mtu value. Three of these bytes are needed for the header, and the maximum payload on ESP32 is thus three bytes smaller than this value.

operator == other/any -> bool
Whether this object is equal to the other.
By default, identical is used for equality.
Inheritance
Classes overwrite this operator to get an equality specific to their needs. Equality operators often compare the type and field contents. For example:

class Pin:
  number/int

  constructor .number:

  operator == other:
    if other is not Pin: return false
    return number == other.number
A class doesn't have to follow the above format, but it must keep the operator in sync with any hash-code method. That is, if a class has a hash-code member, then the equality and hash-code must agree. If two instances are equal (a == b), then their hash codes must also be equal (a.hash-code == b.hash-code).

Reads the value of the characteristic on the remote device.

Stringifies this object.
Inheritance
Objects that need a human-friendly string representation should overwrite this method. The default string is based on the internal class-ID.

subscribe -> none
Requests to subscribe on this characteristic.
This will either enable notifications or indications depending on properties. If both, indications and notifications, are enabled, subscribes to notifications.

unsubscribe -> none
Unsubscribes from a notification or indications on the characteristics. See subscribe.

Waits until the remote device sends a notification or indication on the characteristics. Returns the notified/indicated value.

write value/Data -> none
Writes the value of the characteristic on the remote device.
For characteristics without response, the function returns as soon as the data has been delivered to the BLE stack. Shutting down the adapter or program too soon afterwards might lead to lost data.