Start work on types
Bring in typings folder for adafruit_ble and micropython
This commit is contained in:
120
typings/adafruit_ble/characteristics/__init__.pyi
Normal file
120
typings/adafruit_ble/characteristics/__init__.pyi
Normal file
@@ -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:
|
||||
...
|
||||
|
||||
|
||||
|
49
typings/adafruit_ble/characteristics/stream.pyi
Normal file
49
typings/adafruit_ble/characteristics/stream.pyi
Normal file
@@ -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."""
|
||||
...
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user