bundle.ble

Bundle BLE module public interface definitions.

Submodules

Attributes

Classes

Advertisement

Bleak advertisement adapter with convenience helpers.

Device

Entity describing a discovered peripheral.

FrameCodec

Decode arbitrary BLE notification splits using a 2-byte BE header.

NordicLink

High-level helper managing a single Nordic UART Service connection.

Manager

Provide a compact API for scanning and opening Nordic UART links.

Scanner

Collect advertisement snapshots from nearby peripherals.

ScanResult

Entity describing a scan run and its collected devices.

Package Contents

class bundle.ble.Advertisement(/, **data: Any)

Bases: bundle.core.data.Data

Bleak advertisement adapter with convenience helpers.

raw: bleak.backends.scanner.AdvertisementData | None = None
property local_name: str | None
property rssi: int | None
property tx_power: int | None
property manufacturer_data: dict[int, bytes]
property manufacturer_id: int | None
property manufacturer_label: str | None
property service_uuids: list[str]
property service_labels: list[str]
info_fragments(*, limit: int = 3) list[str]
class bundle.ble.Device(/, **data: Any)

Bases: bundle.core.Entity

Entity describing a discovered peripheral.

name: str = None
alias: str | None = None
address: str = None
signal: int | None = None
type: str = None
manufacturer: str | None = None
services: list[str] = None
tx_power: int | None = None
local_name: str | None = None
classmethod from_backend(device: bleak.backends.device.BLEDevice, advertisement: bleak.backends.scanner.AdvertisementData | None) Device
property raw_device: bleak.backends.device.BLEDevice | None
property rssi_display: str
property info_line: str
matches_name(query: str) bool
class bundle.ble.FrameCodec(/, **data: Any)

Bases: bundle.core.data.Data

Decode arbitrary BLE notification splits using a 2-byte BE header.

encode(payload: bytes) list[bytes]

Wrap payload with its length prefix.

feed(chunk: bytes) collections.abc.Iterable[bytes]

Yield every completed frame extracted from chunk.

Bases: bundle.core.Entity

High-level helper managing a single Nordic UART Service connection.

name: str = None
device_address: str | None = None
device_name: str | None = None
timeout: float = None
on_message(callback: collections.abc.Callable[[bytes], None]) None
property is_connected: bool
async connect() None
async disconnect() None
async send(payload: bytes) None
class bundle.ble.Manager(*args, **kwargs)

Bases: bundle.core.Entity

Provide a compact API for scanning and opening Nordic UART links.

name: str = None
default_timeout: float = None
async scan(*, timeout: float | None = None) bundle.ble.scanner.ScanResult
async open(*, device_name: str | None = None, device_address: str | None = None, timeout: float | None = None) bundle.ble.link.NordicLink
bundle.ble.DEFAULT_SCAN_TIMEOUT = 5.0
class bundle.ble.Scanner(/, **data: Any)

Bases: bundle.core.Entity

Collect advertisement snapshots from nearby peripherals.

timeout: float = None
async scan(*, timeout: float | None = None) ScanResult
class bundle.ble.ScanResult(/, **data: Any)

Bases: bundle.core.data.Data

Entity describing a scan run and its collected devices.

timeout: float = None
devices: list[bundle.ble.device.Device] = None
sorted_devices() list[bundle.ble.device.Device]
lines() list[str]