Descriptor – BLE descriptor

Stores information about a BLE descriptor. Descriptors are attached to BLE characteristics and provide contextual information about the characteristic.

class _bleio.Descriptor

There is no regular constructor for a Descriptor. A new local Descriptor can be created and attached to a Characteristic by calling add_to_characteristic(). Remote Descriptor objects are created by Connection.discover_remote_services() as part of remote Characteristics in the remote Services that are discovered.

classmethod add_to_characteristic(characteristic, uuid, *, read_perm=`Attribute.OPEN`, write_perm=`Attribute.OPEN`, max_length=20, fixed_length=False, initial_value=b'')

Create a new Descriptor object, and add it to this Service.

Parameters:
  • characteristic (Characteristic) – The characteristic that will hold this descriptor
  • uuid (UUID) – The uuid of the descriptor
  • read_perm (int) – Specifies whether the descriptor can be read by a client, and if so, which security mode is required. Must be one of the integer values Attribute.NO_ACCESS, Attribute.OPEN, Attribute.ENCRYPT_NO_MITM, Attribute.ENCRYPT_WITH_MITM, Attribute.LESC_ENCRYPT_WITH_MITM, Attribute.SIGNED_NO_MITM, or Attribute.SIGNED_WITH_MITM.
  • write_perm (int) – Specifies whether the descriptor can be written by a client, and if so, which security mode is required. Values allowed are the same as read_perm.
  • max_length (int) – Maximum length in bytes of the descriptor value. The maximum allowed is is 512, or possibly 510 if fixed_length is False. The default, 20, is the maximum number of data bytes that fit in a single BLE 4.x ATT packet.
  • fixed_length (bool) – True if the descriptor value is of fixed length.
  • initial_value (buf) – The initial value for this descriptor.
Returns:

the new Descriptor.

uuid

The descriptor uuid. (read-only)

characteristic(read-only)

The Characteristic this Descriptor is a part of.

value

The value of this descriptor.