class
AckOutcome:
What an incoming acknowledgement means for the command in flight.
kind
"unrelated" if the ack was for another command, "in_progress" if
the command is still running, or "final" if it finished.
value
The progress percent when in progress (255 when the autopilot does not
report one), or the MAV_RESULT when final.
class
Ads1115Config:
An ADS1115 configuration register, field by field.
mux
The input multiplexer code, 0..=7.
comparator_queue
The comparator queue code, 0..=3, where 3 disables the comparator.
comparator_latching
Whether the comparator latches until the conversion is read.
start_conversion
Whether writing this starts a single conversion.
data_rate
The data rate code, 0..=7.
comparator_active_high
Whether the ALERT/RDY pin is active high.
pga
The gain code, 0..=7, which sets the full-scale range.
single_shot
Whether to convert once per request and power down, rather than continuously.
window_comparator
Whether to use the window comparator rather than the traditional one.
class
AgreementKey:
A key-agreement secret, and the public key to hand to a peer.
public_key
The public key to hand to a peer.
class
AlertReport:
An alert a reading raised.
Only the attribute belonging to kind is set; the rest are None.
reading
The offending reading, for an out-of-range alert.
kind
Which threshold the reading crossed: OutOfRange, RunningOut, or
ChangingFast.
samples
The estimated samples until empty, for a running-out alert.
rate
The change since the previous sample, for a changing-fast alert.
class
Anomaly:
Flags a reading that stands out from the ones around it.
def
check(self, /, reading):
Folds a reading in and reports whether it stands out.
class
AuditEntry:
One signed record, chained onto the one before it.
def
from_bytes(data):
Reads an entry back from the bytes it was written as.
def
to_bytes(self, /):
Encodes this entry for storage or transmission.
index
The position of this entry in its chain.
digest
The hash of this entry, which the next one chains onto.
signature
The signature over this entry.
payload
The record this entry carries.
previous
The hash of the entry before this one, all zeroes for the first.
class
AuditLog:
A log that signs what it is given and chains it onto what came before.
def
resume(identity, last):
Creates a log that carries on from the last entry an earlier one wrote.
This is what a device does after a restart: the chain continues at the
next index and hashes onto the entry it left off at, so a reboot leaves
no gap for a record to be removed through.
def
append(self, /, payload):
Appends a payload, signing it and chaining it onto the last entry.
class
AuditVerifier:
Checks a chain one entry at a time, in the order the entries were written.
def
check(self, /, entry):
Checks the next entry, returning whether it belongs where it was offered.
Feeding entries out of order, skipping one, or repeating one is refused
just as an altered payload is.
class
Bme280Calibration:
A BME280's factory calibration, read once and reused for every measurement.
def
compensate(self, /, measurement):
Turns an eight-byte burst read into a compensated reading.
class
Bme280Measurement:
A compensated BME280 reading.
hectopascals
The pressure in hectopascals, the unit a barometer is usually quoted in.
relative_humidity_percent
The relative humidity as a percentage.
celsius
The temperature in degrees Celsius.
class
Bmp280Calibration:
A BMP280's factory calibration, read once and reused for every measurement.
def
compensate(self, /, measurement):
Turns a six-byte burst read into a compensated reading.
def
to_bytes(self, /):
Rebuilds the 24 calibration bytes a device holding these coefficients returns.
coefficients
The trimming coefficients the calibration bytes carried.
class
Bmp280Coefficients:
A BMP280's per-chip trimming coefficients, as they sit in its registers.
class
Bmp280Config:
A BMP280 config register, field by field.
spi_3wire
Whether the 3-wire SPI interface is enabled.
standby
The normal-mode standby code, 0..=7.
filter
The IIR filter code, 0..=7.
class
Bmp280CtrlMeas:
A BMP280 ctrl_meas register, field by field.
temperature
The temperature oversampling code, 0..=5, where 0 skips the measurement.
pressure
The pressure oversampling code, 0..=5, where 0 skips the measurement.
mode
The power mode code: 0 sleep, 1 forced, 3 normal.
class
Bmp280RawMeasurement:
The uncompensated codes a BMP280 burst read carries.
pressure
The 20-bit pressure code.
temperature_skipped
Whether temperature oversampling was off, so the code carries no reading.
temperature
The 20-bit temperature code.
pressure_skipped
Whether pressure oversampling was off, so the code carries no reading.
class
Bmp280Reading:
A compensated BMP280 reading.
celsius
The temperature in degrees Celsius.
hectopascals
The pressure in hectopascals, the unit a barometer is usually quoted in.
class
BootDecision:
The decision a device made at boot, already recorded before it was returned.
fallback
The slot to run. It is the same as slot for anything but Reverted.
action
What the bootloader should do: Confirmed, Trying, or Reverted.
slot
The image the decision is about, which for Reverted is the one that
failed.
class
Calibration:
Turns a raw sensor count into the units the reading is actually in.
def
linear(scale, offset):
Creates a calibration applying raw * scale + offset.
def
two_point(raw_low, value_low, raw_high, value_high):
Creates a calibration fitted through two known reference points.
def
apply(self, /, raw):
Converts a raw reading into calibrated units.
class
CanFrame:
A CAN frame: an identifier, its flags, and its payload.
remote
Whether this is a remote transmission request, which carries no payload.
dlc
The data length code as it appears on the wire.
data
The payload, empty for a remote frame.
len
The data length: the payload length, or the length a remote frame requests.
id
The arbitration identifier, already masked to 11 or 29 bits.
extended
Whether the identifier is a 29-bit extended one.
fd
Whether this is a CAN-FD frame rather than classic CAN 2.0.
class
CdrReader:
A CDR decoder, which reads primitives back in the order they were written.
Reading past the end returns None rather than raising, because a short
buffer is a wire condition rather than a programming error.
def
read_i32(self, /):
Reads the next 32-bit signed integer, or None once exhausted.
def
read_u32(self, /):
Reads the next 32-bit unsigned integer, or None once exhausted.
def
read_f32(self, /):
Reads the next 32-bit float, or None once exhausted.
def
read_f64(self, /):
Reads the next 64-bit float, or None once exhausted.
class
CdrWriter:
A CDR encoder, which writes primitives with the alignment the wire format
requires.
def
write_i32(self, /, value):
Appends a 32-bit signed integer.
def
write_u32(self, /, value):
Appends a 32-bit unsigned integer.
def
write_f32(self, /, value):
def
write_f64(self, /, value):
bytes
The bytes written so far.
class
ChannelPlan:
A regional channel plan, published or private.
def
for_region(region):
Returns the published plan for a region.
Raises ValueError if no published region goes by that name.
def
regions():
Returns the short code of every published region, as for_region takes.
These are the codes a deployment is configured with. The band name the
specification uses, such as EU863-870, is the plan's name.
def
info(self, /):
Returns the scalar facts of the plan.
def
data_rate(self, /, data_rate, direction='uplink'):
Returns the data rate a number selects, or None past the end of the
plan's table.
A number the region reserves is a data rate of kind reserved, which is
different from a number the plan never defines.
def
link_settings(self, /, data_rate):
Returns the radio settings an uplink data rate selects, ready to hand to
airtime_us, or None if the number is reserved or not carried by LoRa.
def
max_payload(self, /, data_rate, table='uplink_direct'):
Returns what a data rate may carry in one frame, or None where the plan
publishes no limit for it.
def
duty_cycle_permille(self, /, frequency_hz):
Returns the share of time a transmitter may hold a frequency, in parts per
thousand, or None if the frequency falls in no sub-band this plan
describes.
This reports the limit; it does not impose it. Pair it with
min_off_time_us to turn the limit into the silence a frame costs.
def
max_eirp_dbm(self, /, frequency_hz):
Returns the power ceiling that applies at a frequency, in dBm EIRP,
falling back to the plan's default where no sub-band says otherwise.
def
tx_power_dbm(self, /, index, max_eirp_dbm):
Returns the radiated power a transmit-power index selects, in dBm, or
None if the index is past the highest the plan defines.
def
rx1_data_rate(self, /, uplink_data_rate, offset, dwell_limited=False):
Returns the downlink data rate the first receive window listens at, or
None if the uplink data rate or offset is outside what the plan defines.
def
rx2(self, /):
Returns where the second receive window listens, as a frequency in hertz
and a data rate.
def
next_backoff_data_rate(self, /, data_rate):
Returns the next lower data rate to fall back to during adaptive back-off,
or None at the slowest rate the plan has.
A device that has lost the network steps down this chain, trading airtime
for range until it is heard again.
def
channel_frequency_hz(self, /, channel):
Returns the centre frequency of one of the plan's default channels, or
None past the last one the plan starts a device with.
def
channel_blocks(self, /, which='default'):
Returns the plan's channel blocks, either the join set or the default set.
def
sub_bands(self, /):
Returns the plan's sub-bands and the transmit limits inside each.
name
The specification's name for the band.
class
ChannelPlanBuilder:
A channel plan under construction.
Tables are indexed by position, so entries are added in data-rate order and a
number the plan does not use is added as a reserved data rate. What a region
would share between directions is filled in by build.
def
data_rate(self, /, rate, direction='uplink'):
Adds the next data rate in a direction.
A plan that never adds a downlink rate uses its uplink table in both
directions, which is what every region but the 900 MHz plans does.
def
max_payload(self, /, payload=None, table='uplink_direct'):
Adds the next entry of one payload table.
Pass no payload for a data rate that carries nothing. A downlink table
left empty mirrors the matching uplink one.
def
channel_block(self, /, block, which='default'):
Adds a run of evenly spaced channels.
def
sub_band(self, /, band):
Adds a sub-band and the transmit limits inside it.
A deployment on licensed spectrum gives its sub-band a duty cycle of
1000, which reports as unrestricted.
def
rx1_row(self, /, offsets, dwell_limited=False):
Adds the RX1 downlink data rates for the next uplink data rate.
Every row must be as wide as the plan's highest RX1 offset allows.
def
backoff(self, /, lower=None):
Adds the next entry of the adaptive back-off chain.
Pass no data rate at the slowest, which has nothing below it. A chain left
empty steps down one data rate at a time.
def
power(self, /, default_max_eirp_dbm, step_db=2, max_index=7):
Sets the transmit-power ladder.
def
rx(self, /, rx2_frequency_hz, rx2_data_rate=0, max_rx1_offset=0):
Sets the receive windows.
max_rx1_offset fixes how wide every RX1 row must be.
def
beacon(self, /, beacon, has_dwell_time_limit=False):
Sets the Class B beacon and whether the plan limits dwell time.
def
build(self, /):
Finishes the plan.
Raises ValueError if the plan would answer a question wrongly, for
example because an RX1 row is narrower than the plan's offsets allow, or
because the second receive window listens at a data rate the plan does not
define.
class
CoapClient:
def
connect(self, /):
Binds the local socket so the endpoint can carry traffic.
def
send(self, /, topic, payload):
Sends a payload to a resource path.
def
subscribe(self, /, topic):
Observes a resource path, so messages published to it reach recv.
def
recv(self, /):
Waits for the next message on an observed path, or None once closed.
def
is_connected(self, /):
Whether the local socket is bound.
def
disconnect(self, /):
Releases the socket the endpoint holds.
class
CobsDecoder:
Reassembles whole COBS frames from the chunks a serial port delivers.
def
feed(self, /, chunk):
Feeds a chunk of the stream and returns every frame it completed.
def
reset(self, /):
Discards any partly assembled frame.
discarded
How many corrupt frames this decoder has discarded.
class
CommandProtocol:
Tracks one command awaiting its acknowledgement.
def
on_frame(self, /, frame):
Classifies an incoming frame against the command in flight.
Returns the outcome, or None if the frame is not a COMMAND_ACK.
def
on_timeout(self, /):
Records a timeout and reports whether the command may be resent.
Returns the new confirmation count to stamp on the resend, or None
once the retry budget is exhausted.
command
The command id being tracked.
confirmation
The confirmation count to stamp on the command being sent: zero for
the first transmission, incremented on each retransmission.
class
ControlPolicy:
A profile's control policy.
Only the attributes belonging to kind are set; the rest are None.
hysteresis
Half the deadband width, for a setpoint policy.
kind
Which policy this describes: Setpoint, Level, Surge, or Monitor.
safe_band
How far the reading may stray before an alert, for a setpoint policy.
empty
The level treated as empty, for a level policy.
limit
The largest safe change per sample, for a surge policy.
cooling
Whether the output cools rather than heats, for a setpoint policy.
setpoint
The target reading, for a setpoint policy.
warn_within
How many samples ahead to warn, for a level policy.
rising
Whether a rise rather than a fall is watched, for a surge policy.
class
Controller:
The decision logic a profile assembles.
A controller carries state between readings, because a level estimate and a
rate of change both need the previous sample, so evaluate readings through
one controller in the order they were taken.
def
setpoint(setpoint, hysteresis, cooling, safe_band):
Holds a reading near a setpoint by switching an output on and off.
def
level(empty, warn_within):
Warns before a falling level reaches empty.
def
surge(rising, limit):
Warns when a reading changes faster than a limit.
def
monitor():
Reports readings without judging them.
def
evaluate(self, /, reading):
Decides what one reading calls for.
class
Debounce:
Stops a flickering input from acting until it has settled.
def
update(self, /, raw):
Feeds a raw reading in and returns the settled state.
class
Delegation:
A statement, signed by the anchor, that a second key may sign releases.
release_key
The public key that may sign manifests while this delegation stands.
expires
When the delegation stops being honoured, in seconds since the Unix
epoch, or 0 to never expire.
epoch
Rises with every rotation, so a retired key cannot be reinstated by
replaying the statement that once authorised it.
class
Depletion:
Warns before a falling level runs out, by projecting its rate of fall.
def
update(self, /, level):
Records a level and returns the samples left before the threshold.
Returns None while the level is steady or rising, and on the first
reading, when no rate of fall is known yet.
class
DeviceIdentity:
A device's private signing identity.
def
sign(self, /, payload):
Signs a payload, returning the 64-byte detached signature.
def
sign_message(self, /, payload):
Signs a payload and returns the signature followed by the payload, as one message.
public_key
The public key matching this identity, which is safe to share.
fingerprint
The short hex fingerprint of this identity, for logs and displays.
class
Dialect:
The CRC_EXTRA seeds of a dialect beyond the common one.
Entries added here are consulted before the built-in common-dialect registry,
so a private dialect may also override an id the common one defines.
def
add(self, /, msgid, crc_extra):
Adds or replaces the seed for a message id.
def
add_message(self, /, msgid, name, fields):
Adds a message by its definition, deriving the seed, and returns it.
This is the whole path for a vendor dialect: describe the message once,
and every frame carrying it checks from then on.
class
Ds18b20Reading:
A decoded DS18B20 scratchpad.
alarm_low
The low alarm threshold in whole degrees Celsius.
resolution_bits
The configured resolution, as a number of bits: 9, 10, 11, or 12.
alarm_high
The high alarm threshold in whole degrees Celsius.
raw_temperature
The raw temperature register, 1/16 degree Celsius per count.
celsius
The temperature in degrees Celsius.
micro_celsius
The temperature in micro-degrees Celsius, exact in integer arithmetic.
class
DutyCycle:
The split between the time a node works and the time it sleeps.
def
from_fraction(period_us, fraction):
sleep_us
How long it sleeps each period, in microseconds.
period_us
The whole period, awake plus asleep, in microseconds.
fraction
The share of the period spent awake, from 0 through 1.
active_us
How long the node stays awake each period, in microseconds.
class
EventBus:
One endpoint on an event bus.
An endpoint both publishes and receives. Each subscriber needs its own, taken
with subscribe, because an endpoint only sees events published after it
existed.
def
subscribe(self, /):
Takes another endpoint on the same bus.
The new endpoint sees events published from now on, not those already
sent, so subscribe before publishing anything it needs to see.
def
publish(self, /, event):
Publishes an event to every subscriber.
def
next_event(self, /):
Waits for the next event on this endpoint, or None once the bus closes.
class
ForwardDecision:
A routing decision, and the neighbour it names when there is one.
next_hop
The neighbour to unicast to, or None unless the action is Relay.
action
What to do with the packet: Deliver, Relay, or Flood.
class
Geofence:
Keeps a tracked point inside an area, and notices when it leaves.
def
update(self, /, latitude, longitude):
Feeds a fix in and names where it sits, including a single crossing.
Returns one of "Inside", "Outside", "Exited", or "Entered".
def
contains(self, /, latitude, longitude):
Reports whether a fix lies inside, without recording a crossing.
class
Hdc1080Config:
An HDC1080 configuration register, field by field.
temperature_resolution_bits
The temperature resolution in bits: 14 or 11.
sequential
Whether one trigger acquires temperature and humidity in sequence.
battery_low
Whether the supply has dropped below 2.8 V, which the part reports back.
humidity_resolution_bits
The humidity resolution in bits: 14, 11, or 8.
software_reset
Whether writing this resets the part.
heater
Whether the on-die heater runs during measurements.
class
Hdc1080Measurement:
A decoded HDC1080 temperature and humidity pair.
temperature_raw
The raw temperature register.
milli_celsius
The temperature in milli-degrees Celsius, exact in integer arithmetic.
celsius
The temperature in degrees Celsius.
milli_percent
The relative humidity in milli-percent.
humidity_raw
The raw humidity register.
relative_humidity
The relative humidity as a percentage.
class
ImageVerifier:
Hashes an image as it arrives and settles it against its manifest.
def
update(self, /, chunk):
Takes the next piece of the image, in order.
def
finish(self, /):
Settles the image, returning its digest, and spends this verifier.
Raises if the image is not the one the manifest described.
class
Ina226Config:
An INA226 configuration register, field by field.
reset
Whether writing this resets the part.
shunt_conversion_time
The shunt-voltage conversion-time code, 0..=7.
mode
The operating-mode code, 0..=7.
bus_conversion_time
The bus-voltage conversion-time code, 0..=7.
averaging
The averaging code, 0..=7, from 1 to 1024 samples.
class
Ina226DieId:
A decoded INA226 die-ID register.
device
The 12-bit device identifier.
class
Ina226MaskEnable:
An INA226 Mask/Enable register, field by field.
shunt_under_limit
Alert when the shunt voltage drops below the limit.
alert_function_flag
Whether the selected limit function caused the last alert.
bus_over_limit
Alert when the bus voltage exceeds the limit.
alert_active_high
Whether the alert pin is active high.
alert_latch
Whether the alert pin latches until this register is read.
conversion_ready
Also alert when a conversion completes.
bus_under_limit
Alert when the bus voltage drops below the limit.
math_overflow
Whether an arithmetic overflow left current and power invalid.
shunt_over_limit
Alert when the shunt voltage exceeds the limit.
conversion_ready_flag
Whether every conversion and multiplication has completed.
power_over_limit
Alert when the power exceeds the limit.
class
J1939Message:
The fields J1939 packs into an extended CAN identifier.
destination
The destination address for an addressed (PDU1) message, or None for a
broadcast (PDU2) one.
pgn
The parameter group number, which names what the message carries.
priority
The message priority, 0 (highest) to 7.
broadcast
Whether the message is a broadcast.
source
The source address: the node that sent the message.
class
Kalman:
Estimates a true value from noisy readings, trusting the model and the sensor
in proportion to how noisy each is.
def
update(self, /, reading):
Folds a reading in and returns the new estimate.
class
Ladder:
An ordered set of transports backed by an offline buffer.
def
rung(self, /, transport):
Adds a rung, which is tried after the rungs already added.
Add the cheapest, most-preferred link first and the costliest fallback
last, because a send takes the first rung that accepts it. The transport
is consumed.
def
connect(self, /):
Connects every rung, so a send can be tried against each in turn.
A rung that will not connect is left in the ladder: it may come back, and
a send simply falls through it until it does.
def
send(self, /, topic, payload):
Sends a payload, falling through the rungs and buffering if none take it.
Returns "Sent" or "Buffered". Buffering is a success, not a failure:
it is what the ladder exists to do.
def
flush(self, /):
Replays the buffer over the rungs, oldest message first, and reports how
many went out.
def
buffered(self, /):
How many messages are waiting in the buffer.
class
LoopbackBroker:
An in-process broker.
Every transport built from one broker shares its traffic, so a message one
publishes reaches the others that subscribed to the topic.
def
link(self, /):
Creates a link to this broker, for driving directly.
def
rung(self, /):
Creates a link to this broker as a transport, for composing into a ladder
or a wrapper.
class
LoopbackTransport:
One in-process link to a broker.
def
connect(self, /):
Marks this link connected so it will carry traffic.
def
send(self, /, topic, payload):
Publishes a payload to a topic on the broker.
def
subscribe(self, /, topic):
Subscribes this link to a topic.
def
recv(self, /):
Waits for the next message on a subscribed topic, or None once closed.
def
is_connected(self, /):
Whether this link is connected.
def
disconnect(self, /):
Marks this link disconnected, so sends over it fail.
class
LoraBeacon:
The Class B beacon settings of a plan.
frequency_hz
The frequency the beacon is broadcast on, in hertz.
data_rate
The data rate the beacon is broadcast at.
ping_slot_frequency_hz
The default ping-slot frequency, in hertz.
class
LoraChannelBlock:
A run of evenly spaced channels.
max_data_rate
The fastest data rate the block allows.
count
How many channels the block holds.
start_hz
The first channel's centre frequency in hertz.
step_hz
The spacing between channels in hertz.
min_data_rate
The slowest data rate the block allows.
class
LoraDataRate:
One data rate: what a number on the wire means for the radio.
Only the attributes belonging to kind are set; the rest are None.
def
lora(spreading_factor, bandwidth_hz, bitrate_bps):
Describes a rate carried by LoRa modulation.
def
fsk(bitrate_bps):
Describes a rate carried by frequency-shift keying.
def
lr_fhss( coding_rate_numerator, coding_rate_denominator, bandwidth_hz, bitrate_bps):
Describes a rate carried by long-range frequency-hopping spread spectrum.
def
reserved():
Describes a data-rate number the region reserves, which carries nothing.
coding_rate_denominator
The coding-rate denominator, for an LR-FHSS rate.
bandwidth_hz
The channel bandwidth in hertz, for a LoRa or LR-FHSS rate.
bitrate_bps
The payload bitrate in bits per second.
spreading_factor
The spreading factor, for a LoRa rate.
coding_rate_numerator
The coding-rate numerator, for an LR-FHSS rate.
class
LoraLink:
The radio settings of a LoRa link.
def
symbol_time_us(self, /):
The duration of one symbol on this link, in microseconds.
def
airtime_us(self, /, payload_len):
The time on air of a payload, in microseconds.
This is the channel occupancy a transmission costs, which sets both the
duty-cycle budget and most of the energy the transmission spends.
def
min_off_time_us(self, /, payload_len, duty_cycle_permille):
The minimum silence after a transmission to honor a duty-cycle limit.
The limit is in parts per thousand, so 10 is 1%. A limit of 0 forbids
transmitting at all, which comes back as None.
preamble_symbols
The preamble length in symbols; the LoRa default is 8.
spreading_factor
The spreading factor, 5 (fastest) to 12 (longest range).
bandwidth_hz
The channel bandwidth in hertz, such as 125_000.
crc
Whether the frame carries a CRC.
coding_rate_denominator
The coding-rate denominator, 5 to 8, for 4/5 to 4/8.
class
LoraMaxPayload:
What one data rate may carry in a single frame.
mac_payload
The largest MAC payload, frame options included, in bytes.
application
The largest application payload, in bytes.
class
LoraPlanInfo:
The scalar facts of a plan, read in one call.
beacon
The Class B beacon settings.
tx_power_step_db
The step between transmit-power settings, in dB.
max_tx_power_index
The highest transmit-power index the plan defines.
downlink_data_rate_count
How many downlink data-rate numbers the plan defines.
name
The specification's name for the band, such as EU863-870.
uplink_data_rate_count
How many uplink data-rate numbers the plan defines, reserved included.
has_dwell_time_limit
Whether the plan limits how long one transmission may hold a channel.
default_max_eirp_dbm
The power ceiling assumed when no sub-band says otherwise, in dBm.
rx2_data_rate
The data rate the second receive window listens at.
has_dwell_limited_payloads
Whether the plan publishes a payload table for a dwell-limited device.
default_channel_block_count
How many default channel blocks the plan defines.
default_channel_count
How many channels the plan starts a device with.
rx2_frequency_hz
The frequency the second receive window listens on, in hertz.
max_rx1_data_rate_offset
The highest RX1 data-rate offset the plan allows.
has_dwell_limited_rx1
Whether the plan publishes a second RX1 mapping for a dwell-limited
downlink.
sub_band_count
How many sub-bands the plan defines.
join_channel_block_count
How many join channel blocks the plan defines.
class
LoraSubBand:
A slice of a band with its own transmit limits.
max_eirp_dbm
The power ceiling in dBm EIRP.
start_hz
The first frequency in the sub-band, in hertz.
duty_cycle_permille
The share of time a transmitter may hold the channel, in parts per
thousand, so 10 is one percent and 1000 is unrestricted.
end_hz
The last frequency in the sub-band, in hertz.
class
LorawanDevice:
The root credentials over-the-air activation is built on.
def
join_request(self, /, dev_nonce):
Builds the join request this device broadcasts to activate.
dev_nonce must never repeat for a device, since the network rejects a
replayed one.
def
accept_join(self, /, bytes, dev_nonce):
Turns the join accept a network sent into the settings it grants.
dev_nonce is the nonce the matching join request carried.
class
LorawanGrant:
What a network grants a device that joined.
def
accept(self, /, app_key, dev_nonce):
Builds the signed join-accept to transmit.
def
session(self, /, app_key, dev_nonce):
Derives the session this grant activates, the same one the device computes.
net_id
The network identifier this grant carries.
dev_addr
The address this grant assigns.
class
LorawanJoinAccept:
An accepted join: the network settings, and the session it grants.
def
session(self, /):
The activated session this join grants, with its keys already derived.
dev_addr
The device address the network assigned.
net_id
The identifier of the network that accepted the join.
dl_settings
The downlink settings byte, carrying the second receive window data rate
and the first window offset.
rx_delay
The delay before the first receive window, in seconds.
class
LorawanJoinRequest:
A join-request a device broadcast, with its integrity already verified.
dev_nonce
The nonce the request carried, which a network must not accept twice.
dev_eui
The device identifier, most-significant byte first.
app_eui
The application identifier, most-significant byte first.
class
LorawanRxData:
A decoded data frame, with its payload decrypted.
dev_addr
The device address the frame carries.
ack
Whether the frame acknowledges the last confirmed one.
direction
The direction the frame travelled: Uplink or Downlink.
fopts
The MAC commands the header carried.
confirmed
Whether the frame asks to be acknowledged.
fcnt
The low 16 bits of the frame counter.
adr
Whether the frame takes part in adaptive data rate.
fport
The port the frame was sent on, or None when it carries only options.
payload
The decrypted application payload.
fpending
Whether the network has more downlink data waiting.
class
LorawanSession:
An activated LoRaWAN session: a device address and its two session keys.
def
encode_uplink( self, /, fcnt, fport, payload, confirmed=False, adr=False, ack=False, fopts=None):
Encodes an uplink, encrypting the payload and appending the MIC.
def
encode_downlink( self, /, fcnt, fport, payload, confirmed=False, adr=False, ack=False, fpending=False, fopts=None):
Encodes a downlink, encrypting the payload and appending the MIC.
def
decode(self, /, bytes, fcnt):
Verifies a received frame, then decrypts it.
fcnt is the full 32-bit counter expected for this frame; its low 16 bits
must match the counter the frame carries.
dev_addr
The device address this session is bound to.
class
Manifest:
What a release says about itself, and what a device checks it against.
digest
The SHA-256 of the payload, which every other guarantee rests on.
size
The payload length in bytes, known before a single byte is accepted.
sequence
Rises with every release, which is what stops an older image being
replayed at a device.
storage
Which slot the payload belongs in.
structure_version
Which iteration of the manifest format this is.
expires
When this release stops being offered, in seconds since the Unix epoch,
or 0 to never expire.
vendor_id
Who built the image, as 16 bytes.
class_id
Which kind of device it is for, as 16 bytes.
class
MavlinkFieldInfo:
One field of a message shape.
name
The field name as the dialect writes it, such as custom_mode.
offset
The field's byte offset within the payload.
type_name
The field's type name as the dialect writes it, such as uint32_t.
array_len
The element count for an array field, or 0 for a scalar.
extension
Whether this is a MAVLink 2 extension field.
field_type
The field's type, one of the FieldType values.
class
MavlinkFrame:
One MAVLink frame, assembled or received.
def
encode_v2(header, msgid, payload, crc_extra):
Assembles a v2 frame carrying a message.
This is the current wire format and what a modern autopilot expects.
def
encode_v1(header, msgid, payload, crc_extra):
Assembles a v1 frame, for a peer that predates MAVLink 2.
A v1 frame only carries message ids below 256.
def
parse(data, crc_extra):
Parses one frame, checking it against a known CRC_EXTRA.
Raises ValueError if the bytes are not a whole frame or the checksum
does not match, which is what rejects a frame mangled in transit.
def
parse_known(data, dialect=None):
Parses one frame, looking its CRC_EXTRA up as it goes.
This is what a receiver holding many message types uses: the id comes out
of the frame, and the seed comes from the dialect or the common registry.
def
raw(header, msgid, crc_extra, payload):
Assembles a v2 frame carrying a message this build does not type.
The escape hatch a private dialect needs: supply the id, the payload, and
the seed, and the frame is built and checked like any other.
message_id
The id of the message the frame carries.
signature
The signature block, or None when the frame is not signed.
version
Which wire format this frame uses: 1 or 2.
incompat_flags
The incompatibility flags a v2 frame declares.
payload
The message payload.
A v2 frame drops trailing zero bytes, so a payload can arrive shorter
than the message's full length; a decoder zero-extends it.
signed
Whether the frame carries a signature.
This says only that the frame was signed, not that the signature is good;
a MavlinkVerifier decides that.
bytes
The whole frame, ready to put on the wire.
class
MavlinkMessage:
A message read and written by field name against a schema.
def
empty(schema):
Creates a message with every field zero.
Raises ValueError if the shape does not fit a MAVLink payload.
def
decode(schema, payload):
Reads a message out of a frame payload.
A payload shorter than the shape is zero-extended, as MAVLink 2
truncation requires, so a frame from a peer that trimmed trailing zeros or
predates an extension field still decodes. Raises ValueError if the
payload is longer than the shape describes.
def
to_frame(self, /, header):
Builds a v2 frame carrying this message.
Raises ValueError if the message does not fit a frame.
def
get(self, /, field, index=0):
Reads a field as a number.
Every field reads this way. An integer field wider than 53 bits can exceed
what a float holds exactly; read those with get_int where the exact value
matters.
def
get_int(self, /, field, index=0):
Reads an integer field exactly, whatever its width or sign.
def
set(self, /, field, value, index=0):
Writes a number into a field, converting it to the field's type.
A value bound for an integer field must be a whole number within that
field's range, so a fractional or oversized value is refused rather than
silently truncated.
def
set_int(self, /, field, value, index=0):
Writes an integer into a field exactly, whatever its width or sign.
def
get_bytes(self, /, field):
Copies the raw bytes of a byte-wide array field out, padding included.
def
set_bytes(self, /, field, data):
Writes the raw bytes of a byte-wide array field, zero-padding the rest.
def
get_text(self, /, field):
Reads a char array as text, stopping at the padding.
def
set_text(self, /, field, text):
Writes text into a char array, padding the rest with zeros.
name
The name of the message this carries.
message_id
The id of the message this carries.
payload
The message's bytes as they go on the wire.
class
MavlinkParser:
A streaming frame parser, and the frames it has completed.
def
push(self, /, data, dialect=None):
Feeds bytes off a link and returns the frames that completed.
Whatever a serial port or socket delivers can be pushed as it arrives,
however it is split. Noise between frames is skipped rather than
reported, which is what lets a parser join a stream already in progress.
def
feed(self, /, data, dialect=None):
Feeds bytes and queues what completed, for a caller that drains later.
def
next_frame(self, /):
Takes the next queued frame, or None when the parser needs more bytes.
pending
How many completed frames are waiting to be taken.
class
MavlinkSigner:
A signing key and the monotonic timestamp that goes with it.
def
sign(self, /, header, msgid, payload, crc_extra):
Signs a message into a v2 frame.
Each call advances the timestamp, which is what makes a replayed frame
detectable.
link_id
Which link this signer signs on.
class
MavlinkVerifier:
A signing key and the timestamps it has already accepted.
def
set_window(self, /, window):
Sets how far a timestamp may run ahead of the last one accepted.
A wider window tolerates a noisier link; a narrower one narrows the
chance of a replay landing inside it.
def
verify(self, /, frame):
Checks a frame's signature and its place in the timestamp sequence.
Raises ValueError when the frame is unsigned, the signature does not
match the key, or the timestamp has been seen before.
class
MeshFrame:
A mesh packet: its addressing, its payload, and the bytes to transmit.
dst
The address the frame is addressed to.
id
The sequence number identifying this packet from this source.
hop_limit
How many further relays the frame may take.
broadcast
Whether the frame is addressed to every node.
version
The protocol version the frame declares.
payload
The payload the frame carries.
src
The address of the node the frame came from.
bytes
The whole frame as it goes on the air.
class
Message:
A message that arrived on a subscribed topic.
CoAP and the loopback broker both hand back a topic and a payload, so one
class serves them rather than a near-identical type per transport.
topic
The topic it was published to.
class
MessageSchema:
The shape of one message: its id, name, seed, and fields.
def
for_id(msgid):
Returns the shape of a message the engine types, by id.
Raises ValueError if this build does not type that id, which is what a
builder is for.
def
for_name(name):
Returns the shape of a message the engine types, by name.
Raises ValueError if this build does not type that name.
id
The id of the message this schema describes.
wire_len
The length of the message on the wire, in bytes, extensions included.
name
The name of the message this schema describes.
fields
The fields in wire order: the base fields largest first, then extensions.
class
MessageSchemaBuilder:
Describes a message this build does not type, one field at a time.
Fields are added in the order the message definition lists them; building
puts them in wire order and derives the CRC_EXTRA seed from the result.
def
field(self, /, name, field_type, array_len=0):
Adds a base field, in the order the definition declares it.
The type is either a FieldType value or the name a dialect writes, such
as "uint32_t". Raises ValueError if it is neither, or if the shape has
already been built.
def
extension(self, /, name, field_type, array_len=0):
Adds a MAVLink 2 extension field, in the order the definition declares it.
Extensions keep their declared order, stay out of the CRC_EXTRA seed,
and read as zero from a frame sent by a peer that predates them.
def
build(self, /):
Puts the declared fields in wire order and finishes the shape.
Raises ValueError if two fields share a name, the fields do not fit a
MAVLink payload, or the shape has already been built.
class
MissionReceiver:
Requests a plan's items in order and collects them, ending with an
acknowledgement.
def
request_list(self, /, header):
Builds the MISSION_REQUEST_LIST frame that starts a download.
def
on_frame(self, /, frame, header):
Handles an incoming frame, if it is one this transfer is waiting for.
A MISSION_COUNT opens the transfer and a MISSION_ITEM_INT
advances it. Returns the step taken, or None if the frame carries a
message this transfer does not handle.
expected
The next sequence number the receiver expects.
complete
Whether every item has been received and the acknowledgement produced.
class
MissionSender:
Holds a plan and answers a receiver's requests for its items.
def
add_item(self, /, item):
Appends an item to the plan, from a MISSION_ITEM_INT payload.
The sender stamps the sequence number, target ids, and mission type onto
each item as it is handed out, so the item need only carry its content:
command, frame, position, and parameters. Build one by field name with the
MISSION_ITEM_INT schema and pass its payload.
def
count(self, /, header):
Builds the MISSION_COUNT frame that opens an upload.
def
on_frame(self, /, frame, header):
Handles an incoming frame, if it is one this transfer answers.
A MISSION_REQUEST_LIST is answered with the count, a
MISSION_REQUEST_INT (or the older MISSION_REQUEST) with the item
asked for, and a request past the end of the plan with a MISSION_ACK
reporting an invalid sequence. A MISSION_ACK from the receiver ends
the transfer. Returns None for a message this transfer does not
handle.
class
ModbusFrame:
A received Modbus RTU frame whose CRC has been verified.
def
registers(self, /):
Reads the 16-bit registers out of a read-registers reply.
def
coils(self, /, count):
Reads count coils or discrete inputs out of a read-bits reply.
exception
The exception code a device reported, or None when the frame is not an
exception response.
function_code
The function code. An exception response carries the request's code with
its high bit set, as it appeared on the wire.
address
The unit (slave) address the frame is addressed to or came from.
pdu
The protocol data unit: the function code and its data, without the
address or the CRC.
class
MqttClient:
An MQTT client transport backed by the native pamoja core.
def
connect(self, /):
Connects to the broker and starts the background event loop.
def
publish(self, /, topic, payload):
Publishes a payload to a topic.
def
subscribe(self, /, topic):
Subscribes to a topic filter.
def
recv(self, /):
Awaits the next message from any subscribed topic, or None once the
connection has ended.
def
is_connected(self, /):
Reports whether the client currently holds an active connection.
def
disconnect(self, /):
Closes the connection and stops the background event loop.
class
MqttMessage:
A message received from a subscribed topic.
topic
The topic the message was published to.
class
Opt3001Config:
An OPT3001 configuration register, field by field.
long_conversion
Whether a conversion takes 800 ms rather than 100 ms.
conversion_ready
Whether a conversion has completed since the register was last read.
range_number
The full-scale range number, 0..=11, or 12 to set the range automatically.
latched_window
Whether the INT pin latches until the configuration register is read.
overflow
Whether the last result overflowed its range.
flag_high
Whether the result went above the high limit.
mode
The mode code: 0 shutdown, 1 single shot, 2 continuous.
mask_exponent
Whether the limit registers carry a mantissa alone, without an exponent.
flag_low
Whether the result went below the low limit.
fault_count
The fault-count code, 0..=3, for one, two, four, or eight faults.
active_high
Whether the INT pin is active high.
class
PamojaError(builtins.Exception):
Raised when a pamoja operation fails.
class
Pid:
Holds a value at a setpoint by trading off present, past, and predicted error.
def
update(self, /, setpoint, measurement, dt):
Advances the controller by one step and returns the control output.
def
reset(self, /):
Clears the accumulated integral and last error.
class
Pose:
Where a robot is and which way it faces.
theta
Heading from the world x axis, in radians, positive counter-clockwise.
x
Position along the world x axis, in metres.
y
Position along the world y axis, in metres.
class
PowerPlan:
The work intervals a node uses in each mode, and where the modes change.
def
with_thresholds(self, /, saver_below, critical_below):
Returns a copy of this plan with the state-of-charge thresholds moved.
def
mode(self, /, soc):
Returns the mode this plan calls for at a state of charge, by name.
def
mode_while_charging(self, /, soc, charging):
Returns the mode, eased one step toward full duty while charging.
def
interval_for_us(self, /, mode):
Returns the work interval for a named mode, in microseconds.
def
interval_us(self, /, soc):
Returns the work interval at a state of charge, in microseconds.
critical_below
The charge below which the plan enters critical mode.
saver_below
The charge below which the plan enters saver mode.
class
PowerScheduleSpec:
How often a node samples as its battery drains, in whole seconds.
saver_below
Enter the saver cadence below this state of charge.
active_secs
Seconds between samples at a healthy charge.
saver_secs
Seconds between samples while conserving.
critical_secs
Seconds between samples when critically low.
critical_below
Enter the critical cadence below this state of charge.
class
Profile:
A named, ready-to-run node assembled from pamoja capabilities.
def
vaccine_fridge_monitor():
A cold-chain fridge monitor, which holds 5 C and flags an excursion.
def
irrigation_node():
An irrigation node, which opens a valve as soil moisture falls.
def
well_level():
A well-level monitor, which warns before a tank runs dry.
def
flood_sensor():
A flood sensor, which warns when a level rises too fast.
def
from_json(manifest):
Loads a profile from its JSON manifest.
Raises ValueError if the manifest is malformed.
def
to_json(self, /):
Serializes this profile to its JSON manifest.
def
controller(self, /):
Builds the decision logic this profile describes.
control
The control policy applied to each reading.
topic
The topic each reading is published to.
power
The sampling schedule kept as the battery drains.
name
The profile's stable, human-readable name.
class
Progress:
How much of an image has arrived.
total
The total the manifest declares.
class
PyTransport:
One transport, ready to compose into a ladder or a wrapper.
Build one with the module constructors, then hand it to whatever should own
it. A transport handed on is spent: using it afterwards raises.
def
mqtt( *, client_id, host, port, keep_alive_secs=None, capacity=None, qos=None):
Creates an MQTT transport from broker settings.
def
coap( *, host, port, bind=None, reliability=None, ack_timeout_ms=None, max_retransmits=None):
Creates a CoAP transport from endpoint settings.
def
faulty(inner, failures):
Wraps a transport so its next failures sends fail.
This is how a caller checks that a ladder falls through to its next rung,
or that a buffer fills, without unplugging anything. The wrapped
transport is consumed.
def
degraded(inner, drop_every=0, up=0, down=0):
Wraps a transport in a link that loses packets and goes down.
The wrapped transport is consumed.
is_available
Whether this transport is still holdable, or has been handed on.
class
Quantizer:
Packs float readings to a fixed precision for a metered link.
def
encode(self, /, readings):
Quantizes and delta-encodes a batch of readings.
def
decode(self, /, bytes):
Decodes a batch back into readings, to within the quantizer's precision.
class
Ramp:
Limits how fast a value may change, so a load is never slammed.
def
update(self, /, target):
Moves one step toward target and returns the new value.
def
set(self, /, value):
Forces the value without rate limiting.
class
Reaction:
What a controller decided about one reading.
alert
The alert the reading raised, or None if it crossed nothing.
actuator
The setting the output should take, or None when the profile observes
rather than controls.
class
ReceiverStep:
What one incoming frame produced for a mission receiver.
accepted
The MISSION_ITEM_INT the frame carried, if it was the one expected
next, as a message read by field name.
kind
What the receiver answered with: "request" for the next item, or
"ack" to end the transfer.
class
RecordingActuatorHandle:
An actuator that records every command instead of acting on one.
def
apply(self, /, command):
Applies a command, which is recorded rather than acted on.
def
commands(self, /):
The commands recorded so far, oldest first.
class
Replay:
A sensor that reads back a recorded series.
This is how a caller replays a real capture, so a test asks what the code
does with readings that actually happened rather than ones it invented.
class
Reporter:
Records telemetry events, ships the ones worth their bytes, and counts them
all.
def
adapt_to(self, /, cost):
Moves the threshold to match what the link now costs.
def
record(self, /, level):
Records an event at a level and reports whether it should be shipped.
The event is counted either way, so the aggregate picture survives even
when the link is too costly to carry the detail.
def
count(self, /, level):
Returns how many events have been seen at a level, shipped or not.
def
snapshot(self, /):
Takes a snapshot of the counters to ship in place of the event stream.
emitted
How many events passed the threshold and were shipped.
threshold
The level this reporter is currently shipping from.
total
How many events have been seen across every level.
dropped
How many events the threshold dropped.
class
Route:
A learned way to reach one node.
next_hop
The neighbour to send a packet to on the way there.
dst
The node this route reaches.
cost
What the route costs, usually in hops.
class
Router:
One node routing table, learned from the traffic the node hears.
def
observe(self, /, origin, via, cost):
Learns a route from a packet that arrived, reporting whether it changed
the table.
def
next_hop(self, /, dst):
The neighbour to send a packet to on the way to dst, or None.
def
cost(self, /, dst):
What the known route to dst costs, or None when none is known.
def
route(self, /, dst):
The whole route to dst, or None when none is known.
def
forward(self, /, dst):
Decides what to do with a packet bound for dst.
def
forget(self, /, dst):
Forgets the route to dst, for example after it stops answering.
capacity
How many routes the table can hold.
address
The address this router answers for.
class
Scd4xMeasurement:
A decoded SCD4x measurement frame.
milli_celsius
The temperature in milli-degrees Celsius, exact in integer arithmetic.
celsius
The temperature in degrees Celsius.
humidity_milli_percent
The relative humidity in milli-percent.
relative_humidity_percent
The relative humidity as a percentage.
co2_ppm
The carbon dioxide concentration in parts per million.
temperature_raw
The raw temperature word.
class
SealedMessage:
A message that has been sealed, with the header that travels beside it.
tag
The tag over the ciphertext and its associated data.
counter
The counter naming this message within the session.
class
SeenPackets:
A memory of recently seen packets, so a node relays each one only once.
def
contains(self, /, src, id):
Reports whether a packet is currently remembered, without recording it.
def
record(self, /, src, id):
Records a packet and reports whether it was new.
A true answer is when a node should act on the packet and relay it; a
false one means another copy already arrived by a different path.
capacity
How many packets this cache remembers.
class
SenderStep:
What one incoming frame produced for a mission sender.
kind
What happened: "reply" when there is a frame to send, or
"finished" when the receiver acknowledged the transfer.
result
The receiver's MAV_MISSION_RESULT, when the transfer finished.
reply
The frame to send back, when there is one.
class
Session:
A confidential, tamper-evident, replay-protected channel with one peer.
def
seal(self, /, plaintext, aad=Ellipsis):
Seals a message for the peer.
The associated data is authenticated but not encrypted, so it stays
readable on the wire yet cannot be altered: a device identifier or a
routing header belongs there.
def
open(self, /, sealed, aad=Ellipsis):
Opens a message from the peer, returning the plaintext.
Raises if the counter repeats or is older than the replay window still
tracks, and if the tag does not authenticate. Nothing readable is ever
returned from a message that failed either check.
class
Sht3xMeasurement:
A decoded SHT3x temperature and humidity pair.
temperature_raw
The raw temperature word.
milli_celsius
The temperature in milli-degrees Celsius, exact in integer arithmetic.
celsius
The temperature in degrees Celsius.
relative_humidity
The relative humidity as a percentage.
fahrenheit
The temperature in degrees Fahrenheit.
milli_percent
The relative humidity in milli-percent.
milli_fahrenheit
The temperature in milli-degrees Fahrenheit.
class
Sht3xStatus:
A decoded SHT3x status register.
bits
The 16-bit status word the flags were read from.
temperature_tracking_alert
Whether a temperature tracking alert is set.
command_failed
Whether the last command could not be processed.
alert_pending
Whether at least one alert condition is pending.
reset_detected
Whether the part has reset since the flag was last cleared.
write_checksum_failed
Whether the last write failed its checksum.
heater_on
Whether the on-die heater is running.
humidity_tracking_alert
Whether a humidity tracking alert is set.
class
Signals:
The eight data bytes of a J1939 frame, addressed by the signals inside them.
A parameter group places each signal at a fixed byte offset, little-endian. A
payload starts with every signal marked not available, so a controller writes
only the signals it actually reports.
def
from_bytes(bytes):
Reads the eight data bytes of a frame that arrived off the bus.
def
set_u8(self, /, at, value):
Writes a one-byte signal at the offset its parameter group defines.
def
set_u16(self, /, at, value):
Writes a two-byte little-endian signal at the offset its group defines.
def
u8(self, /, at):
Reads a one-byte signal, or None if the offset is past the payload.
def
u16(self, /, at):
Reads a two-byte little-endian signal, or None if it would run past the
payload.
bytes
The eight data bytes, ready to put in a frame.
class
SimulatedRobot:
A robot that moves only in arithmetic.
def
apply(self, /, *, vx=0.0, vy=0.0, omega=0.0):
Drives the robot for one time step.
def
pose(self, /):
Where the robot has got to.
class
SimulatedSensor:
A sensor that invents plausible readings.
class
SlipDecoder:
Reassembles whole SLIP frames from the chunks a serial port delivers.
def
feed(self, /, chunk):
Feeds a chunk of the stream and returns every frame it completed.
def
reset(self, /):
Discards any partly assembled frame.
discarded
How many corrupt frames this decoder has discarded.
class
SlotRecord:
The record a device keeps about one slot, durable across a reboot.
size
The length of the image in bytes.
written
How many bytes have been stored, which is where a resumed transfer picks
up.
state
The state of the slot, by name.
sequence
The sequence number of the image in the slot.
class
Smoother:
Smooths a noisy reading by weighting each new sample against the running value.
def
update(self, /, sample):
Folds a sample in and returns the smoothed value.
def
reset(self, /):
Clears the smoother back to its initial state.
value
The current value, or None before the first sample.
class
Snapshot:
A count of everything a reporter has seen, cheap enough to ship anywhere.
trace
How many events were seen at trace level.
debug
How many events were seen at debug level.
warn
How many events were seen at warn level.
error
How many events were seen at error level.
info
How many events were seen at info level.
emitted
How many events passed the filter and were shipped.
dropped
How many events the filter dropped.
class
SpiClock:
The clock polarity and phase pair an SPI mode number names.
cpha
Whether data is sampled on the trailing edge (CPHA = 1), which is modes 1 and 3.
cpol
Whether the clock idles high (CPOL = 1), which is modes 2 and 3.
class
Stepper:
A stepper motor's place in its drive sequence, and how far it has turned.
def
step(self, /, direction):
Advances one step and returns the four-bit coil pattern to apply.
The most significant of the four bits is the first coil.
coils
The coil pattern currently held, without advancing.
steps
How many steps have been taken, signed by direction.
class
Store:
A store-and-forward buffer.
Handing a store to a ladder consumes it, because the ladder owns it from then
on. A consumed store is emptied rather than left aliasing what now belongs to
the ladder, so using one twice raises.
def
memory(capacity=0):
Creates a buffer held in memory.
A full store refuses the next append rather than dropping anything, so a
record is never lost without the caller being told.
def
file(dir):
Opens a buffer backed by a directory, so it survives a restart.
def
append(self, /, record):
Adds a record to the end of the buffer.
def
peek(self, /):
Reads the oldest record without removing it, or None when empty.
def
pop(self, /):
Removes and returns the oldest record, or None when empty.
def
len(self, /):
How many records the buffer holds.
is_available
Whether this store is still holdable, or has been given to a ladder.
class
Surge:
Notices a step change between successive readings, such as a burst pipe.
def
rising(limit):
Creates a detector for rises of at least limit between readings.
def
falling(limit):
Creates a detector for falls of at least limit between readings.
def
update(self, /, value):
Feeds a value in and returns the size of a qualifying step, or None.
class
Thermostat:
Switches a load on and off around a setpoint, with hysteresis to stop chatter.
def
cooling(setpoint, hysteresis):
Creates a cooling thermostat, which switches on when the reading rises.
def
heating(setpoint, hysteresis):
Creates a heating thermostat, which switches on when the reading falls.
def
update(self, /, reading):
Feeds a reading in and returns whether the load should be on.
is_on
Whether the load should currently be on.
class
Tmp117Config:
A TMP117 configuration register, field by field.
low_alert
Whether a result went below the low limit.
alert_pin_data_ready
Whether the ALERT pin reflects data ready rather than the alert flags.
averaging
The averaging code, 0..=3.
eeprom_busy
Whether an EEPROM write is still in progress.
alert_active_high
Whether the ALERT pin is active high.
cycle
The conversion-cycle code, 0..=7.
data_ready
Whether a conversion has completed since the register was last read.
high_alert
Whether a result went above the high limit.
therm_mode
Whether the limits act as a therm hysteresis band rather than as alerts.
soft_reset
Whether writing this triggers a software reset.
mode
The conversion-mode code: 0 continuous, 1 shutdown, 3 one-shot.
class
Trend:
Fits a line through recent readings, so a slow drift shows before it matters.
def
push(self, /, reading):
slope
The fitted slope in units per reading, or None without enough readings.
class
Updater:
A device slots, and the rules applied to what is offered for them.
def
slot_record(self, /, slot):
Reads what the device believes about one slot.
def
provision(self, /, slot, sequence):
Records that a slot already holds a confirmed image at a sequence number.
This is how a device that shipped with firmware says what it is running,
so the rollback rule has something to compare against.
def
adopt(self, /, envelope, now=None):
Adopts a delegation, so releases signed by the key it names are accepted.
def
stage(self, /, envelope, image, now=None):
Checks a manifest and stages an image that is already held whole,
returning the slot it went into.
def
begin(self, /, envelope, now=None):
Checks a manifest and opens the slot it names for a transfer in pieces.
Every check that can be made without the image runs here, so a release
that is not for this device, would roll it back, or does not fit is
refused before a byte of it is accepted. The envelope is remembered until
finish, and each call after this one reopens the transfer from what the
slot records, which is the same path a device takes after a reset.
def
write(self, /, chunk):
Takes the next piece of an image opened with begin.
def
progress(self, /):
Reports how much of an opened image has arrived.
def
finish(self, /):
Finishes an opened image and marks the slot bootable if it matched,
returning the slot now holding it.
def
on_boot(self, /):
Decides what to run, and records that decision before returning it.
Call this once per boot, before jumping to an image. A staged image
becomes pending here, so a device that resets before confirming reverts
on the next call rather than trying a broken image forever.
def
confirm(self, /):
Confirms the pending image, so it will be run from now on.
def
revert(self, /):
Fails the pending image and goes back to the confirmed one.
slot_count
How many slots this device has.
installed_sequence
The highest sequence number the device already holds.
delegation
The delegation this updater currently honours, or None when releases
must be signed by the anchor itself.
class
Window:
A rolling window of the most recent readings, with the stats over them.
def
push(self, /, reading):
Adds a reading, dropping the oldest once the window is full.
def
mean(self, /):
The mean of the readings, or None while the window is empty.
def
min(self, /):
The smallest reading, or None while the window is empty.
def
max(self, /):
The largest reading, or None while the window is empty.
def
range(self, /):
The spread between the smallest and largest readings.
def
variance(self, /):
The variance of the readings, or None without enough of them.
capacity
How many readings the window holds before it starts dropping.
def
ads1115_config_bits(config):
Assembles the 16-bit ADS1115 configuration register value.
def
ads1115_config_from_bits(bits):
Parses a 16-bit ADS1115 configuration register value.
def
ads1115_full_scale_microvolts(pga):
Returns the full-scale range an ADS1115 gain code selects, in microvolts.
def
ads1115_samples_per_second(data_rate):
Returns the sample rate an ADS1115 data-rate code selects.
def
ads1115_to_nanovolts(pga, raw):
Converts a raw ADS1115 conversion result to nanovolts.
def
ads1115_to_volts(pga, raw):
Converts a raw ADS1115 conversion result to volts.
def
bearing_between(from_latitude, from_longitude, to_latitude, to_longitude):
Returns the initial bearing from one coordinate to another, in degrees.
def
bmp280_config_bits(config):
Packs a BMP280 config register value.
def
bmp280_config_from_bits(bits):
Parses a BMP280 config register value.
def
bmp280_ctrl_meas_bits(ctrl):
Packs a BMP280 ctrl_meas register value.
def
bmp280_ctrl_meas_from_bits(bits):
Parses a BMP280 ctrl_meas register value.
def
bmp280_image_updating(status):
Reports whether a BMP280 status byte says the calibration image is loading.
def
bmp280_measurement_bytes(pressure, temperature):
Builds the six data bytes a BMP280 holding these codes would return.
def
bmp280_measuring(status):
Reports whether a BMP280 status byte says a conversion is running.
def
bmp280_oversampling_factor(code):
Returns how many samples a BMP280 oversampling code averages.
def
bmp280_parse_measurement(data):
Unpacks the six data bytes a BMP280 burst read returns.
def
bmp280_pressure_skipped(pressure):
Reports whether a raw BMP280 pressure says the measurement is switched off.
def
bmp280_standby_micros(code):
Returns the normal-mode standby period a BMP280 code selects, in microseconds.
def
bmp280_temperature_skipped(temperature):
Reports whether a raw BMP280 temperature says the measurement is switched off.
def
can_dlc_to_len(dlc):
Returns the payload length a data length code encodes.
def
can_fd_frame(id, extended, data):
Builds a CAN-FD frame, which carries up to 64 bytes at the discrete CAN-FD lengths.
def
can_frame(id, extended, data):
Builds a classic CAN 2.0 frame, which carries up to eight bytes.
def
can_len_to_dlc(len):
Returns the data length code that encodes a payload length.
def
can_remote_frame(id, extended, len):
Builds a remote transmission request, which asks another node to send.
def
cbor_to_json_bytes(cbor):
Converts a CBOR document back into its JSON encoding.
def
cobs_decode(frame):
Reads the payload back out of a COBS frame.
def
cobs_encode(payload):
Frames a payload as a COBS packet, terminated by its zero delimiter.
def
cobs_max_encoded_len(payload_len):
Returns the largest COBS frame a payload of this length can produce.
def
deadband(value, center, width):
Suppresses movement within width of center, so noise does not act.
def
decode_delta_samples(bytes):
Decodes a delta-encoded buffer back into its integer samples.
def
decode_manifest(data):
Reads a manifest body back from its bytes.
This reads what a manifest claims; it proves nothing about who wrote it. Use
verify_envelope to read one whose signature has been checked.
def
distance_between(from_latitude, from_longitude, to_latitude, to_longitude):
Returns the great-circle distance between two coordinates, in metres.
def
ds18b20_build_scratchpad(celsius, bits, alarm_high, alarm_low):
Builds the nine bytes a DS18B20 in the given state puts on the bus, CRC last.
def
ds18b20_celsius(raw):
Converts a raw DS18B20 temperature register to degrees Celsius.
def
ds18b20_config_byte(bits):
Returns the configuration byte that selects a DS18B20 resolution.
def
ds18b20_crc8(data):
Computes the Maxim CRC-8 a 1-Wire device checks its own bytes with.
def
ds18b20_max_conversion_micros(bits):
Returns how long a DS18B20 conversion may take at a resolution, in microseconds.
def
ds18b20_micro_celsius(raw):
Converts a raw DS18B20 temperature register to micro-degrees Celsius.
def
ds18b20_parse_scratchpad(data):
Parses and CRC-checks a nine-byte DS18B20 scratchpad.
def
ds18b20_resolution_bits(config_byte):
Returns the resolution a DS18B20 configuration byte selects, in bits.
def
ds18b20_step_micro_celsius(bits):
Returns the temperature step a DS18B20 resolution resolves, in micro-degrees.
def
encode_delta_samples(samples):
Delta-encodes a series of integer samples into a compact buffer.
def
encode_manifest(manifest):
Encodes the body of a manifest, which is the part a signature covers.
def
envelope_body(data):
Copies out the signed body of an envelope, without checking the signature.
This is what a gateway relays onward unchanged.
def
fingerprint(public_key):
Returns the short hex fingerprint of a public key.
def
hdc1080_celsius(raw):
Converts a raw HDC1080 temperature register to degrees Celsius.
def
hdc1080_config_from_register(raw):
Parses an HDC1080 configuration register value.
def
hdc1080_config_to_register(config):
Assembles an HDC1080 configuration register value.
def
hdc1080_conversion_time_micros(config):
Returns how long to wait after triggering an HDC1080 in this configuration.
def
hdc1080_humidity_conversion_micros(bits):
Returns how long an HDC1080 humidity conversion takes, in microseconds.
def
hdc1080_humidity_register(milli_percent):
Builds the HDC1080 humidity register that decodes to a relative humidity.
def
hdc1080_measurement_bytes(temperature_raw, humidity_raw):
Builds the four bytes an HDC1080 sends for a pair of raw registers.
def
hdc1080_measurement_from_physical(milli_celsius, milli_percent):
Builds the HDC1080 measurement a sensor reporting these physical values would send.
def
hdc1080_milli_celsius(raw):
Converts a raw HDC1080 temperature register to milli-degrees Celsius.
def
hdc1080_milli_percent(raw):
Converts a raw HDC1080 humidity register to milli-percent.
def
hdc1080_parse_measurement(data):
Parses the four bytes an HDC1080 sequential read returns.
def
hdc1080_relative_humidity(raw):
Converts a raw HDC1080 humidity register to a relative humidity percentage.
def
hdc1080_serial_id(high, mid, low):
Joins the three HDC1080 serial-ID registers into the 40-bit serial number.
def
hdc1080_serial_id_registers(serial):
Splits a serial number back into the three HDC1080 serial-ID registers.
def
hdc1080_temperature_conversion_micros(bits):
Returns how long an HDC1080 temperature conversion takes, in microseconds.
def
hdc1080_temperature_register(milli_celsius):
Builds the HDC1080 temperature register that decodes to a temperature.
def
hkdf_sha256_expand(salt, ikm, info, length):
Expands input keying material into length bytes bound to info.
def
hmac_sha256_digest(key, message):
Computes a keyed hash over a message.
This is the primitive a host uses to authenticate a pairing exchange or a
single command, where a whole session would be more than the job needs.
def
i2c_address_frame(address, ten_bit, read):
Returns the address bytes a controller puts on the bus for a transfer.
def
i2c_address_frame_len(address, ten_bit):
Returns how many bytes an address frame occupies.
def
i2c_address_is_general_call(address, ten_bit):
Reports whether an address is the general call address 0x00.
def
i2c_address_is_reserved(address, ten_bit):
Reports whether a 7-bit address falls in a range the I2C specification reserves.
def
image_digest(image):
Hashes a complete image, for a publisher filling in a manifest.
def
ina219_bus_millivolts(raw):
Converts a raw INA219 bus-voltage register to millivolts.
def
ina219_bus_register(millivolts):
Builds the INA219 bus-voltage register a monitor reports for a bus voltage.
def
ina219_calibration(current_lsb_microamps, shunt_milliohms):
Computes the INA219 calibration register for a shunt and current resolution.
def
ina219_conversion_ready(raw):
Reports whether an INA219 bus-voltage register says a conversion is ready.
def
ina219_current_microamps(raw, current_lsb_microamps):
Converts a raw INA219 current register to microamps.
def
ina219_current_register(microamps, current_lsb_microamps):
Builds the INA219 current register a monitor reports for a current.
def
ina219_math_overflow(raw):
Reports whether an INA219 bus-voltage register flags a math overflow.
def
ina219_minimum_current_lsb_microamps(max_expected_microamps):
Returns the smallest current resolution that still covers an expected maximum.
def
ina219_power_microwatts(raw, current_lsb_microamps):
Converts a raw INA219 power register to microwatts.
def
ina219_power_register(microwatts, current_lsb_microamps):
Builds the INA219 power register a monitor reports for a power.
def
ina219_shunt_microvolts(raw):
Converts a raw INA219 shunt-voltage register to microvolts.
def
ina219_shunt_register(microvolts):
Builds the INA219 shunt-voltage register a monitor reports for a shunt voltage.
def
ina226_active_alert_function(mask):
Returns the alert function an INA226 pin actually responds to.
def
ina226_address(a1, a0):
Returns the I2C address an INA226's A1 and A0 pin codes select.
def
ina226_averaging_samples(code):
Returns how many samples an INA226 averaging code folds into one result.
def
ina226_bus_microvolts(raw):
Converts a raw INA226 bus-voltage register to microvolts.
def
ina226_bus_register(microvolts):
Builds the INA226 bus-voltage register a monitor reports for a bus voltage.
def
ina226_bus_volts(raw):
Converts a raw INA226 bus-voltage register to volts.
def
ina226_calibration(current_lsb_microamps, shunt_milliohms):
Computes the INA226 calibration register for a shunt and current resolution.
def
ina226_config_from_register(raw):
Parses an INA226 configuration register value.
def
ina226_config_to_register(config):
Assembles an INA226 configuration register value.
def
ina226_conversion_micros(code):
Returns the conversion time an INA226 code selects, in microseconds.
def
ina226_current_amps(raw, current_lsb_microamps):
Converts a raw INA226 current register to amps.
def
ina226_current_microamps(raw, current_lsb_microamps):
Converts a raw INA226 current register to microamps.
def
ina226_current_register(microamps, current_lsb_microamps):
Builds the INA226 current register a monitor reports for a current.
def
ina226_current_register_from_shunt(shunt, calibration):
Computes the INA226 current register the chip derives from a shunt reading.
def
ina226_die_id(raw):
Splits an INA226 die-ID register into its device and revision fields.
def
ina226_identify(manufacturer_id, die_id):
Checks that a pair of identification registers belongs to an INA226.
def
ina226_is_continuous(code):
Reports whether an INA226 mode code keeps converting after the first result.
def
ina226_mask_enable_from_register(raw):
Parses an INA226 Mask/Enable register value.
def
ina226_mask_enable_to_register(mask):
Assembles an INA226 Mask/Enable register value.
def
ina226_measures_bus(code):
Reports whether an INA226 mode code converts the bus voltage.
def
ina226_measures_shunt(code):
Reports whether an INA226 mode code converts the shunt voltage.
def
ina226_minimum_current_lsb_microamps(max_expected_microamps):
Returns the smallest current resolution that still covers an expected maximum.
def
ina226_power_microwatts(raw, current_lsb_microamps):
Converts a raw INA226 power register to microwatts.
def
ina226_power_register(microwatts, current_lsb_microamps):
Builds the INA226 power register a monitor reports for a power.
def
ina226_power_register_from_current(current, bus):
Computes the INA226 power register the chip derives from a current reading.
def
ina226_power_watts(raw, current_lsb_microamps):
Converts a raw INA226 power register to watts.
def
ina226_shunt_millivolts(raw):
Converts a raw INA226 shunt-voltage register to millivolts.
def
ina226_shunt_nanovolts(raw):
Converts a raw INA226 shunt-voltage register to nanovolts.
def
ina226_shunt_register(nanovolts):
Builds the INA226 shunt-voltage register a monitor reports for a shunt voltage.
def
ina226_update_micros(config):
Returns how often an INA226 in this configuration updates its results.
def
j1939_broadcast(priority, pgn, source):
Composes the identifier of a J1939 broadcast, which every node on the bus reads.
Most parameter groups are broadcast, so this is the common case; it saves a
caller knowing that a broadcast is addressed to 0xFF.
def
j1939_compose(priority, pgn, source, destination):
Composes the extended CAN identifier a set of J1939 fields describes.
The destination is used only for an addressed (PDU1) parameter group and
ignored for a broadcast (PDU2) one.
def
j1939_decode(id, extended):
Decodes the J1939 fields out of an extended CAN identifier.
Returns None for a standard 11-bit identifier, which J1939 does not use.
def
j1939_limits():
Returns the named values J1939 publishes.
The order is the not-available byte, the broadcast address, and the control,
default, and lowest priorities.
def
json_to_cbor_bytes(json):
Converts a JSON document into its CBOR encoding, which is typically smaller.
def
keyexpr_canonize(key):
Rewrites a key expression into its canonical form, or None if it is
malformed.
def
keyexpr_is_canon(key):
Reports whether a key expression is already in its canonical form.
def
keyexpr_is_valid(key):
Reports whether a key expression is well formed.
def
keyexpr_matches(pattern, key):
Reports whether a pattern selects a key.
def
link_cost_threshold(cost):
Returns the level a named link cost calls for.
def
lorawan_parse_join_request(bytes, app_key):
Verifies a join-request and reads the identifiers out of it.
def
mavlink_crc16_mcrf4xx(data):
Returns the CRC-16/MCRF4XX checksum of a byte string.
This is the checksum every MAVLink frame carries, exposed because a host that
implements part of the protocol itself needs the same arithmetic.
def
mavlink_known_messages():
Returns the names of every message this build types, in message-id order.
def
mavlink_offboard_global_position( header, time_boot_ms, coordinate_frame, target_system, target_component, lat_int, lon_int, alt):
Builds a global-frame position setpoint frame, with latitude and longitude
in degrees times ten million and altitude in metres.
def
mavlink_offboard_local_position( header, time_boot_ms, coordinate_frame, target_system, target_component, x, y, z):
Builds a local-frame position setpoint frame, in metres in the chosen
MAV_FRAME.
def
mavlink_offboard_local_velocity( header, time_boot_ms, coordinate_frame, target_system, target_component, vx, vy, vz):
Builds a local-frame velocity setpoint frame, in metres per second in the
chosen MAV_FRAME.
def
mavlink_offboard_type_mask(flags):
Builds a setpoint type_mask from the fields to use.
flags is a bitwise-or of the TypeMask flags; fields left out are
ignored. Returns the mask as the type_mask field of a setpoint carries it.
def
mavlink_timestamp_from_unix_micros(unix_micros):
Converts Unix time into the timestamp MAVLink signing counts in.
def
mesh_broadcast_frame(src, id, payload, hop_limit=None):
Builds a mesh frame addressed to every node.
def
mesh_crc16(data):
Computes the CRC-16 a mesh frame carries.
def
mesh_frame(src, dst, id, payload, hop_limit=None):
Builds a mesh frame addressed to one node.
def
mesh_limits():
Returns the frame, payload, and cache sizes a mesh node works within.
The order is the maximum frame length, the maximum payload, the broadcast
address, the default hop limit, the duplicate-cache capacity, and the header
length.
def
mesh_parse_frame(bytes):
Parses a frame received off a radio, rejecting anything the air mangled.
def
mesh_relayed(bytes):
Returns the same frame with one hop spent, or None once its hops run out.
def
modbus_crc16(data):
Computes the CRC-16/MODBUS that every RTU frame ends with.
def
modbus_parse_frame(data):
Parses a received RTU frame, verifying its CRC.
def
modbus_raw(address, function_code, data):
Builds a request frame from a raw function code and data.
This is the escape hatch for the function codes the SDK does not name.
def
modbus_read_coils(address, start, count):
Builds a read-coils request frame (function 0x01).
def
modbus_read_holding_registers(address, start, count):
Builds a read-holding-registers request frame (function 0x03).
def
modbus_read_holding_registers_reply(address, values):
Builds the reply a device sends to a read-holding-registers request.
def
modbus_write_multiple_coils(address, start, values):
Builds a write-multiple-coils request frame (function 0x0F).
def
modbus_write_multiple_registers(address, start, values):
Builds a write-multiple-registers request frame (function 0x10).
def
modbus_write_single_coil(address, coil, on):
Builds a write-single-coil request frame (function 0x05).
def
modbus_write_single_register(address, register, value):
Builds a write-single-register request frame (function 0x06).
def
open_delegation(data, anchor_public_key):
Opens a signed delegation against the anchor that should have signed it.
def
opt3001_config_bits(config):
Assembles the 16-bit OPT3001 configuration register value.
def
opt3001_config_from_bits(bits):
Parses a 16-bit OPT3001 configuration register value.
def
opt3001_conversion_millis(long_conversion):
Returns the conversion time an OPT3001 setting selects, in milliseconds.
def
opt3001_fault_count(code):
Returns how many consecutive faults an OPT3001 fault-count code requires.
def
opt3001_full_scale_milli_lux(range_number):
Returns the full scale an OPT3001 range number covers, in milli-lux.
def
opt3001_is_automatic_range(range_number):
Reports whether an OPT3001 range number sets the full scale automatically.
def
opt3001_lsb_milli_lux(exponent):
Returns the illuminance one count carries at an OPT3001 exponent.
def
opt3001_lux(raw):
Converts a raw OPT3001 result register to lux.
def
opt3001_milli_lux(raw):
Converts a raw OPT3001 result register to milli-lux.
def
opt3001_raw_from_milli_lux(milli_lux):
Builds the OPT3001 result register that decodes to an illuminance.
def
opt3001_word_from_bytes(data):
Reads the two bytes an OPT3001 sends for a register.
def
opt3001_word_to_bytes(word):
Builds the two bytes an OPT3001 sends for a register.
def
pca9685_channel_register(channel):
Returns the first of a PCA9685 channel's four consecutive registers.
def
pca9685_frequency_for_prescale(prescale, osc_hz):
Returns the update rate a PCA9685 prescale value produces, in hertz.
def
pca9685_limits():
Returns the PCA9685 constants a caller sizes its arithmetic against.
The tuple is the internal oscillator frequency in hertz, the channel count,
and the counts per period.
def
pca9685_prescale_for_frequency(update_rate_hz, osc_hz):
Returns the prescale value that sets a PCA9685 update rate.
def
pin_edge_triggered_by(edge, before, after):
Reports whether a change from one level to another fires an interrupt trigger.
def
pin_level_from_bool(high):
Returns the level a boolean names, as "Low" or "High".
def
pin_level_inverted(level):
Returns the opposite level, as "Low" or "High".
def
pin_polarity_is_asserted(polarity, level):
Reports whether a physical level means the signal is asserted.
def
pin_polarity_level(polarity, asserted):
Returns the physical level that represents a logical state under a polarity.
def
pwm_counts(data):
Reads a PCA9685 setting back from the four register bytes a channel holds.
def
pwm_duty(off):
Builds a channel's register bytes with no phase delay: on at 0, off at off.
def
pwm_from_counts(on, off):
Builds a channel's four register bytes from explicit on and off counts.
def
pwm_full_off():
The register bytes that hold a channel continuously low, the power-on state.
def
pwm_full_on():
The register bytes that hold a channel continuously high.
def
pwm_servo(pulse_micros, update_rate_hz):
Builds the register bytes that drive a hobby servo to a given pulse width.
def
ros2_dds_topic(fqn, kind):
Returns the DDS topic a fully qualified name maps onto, or None if the
name is not fully qualified.
def
ros2_dds_type_name(ros_type):
Returns the DDS type name an interface type maps onto, or None if the type
is not a valid package/namespace/Type.
def
ros2_entity_key(domain_id, fqn, ros_type, type_hash):
Builds the Zenoh key an rmw_zenoh peer publishes an entity on, or None
if the name, type, or hash is not usable.
def
ros2_entity_kind_prefix(kind):
Returns the DDS topic prefix a subsystem uses.
def
ros2_is_fully_qualified(name):
Reports whether a name is fully qualified, so it resolves with no namespace.
def
ros2_is_valid_name(name):
Reports whether a string is a valid ROS 2 topic or service name.
def
ros2_percent_mangle(name):
Percent-mangles a name the way a DDS partition requires.
def
ros2_twist_from_cdr(data):
Decodes a twist from its CDR representation, or None if the bytes are not
a well-formed twist.
Returns the linear and angular velocities as two (x, y, z) triples.
def
ros2_twist_to_cdr(linear, angular):
Encodes a twist into its CDR representation.
The linear and angular velocities each cross as an (x, y, z) triple.
def
ros2_type_hash_digest(text):
Returns the 32-byte digest a RIHS01 hash string carries, or None if the
string is malformed.
def
routing_default_capacity():
Returns a routing table size for a caller with no reason to choose one.
def
scd4x_allowed_during_measurement(command):
Reports whether an SCD4x accepts a command while it is measuring.
def
scd4x_ambient_pressure_pascals(word):
Converts an SCD4x ambient-pressure word back to pascals.
def
scd4x_ambient_pressure_word(pascals):
Builds the SCD4x word that programs an ambient pressure.
def
scd4x_automatic_self_calibration_enabled(word):
Reports whether an SCD4x word says automatic self-calibration is on.
def
scd4x_automatic_self_calibration_word(enabled):
Builds the SCD4x word that turns automatic self-calibration on or off.
def
scd4x_celsius(raw):
Converts a raw SCD4x temperature word to degrees Celsius.
def
scd4x_command_frame(command):
Builds the two bytes that send a bare SCD4x command.
def
scd4x_crc(data):
Computes the CRC-8 an SCD4x appends to every data word.
def
scd4x_data_ready(word):
Reports whether an SCD4x data-ready word says a measurement is waiting.
def
scd4x_forced_recalibration_correction_ppm(word):
Reads the correction an SCD4x reports after a forced recalibration.
def
scd4x_forced_recalibration_word(correction_ppm=None):
Builds the word an SCD4x returns for a forced-recalibration outcome.
def
scd4x_humidity_milli_percent(raw):
Converts a raw SCD4x humidity word to milli-percent.
def
scd4x_humidity_raw(milli_percent):
Builds the SCD4x humidity word that decodes to a relative humidity.
def
scd4x_max_duration_ms(command):
Returns how long an SCD4x command may take, in milliseconds.
def
scd4x_measurement_bytes(co2_ppm, temperature_raw, humidity_raw):
Builds the nine bytes an SCD4x sends for a set of raw words.
def
scd4x_measurement_from_physical(co2_ppm, milli_celsius, humidity_milli_percent):
Builds the SCD4x measurement a sensor reporting these physical values would send.
def
scd4x_milli_celsius(raw):
Converts a raw SCD4x temperature word to milli-degrees Celsius.
def
scd4x_parse_measurement(frame):
Parses and CRC-checks a nine-byte SCD4x measurement frame.
def
scd4x_relative_humidity_percent(raw):
Converts a raw SCD4x humidity word to a relative humidity percentage.
def
scd4x_self_test_passed(word):
Reports whether an SCD4x self-test word says the part passed.
def
scd4x_serial_number(frame):
Reads a CRC-checked nine-byte SCD4x serial-number frame.
def
scd4x_serial_number_frame(serial):
Builds the nine bytes an SCD4x sends for a serial number.
def
scd4x_temperature_offset_milli_celsius(word):
Converts an SCD4x temperature-offset word back to milli-degrees Celsius.
def
scd4x_temperature_offset_word(milli_celsius):
Builds the SCD4x word that programs a temperature offset.
def
scd4x_temperature_raw(milli_celsius):
Builds the SCD4x temperature word that decodes to a temperature.
def
scd4x_word(frame):
Reads a CRC-checked three-byte SCD4x word frame.
def
scd4x_word_frame(value):
Builds the three bytes an SCD4x sends for a word: the word then its CRC.
def
scd4x_write_frame(command, value):
Builds the five bytes that send an SCD4x command with an argument.
def
serial_framing_bytes():
Returns the reserved framing bytes: SLIP end, escape, the two escape codes, and
the COBS delimiter.
def
sht3x_celsius(raw):
Converts a raw SHT3x temperature word to degrees Celsius.
def
sht3x_crc(data):
Computes the CRC-8 an SHT3x appends to every data word.
def
sht3x_fahrenheit(raw):
Converts a raw SHT3x temperature word to degrees Fahrenheit.
def
sht3x_humidity_raw_from_milli_percent(milli_percent):
Builds the SHT3x humidity word that decodes to a relative humidity.
def
sht3x_humidity_raw_from_relative_humidity(percent):
Builds the SHT3x humidity word that decodes to a relative humidity percentage.
def
sht3x_interval_micros(rate):
Returns the gap between SHT3x periodic measurements, in microseconds.
def
sht3x_max_measurement_micros(repeatability):
Returns how long an SHT3x measurement may take, in microseconds.
def
sht3x_measurement_bytes(temperature_raw, humidity_raw):
Builds the six bytes an SHT3x sends for a pair of raw words.
def
sht3x_milli_celsius(raw):
Converts a raw SHT3x temperature word to milli-degrees Celsius.
def
sht3x_milli_fahrenheit(raw):
Converts a raw SHT3x temperature word to milli-degrees Fahrenheit.
def
sht3x_milli_percent(raw):
Converts a raw SHT3x humidity word to milli-percent.
def
sht3x_parse_measurement(frame):
Parses and CRC-checks a six-byte SHT3x measurement frame.
def
sht3x_parse_status(frame):
Parses and CRC-checks a three-byte SHT3x status frame.
def
sht3x_periodic(repeatability, rate):
Returns the SHT3x periodic-mode command for a repeatability and rate.
def
sht3x_relative_humidity(raw):
Converts a raw SHT3x humidity word to a relative humidity percentage.
def
sht3x_single_shot(repeatability, clock_stretching):
Returns the SHT3x single-shot command for a repeatability and clock mode.
def
sht3x_status_bytes(bits):
Builds the three bytes an SHT3x sends for a status word, CRC last.
def
sht3x_status_from_bits(bits):
Splits an SHT3x status word into its flags.
def
sht3x_temperature_raw_from_celsius(celsius):
Builds the SHT3x temperature word that decodes to a temperature in Celsius.
def
sht3x_temperature_raw_from_milli_celsius(milli_celsius):
Builds the SHT3x temperature word that decodes to a temperature.
def
sht3x_temperature_raw_from_milli_fahrenheit(milli_fahrenheit):
Builds the SHT3x temperature word that decodes to a temperature in Fahrenheit.
def
sht3x_typical_measurement_micros(repeatability):
Returns how long an SHT3x measurement typically takes, in microseconds.
def
sht3x_word(frame):
Reads a CRC-checked three-byte SHT3x word frame.
def
sht3x_word_bytes(value):
Builds the three bytes an SHT3x sends for a word: the word then its CRC.
def
sign_delegation(delegation, anchor):
Signs a delegation, naming a release key the anchor stands behind.
def
sign_manifest(manifest, author):
Signs a manifest into the envelope that is offered to a device.
def
slip_decode(frame):
Reads the payload back out of a SLIP frame.
def
slip_encode(payload):
Frames a payload as a SLIP packet (RFC 1055).
def
slip_max_encoded_len(payload_len):
Returns the largest SLIP frame a payload of this length can produce.
def
spi_mode_clock(mode):
Returns the (CPOL, CPHA) pair an SPI mode number names.
def
spi_mode_from_clock(cpol, cpha):
Returns the SPI mode number a (CPOL, CPHA) pair names.
def
stepper_step_count(drive):
Returns how many steps make up one electrical cycle of a drive pattern.
def
stepper_steps_for_degrees(degrees, steps_per_revolution):
Returns how many steps a rotation of degrees takes on a given motor.
def
tmp117_averaging_conversions(code):
Returns how many conversions a TMP117 averaging code folds into one result.
def
tmp117_averaging_micros(code):
Returns how long a TMP117 averaging code takes to convert, in microseconds.
def
tmp117_celsius(raw):
Converts a raw TMP117 temperature register to degrees Celsius.
def
tmp117_config_bits(config):
Assembles the 16-bit TMP117 configuration register value.
def
tmp117_config_from_bits(bits):
Parses a 16-bit TMP117 configuration register value.
def
tmp117_cycle_micros(cycle, averaging):
Returns the TMP117 result-update interval for a cycle and averaging code.
def
tmp117_cycle_nominal_micros(code):
Returns the nominal cycle a TMP117 conversion-cycle code selects, in microseconds.
def
tmp117_data_ready(config):
Reports whether a TMP117 configuration register says a result is ready.
def
tmp117_device_id(raw):
Reads the device identifier out of a TMP117 device-ID register.
def
tmp117_eeprom_busy(config):
Reports whether a TMP117 configuration register says an EEPROM write is running.
def
tmp117_eeprom_unlock_busy(unlock):
Reports whether a TMP117 EEPROM unlock register says a write is running.
def
tmp117_high_alert(config):
Reports whether a TMP117 configuration register flags a high alert.
def
tmp117_low_alert(config):
Reports whether a TMP117 configuration register flags a low alert.
def
tmp117_micro_celsius(raw):
Converts a raw TMP117 temperature register to micro-degrees Celsius.
def
tmp117_nano_celsius(raw):
Converts a raw TMP117 temperature register to nano-degrees Celsius.
def
tmp117_raw_from_celsius(celsius):
Builds the TMP117 temperature register that decodes to a temperature in Celsius.
def
tmp117_raw_from_micro_celsius(micro_celsius):
Builds the TMP117 temperature register that decodes to a temperature.
def
tmp117_revision(raw):
Reads the die revision out of a TMP117 device-ID register.
def
tmp117_temperature_bytes(raw):
Builds the two bytes a TMP117 sends for a temperature register.
def
tmp117_temperature_from_bytes(data):
Reads the two bytes a TMP117 sends for a temperature register.
def
update_structure_version():
The manifest structure version this build writes.
def
verify(public_key, payload, signature):
Verifies that a signature covers a payload and was made by a public key.
Returns False when the payload was altered or was signed by a different
device, and raises only when an argument is the wrong length.
def
verify_audit_chain(public_key, entries):
Checks a whole chain that has already arrived.
Raises with the reason if any entry fails to follow the one before it or
carries a signature that does not hold.
def
verify_envelope(data, public_key):
Verifies an envelope against a key and reads the manifest inside it.
Raises when the signature is not from that key.
def
verify_message(public_key, message):
Verifies a signed message and returns the payload it carries.
Returns None when the message is too short to hold a signature, was altered,
or was signed by a different device.
def
version():
Returns the version of the native pamoja module.
def
window_capacity():
The number of readings a windowed helper keeps.