diff options
Diffstat (limited to 'shared-bindings/_bleio')
| -rw-r--r-- | shared-bindings/_bleio/Adapter.c | 4 | ||||
| -rw-r--r-- | shared-bindings/_bleio/Address.c | 6 | ||||
| -rw-r--r-- | shared-bindings/_bleio/Connection.c | 2 | ||||
| -rw-r--r-- | shared-bindings/_bleio/PacketBuffer.c | 2 | ||||
| -rw-r--r-- | shared-bindings/_bleio/ScanEntry.c | 2 | ||||
| -rw-r--r-- | shared-bindings/_bleio/ScanResults.c | 4 | ||||
| -rw-r--r-- | shared-bindings/_bleio/Service.c | 2 | ||||
| -rw-r--r-- | shared-bindings/_bleio/UUID.c | 4 | ||||
| -rw-r--r-- | shared-bindings/_bleio/__init__.c | 30 |
9 files changed, 26 insertions, 30 deletions
diff --git a/shared-bindings/_bleio/Adapter.c b/shared-bindings/_bleio/Adapter.c index 5aab9eca5..4067a2a2a 100644 --- a/shared-bindings/_bleio/Adapter.c +++ b/shared-bindings/_bleio/Adapter.c @@ -95,7 +95,7 @@ const mp_obj_property_t bleio_adapter_enabled_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| address: str = ... +//| address: Address = ... //| """MAC address of the BLE adapter. (read-only)""" //| STATIC mp_obj_t bleio_adapter_get_address(mp_obj_t self) { @@ -350,7 +350,7 @@ const mp_obj_property_t bleio_adapter_connections_obj = { (mp_obj_t)&mp_const_none_obj }, }; -//| def connect(self, address: Address, *, timeout: float/int) -> Adapter.connect: +//| def connect(self, address: Address, *, timeout: float/int) -> Connection: //| """Attempts a connection to the device with the given address. //| //| :param Address address: The address of the peripheral to connect to diff --git a/shared-bindings/_bleio/Address.c b/shared-bindings/_bleio/Address.c index 06fb58d76..144b4c167 100644 --- a/shared-bindings/_bleio/Address.c +++ b/shared-bindings/_bleio/Address.c @@ -128,7 +128,7 @@ const mp_obj_property_t bleio_address_type_obj = { (mp_obj_t)&mp_const_none_obj}, }; -//| def __eq__(self, other: bytes) -> Optional[bool]: +//| def __eq__(self, other: Any) -> bool: //| """Two Address objects are equal if their addresses and address types are equal.""" //| ... //| @@ -154,7 +154,7 @@ STATIC mp_obj_t bleio_address_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_o } } -//| def __hash__(self) -> Optional[int]: +//| def __hash__(self) -> int: //| """Returns a hash for the Address data.""" //| ... //| @@ -187,7 +187,7 @@ STATIC void bleio_address_print(const mp_print_t *print, mp_obj_t self_in, mp_pr buf[5], buf[4], buf[3], buf[2], buf[1], buf[0]); } -//| PUBLIC: bytes = ... +//| PUBLIC: int = ... //| """A publicly known address, with a company ID (high 24 bits)and company-assigned part (low 24 bits).""" //| //| RANDOM_STATIC: int = ... diff --git a/shared-bindings/_bleio/Connection.c b/shared-bindings/_bleio/Connection.c index 64e2baefa..ad63a3c15 100644 --- a/shared-bindings/_bleio/Connection.c +++ b/shared-bindings/_bleio/Connection.c @@ -109,7 +109,7 @@ STATIC mp_obj_t bleio_connection_pair(mp_uint_t n_args, const mp_obj_t *pos_args } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_connection_pair_obj, 1, bleio_connection_pair); -//| def discover_remote_services(self, service_uuids_whitelist: iterable = None) -> Tuple(_bleio.Service, ...): +//| def discover_remote_services(self, service_uuids_whitelist: iterable = None) -> Service: //| """Do BLE discovery for all services or for the given service UUIDS, //| to find their handles and characteristics, and return the discovered services. //| `Connection.connected` must be True. diff --git a/shared-bindings/_bleio/PacketBuffer.c b/shared-bindings/_bleio/PacketBuffer.c index 7645a25aa..7de79ab63 100644 --- a/shared-bindings/_bleio/PacketBuffer.c +++ b/shared-bindings/_bleio/PacketBuffer.c @@ -117,7 +117,7 @@ STATIC mp_obj_t bleio_packet_buffer_readinto(mp_obj_t self_in, mp_obj_t buffer_o } STATIC MP_DEFINE_CONST_FUN_OBJ_2(bleio_packet_buffer_readinto_obj, bleio_packet_buffer_readinto); -//| def write(self, data: bytes, *, header: bytes = None) -> int: +//| def write(self, data: bytes, *, header: Optional[bytes] = None) -> int: //| """Writes all bytes from data into the same outgoing packet. The bytes from header are included //| before data when the pending packet is currently empty. //| diff --git a/shared-bindings/_bleio/ScanEntry.c b/shared-bindings/_bleio/ScanEntry.c index f8d769cab..561472f5c 100644 --- a/shared-bindings/_bleio/ScanEntry.c +++ b/shared-bindings/_bleio/ScanEntry.c @@ -70,7 +70,7 @@ STATIC mp_obj_t bleio_scanentry_matches(mp_uint_t n_args, const mp_obj_t *pos_ar } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_scanentry_matches_obj, 2, bleio_scanentry_matches); -//| address: _bleio.Address = ... +//| address: Address = ... //| """The address of the device (read-only), of type `_bleio.Address`.""" //| STATIC mp_obj_t bleio_scanentry_get_address(mp_obj_t self_in) { diff --git a/shared-bindings/_bleio/ScanResults.c b/shared-bindings/_bleio/ScanResults.c index bc9d55c80..d9620e3fc 100644 --- a/shared-bindings/_bleio/ScanResults.c +++ b/shared-bindings/_bleio/ScanResults.c @@ -50,11 +50,11 @@ STATIC mp_obj_t scanresults_iternext(mp_obj_t self_in) { //| """Cannot be instantiated directly. Use `_bleio.Adapter.start_scan`.""" //| ... //| -//| def __iter__(self) -> __iter__: +//| def __iter__(self) -> Iterator[ScanEntry]: //| """Returns itself since it is the iterator.""" //| ... //| -//| def __next__(self) -> _bleio.ScanEntry: +//| def __next__(self) -> ScanEntry: //| """Returns the next `_bleio.ScanEntry`. Blocks if none have been received and scanning is still //| active. Raises `StopIteration` if scanning is finished and no other results are available.""" //| ... diff --git a/shared-bindings/_bleio/Service.c b/shared-bindings/_bleio/Service.c index 5cda11de4..d2033c60c 100644 --- a/shared-bindings/_bleio/Service.c +++ b/shared-bindings/_bleio/Service.c @@ -73,7 +73,7 @@ STATIC mp_obj_t bleio_service_make_new(const mp_obj_type_t *type, size_t n_args, return MP_OBJ_FROM_PTR(service); } -//| characteristics: Tuple(Characteristic, ...) = ... +//| characteristics: Tuple[Characteristic, ...] = ... //| """A tuple of :py:class:`Characteristic` designating the characteristics that are offered by //| this service. (read-only)""" //| diff --git a/shared-bindings/_bleio/UUID.c b/shared-bindings/_bleio/UUID.c index 823275f90..90a39e5e5 100644 --- a/shared-bindings/_bleio/UUID.c +++ b/shared-bindings/_bleio/UUID.c @@ -36,7 +36,7 @@ //| class UUID: //| """A 16-bit or 128-bit UUID. Can be used for services, characteristics, descriptors and more.""" //| -//| def __init__(self, value: Union[int, typing.ByteString]): +//| def __init__(self, value: Union[int, ReadableBuffer, str]): //| """Create a new UUID or UUID object encapsulating the uuid value. //| The value can be one of: //| @@ -248,7 +248,7 @@ STATIC mp_obj_t bleio_uuid_unary_op(mp_unary_op_t op, mp_obj_t self_in) { } } -//| def __eq__(self, other: UUID) -> Optional[bool]: +//| def __eq__(self, other: Any) -> bool: //| """Two UUID objects are equal if their values match and they are both 128-bit or both 16-bit.""" //| ... //| diff --git a/shared-bindings/_bleio/__init__.c b/shared-bindings/_bleio/__init__.c index 8778e94ed..4aeb7b460 100644 --- a/shared-bindings/_bleio/__init__.c +++ b/shared-bindings/_bleio/__init__.c @@ -59,10 +59,9 @@ //| -//| class BluetoothError: -//| def __init__(self, Exception: Exception): -//| """Catch all exception for Bluetooth related errors.""" -//| ... +//| class BluetoothError(Exception): +//| """Catch all exception for Bluetooth related errors.""" +//| ... MP_DEFINE_BLEIO_EXCEPTION(BluetoothError, Exception) NORETURN void mp_raise_bleio_BluetoothError(const compressed_string_t* fmt, ...) { @@ -72,10 +71,9 @@ NORETURN void mp_raise_bleio_BluetoothError(const compressed_string_t* fmt, ...) va_end(argptr); nlr_raise(exception); } -//| class ConnectionError: -//| def __init__(self, BluetoothError: _bleio.BluetoothError): -//| """Raised when a connection is unavailable.""" -//| ... +//| class ConnectionError(BluetoothError): +//| """Raised when a connection is unavailable.""" +//| ... //| MP_DEFINE_BLEIO_EXCEPTION(ConnectionError, bleio_BluetoothError) NORETURN void mp_raise_bleio_ConnectionError(const compressed_string_t* fmt, ...) { @@ -86,20 +84,18 @@ NORETURN void mp_raise_bleio_ConnectionError(const compressed_string_t* fmt, ... nlr_raise(exception); } -//| class RoleError: -//| def __init__(self, BluetoothError: _bleio.BluetoothError): -//| """Raised when a resource is used as the mismatched role. For example, if a local CCCD is -//| attempted to be set but they can only be set when remote.""" -//| ... +//| class RoleError(BluetoothError): +//| """Raised when a resource is used as the mismatched role. For example, if a local CCCD is +//| attempted to be set but they can only be set when remote.""" +//| ... //| MP_DEFINE_BLEIO_EXCEPTION(RoleError, bleio_BluetoothError) NORETURN void mp_raise_bleio_RoleError(const compressed_string_t* msg) { mp_raise_msg(&mp_type_bleio_RoleError, msg); } -//| class SecurityError: -//| def __init__(self, BluetoothError: _bleio.BluetoothError): -//| """Raised when a security related error occurs.""" -//| ... +//| class SecurityError(BluetoothError): +//| """Raised when a security related error occurs.""" +//| ... //| MP_DEFINE_BLEIO_EXCEPTION(SecurityError, bleio_BluetoothError) NORETURN void mp_raise_bleio_SecurityError(const compressed_string_t* fmt, ...) { |
