This module provides the top level Service definition.

class Service(*, service: Service | None = None, secondary: bool = False, **initial_values)

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.


Override this method to do any explicit cleanup necessary on connection close.

property remote: bool

True if the service is provided by a peer and accessed remotely.


This module provides Services defined by CircuitPython. Out of date.

class CircuitPythonUUID(uuid16: int)

UUIDs with the CircuitPython base UUID.

class CircuitPythonService(*, service: Service | None = None, secondary: bool = False, **initial_values)

Core CircuitPython service that allows for file modification and REPL access. Unimplemented.


This module provides Services used by Nordic Semiconductors.

class UARTService(service: _bleio.Service | None = None)

Provide UART-like functionality via the Nordic NUS service.

See examples/ for a usage example.


The characteristic buffers must be deinitialized when no longer needed. Otherwise they will leak storage.

read(nbytes: int | None = None) bytes | None

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.


Data read

Return type:

bytes or None

readinto(buf: WriteableBuffer, nbytes: int | None = None) int | None

Read bytes into the buf. If nbytes is specified then read at most that many bytes. Otherwise, read at most len(buf) bytes.


number of bytes read and stored into buf

Return type:

int or None (on a non-blocking error)

readline() bytes | None

Read a line, ending in a newline character.


the line read

Return type:

bytes or None

property in_waiting: int

The number of bytes in the input buffer, available to be read.

reset_input_buffer() None

Discard any unread characters in the input buffer.

write(buf: ReadableBuffer) None

Write a buffer of bytes.