sciro.iodevices

sciro.iodevices – PeakHub-only device classes (re-exported from pybricks.iodevices on the hub; declared here for the IDE).

class sciro.iodevices.PUMPDevice(port: Port)

Bases: object

Generic access to a PUMP device (Power UART Multiplex Protocol) on a PeakHub port. Streams are addressed by id (1..N); state and data are raw bytes decoded by the user or a convenience class such as sciro.pump.FloorPro. Spec: PUMP-Protocol.md.

OFF: int = 0

stream is silent.

Type:

Stream-control mode

ONESHOT: int = 1

one frame, then the mode self-clears to OFF.

Type:

Stream-control mode

ON_CHANGE: int = 2

a frame whenever a new sample differs.

Type:

Stream-control mode

PERIODIC: int = 3

every sample (rate 0) or at the given rate.

Type:

Stream-control mode

info() → Dict
Returns:

{"url": str, "serial": str, "streams": ((id, url, ext_port, state_len), ...)}

stats() → Dict

Link counters since the session started, for load tests and diagnostics: {"frames": good frames received, "crc_errors", "cobs_errors", "short_frames", "overflows", "streams": ((id, frames, gaps), ...)} where gaps counts frames of that stream the hub never received.

state(stream) → bytes | None

The last state prefix echoed by the stream (first two bytes are the stream-control word: mode, rate), or None if none was received yet.

read(stream) → Tuple[bytes, bytes]

Waits for a frame measured under the currently requested settings and returns (state, data). Awaitable under multitasking.

change_state(stream, state)

Sets the stream’s whole state prefix (must be exactly its length) and waits until the device echoes it. Raises OSError (ETIMEDOUT) if the device never acknowledges.

subscribe(stream, mode, rate=0)

Changes only the stream-control word (keeps the device-specific state bytes). rate is in Hz (1 .. 255; higher values are clamped to 255), 0 = every sample.