diff --git a/kmk/types.py b/kmk/types.py index 54a49b3..5633605 100644 --- a/kmk/types.py +++ b/kmk/types.py @@ -1,3 +1,8 @@ +from kmk.consts import UnicodeMode +from kmk.keys import KeyAttrDict +from typing import List, Optional + + class AttrDict(dict): ''' Primitive support for accessing dictionary entries in dot notation. @@ -7,34 +12,34 @@ class AttrDict(dict): This is read-only on purpose. ''' - def __getattr__(self, key): + def __getattr__(self, key: str) -> str: return self[key] class LayerKeyMeta: - def __init__(self, layer, kc=None): - self.layer = layer - self.kc = kc + def __init__(self, layer: int, kc: Optional[KeyAttrDict] = None) -> None: + self.layer: int = layer + self.kc: Optional[KeyAttrDict] = kc class ModTapKeyMeta: - def __init__(self, kc=None, mods=None): - self.mods = mods - self.kc = kc + def __init__(self, kc: Optional[KeyAttrDict] = None, mods: Optional[List[KeyAttrDict]] = None): + self.mods: Optional[List[KeyAttrDict]] = mods + self.kc: Optional[KeyAttrDict] = kc class KeySequenceMeta: - def __init__(self, seq): - self.seq = seq + def __init__(self, seq: List[KeyAttrDict]): + self.seq: List[KeyAttrDict] = seq class KeySeqSleepMeta: - def __init__(self, ms): - self.ms = ms + def __init__(self, ms: float): + self.ms: float = ms class UnicodeModeKeyMeta: - def __init__(self, mode): + def __init__(self, mode: UnicodeMode): self.mode = mode diff --git a/typings/adafruit_ble/__init__.pyi b/typings/adafruit_ble/__init__.pyi new file mode 100644 index 0000000..bb8377c --- /dev/null +++ b/typings/adafruit_ble/__init__.pyi @@ -0,0 +1,208 @@ +""" +This type stub file was generated by pyright. +""" + +import sys +import _bleio +from .services import Service +from .advertising import Advertisement + +""" + +This module provides higher-level BLE (Bluetooth Low Energy) functionality, +building on the native `_bleio` module. + +""" +if sys.implementation.name == "circuitpython" and sys.implementation.version[0] <= 4: + ... +__version__ = ... +__repo__ = ... +class BLEConnection: + """ + Represents a connection to a peer BLE device. + It acts as a map from a `Service` type to a `Service` instance for the connection. + + :param bleio_connection _bleio.Connection: the native `_bleio.Connection` object to wrap + + """ + def __init__(self, bleio_connection) -> None: + ... + + def __contains__(self, key): # -> bool: + """ + Allows easy testing for a particular Service class or a particular UUID + associated with this connection. + + Example:: + + if UARTService in connection: + # do something + + if StandardUUID(0x1234) in connection: + # do something + """ + ... + + def __getitem__(self, key): # -> None: + """Return the Service for the given Service class or uuid, if any.""" + ... + + @property + def connected(self): + """True if the connection to the peer is still active.""" + ... + + @property + def paired(self): + """True if the paired to the peer.""" + ... + + @property + def connection_interval(self): + """Time between transmissions in milliseconds. Will be multiple of 1.25ms. Lower numbers + increase speed and decrease latency but increase power consumption. + + When setting connection_interval, the peer may reject the new interval and + `connection_interval` will then remain the same. + + Apple has additional guidelines that dictate should be a multiple of 15ms except if HID + is available. When HID is available Apple devices may accept 11.25ms intervals.""" + ... + + @connection_interval.setter + def connection_interval(self, value): # -> None: + ... + + def pair(self, *, bond=...): + """Pair to the peer to increase security of the connection.""" + ... + + def disconnect(self): # -> None: + """Disconnect from peer.""" + ... + + + +class BLERadio: + """ + BLERadio provides the interfaces for BLE advertising, + scanning for advertisements, and connecting to peers. There may be + multiple connections active at once. + + It uses this library's `Advertisement` classes and the `BLEConnection` class.""" + def __init__(self, adapter=...) -> None: + """If no adapter is supplied, use the built-in `_bleio.adapter`. + If no built-in adapter is available, raise `RuntimeError`. + """ + ... + + def start_advertising(self, advertisement, scan_response=..., interval=..., timeout=...): # -> None: + """ + Starts advertising the given advertisement. + + :param buf scan_response: scan response data packet bytes. + If ``None``, a default scan response will be generated that includes + `BLERadio.name` and `BLERadio.tx_power`. + :param float interval: advertising interval, in seconds + :param int timeout: advertising timeout in seconds. + If None, no timeout. + + ``timeout`` is not available in CircuitPython 5.x and must be `None`. + """ + ... + + def stop_advertising(self): # -> None: + """Stops advertising.""" + ... + + def start_scan(self, *advertisement_types, buffer_size=..., extended=..., timeout=..., interval=..., window=..., minimum_rssi=..., active=...): # -> Generator[Advertisement | Unknown, None, None]: + """ + Starts scanning. Returns an iterator of advertisement objects of the types given in + advertisement_types. The iterator will block until an advertisement is heard or the scan + times out. + + If any ``advertisement_types`` are given, only Advertisements of those types are produced + by the returned iterator. If none are given then `Advertisement` objects will be + returned. + + Advertisements and scan responses are filtered and returned separately. + + :param int buffer_size: the maximum number of advertising bytes to buffer. + :param bool extended: When True, support extended advertising packets. + Increasing buffer_size is recommended when this is set. + :param float timeout: the scan timeout in seconds. + If None, will scan until `stop_scan` is called. + :param float interval: the interval (in seconds) between the start + of two consecutive scan windows + Must be in the range 0.0025 - 40.959375 seconds. + :param float window: the duration (in seconds) to scan a single BLE channel. + window must be <= interval. + :param int minimum_rssi: the minimum rssi of entries to return. + :param bool active: request and retrieve scan responses for scannable advertisements. + :return: If any ``advertisement_types`` are given, + only Advertisements of those types are produced by the returned iterator. + If none are given then `Advertisement` objects will be returned. + :rtype: iterable + """ + ... + + def stop_scan(self): # -> None: + """Stops any active scan. + + The scan results iterator will return any buffered results and then raise StopIteration + once empty.""" + ... + + def connect(self, advertisement, *, timeout=...): + """ + Initiates a `BLEConnection` to the peer that advertised the given advertisement. + + :param advertisement Advertisement: An `Advertisement` or a subclass of `Advertisement` + :param timeout float: how long to wait for a connection + :return: the connection to the peer + :rtype: BLEConnection + """ + ... + + @property + def connected(self): # -> bool: + """True if any peers are connected.""" + ... + + @property + def connections(self): # -> tuple[None, ...]: + """A tuple of active `BLEConnection` objects.""" + ... + + @property + def name(self): # -> str: + """The name for this device. Used in advertisements and + as the Device Name in the Generic Access Service, available to a connected peer. + """ + ... + + @name.setter + def name(self, value): # -> None: + ... + + @property + def tx_power(self): # -> Literal[0]: + """Transmit power, in dBm.""" + ... + + @tx_power.setter + def tx_power(self, value): + ... + + @property + def address_bytes(self): # -> bytes: + """The device address, as a ``bytes()`` object of length 6.""" + ... + + @property + def advertising(self): # -> bool: + """The advertising state""" + ... + + + diff --git a/typings/adafruit_ble/advertising/__init__.pyi b/typings/adafruit_ble/advertising/__init__.pyi new file mode 100644 index 0000000..0180bab --- /dev/null +++ b/typings/adafruit_ble/advertising/__init__.pyi @@ -0,0 +1,173 @@ +""" +This type stub file was generated by pyright. +""" + +import struct + +""" +Advertising is the first phase of BLE where devices can broadcast +""" +def to_hex(seq): # -> str: + """Pretty prints a byte sequence as hex values.""" + ... + +def to_bytes_literal(seq): # -> str: + """Prints a byte sequence as a Python bytes literal that only uses hex encoding.""" + ... + +def decode_data(data, *, key_encoding=...): # -> dict[Unknown, Unknown]: + """Helper which decodes length encoded structures into a dictionary with the given key + encoding.""" + ... + +def compute_length(data_dict, *, key_encoding=...): # -> int: + """Computes the length of the encoded data dictionary.""" + ... + +def encode_data(data_dict, *, key_encoding=...): # -> bytes: + """Helper which encodes dictionaries into length encoded structures with the given key + encoding.""" + ... + +class AdvertisingDataField: + """Top level class for any descriptor classes that live in Advertisement or its subclasses.""" + ... + + +class AdvertisingFlag: + """A single bit flag within an AdvertisingFlags object.""" + def __init__(self, bit_position) -> None: + ... + + def __get__(self, obj, cls): # -> AdvertisingFlag: + ... + + def __set__(self, obj, value): # -> None: + ... + + + +class AdvertisingFlags(AdvertisingDataField): + """Standard advertising flags""" + limited_discovery = ... + general_discovery = ... + le_only = ... + def __init__(self, advertisement, advertising_data_type) -> None: + ... + + def __len__(self): # -> Literal[1]: + ... + + def __bytes__(self): # -> bytes: + ... + + def __str__(self) -> str: + ... + + + +class String(AdvertisingDataField): + """UTF-8 encoded string in an Advertisement. + + Not null terminated once encoded because length is always transmitted.""" + def __init__(self, *, advertising_data_type) -> None: + ... + + def __get__(self, obj, cls): # -> String | str | None: + ... + + def __set__(self, obj, value): # -> None: + ... + + + +class Struct(AdvertisingDataField): + """`struct` encoded data in an Advertisement.""" + def __init__(self, struct_format, *, advertising_data_type) -> None: + ... + + def __get__(self, obj, cls): # -> Struct | Any | None: + ... + + def __set__(self, obj, value): # -> None: + ... + + + +class LazyObjectField(AdvertisingDataField): + """Non-data descriptor useful for lazily binding a complex object to an advertisement object.""" + def __init__(self, cls, attribute_name, *, advertising_data_type, **kwargs) -> None: + ... + + def __get__(self, obj, cls): # -> LazyObjectField | None: + ... + + @property + def advertising_data_type(self): + """Return the data type value used to indicate this field.""" + ... + + + +class Advertisement: + """Core Advertisement type. + + The class attribute ``match_prefixes``, if not ``None``, is a tuple of + bytestring prefixes to match against the multiple data structures in the advertisement. + """ + match_prefixes = ... + _prefix_bytes = ... + flags = ... + short_name = ... + complete_name = ... + tx_power = ... + appearance = ... + def __init__(self, *, entry=...) -> None: + """Create an empty advertising packet or one from a ScanEntry.""" + ... + + @property + def rssi(self): # -> None: + """Signal strength of the scanned advertisement. Only available on Advertisements returned + from `BLERadio.start_scan()`. (read-only)""" + ... + + @classmethod + def get_prefix_bytes(cls): # -> bytes | Any: + """Return a merged version of match_prefixes as a single bytes object, + with length headers. + """ + ... + + @classmethod + def matches(cls, entry): + """Returns ``True`` if the given `_bleio.ScanEntry` advertisement fields + matches all of the given prefixes in the `match_prefixes` tuple attribute. + Subclasses may override this to match any instead of all. + """ + ... + + @classmethod + def matches_prefixes(cls, entry, *, all_): + """Returns ``True`` if the given `_bleio.ScanEntry` advertisement fields + match any or all of the given prefixes in the `match_prefixes` tuple attribute. + If ``all_`` is ``True``, all the prefixes must match. If ``all_`` is ``False``, + returns ``True`` if at least one of the prefixes match. + """ + ... + + def __bytes__(self): # -> bytes: + """The raw packet bytes.""" + ... + + def __str__(self) -> str: + ... + + def __len__(self): # -> int: + ... + + def __repr__(self): # -> str: + ... + + + diff --git a/typings/adafruit_ble/advertising/standard.pyi b/typings/adafruit_ble/advertising/standard.pyi new file mode 100644 index 0000000..9556d96 --- /dev/null +++ b/typings/adafruit_ble/advertising/standard.pyi @@ -0,0 +1,122 @@ +""" +This type stub file was generated by pyright. +""" + +from . import Advertisement, AdvertisingDataField + +""" +:py:mod:`~adafruit_ble.advertising.standard` +==================================================== + +This module provides BLE standard defined advertisements. The Advertisements are single purpose +even though multiple purposes may actually be present in a single packet. + +""" +__version__ = ... +__repo__ = ... +class BoundServiceList: + """Sequence-like object of Service UUID objects. It stores both standard and vendor UUIDs.""" + def __init__(self, advertisement, *, standard_services, vendor_services) -> None: + ... + + def __contains__(self, key): # -> bool: + ... + + def __iter__(self): # -> Iterator[Unknown]: + ... + + def append(self, service): # -> None: + """Append a service to the list.""" + ... + + def extend(self, services): # -> None: + """Appends all services in the iterable to the list.""" + ... + + def __str__(self) -> str: + ... + + + +class ServiceList(AdvertisingDataField): + """Descriptor for a list of Service UUIDs that lazily binds a corresponding BoundServiceList.""" + def __init__(self, *, standard_services, vendor_services) -> None: + ... + + def __get__(self, obj, cls): # -> ServiceList | tuple[()]: + ... + + + +class ProvideServicesAdvertisement(Advertisement): + """Advertise what services that the device makes available upon connection.""" + match_prefixes = ... + services = ... + def __init__(self, *services, entry=...) -> None: + ... + + @classmethod + def matches(cls, entry): + """Only one kind of service list need be present in a ProvideServicesAdvertisement, + so override the default behavior and match any prefix, not all. + """ + ... + + + +class SolicitServicesAdvertisement(Advertisement): + """Advertise what services the device would like to use over a connection.""" + match_prefixes = ... + solicited_services = ... + def __init__(self, *services, entry=...) -> None: + ... + + + +class ManufacturerData(AdvertisingDataField): + """Encapsulates manufacturer specific keyed data bytes. The manufacturer is identified by the + company_id and the data is structured like an advertisement with a configurable key + format. The order of the serialized data is determined by the order that the + `ManufacturerDataField` attributes are set in - this can be useful for + `match_prefixes` in an `Advertisement` sub-class.""" + def __init__(self, obj, *, advertising_data_type=..., company_id, key_encoding=...) -> None: + ... + + def __len__(self): # -> int: + ... + + def __bytes__(self): # -> bytes: + ... + + def __str__(self) -> str: + ... + + + +class ManufacturerDataField: + """A single piece of data within the manufacturer specific data. The format can be repeated.""" + def __init__(self, key, value_format, field_names=...) -> None: + ... + + def __get__(self, obj, cls): # -> ManufacturerDataField | mdf_tuple | Any | Tuple[Any, ...] | tuple[None, ...] | None: + ... + + def __set__(self, obj, value): # -> None: + ... + + + +class ServiceData(AdvertisingDataField): + """Encapsulates service data. It is read as a memoryview which can be manipulated or set as a + bytearray to change the size.""" + def __init__(self, service) -> None: + ... + + def __get__(self, obj, cls): # -> ServiceData | memoryview | None: + ... + + def __set__(self, obj, value): # -> None: + ... + + + diff --git a/typings/adafruit_ble/attributes/__init__.pyi b/typings/adafruit_ble/attributes/__init__.pyi new file mode 100644 index 0000000..03c7968 --- /dev/null +++ b/typings/adafruit_ble/attributes/__init__.pyi @@ -0,0 +1,55 @@ +""" +This type stub file was generated by pyright. +""" + +import _bleio + +""" +:py:mod:`~adafruit_ble.attributes` +==================================================== + +This module provides definitions common to all kinds of BLE attributes, +specifically characteristics and descriptors. + +""" +__version__ = ... +__repo__ = ... +class Attribute: + """Constants describing security levels. + + .. data:: NO_ACCESS + + security mode: access not allowed + + .. data:: OPEN + + security_mode: no security (link is not encrypted) + + .. data:: ENCRYPT_NO_MITM + + security_mode: unauthenticated encryption, without man-in-the-middle protection + + .. data:: ENCRYPT_WITH_MITM + + security_mode: authenticated encryption, with man-in-the-middle protection + + .. data:: LESC_ENCRYPT_WITH_MITM + + security_mode: LESC encryption, with man-in-the-middle protection + + .. data:: SIGNED_NO_MITM + + security_mode: unauthenticated data signing, without man-in-the-middle protection + + .. data:: SIGNED_WITH_MITM + + security_mode: authenticated data signing, without man-in-the-middle protection""" + NO_ACCESS = ... + OPEN = ... + ENCRYPT_NO_MITM = ... + ENCRYPT_WITH_MITM = ... + LESC_ENCRYPT_WITH_MITM = ... + SIGNED_NO_MITM = ... + SIGNED_WITH_MITM = ... + + diff --git a/typings/adafruit_ble/characteristics/__init__.pyi b/typings/adafruit_ble/characteristics/__init__.pyi new file mode 100644 index 0000000..b368038 --- /dev/null +++ b/typings/adafruit_ble/characteristics/__init__.pyi @@ -0,0 +1,120 @@ +""" +This type stub file was generated by pyright. +""" + +import struct +import _bleio +from ..attributes import Attribute + +""" + +This module provides core BLE characteristic classes that are used within Services. + +""" +__version__ = ... +__repo__ = ... +class Characteristic: + """ + Top level Characteristic class that does basic binding. + + :param UUID uuid: The uuid of the characteristic + :param int properties: The properties of the characteristic, + specified as a bitmask of these values bitwise-or'd together: + `BROADCAST`, `INDICATE`, `NOTIFY`, `READ`, `WRITE`, `WRITE_NO_RESPONSE`. + :param int read_perm: Specifies whether the characteristic 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`. + :param int write_perm: Specifies whether the characteristic can be written by a client, + and if so, which security mode is required. Values allowed are the same as ``read_perm``. + :param int max_length: Maximum length in bytes of the characteristic value. The maximum allowed + by the BLE specification is 512. On nRF, if ``fixed_length`` is ``True``, the maximum + is 510. The default value is 20, which is the maximum + number of data bytes that fit in a single BLE 4.x ATT packet. + :param bool fixed_length: True if the characteristic value is of fixed length. + :param buf initial_value: The initial value for this characteristic. If not given, will be + filled with zeros. + + .. data:: BROADCAST + + property: allowed in advertising packets + + .. data:: INDICATE + + property: server will indicate to the client when the value is set and wait for a response + + .. data:: NOTIFY + + property: server will notify the client when the value is set + + .. data:: READ + + property: clients may read this characteristic + + .. data:: WRITE + + property: clients may write this characteristic; a response will be sent back + + .. data:: WRITE_NO_RESPONSE + + property: clients may write this characteristic; no response will be sent back""" + BROADCAST = ... + INDICATE = ... + NOTIFY = ... + READ = ... + WRITE = ... + WRITE_NO_RESPONSE = ... + def __init__(self, *, uuid=..., properties=..., read_perm=..., write_perm=..., max_length=..., fixed_length=..., initial_value=...) -> None: + ... + + def __get__(self, service, cls=...): # -> Characteristic: + ... + + def __set__(self, service, value): # -> None: + ... + + + +class ComplexCharacteristic: + """ + Characteristic class that does complex binding where the subclass returns a full object for + interacting with the characteristic data. The Characteristic itself will be shadowed once it + has been bound to the corresponding instance attribute. + """ + def __init__(self, *, uuid=..., properties=..., read_perm=..., write_perm=..., max_length=..., fixed_length=..., initial_value=...) -> None: + ... + + def bind(self, service): + """Binds the characteristic to the local Service or remote Characteristic object given.""" + ... + + def __get__(self, service, cls=...): # -> ComplexCharacteristic: + ... + + + +class StructCharacteristic(Characteristic): + """ + Data descriptor for a structure with a fixed format. + + :param struct_format: a `struct` format string describing how to pack multiple values + into the characteristic bytestring + :param UUID uuid: The uuid of the characteristic + :param int properties: see `Characteristic` + :param int read_perm: see `Characteristic` + :param int write_perm: see `Characteristic` + :param buf initial_value: see `Characteristic` + """ + def __init__(self, struct_format, *, uuid=..., properties=..., read_perm=..., write_perm=..., initial_value=...) -> None: + ... + + def __get__(self, obj, cls=...): # -> StructCharacteristic | Tuple[Any, ...] | None: + ... + + def __set__(self, obj, value): # -> None: + ... + + + diff --git a/typings/adafruit_ble/characteristics/stream.pyi b/typings/adafruit_ble/characteristics/stream.pyi new file mode 100644 index 0000000..d2c64b0 --- /dev/null +++ b/typings/adafruit_ble/characteristics/stream.pyi @@ -0,0 +1,49 @@ +""" +This type stub file was generated by pyright. +""" + +from . import ComplexCharacteristic + +""" +`stream` +==================================================== + +This module provides stream characteristics that bind readable or writable objects to the Service +object they are on. + +""" +__version__ = ... +__repo__ = ... +class BoundWriteStream: + """Writes data out to the peer.""" + def __init__(self, bound_characteristic) -> None: + ... + + def write(self, buf): # -> None: + """Write data from buf out to the peer.""" + ... + + + +class StreamOut(ComplexCharacteristic): + """Output stream from the Service server.""" + def __init__(self, *, uuid=..., timeout=..., buffer_size=..., properties=..., read_perm=..., write_perm=...) -> None: + ... + + def bind(self, service): # -> CharacteristicBuffer | BoundWriteStream: + """Binds the characteristic to the given Service.""" + ... + + + +class StreamIn(ComplexCharacteristic): + """Input stream into the Service server.""" + def __init__(self, *, uuid=..., timeout=..., buffer_size=..., properties=..., write_perm=...) -> None: + ... + + def bind(self, service): # -> BoundWriteStream | CharacteristicBuffer: + """Binds the characteristic to the given Service.""" + ... + + + diff --git a/typings/adafruit_ble/services/__init__.pyi b/typings/adafruit_ble/services/__init__.pyi new file mode 100644 index 0000000..efd308a --- /dev/null +++ b/typings/adafruit_ble/services/__init__.pyi @@ -0,0 +1,36 @@ +""" +This type stub file was generated by pyright. +""" + +import _bleio +from ..characteristics import Characteristic, ComplexCharacteristic + +""" + +This module provides the top level Service definition. + +""" +__version__ = ... +__repo__ = ... +class Service: + """Top level Service class that handles the hard work of binding to a local or remote service. + + Providers of a local service should instantiate their Service with service=None, the default. + The local Service's characteristics will be lazily made available to clients as they are used + locally. In other words, a characteristic won't be available to remote clients until it has + been read or written locally. + + To use a remote Service, get the item with the key of the Service type on the + `BLEConnection`. For example, ``connection[UartService]`` will return the UartService + instance for the connection's peer. + """ + def __init__(self, *, service=..., secondary=..., **initial_values) -> None: + ... + + @property + def remote(self): # -> bool: + """True if the service is provided by a peer and accessed remotely.""" + ... + + + diff --git a/typings/adafruit_ble/services/nordic.pyi b/typings/adafruit_ble/services/nordic.pyi new file mode 100644 index 0000000..aef9441 --- /dev/null +++ b/typings/adafruit_ble/services/nordic.pyi @@ -0,0 +1,77 @@ +""" +This type stub file was generated by pyright. +""" + +from . import Service + +""" +`nordic` +==================================================== + +This module provides Services used by Nordic Semiconductors. + +""" +__version__ = ... +__repo__ = ... +class UARTService(Service): + """ + Provide UART-like functionality via the Nordic NUS service. + + :param int timeout: the timeout in seconds to wait + for the first character and between subsequent characters. + :param int buffer_size: buffer up to this many bytes. + If more bytes are received, older bytes will be discarded. + + See ``examples/ble_uart_echo_test.py`` for a usage example. + """ + uuid = ... + _server_tx = ... + _server_rx = ... + def __init__(self, service=...) -> None: + ... + + def read(self, nbytes=...): + """ + Read characters. If ``nbytes`` is specified then read at most that many bytes. + Otherwise, read everything that arrives until the connection times out. + Providing the number of bytes expected is highly recommended because it will be faster. + + :return: Data read + :rtype: bytes or None + """ + ... + + def readinto(self, buf, nbytes=...): + """ + Read bytes into the ``buf``. If ``nbytes`` is specified then read at most + that many bytes. Otherwise, read at most ``len(buf)`` bytes. + + :return: number of bytes read and stored into ``buf`` + :rtype: int or None (on a non-blocking error) + """ + ... + + def readline(self): + """ + Read a line, ending in a newline character. + + :return: the line read + :rtype: bytes or None + """ + ... + + @property + def in_waiting(self): + """The number of bytes in the input buffer, available to be read.""" + ... + + def reset_input_buffer(self): # -> None: + """Discard any unread characters in the input buffer.""" + ... + + def write(self, buf): # -> None: + """Write a buffer of bytes.""" + ... + + + diff --git a/typings/adafruit_ble/uuid/__init__.pyi b/typings/adafruit_ble/uuid/__init__.pyi new file mode 100644 index 0000000..7f68c63 --- /dev/null +++ b/typings/adafruit_ble/uuid/__init__.pyi @@ -0,0 +1,48 @@ +""" +This type stub file was generated by pyright. +""" + +import struct +import _bleio + +""" + +This module provides core Unique ID (UUID) classes. + +""" +__version__ = ... +__repo__ = ... +class UUID: + """Top level UUID""" + def __hash__(self) -> int: + ... + + def __eq__(self, other) -> bool: + ... + + def __str__(self) -> str: + ... + + def __bytes__(self): # -> bytes: + ... + + def pack_into(self, buffer, offset=...): # -> None: + """Packs the UUID into the buffer at the given offset.""" + ... + + + +class StandardUUID(UUID): + """Standard 16-bit UUID defined by the Bluetooth SIG.""" + def __init__(self, uuid16) -> None: + ... + + + +class VendorUUID(UUID): + """Vendor defined, 128-bit UUID.""" + def __init__(self, uuid128) -> None: + ... + + + diff --git a/typings/micropython.pyi b/typings/micropython.pyi new file mode 100644 index 0000000..f2c1dc4 --- /dev/null +++ b/typings/micropython.pyi @@ -0,0 +1,5 @@ +from typing import TypeVar + +T = TypeVar('T') + +def const(x: T) -> T: ...