Start work on types

Bring in typings folder for adafruit_ble and micropython
This commit is contained in:
sofubi
2021-08-13 23:10:43 -04:00
parent 95dcc57e76
commit 2c69d0e197
11 changed files with 910 additions and 12 deletions

View File

@@ -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."""
...

View File

@@ -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."""
...