43
43
//| """There is no regular constructor for a Descriptor. A new local Descriptor can be created
44
44
//| and attached to a Characteristic by calling `add_to_characteristic()`.
45
45
//| Remote Descriptor objects are created by `Connection.discover_remote_services()`
46
- //| as part of remote Characteristics in the remote Services that are discovered.
46
+ //| as part of remote Characteristics in the remote Services that are discovered."""
47
47
//|
48
- //| .. classmethod:: add_to_characteristic(characteristic, uuid, *, read_perm=`Attribute.OPEN`, write_perm=`Attribute.OPEN`, max_length=20, fixed_length=False, initial_value=b'')
48
+ //| @classmethod
49
+ //| def add_to_characteristic(characteristic: Characteristic, uuid: UUID, *, read_perm: int = Attribute.OPEN, write_perm: int = Attribute.OPEN, max_length = 20, fixed_length: bool = False, initial_value: ReadableBuffer = b'') -> Descriptor:
50
+ //| """Create a new Descriptor object, and add it to this Service.
49
51
//|
50
- //| Create a new Descriptor object, and add it to this Service.
52
+ //| :param Characteristic characteristic: The characteristic that will hold this descriptor
53
+ //| :param UUID uuid: The uuid of the descriptor
54
+ //| :param int read_perm: Specifies whether the descriptor can be read by a client, and if so, which
55
+ //| security mode is required. Must be one of the integer values `Attribute.NO_ACCESS`, `Attribute.OPEN`,
56
+ //| `Attribute.ENCRYPT_NO_MITM`, `Attribute.ENCRYPT_WITH_MITM`, `Attribute.LESC_ENCRYPT_WITH_MITM`,
57
+ //| `Attribute.SIGNED_NO_MITM`, or `Attribute.SIGNED_WITH_MITM`.
58
+ //| :param int write_perm: Specifies whether the descriptor can be written by a client, and if so, which
59
+ //| security mode is required. Values allowed are the same as ``read_perm``.
60
+ //| :param int max_length: Maximum length in bytes of the descriptor value. The maximum allowed is
61
+ //| is 512, or possibly 510 if ``fixed_length`` is False. The default, 20, is the maximum
62
+ //| number of data bytes that fit in a single BLE 4.x ATT packet.
63
+ //| :param bool fixed_length: True if the descriptor value is of fixed length.
64
+ //| :param buf initial_value: The initial value for this descriptor.
51
65
//|
52
- //| :param Characteristic characteristic: The characteristic that will hold this descriptor
53
- //| :param UUID uuid: The uuid of the descriptor
54
- //| :param int read_perm: Specifies whether the descriptor can be read by a client, and if so, which
55
- //| security mode is required. Must be one of the integer values `Attribute.NO_ACCESS`, `Attribute.OPEN`,
56
- //| `Attribute.ENCRYPT_NO_MITM`, `Attribute.ENCRYPT_WITH_MITM`, `Attribute.LESC_ENCRYPT_WITH_MITM`,
57
- //| `Attribute.SIGNED_NO_MITM`, or `Attribute.SIGNED_WITH_MITM`.
58
- //| :param int write_perm: Specifies whether the descriptor can be written by a client, and if so, which
59
- //| security mode is required. Values allowed are the same as ``read_perm``.
60
- //| :param int max_length: Maximum length in bytes of the descriptor value. The maximum allowed is
61
- //| is 512, or possibly 510 if ``fixed_length`` is False. The default, 20, is the maximum
62
- //| number of data bytes that fit in a single BLE 4.x ATT packet.
63
- //| :param bool fixed_length: True if the descriptor value is of fixed length.
64
- //| :param buf initial_value: The initial value for this descriptor.
65
- //|
66
- //| :return: the new Descriptor."""
66
+ //| :return: the new Descriptor."""
67
67
//| ...
68
68
//|
69
69
STATIC mp_obj_t bleio_descriptor_add_to_characteristic (size_t n_args , const mp_obj_t * pos_args , mp_map_t * kw_args ) {
@@ -132,7 +132,7 @@ STATIC mp_obj_t bleio_descriptor_add_to_characteristic(size_t n_args, const mp_o
132
132
STATIC MP_DEFINE_CONST_FUN_OBJ_KW (bleio_descriptor_add_to_characteristic_fun_obj , 3 , bleio_descriptor_add_to_characteristic );
133
133
STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ (bleio_descriptor_add_to_characteristic_obj , MP_ROM_PTR (& bleio_descriptor_add_to_characteristic_fun_obj ));
134
134
135
- //| uuid: UUID = ...
135
+ //| uuid: UUID
136
136
//| """The descriptor uuid. (read-only)"""
137
137
//|
138
138
STATIC mp_obj_t bleio_descriptor_get_uuid (mp_obj_t self_in ) {
@@ -150,7 +150,7 @@ const mp_obj_property_t bleio_descriptor_uuid_obj = {
150
150
(mp_obj_t )& mp_const_none_obj },
151
151
};
152
152
153
- //| characteristic: Characteristic = ...
153
+ //| characteristic: Characteristic
154
154
//| """The Characteristic this Descriptor is a part of."""
155
155
//|
156
156
STATIC mp_obj_t bleio_descriptor_get_characteristic (mp_obj_t self_in ) {
@@ -167,7 +167,7 @@ const mp_obj_property_t bleio_descriptor_characteristic_obj = {
167
167
(mp_obj_t )& mp_const_none_obj },
168
168
};
169
169
170
- //| value: WriteableBuffer = ...
170
+ //| value: bytearray
171
171
//| """The value of this descriptor."""
172
172
//|
173
173
STATIC mp_obj_t bleio_descriptor_get_value (mp_obj_t self_in ) {
0 commit comments