Table of Contents

Class NativeMethods

Namespace
Pamoja.Native.Interop
Assembly
Pamoja.Native.dll

The P/Invoke declarations for the identity, codec, and helper-math capabilities of the pamoja C ABI, mirroring pamoja.h one-to-one.

public static class NativeMethods
Inheritance
NativeMethods
Inherited Members

Remarks

Split from the MQTT declarations only to keep each file readable; this is the same NativeMethods class and the same low-level escape hatch. Both halves must be updated together with the generated header.

Fields

AuditDigestLen

The length in bytes of an audit entry hash.

public const int AuditDigestLen = 32

Field Value

int

AuditSignatureLen

The length in bytes of an audit entry signature.

public const int AuditSignatureLen = 64

Field Value

int

Bme280CalibrationHumidityLen

The BME280 humidity calibration block length.

public const int Bme280CalibrationHumidityLen = 7

Field Value

int

Bme280CalibrationTempPressLen

The BME280 temperature and pressure calibration block length.

public const int Bme280CalibrationTempPressLen = 26

Field Value

int

Bme280MeasurementLen

The length of a BME280 burst measurement read.

public const int Bme280MeasurementLen = 8

Field Value

int

Bmp280CalibrationLen

The length of a BMP280 calibration block.

public const int Bmp280CalibrationLen = 24

Field Value

int

Bmp280DataLen

The length of a BMP280 burst data read.

public const int Bmp280DataLen = 6

Field Value

int

Ds18b20ScratchpadLen

The length of a DS18B20 scratchpad, the ninth byte its CRC.

public const int Ds18b20ScratchpadLen = 9

Field Value

int

Hdc1080MeasurementLen

The length of a HDC1080 measurement frame.

public const int Hdc1080MeasurementLen = 4

Field Value

int

I2cReservedBelow

The first 7-bit address above the reserved block at the bottom.

public const byte I2cReservedBelow = 8

Field Value

byte

I2cReservedFrom

The lowest 7-bit address the I2C specification keeps for itself.

public const byte I2cReservedFrom = 120

Field Value

byte

J1939BroadcastAddress

The destination address every node on the bus reads.

public const byte J1939BroadcastAddress = 255

Field Value

byte

J1939NotAvailable

The byte a J1939 sender writes for a signal it is not reporting.

public const byte J1939NotAvailable = 255

Field Value

byte

J1939PriorityControl

The priority a control message takes, ahead of ordinary traffic.

public const byte J1939PriorityControl = 3

Field Value

byte

J1939PriorityDefault

The priority ordinary traffic takes.

public const byte J1939PriorityDefault = 6

Field Value

byte

J1939PriorityLowest

The priority that yields to everything else on the bus.

public const byte J1939PriorityLowest = 7

Field Value

byte

LoraChannelsDefault

The channels a device starts with before a network adds any.

public const uint LoraChannelsDefault = 1

Field Value

uint

LoraChannelsJoin

The channels a device must use to send a join request.

public const uint LoraChannelsJoin = 0

Field Value

uint

The downlink direction, for a table that differs between the two.

public const uint LoraDirectionDownlink = 1

Field Value

uint

The uplink direction, for a table that differs between the two.

public const uint LoraDirectionUplink = 0

Field Value

uint

LoraModulationFsk

A data rate carried by FSK modulation.

public const byte LoraModulationFsk = 1

Field Value

byte

LoraModulationLora

A data rate carried by LoRa modulation.

public const byte LoraModulationLora = 0

Field Value

byte

LoraModulationLrFhss

A data rate carried by long-range frequency-hopping spread spectrum.

public const byte LoraModulationLrFhss = 2

Field Value

byte

LoraModulationReserved

A data-rate number the region reserves, which carries nothing.

public const byte LoraModulationReserved = 3

Field Value

byte

LoraPayloadTableDownlinkDirect

The downlink payload limits for a device that will not.

public const uint LoraPayloadTableDownlinkDirect = 3

Field Value

uint

LoraPayloadTableDownlinkRepeater

The downlink payload limits for a device that may sit behind a repeater.

public const uint LoraPayloadTableDownlinkRepeater = 2

Field Value

uint

LoraPayloadTableDwellLimited

The payload limits that apply under a dwell-time limit.

public const uint LoraPayloadTableDwellLimited = 4

Field Value

uint

LoraPayloadTableUplinkDirect

The uplink payload limits for a device that will not.

public const uint LoraPayloadTableUplinkDirect = 1

Field Value

uint

LoraPayloadTableUplinkRepeater

The uplink payload limits for a device that may sit behind a repeater.

public const uint LoraPayloadTableUplinkRepeater = 0

Field Value

uint

LoraRegionAs923

The AS923 band.

public const uint LoraRegionAs923 = 6

Field Value

uint

LoraRegionAu915

The AU915-928 band.

public const uint LoraRegionAu915 = 4

Field Value

uint

LoraRegionCn470

The CN470-510 band.

public const uint LoraRegionCn470 = 5

Field Value

uint

LoraRegionEu433

The EU433 band.

public const uint LoraRegionEu433 = 3

Field Value

uint

LoraRegionEu868

The EU863-870 band.

public const uint LoraRegionEu868 = 1

Field Value

uint

LoraRegionIn865

The IN865-867 band.

public const uint LoraRegionIn865 = 8

Field Value

uint

LoraRegionKr920

The KR920-923 band.

public const uint LoraRegionKr920 = 7

Field Value

uint

LoraRegionRu864

The RU864-870 band.

public const uint LoraRegionRu864 = 9

Field Value

uint

LoraRegionUs915

The US902-928 band.

public const uint LoraRegionUs915 = 2

Field Value

uint

LorawanEuiLen

The length of a LoRaWAN EUI, in bytes.

public const int LorawanEuiLen = 8

Field Value

int

LorawanKeyLen

The length of a LoRaWAN key, in bytes.

public const int LorawanKeyLen = 16

Field Value

int

LorawanPayloadMax

The largest LoRaWAN application payload, in bytes.

public const int LorawanPayloadMax = 243

Field Value

int

MavlinkAckFinal

The command finished.

public const uint MavlinkAckFinal = 3

Field Value

uint

MavlinkAckInProgress

The command is still running.

public const uint MavlinkAckInProgress = 2

Field Value

uint

MavlinkAckUnrelated

An acknowledgment was for a different command.

public const uint MavlinkAckUnrelated = 1

Field Value

uint

MavlinkDefaultTimestampWindow

The default window a verifier accepts a timestamp within.

public const ulong MavlinkDefaultTimestampWindow = 6000000

Field Value

ulong

MavlinkKeyLen

The length of a signing key, in bytes.

public const int MavlinkKeyLen = 32

Field Value

int

MavlinkMaxFrame

The largest frame, in bytes, header, checksum and signature included.

public const int MavlinkMaxFrame = 280

Field Value

int

MavlinkMaxPayload

The largest payload a frame can carry, in bytes.

public const int MavlinkMaxPayload = 255

Field Value

int

MavlinkMaxRetries

The retransmissions the mission protocol recommends before giving up.

public const byte MavlinkMaxRetries = 5

Field Value

byte

MavlinkReceiverAck

A receiver answered with the acknowledgment that ends the transfer.

public const uint MavlinkReceiverAck = 2

Field Value

uint

MavlinkReceiverRequest

A receiver answered with a request for the next item.

public const uint MavlinkReceiverRequest = 1

Field Value

uint

MavlinkSenderFinished

A sender saw the receiver's acknowledgment.

public const uint MavlinkSenderFinished = 2

Field Value

uint

MavlinkSenderReply

A sender answered with a frame to send.

public const uint MavlinkSenderReply = 1

Field Value

uint

MavlinkSignatureLen

The length of a v2 signature block, in bytes.

public const int MavlinkSignatureLen = 13

Field Value

int

MavlinkStepIgnored

The frame was not one the machine handles.

public const uint MavlinkStepIgnored = 0

Field Value

uint

MavlinkVersionV1

The original wire format, with a six-byte header.

public const byte MavlinkVersionV1 = 1

Field Value

byte

MavlinkVersionV2

The current wire format, with a 24-bit message id and signing.

public const byte MavlinkVersionV2 = 2

Field Value

byte

MeshBroadcast

The destination address that means every node.

public const uint MeshBroadcast = 4294967295

Field Value

uint

MeshDefaultHopLimit

The hop limit a mesh frame starts with unless one is set.

public const byte MeshDefaultHopLimit = 3

Field Value

byte

MeshFrameMax

The largest mesh frame, in bytes, header and checksum included.

public const int MeshFrameMax = 250

Field Value

int

MeshHeaderLen

How many bytes of a mesh frame are header.

public const int MeshHeaderLen = 12

Field Value

int

MeshPayloadMax

The largest payload a single mesh frame can carry, in bytes.

public const int MeshPayloadMax = 236

Field Value

int

MeshSeenDefaultCapacity

A duplicate-cache size for a caller with no reason to choose one.

public const int MeshSeenDefaultCapacity = 64

Field Value

int

Opt3001RegisterLen

The length of a OPT3001 register.

public const int Opt3001RegisterLen = 2

Field Value

int

RoutingDefaultCapacity

A routing table size for a caller with no reason to choose one.

public const int RoutingDefaultCapacity = 64

Field Value

int

Scd4xCommandLen

The length of a SCD4x command frame.

public const int Scd4xCommandLen = 2

Field Value

int

Scd4xMeasurementLen

The length of a SCD4x measurement frame.

public const int Scd4xMeasurementLen = 9

Field Value

int

Scd4xWordLen

The length of a SCD4x word and its checksum.

public const int Scd4xWordLen = 3

Field Value

int

Scd4xWriteLen

The length of a SCD4x command-and-value frame.

public const int Scd4xWriteLen = 5

Field Value

int

SessionKeyLen

The length in bytes of an agreement seed, key, or digest.

public const int SessionKeyLen = 32

Field Value

int

SessionTagLen

The length in bytes of the tag on a sealed message.

public const int SessionTagLen = 16

Field Value

int

Sht3xMeasurementLen

The length of a SHT3x measurement frame.

public const int Sht3xMeasurementLen = 6

Field Value

int

Sht3xWordLen

The length of a SHT3x word and its checksum.

public const int Sht3xWordLen = 3

Field Value

int

Tmp117RegisterLen

The length of a TMP117 register.

public const int Tmp117RegisterLen = 2

Field Value

int

UpdateFormatRaw

The payload format meaning the payload is the image itself.

public const byte UpdateFormatRaw = 1

Field Value

byte

UpdateStructureVersion

The manifest structure version this build writes.

public const byte UpdateStructureVersion = 1

Field Value

byte

WindowCapacity

The number of readings a windowed helper keeps.

public const int WindowCapacity = 32

Field Value

int

Methods

pamoja_ads1115_config_bits(PamojaAds1115Config)

Assembles the 16-bit ADS1115 configuration register value.

public static extern ushort pamoja_ads1115_config_bits(PamojaAds1115Config config)

Parameters

config PamojaAds1115Config

Returns

ushort

pamoja_ads1115_config_from_bits(ushort, out PamojaAds1115Config)

Parses a 16-bit ADS1115 configuration register value.

public static PamojaStatus pamoja_ads1115_config_from_bits(ushort bits, out PamojaAds1115Config outConfig)

Parameters

bits ushort
outConfig PamojaAds1115Config

Returns

PamojaStatus

pamoja_ads1115_full_scale_microvolts(byte)

Returns the full-scale range an ADS1115 gain code selects.

public static extern uint pamoja_ads1115_full_scale_microvolts(byte pga)

Parameters

pga byte

Returns

uint

pamoja_ads1115_samples_per_second(byte)

Returns the sample rate an ADS1115 data-rate code selects.

public static extern ushort pamoja_ads1115_samples_per_second(byte dataRate)

Parameters

dataRate byte

Returns

ushort

pamoja_ads1115_to_nanovolts(byte, short)

Converts a raw ADS1115 conversion result to nanovolts.

public static extern long pamoja_ads1115_to_nanovolts(byte pga, short raw)

Parameters

pga byte
raw short

Returns

long

pamoja_ads1115_to_volts(byte, short)

Converts a raw ADS1115 conversion result to volts.

public static extern float pamoja_ads1115_to_volts(byte pga, short raw)

Parameters

pga byte
raw short

Returns

float

pamoja_agreement_key_free(nint)

Releases an agreement key handle.

public static extern void pamoja_agreement_key_free(nint key)

Parameters

key nint

pamoja_agreement_key_from_seed(ReadOnlySpan<byte>, nuint)

Creates a key-agreement secret from a 32-byte seed.

public static nint pamoja_agreement_key_from_seed(ReadOnlySpan<byte> seed, nuint seedLen)

Parameters

seed ReadOnlySpan<byte>
seedLen nuint

Returns

nint

pamoja_agreement_key_public(nint, Span<byte>)

Copies out the public key to hand to a peer.

public static PamojaStatus pamoja_agreement_key_public(nint key, Span<byte> outPublicKey)

Parameters

key nint
outPublicKey Span<byte>

Returns

PamojaStatus

pamoja_anomaly_check(nint, float)

Folds a reading in and reports whether it stands out.

public static bool pamoja_anomaly_check(nint anomaly, float reading)

Parameters

anomaly nint
reading float

Returns

bool

pamoja_anomaly_free(nint)

Releases an anomaly detector handle. Passing null is a no-op.

public static extern void pamoja_anomaly_free(nint anomaly)

Parameters

anomaly nint

pamoja_anomaly_new(float)

Creates an anomaly detector at a deviation threshold.

public static extern nint pamoja_anomaly_new(float sigmas)

Parameters

sigmas float

Returns

nint

pamoja_audit_entry_digest(nint, Span<byte>)

Copies out the hash of this entry.

public static PamojaStatus pamoja_audit_entry_digest(nint entry, Span<byte> outDigest)

Parameters

entry nint
outDigest Span<byte>

Returns

PamojaStatus

pamoja_audit_entry_free(nint)

Releases an entry handle.

public static extern void pamoja_audit_entry_free(nint entry)

Parameters

entry nint

pamoja_audit_entry_from_bytes(ReadOnlySpan<byte>, nuint)

Reads an entry back from the bytes it was written as.

public static nint pamoja_audit_entry_from_bytes(ReadOnlySpan<byte> bytes, nuint len)

Parameters

bytes ReadOnlySpan<byte>
len nuint

Returns

nint

pamoja_audit_entry_index(nint)

Returns the position of an entry in its chain.

public static extern ulong pamoja_audit_entry_index(nint entry)

Parameters

entry nint

Returns

ulong

pamoja_audit_entry_payload(nint)

Copies out the record an entry carries.

public static extern nint pamoja_audit_entry_payload(nint entry)

Parameters

entry nint

Returns

nint

pamoja_audit_entry_previous(nint, Span<byte>)

Copies out the hash of the entry before this one.

public static PamojaStatus pamoja_audit_entry_previous(nint entry, Span<byte> outPrevious)

Parameters

entry nint
outPrevious Span<byte>

Returns

PamojaStatus

pamoja_audit_entry_signature(nint, Span<byte>)

Copies out the signature over an entry.

public static PamojaStatus pamoja_audit_entry_signature(nint entry, Span<byte> outSignature)

Parameters

entry nint
outSignature Span<byte>

Returns

PamojaStatus

pamoja_audit_entry_to_bytes(nint)

Encodes an entry for storage or transmission.

public static extern nint pamoja_audit_entry_to_bytes(nint entry)

Parameters

entry nint

Returns

nint

pamoja_audit_log_append(nint, ReadOnlySpan<byte>, nuint)

Appends a payload, signing and chaining it.

public static nint pamoja_audit_log_append(nint log, ReadOnlySpan<byte> payload, nuint payloadLen)

Parameters

log nint
payload ReadOnlySpan<byte>
payloadLen nuint

Returns

nint

pamoja_audit_log_free(nint)

Releases a log handle.

public static extern void pamoja_audit_log_free(nint log)

Parameters

log nint

pamoja_audit_log_new(nint)

Creates a log that signs with a device identity, starting empty.

public static extern nint pamoja_audit_log_new(nint identity)

Parameters

identity nint

Returns

nint

pamoja_audit_log_resume(nint, nint)

Creates a log that carries on from an existing final entry.

public static extern nint pamoja_audit_log_resume(nint identity, nint last)

Parameters

identity nint
last nint

Returns

nint

pamoja_audit_verifier_check(nint, nint)

Checks the next entry of a chain.

public static extern PamojaStatus pamoja_audit_verifier_check(nint verifier, nint entry)

Parameters

verifier nint
entry nint

Returns

PamojaStatus

pamoja_audit_verifier_free(nint)

Releases a verifier handle.

public static extern void pamoja_audit_verifier_free(nint verifier)

Parameters

verifier nint

pamoja_audit_verifier_new(ReadOnlySpan<byte>)

Creates a verifier for a chain signed by one public key.

public static nint pamoja_audit_verifier_new(ReadOnlySpan<byte> publicKey)

Parameters

publicKey ReadOnlySpan<byte>

Returns

nint

pamoja_audit_verify_chain(ReadOnlySpan<byte>, ReadOnlySpan<nint>, nuint)

Checks a whole chain that has already arrived.

public static PamojaStatus pamoja_audit_verify_chain(ReadOnlySpan<byte> publicKey, ReadOnlySpan<nint> entries, nuint count)

Parameters

publicKey ReadOnlySpan<byte>
entries ReadOnlySpan<nint>
count nuint

Returns

PamojaStatus

pamoja_bme280_calibration_free(nint)

Releases a BME280 calibration handle. Passing null is a no-op.

public static extern void pamoja_bme280_calibration_free(nint calibration)

Parameters

calibration nint

pamoja_bme280_calibration_new(ReadOnlySpan<byte>, nuint, ReadOnlySpan<byte>, nuint, out nint)

Builds a BME280 calibration from its register bytes.

public static PamojaStatus pamoja_bme280_calibration_new(ReadOnlySpan<byte> tempPress, nuint tempPressLen, ReadOnlySpan<byte> humidity, nuint humidityLen, out nint outCalibration)

Parameters

tempPress ReadOnlySpan<byte>
tempPressLen nuint
humidity ReadOnlySpan<byte>
humidityLen nuint
outCalibration nint

Returns

PamojaStatus

pamoja_bme280_compensate(nint, ReadOnlySpan<byte>, nuint, out PamojaBme280Measurement)

Turns a BME280 burst read into a compensated reading.

public static PamojaStatus pamoja_bme280_compensate(nint calibration, ReadOnlySpan<byte> measurement, nuint measurementLen, out PamojaBme280Measurement outMeasurement)

Parameters

calibration nint
measurement ReadOnlySpan<byte>
measurementLen nuint
outMeasurement PamojaBme280Measurement

Returns

PamojaStatus

pamoja_bmp280_calibration_coefficients(nint, out PamojaBmp280Coefficients)

Reads out the trimming coefficients a BMP280 calibration carries. # Returns [PamojaStatus::Ok] on success, with *out_coefficients filled in, or [PamojaStatus::InvalidArgument] if either pointer is null. # Safety calibration must be a live handle from [pamoja_bmp280_calibration_new], and out_coefficients must point to a writable PamojaBmp280Coefficients.

public static PamojaStatus pamoja_bmp280_calibration_coefficients(nint calibration, out PamojaBmp280Coefficients outCoefficients)

Parameters

calibration nint
outCoefficients PamojaBmp280Coefficients

Returns

PamojaStatus

pamoja_bmp280_calibration_free(nint)

Releases a BMP280 calibration handle. Passing null is a no-op. # Safety calibration must be a handle from [pamoja_bmp280_calibration_new] that has not already been freed, or null. After this call it must not be used again.

public static extern void pamoja_bmp280_calibration_free(nint calibration)

Parameters

calibration nint

pamoja_bmp280_calibration_new(ReadOnlySpan<byte>, nuint, out nint)

Builds a BMP280 calibration from the 24 bytes read out of its registers. # Returns [PamojaStatus::Ok] on success, with *out_calibration set to a new handle the caller must release with [pamoja_bmp280_calibration_free], or [PamojaStatus::InvalidArgument] if the buffer is not 24 bytes. # Safety bytes must point to at least bytes_len readable bytes, and out_calibration must point to a writable *mut PamojaBmp280Calibration.

public static PamojaStatus pamoja_bmp280_calibration_new(ReadOnlySpan<byte> bytes, nuint bytesLen, out nint outCalibration)

Parameters

bytes ReadOnlySpan<byte>
bytesLen nuint
outCalibration nint

Returns

PamojaStatus

pamoja_bmp280_calibration_to_bytes(nint, Span<byte>)

Rebuilds the 24 calibration bytes a device holding these coefficients returns. # Returns [PamojaStatus::Ok] on success, with the 24 bytes written to out_bytes, or [PamojaStatus::InvalidArgument] if either pointer is null. # Safety calibration must be a live handle from [pamoja_bmp280_calibration_new], and out_bytes must point to at least 24 writable bytes.

public static PamojaStatus pamoja_bmp280_calibration_to_bytes(nint calibration, Span<byte> outBytes)

Parameters

calibration nint
outBytes Span<byte>

Returns

PamojaStatus

pamoja_bmp280_compensate(nint, ReadOnlySpan<byte>, nuint, out PamojaBmp280Reading)

Turns a BMP280 burst read into a compensated reading. # Returns [PamojaStatus::Ok] on success, with *out_reading filled in, or [PamojaStatus::InvalidArgument] if the calibration is null or the measurement is not six bytes. # Safety calibration must be a live handle from [pamoja_bmp280_calibration_new], measurement must point to at least measurement_len readable bytes, and out_reading must point to a writable PamojaBmp280Reading.

public static PamojaStatus pamoja_bmp280_compensate(nint calibration, ReadOnlySpan<byte> measurement, nuint measurementLen, out PamojaBmp280Reading outReading)

Parameters

calibration nint
measurement ReadOnlySpan<byte>
measurementLen nuint
outReading PamojaBmp280Reading

Returns

PamojaStatus

pamoja_bmp280_config_bits(PamojaBmp280Config)

Assembles a BMP280 config register value. # Returns The register value to write.

public static extern byte pamoja_bmp280_config_bits(PamojaBmp280Config config)

Parameters

config PamojaBmp280Config

Returns

byte

pamoja_bmp280_config_from_bits(byte, out PamojaBmp280Config)

Parses a BMP280 config register value. # Returns [PamojaStatus::Ok], with *out_config filled in. Every register value decodes, so this fails only on a null pointer. # Safety out_config must point to a writable PamojaBmp280Config.

public static PamojaStatus pamoja_bmp280_config_from_bits(byte bits, out PamojaBmp280Config outConfig)

Parameters

bits byte
outConfig PamojaBmp280Config

Returns

PamojaStatus

pamoja_bmp280_ctrl_meas_bits(PamojaBmp280CtrlMeas)

Assembles a BMP280 ctrl_meas register value. # Returns The register value to write.

public static extern byte pamoja_bmp280_ctrl_meas_bits(PamojaBmp280CtrlMeas config)

Parameters

config PamojaBmp280CtrlMeas

Returns

byte

pamoja_bmp280_ctrl_meas_from_bits(byte, out PamojaBmp280CtrlMeas)

Parses a BMP280 ctrl_meas register value. # Returns [PamojaStatus::Ok], with *out_config filled in. Every register value decodes, so this fails only on a null pointer. # Safety out_config must point to a writable PamojaBmp280CtrlMeas.

public static PamojaStatus pamoja_bmp280_ctrl_meas_from_bits(byte bits, out PamojaBmp280CtrlMeas outConfig)

Parameters

bits byte
outConfig PamojaBmp280CtrlMeas

Returns

PamojaStatus

pamoja_bmp280_image_updating(byte)

Reports whether a BMP280 status byte says the calibration image is loading. # Returns true while the coefficients are being copied out of non-volatile memory.

public static bool pamoja_bmp280_image_updating(byte status)

Parameters

status byte

Returns

bool

pamoja_bmp280_measurement_bytes(uint, uint, Span<byte>)

Builds the six data bytes a BMP280 holding these codes would return. # Returns [PamojaStatus::Ok] on success, with the six bytes written to out_bytes, or [PamojaStatus::InvalidArgument] if out_bytes is null. # Safety out_bytes must point to at least six writable bytes.

public static PamojaStatus pamoja_bmp280_measurement_bytes(uint pressure, uint temperature, Span<byte> outBytes)

Parameters

pressure uint
temperature uint
outBytes Span<byte>

Returns

PamojaStatus

pamoja_bmp280_measuring(byte)

Reports whether a BMP280 status byte says a conversion is running. # Returns true while the part is measuring.

public static bool pamoja_bmp280_measuring(byte status)

Parameters

status byte

Returns

bool

pamoja_bmp280_oversampling_factor(byte)

Returns how many samples a BMP280 oversampling code averages. # Returns The oversampling factor, 1 to 16.

public static extern byte pamoja_bmp280_oversampling_factor(byte code)

Parameters

code byte

Returns

byte

pamoja_bmp280_parse_measurement(ReadOnlySpan<byte>, nuint, out PamojaBmp280Measurement)

Unpacks the six data bytes a BMP280 burst read returns. # Returns [PamojaStatus::Ok] on success, with *out_measurement filled in, or [PamojaStatus::InvalidArgument] if the buffer is not six bytes. # Safety data must point to at least data_len readable bytes, and out_measurement must point to a writable PamojaBmp280Measurement.

public static PamojaStatus pamoja_bmp280_parse_measurement(ReadOnlySpan<byte> data, nuint dataLen, out PamojaBmp280Measurement outMeasurement)

Parameters

data ReadOnlySpan<byte>
dataLen nuint
outMeasurement PamojaBmp280Measurement

Returns

PamojaStatus

pamoja_bmp280_standby_micros(byte)

Returns the normal-mode standby period a BMP280 code selects. # Returns The period in microseconds.

public static extern uint pamoja_bmp280_standby_micros(byte code)

Parameters

code byte

Returns

uint

pamoja_buffer_data(nint)

Returns a pointer to a byte buffer's contents.

public static extern nint pamoja_buffer_data(nint buffer)

Parameters

buffer nint

Returns

nint

pamoja_buffer_free(nint)

Releases a byte buffer handle. Passing null is a no-op.

public static extern void pamoja_buffer_free(nint buffer)

Parameters

buffer nint

pamoja_buffer_len(nint)

Returns the length in bytes of a byte buffer.

public static extern nuint pamoja_buffer_len(nint buffer)

Parameters

buffer nint

Returns

nuint

pamoja_calibration_apply(nint, float)

Converts a raw reading into calibrated units.

public static extern float pamoja_calibration_apply(nint calibration, float raw)

Parameters

calibration nint
raw float

Returns

float

pamoja_calibration_free(nint)

Releases a calibration handle. Passing null is a no-op.

public static extern void pamoja_calibration_free(nint calibration)

Parameters

calibration nint

pamoja_calibration_linear(float, float)

Creates a linear calibration.

public static extern nint pamoja_calibration_linear(float scale, float offset)

Parameters

scale float
offset float

Returns

nint

pamoja_calibration_two_point(float, float, float, float)

Creates a calibration fitted through two reference points.

public static extern nint pamoja_calibration_two_point(float rawLow, float valueLow, float rawHigh, float valueHigh)

Parameters

rawLow float
valueLow float
rawHigh float
valueHigh float

Returns

nint

pamoja_can_dlc_to_len(byte)

Returns the payload length a data length code encodes.

public static extern nuint pamoja_can_dlc_to_len(byte dlc)

Parameters

dlc byte

Returns

nuint

pamoja_can_frame_data(nint)

Returns a pointer to a frame's payload bytes.

public static extern nint pamoja_can_frame_data(nint frame)

Parameters

frame nint

Returns

nint

pamoja_can_frame_data_len(nint)

Returns how many bytes the payload pointer covers.

public static extern nuint pamoja_can_frame_data_len(nint frame)

Parameters

frame nint

Returns

nuint

pamoja_can_frame_dlc(nint)

Returns a frame's data length code.

public static extern byte pamoja_can_frame_dlc(nint frame)

Parameters

frame nint

Returns

byte

pamoja_can_frame_fd(uint, bool, ReadOnlySpan<byte>, nuint, out nint)

Builds a CAN-FD frame.

public static PamojaStatus pamoja_can_frame_fd(uint id, bool extended, ReadOnlySpan<byte> data, nuint dataLen, out nint outFrame)

Parameters

id uint
extended bool
data ReadOnlySpan<byte>
dataLen nuint
outFrame nint

Returns

PamojaStatus

pamoja_can_frame_free(nint)

Releases a CAN frame handle. Passing null is a no-op.

public static extern void pamoja_can_frame_free(nint frame)

Parameters

frame nint

pamoja_can_frame_id(nint)

Returns a frame's identifier.

public static extern uint pamoja_can_frame_id(nint frame)

Parameters

frame nint

Returns

uint

pamoja_can_frame_is_extended(nint)

Reports whether a frame carries a 29-bit extended identifier.

public static bool pamoja_can_frame_is_extended(nint frame)

Parameters

frame nint

Returns

bool

pamoja_can_frame_is_fd(nint)

Reports whether a frame is CAN-FD rather than classic CAN 2.0.

public static bool pamoja_can_frame_is_fd(nint frame)

Parameters

frame nint

Returns

bool

pamoja_can_frame_is_remote(nint)

Reports whether a frame is a remote transmission request.

public static bool pamoja_can_frame_is_remote(nint frame)

Parameters

frame nint

Returns

bool

pamoja_can_frame_len(nint)

Returns a frame's data length, which a remote frame only requests.

public static extern nuint pamoja_can_frame_len(nint frame)

Parameters

frame nint

Returns

nuint

pamoja_can_frame_new(uint, bool, ReadOnlySpan<byte>, nuint, out nint)

Builds a classic CAN 2.0 frame.

public static PamojaStatus pamoja_can_frame_new(uint id, bool extended, ReadOnlySpan<byte> data, nuint dataLen, out nint outFrame)

Parameters

id uint
extended bool
data ReadOnlySpan<byte>
dataLen nuint
outFrame nint

Returns

PamojaStatus

pamoja_can_frame_remote(uint, bool, nuint, out nint)

Builds a remote transmission request.

public static PamojaStatus pamoja_can_frame_remote(uint id, bool extended, nuint len, out nint outFrame)

Parameters

id uint
extended bool
len nuint
outFrame nint

Returns

PamojaStatus

pamoja_can_j1939_broadcast(byte, uint, byte)

Composes the identifier of a J1939 broadcast.

public static extern uint pamoja_can_j1939_broadcast(byte priority, uint pgn, byte source)

Parameters

priority byte
pgn uint
source byte

Returns

uint

pamoja_can_j1939_compose(byte, uint, byte, byte)

Composes the extended identifier a set of J1939 fields describes.

public static extern uint pamoja_can_j1939_compose(byte priority, uint pgn, byte source, byte destination)

Parameters

priority byte
pgn uint
source byte
destination byte

Returns

uint

pamoja_can_j1939_decode(uint, bool, out PamojaJ1939Id)

Decodes the J1939 fields out of an extended CAN identifier.

public static bool pamoja_can_j1939_decode(uint id, bool extended, out PamojaJ1939Id outMessage)

Parameters

id uint
extended bool
outMessage PamojaJ1939Id

Returns

bool

pamoja_can_len_to_dlc(nuint)

Returns the data length code that encodes a payload length.

public static extern byte pamoja_can_len_to_dlc(nuint len)

Parameters

len nuint

Returns

byte

pamoja_can_signals_new()

Builds a J1939 payload with every signal marked not available.

public static extern PamojaJ1939Signals pamoja_can_signals_new()

Returns

PamojaJ1939Signals

pamoja_can_signals_set_u16(PamojaJ1939Signals, nuint, ushort)

Writes a two-byte little-endian signal at the offset its group defines.

public static extern PamojaJ1939Signals pamoja_can_signals_set_u16(PamojaJ1939Signals signals, nuint at, ushort value)

Parameters

signals PamojaJ1939Signals
at nuint
value ushort

Returns

PamojaJ1939Signals

pamoja_can_signals_set_u8(PamojaJ1939Signals, nuint, byte)

Writes a one-byte signal at the offset its group defines.

public static extern PamojaJ1939Signals pamoja_can_signals_set_u8(PamojaJ1939Signals signals, nuint at, byte value)

Parameters

signals PamojaJ1939Signals
at nuint
value byte

Returns

PamojaJ1939Signals

pamoja_can_signals_u16(PamojaJ1939Signals, nuint, out ushort)

Reads a two-byte little-endian signal at the offset its group defines.

public static bool pamoja_can_signals_u16(PamojaJ1939Signals signals, nuint at, out ushort outValue)

Parameters

signals PamojaJ1939Signals
at nuint
outValue ushort

Returns

bool

pamoja_can_signals_u8(PamojaJ1939Signals, nuint, out byte)

Reads a one-byte signal at the offset its group defines.

public static bool pamoja_can_signals_u8(PamojaJ1939Signals signals, nuint at, out byte outValue)

Parameters

signals PamojaJ1939Signals
at nuint
outValue byte

Returns

bool

pamoja_cdr_reader_free(nint)

Releases a CDR decoder handle.

public static extern void pamoja_cdr_reader_free(nint reader)

Parameters

reader nint

pamoja_cdr_reader_new(ReadOnlySpan<byte>, nuint)

Creates a CDR decoder over encoded bytes.

public static nint pamoja_cdr_reader_new(ReadOnlySpan<byte> data, nuint dataLen)

Parameters

data ReadOnlySpan<byte>
dataLen nuint

Returns

nint

pamoja_cdr_reader_read_f32(nint, out float)

Reads the next 32-bit float.

public static PamojaStatus pamoja_cdr_reader_read_f32(nint reader, out float value)

Parameters

reader nint
value float

Returns

PamojaStatus

pamoja_cdr_reader_read_f64(nint, out double)

Reads the next 64-bit float.

public static PamojaStatus pamoja_cdr_reader_read_f64(nint reader, out double value)

Parameters

reader nint
value double

Returns

PamojaStatus

pamoja_cdr_reader_read_i32(nint, out int)

Reads the next 32-bit signed integer.

public static PamojaStatus pamoja_cdr_reader_read_i32(nint reader, out int value)

Parameters

reader nint
value int

Returns

PamojaStatus

pamoja_cdr_reader_read_u32(nint, out uint)

Reads the next 32-bit unsigned integer.

public static PamojaStatus pamoja_cdr_reader_read_u32(nint reader, out uint value)

Parameters

reader nint
value uint

Returns

PamojaStatus

pamoja_cdr_writer_free(nint)

Releases a CDR encoder handle.

public static extern void pamoja_cdr_writer_free(nint writer)

Parameters

writer nint

pamoja_cdr_writer_into_bytes(nint)

Takes the encoded bytes, consuming the encoder.

public static extern nint pamoja_cdr_writer_into_bytes(nint writer)

Parameters

writer nint

Returns

nint

pamoja_cdr_writer_new()

Creates a CDR encoder.

public static extern nint pamoja_cdr_writer_new()

Returns

nint

pamoja_cdr_writer_write_f32(nint, float)

Appends a 32-bit float.

public static extern PamojaStatus pamoja_cdr_writer_write_f32(nint writer, float value)

Parameters

writer nint
value float

Returns

PamojaStatus

pamoja_cdr_writer_write_f64(nint, double)

Appends a 64-bit float.

public static extern PamojaStatus pamoja_cdr_writer_write_f64(nint writer, double value)

Parameters

writer nint
value double

Returns

PamojaStatus

pamoja_cdr_writer_write_i32(nint, int)

Appends a 32-bit signed integer.

public static extern PamojaStatus pamoja_cdr_writer_write_i32(nint writer, int value)

Parameters

writer nint
value int

Returns

PamojaStatus

pamoja_cdr_writer_write_u32(nint, uint)

Appends a 32-bit unsigned integer.

public static extern PamojaStatus pamoja_cdr_writer_write_u32(nint writer, uint value)

Parameters

writer nint
value uint

Returns

PamojaStatus

pamoja_coap_client_connect(nint)

Binds the local socket of a CoAP endpoint.

public static extern PamojaStatus pamoja_coap_client_connect(nint client)

Parameters

client nint

Returns

PamojaStatus

pamoja_coap_client_disconnect(nint)

Releases the socket a CoAP endpoint holds.

public static extern PamojaStatus pamoja_coap_client_disconnect(nint client)

Parameters

client nint

Returns

PamojaStatus

pamoja_coap_client_free(nint)

Releases a CoAP endpoint handle.

public static extern void pamoja_coap_client_free(nint client)

Parameters

client nint

pamoja_coap_client_is_connected(nint)

Reports whether a CoAP endpoint is bound.

public static bool pamoja_coap_client_is_connected(nint client)

Parameters

client nint

Returns

bool

pamoja_coap_client_new(ref PamojaCoapConfig)

Creates a disconnected CoAP endpoint.

public static nint pamoja_coap_client_new(ref PamojaCoapConfig config)

Parameters

config PamojaCoapConfig

Returns

nint

pamoja_coap_client_recv(nint, out nint)

Waits for the next message on an observed CoAP path.

public static PamojaStatus pamoja_coap_client_recv(nint client, out nint outMessage)

Parameters

client nint
outMessage nint

Returns

PamojaStatus

pamoja_coap_client_send(nint, nint, ReadOnlySpan<byte>, nuint)

Sends a payload to a CoAP resource path.

public static PamojaStatus pamoja_coap_client_send(nint client, nint topic, ReadOnlySpan<byte> payload, nuint payloadLen)

Parameters

client nint
topic nint
payload ReadOnlySpan<byte>
payloadLen nuint

Returns

PamojaStatus

pamoja_coap_client_subscribe(nint, nint)

Observes a CoAP resource path.

public static extern PamojaStatus pamoja_coap_client_subscribe(nint client, nint topic)

Parameters

client nint
topic nint

Returns

PamojaStatus

pamoja_cobs_decoder_discarded(nint)

Returns how many corrupt frames a COBS decoder has discarded.

public static extern ulong pamoja_cobs_decoder_discarded(nint decoder)

Parameters

decoder nint

Returns

ulong

pamoja_cobs_decoder_feed(nint, ReadOnlySpan<byte>, nuint, out nint)

Feeds a chunk of the byte stream to a COBS decoder.

public static PamojaStatus pamoja_cobs_decoder_feed(nint decoder, ReadOnlySpan<byte> bytes, nuint bytesLen, out nint outFrames)

Parameters

decoder nint
bytes ReadOnlySpan<byte>
bytesLen nuint
outFrames nint

Returns

PamojaStatus

pamoja_cobs_decoder_free(nint)

Releases a COBS decoder handle. Passing null is a no-op.

public static extern void pamoja_cobs_decoder_free(nint decoder)

Parameters

decoder nint

pamoja_cobs_decoder_new()

Creates a streaming COBS decoder.

public static extern nint pamoja_cobs_decoder_new()

Returns

nint

pamoja_cobs_decoder_reset(nint)

Discards any partly assembled COBS frame.

public static extern void pamoja_cobs_decoder_reset(nint decoder)

Parameters

decoder nint

pamoja_codec_cbor_to_json(ReadOnlySpan<byte>, nuint, out nint)

Converts a CBOR document into its JSON encoding.

public static PamojaStatus pamoja_codec_cbor_to_json(ReadOnlySpan<byte> cbor, nuint cborLen, out nint outBuffer)

Parameters

cbor ReadOnlySpan<byte>
cborLen nuint
outBuffer nint

Returns

PamojaStatus

pamoja_codec_decode_deltas(ReadOnlySpan<byte>, nuint, out nint)

Decodes a delta-encoded buffer back into integer samples.

public static PamojaStatus pamoja_codec_decode_deltas(ReadOnlySpan<byte> bytes, nuint bytesLen, out nint outSamples)

Parameters

bytes ReadOnlySpan<byte>
bytesLen nuint
outSamples nint

Returns

PamojaStatus

pamoja_codec_encode_deltas(ReadOnlySpan<long>, nuint, out nint)

Delta-encodes a series of integer samples.

public static PamojaStatus pamoja_codec_encode_deltas(ReadOnlySpan<long> samples, nuint count, out nint outBuffer)

Parameters

samples ReadOnlySpan<long>
count nuint
outBuffer nint

Returns

PamojaStatus

pamoja_codec_json_to_cbor(ReadOnlySpan<byte>, nuint, out nint)

Converts a JSON document into its CBOR encoding.

public static PamojaStatus pamoja_codec_json_to_cbor(ReadOnlySpan<byte> json, nuint jsonLen, out nint outBuffer)

Parameters

json ReadOnlySpan<byte>
jsonLen nuint
outBuffer nint

Returns

PamojaStatus

pamoja_codec_quantizer_decode(float, ReadOnlySpan<byte>, nuint, out nint)

Decodes a quantized batch back into float readings.

public static PamojaStatus pamoja_codec_quantizer_decode(float scale, ReadOnlySpan<byte> bytes, nuint bytesLen, out nint outReadings)

Parameters

scale float
bytes ReadOnlySpan<byte>
bytesLen nuint
outReadings nint

Returns

PamojaStatus

pamoja_codec_quantizer_encode(float, ReadOnlySpan<float>, nuint, out nint)

Quantizes and delta-encodes a batch of float readings.

public static PamojaStatus pamoja_codec_quantizer_encode(float scale, ReadOnlySpan<float> readings, nuint count, out nint outBuffer)

Parameters

scale float
readings ReadOnlySpan<float>
count nuint
outBuffer nint

Returns

PamojaStatus

pamoja_controller_evaluate(nint, float, out PamojaReaction)

Decides what one reading calls for.

public static PamojaStatus pamoja_controller_evaluate(nint controller, float reading, out PamojaReaction reaction)

Parameters

controller nint
reading float
reaction PamojaReaction

Returns

PamojaStatus

pamoja_controller_free(nint)

Releases a controller handle.

public static extern void pamoja_controller_free(nint controller)

Parameters

controller nint

pamoja_controller_level(float, uint)

Creates a controller that warns before a level reaches empty.

public static extern nint pamoja_controller_level(float empty, uint warnWithin)

Parameters

empty float
warnWithin uint

Returns

nint

pamoja_controller_monitor()

Creates a controller that reports readings without judging them.

public static extern nint pamoja_controller_monitor()

Returns

nint

pamoja_controller_setpoint(float, float, bool, float)

Creates a controller that holds a reading near a setpoint.

public static nint pamoja_controller_setpoint(float setpoint, float hysteresis, bool cooling, float safeBand)

Parameters

setpoint float
hysteresis float
cooling bool
safeBand float

Returns

nint

pamoja_controller_surge(bool, float)

Creates a controller that warns when a reading changes too fast.

public static nint pamoja_controller_surge(bool rising, float limit)

Parameters

rising bool
limit float

Returns

nint

pamoja_coordinate_bearing_to(PamojaCoordinate, PamojaCoordinate)

Returns the initial bearing between two coordinates, in degrees.

public static extern double pamoja_coordinate_bearing_to(PamojaCoordinate from, PamojaCoordinate to)

Parameters

from PamojaCoordinate
to PamojaCoordinate

Returns

double

pamoja_coordinate_distance_to(PamojaCoordinate, PamojaCoordinate)

Returns the great-circle distance between two coordinates, in meters.

public static extern double pamoja_coordinate_distance_to(PamojaCoordinate from, PamojaCoordinate to)

Parameters

from PamojaCoordinate
to PamojaCoordinate

Returns

double

pamoja_debounce_free(nint)

Releases a debouncer handle. Passing null is a no-op.

public static extern void pamoja_debounce_free(nint debounce)

Parameters

debounce nint

pamoja_debounce_new(ushort, bool)

Creates a boolean debouncer.

public static nint pamoja_debounce_new(ushort samples, bool initial)

Parameters

samples ushort
initial bool

Returns

nint

pamoja_debounce_state(nint)

Reports a debouncer's settled state.

public static bool pamoja_debounce_state(nint debounce)

Parameters

debounce nint

Returns

bool

pamoja_debounce_update(nint, bool)

Feeds a raw reading to a debouncer and returns the settled state.

public static bool pamoja_debounce_update(nint debounce, bool raw)

Parameters

debounce nint
raw bool

Returns

bool

pamoja_delegation_open(ReadOnlySpan<byte>, nuint, ReadOnlySpan<byte>, out PamojaDelegation)

Opens a signed delegation against its anchor.

public static PamojaStatus pamoja_delegation_open(ReadOnlySpan<byte> bytes, nuint len, ReadOnlySpan<byte> anchorPublicKey, out PamojaDelegation outDelegation)

Parameters

bytes ReadOnlySpan<byte>
len nuint
anchorPublicKey ReadOnlySpan<byte>
outDelegation PamojaDelegation

Returns

PamojaStatus

pamoja_delegation_sign(PamojaDelegation, nint)

Signs a delegation naming a release key.

public static extern nint pamoja_delegation_sign(PamojaDelegation delegation, nint anchor)

Parameters

delegation PamojaDelegation
anchor nint

Returns

nint

pamoja_depletion_free(nint)

Releases a depletion handle. Passing null is a no-op.

public static extern void pamoja_depletion_free(nint depletion)

Parameters

depletion nint

pamoja_depletion_new(float)

Creates a depletion estimator.

public static extern nint pamoja_depletion_new(float threshold)

Parameters

threshold float

Returns

nint

pamoja_depletion_update(nint, float, out uint)

Records a level and estimates the samples until the threshold.

public static bool pamoja_depletion_update(nint depletion, float level, out uint outSamples)

Parameters

depletion nint
level float
outSamples uint

Returns

bool

pamoja_device_identity_free(nint)

Releases a device identity handle. Passing null is a no-op.

public static extern void pamoja_device_identity_free(nint identity)

Parameters

identity nint

pamoja_device_identity_new(ReadOnlySpan<byte>, nuint)

Creates a device identity from a 32-byte seed, or returns null.

public static nint pamoja_device_identity_new(ReadOnlySpan<byte> seed, nuint seedLen)

Parameters

seed ReadOnlySpan<byte>
seedLen nuint

Returns

nint

pamoja_device_identity_public_key(nint, Span<byte>)

Writes the 32-byte public key matching a device identity.

public static PamojaStatus pamoja_device_identity_public_key(nint identity, Span<byte> outPublicKey)

Parameters

identity nint
outPublicKey Span<byte>

Returns

PamojaStatus

pamoja_device_identity_sign(nint, ReadOnlySpan<byte>, nuint, Span<byte>)

Signs a payload, writing the 64-byte signature.

public static PamojaStatus pamoja_device_identity_sign(nint identity, ReadOnlySpan<byte> payload, nuint payloadLen, Span<byte> outSignature)

Parameters

identity nint
payload ReadOnlySpan<byte>
payloadLen nuint
outSignature Span<byte>

Returns

PamojaStatus

pamoja_device_identity_sign_message(nint, ReadOnlySpan<byte>, nuint, out nint)

Signs a payload, returning the signature followed by the payload.

public static PamojaStatus pamoja_device_identity_sign_message(nint identity, ReadOnlySpan<byte> payload, nuint payloadLen, out nint outBuffer)

Parameters

identity nint
payload ReadOnlySpan<byte>
payloadLen nuint
outBuffer nint

Returns

PamojaStatus

pamoja_ds18b20_build_scratchpad(float, byte, sbyte, sbyte, Span<byte>)

Builds the nine bytes a DS18B20 in the given state puts on the bus.

public static PamojaStatus pamoja_ds18b20_build_scratchpad(float celsius, byte bits, sbyte alarmHigh, sbyte alarmLow, Span<byte> outBytes)

Parameters

celsius float
bits byte
alarmHigh sbyte
alarmLow sbyte
outBytes Span<byte>

Returns

PamojaStatus

pamoja_ds18b20_celsius(short)

Converts a raw DS18B20 temperature register to degrees Celsius.

public static extern float pamoja_ds18b20_celsius(short raw)

Parameters

raw short

Returns

float

pamoja_ds18b20_config_byte(byte, out byte)

Returns the configuration byte that selects a DS18B20 resolution.

public static PamojaStatus pamoja_ds18b20_config_byte(byte bits, out byte outByte)

Parameters

bits byte
outByte byte

Returns

PamojaStatus

pamoja_ds18b20_crc8(ReadOnlySpan<byte>, nuint)

Computes the Maxim CRC-8 a 1-Wire device checks its bytes with.

public static byte pamoja_ds18b20_crc8(ReadOnlySpan<byte> data, nuint dataLen)

Parameters

data ReadOnlySpan<byte>
dataLen nuint

Returns

byte

pamoja_ds18b20_max_conversion_micros(byte, out uint)

Returns how long a DS18B20 conversion may take at a resolution.

public static PamojaStatus pamoja_ds18b20_max_conversion_micros(byte bits, out uint outMicros)

Parameters

bits byte
outMicros uint

Returns

PamojaStatus

pamoja_ds18b20_micro_celsius(short)

Converts a raw DS18B20 temperature register to micro-degrees Celsius.

public static extern int pamoja_ds18b20_micro_celsius(short raw)

Parameters

raw short

Returns

int

pamoja_ds18b20_parse_scratchpad(ReadOnlySpan<byte>, nuint, out PamojaDs18b20Reading)

Parses and CRC-checks a nine-byte DS18B20 scratchpad.

public static PamojaStatus pamoja_ds18b20_parse_scratchpad(ReadOnlySpan<byte> bytes, nuint bytesLen, out PamojaDs18b20Reading outReading)

Parameters

bytes ReadOnlySpan<byte>
bytesLen nuint
outReading PamojaDs18b20Reading

Returns

PamojaStatus

pamoja_ds18b20_resolution_bits(byte)

Returns the resolution a DS18B20 configuration byte selects, in bits.

public static extern byte pamoja_ds18b20_resolution_bits(byte configByte)

Parameters

configByte byte

Returns

byte

pamoja_ds18b20_step_micro_celsius(byte, out uint)

Returns the temperature step a DS18B20 resolution resolves.

public static PamojaStatus pamoja_ds18b20_step_micro_celsius(byte bits, out uint outMicroCelsius)

Parameters

bits byte
outMicroCelsius uint

Returns

PamojaStatus

pamoja_duty_cycle_fraction(PamojaDutyCycle)

Returns the share of a period a duty cycle spends awake.

public static extern float pamoja_duty_cycle_fraction(PamojaDutyCycle duty)

Parameters

duty PamojaDutyCycle

Returns

float

pamoja_duty_cycle_from_fraction(ulong, float)

Creates a duty cycle that spends a fraction of a period awake.

public static extern PamojaDutyCycle pamoja_duty_cycle_from_fraction(ulong periodUs, float fraction)

Parameters

periodUs ulong
fraction float

Returns

PamojaDutyCycle

pamoja_duty_cycle_new(ulong, ulong)

Creates a duty cycle from the time awake and the time asleep.

public static extern PamojaDutyCycle pamoja_duty_cycle_new(ulong activeUs, ulong sleepUs)

Parameters

activeUs ulong
sleepUs ulong

Returns

PamojaDutyCycle

pamoja_duty_cycle_period_us(PamojaDutyCycle)

Returns the whole period of a duty cycle.

public static extern ulong pamoja_duty_cycle_period_us(PamojaDutyCycle duty)

Parameters

duty PamojaDutyCycle

Returns

ulong

pamoja_envelope_body(ReadOnlySpan<byte>, nuint)

Copies out the signed body of an envelope.

public static nint pamoja_envelope_body(ReadOnlySpan<byte> bytes, nuint len)

Parameters

bytes ReadOnlySpan<byte>
len nuint

Returns

nint

pamoja_envelope_verify(ReadOnlySpan<byte>, nuint, ReadOnlySpan<byte>, out PamojaManifest)

Verifies an envelope and reads the manifest inside it.

public static PamojaStatus pamoja_envelope_verify(ReadOnlySpan<byte> bytes, nuint len, ReadOnlySpan<byte> publicKey, out PamojaManifest outManifest)

Parameters

bytes ReadOnlySpan<byte>
len nuint
publicKey ReadOnlySpan<byte>
outManifest PamojaManifest

Returns

PamojaStatus

pamoja_event_bus_free(nint)

Releases an event bus endpoint.

public static extern void pamoja_event_bus_free(nint bus)

Parameters

bus nint

pamoja_event_bus_new(nuint)

Creates an event bus.

public static extern nint pamoja_event_bus_new(nuint capacity)

Parameters

capacity nuint

Returns

nint

pamoja_event_bus_next(nint, out nint)

Waits for the next event on an endpoint.

public static PamojaStatus pamoja_event_bus_next(nint bus, out nint outEvent)

Parameters

bus nint
outEvent nint

Returns

PamojaStatus

pamoja_event_bus_publish(nint, ReadOnlySpan<byte>, nuint)

Publishes an event to every subscriber.

public static PamojaStatus pamoja_event_bus_publish(nint bus, ReadOnlySpan<byte> payload, nuint payloadLen)

Parameters

bus nint
payload ReadOnlySpan<byte>
payloadLen nuint

Returns

PamojaStatus

pamoja_event_bus_subscribe(nint)

Takes another endpoint on an event bus.

public static extern nint pamoja_event_bus_subscribe(nint bus)

Parameters

bus nint

Returns

nint

pamoja_frames_count(nint)

Returns how many frames a decoder call produced.

public static extern nuint pamoja_frames_count(nint frames)

Parameters

frames nint

Returns

nuint

pamoja_frames_data(nint, nuint)

Returns a pointer to one frame's payload bytes.

public static extern nint pamoja_frames_data(nint frames, nuint index)

Parameters

frames nint
index nuint

Returns

nint

pamoja_frames_free(nint)

Releases a decoded frame set. Passing null is a no-op.

public static extern void pamoja_frames_free(nint frames)

Parameters

frames nint

pamoja_frames_len(nint, nuint)

Returns the length in bytes of one frame's payload.

public static extern nuint pamoja_frames_len(nint frames, nuint index)

Parameters

frames nint
index nuint

Returns

nuint

pamoja_geofence_contains(nint, PamojaCoordinate)

Reports whether a fix lies inside a geofence.

public static bool pamoja_geofence_contains(nint geofence, PamojaCoordinate point)

Parameters

geofence nint
point PamojaCoordinate

Returns

bool

pamoja_geofence_free(nint)

Releases a geofence handle. Passing null is a no-op.

public static extern void pamoja_geofence_free(nint geofence)

Parameters

geofence nint

pamoja_geofence_new(PamojaCoordinate, double)

Creates a circular geofence.

public static extern nint pamoja_geofence_new(PamojaCoordinate center, double radiusM)

Parameters

center PamojaCoordinate
radiusM double

Returns

nint

pamoja_geofence_update(nint, PamojaCoordinate)

Feeds a fix to a geofence and reports where it sits.

public static extern PamojaBoundary pamoja_geofence_update(nint geofence, PamojaCoordinate point)

Parameters

geofence nint
point PamojaCoordinate

Returns

PamojaBoundary

pamoja_hdc1080_celsius(ushort)

Converts a raw HDC1080 temperature register to degrees Celsius. # Returns The temperature.

public static extern float pamoja_hdc1080_celsius(ushort raw)

Parameters

raw ushort

Returns

float

pamoja_hdc1080_config_from_register(ushort, out PamojaHdc1080Config)

Parses an HDC1080 configuration register value. # Returns [PamojaStatus::Ok] on success, with *out_config filled in, or [PamojaStatus::Codec] if the humidity-resolution field carries the code the datasheet leaves undefined, which means the value did not come from a working part. # Safety out_config must point to a writable PamojaHdc1080Config.

public static PamojaStatus pamoja_hdc1080_config_from_register(ushort raw, out PamojaHdc1080Config outConfig)

Parameters

raw ushort
outConfig PamojaHdc1080Config

Returns

PamojaStatus

pamoja_hdc1080_config_to_register(PamojaHdc1080Config, out ushort)

Assembles an HDC1080 configuration register value. # Returns [PamojaStatus::Ok] on success, with *out_register set, or [PamojaStatus::InvalidArgument] if either resolution is not one the part offers. # Safety out_register must point to a writable uint16_t.

public static PamojaStatus pamoja_hdc1080_config_to_register(PamojaHdc1080Config config, out ushort outRegister)

Parameters

config PamojaHdc1080Config
outRegister ushort

Returns

PamojaStatus

pamoja_hdc1080_conversion_time_micros(PamojaHdc1080Config, out uint)

Returns how long to wait after triggering an HDC1080 in a configuration. # Returns [PamojaStatus::Ok] on success, with *out_micros set, or [PamojaStatus::InvalidArgument] if either resolution is not one the part offers. # Safety out_micros must point to a writable uint32_t.

public static PamojaStatus pamoja_hdc1080_conversion_time_micros(PamojaHdc1080Config config, out uint outMicros)

Parameters

config PamojaHdc1080Config
outMicros uint

Returns

PamojaStatus

pamoja_hdc1080_humidity_conversion_micros(byte, out uint)

Returns how long an HDC1080 humidity conversion takes at a resolution. # Returns [PamojaStatus::Ok] on success, with *out_micros set, or [PamojaStatus::InvalidArgument] if bits is not 14, 11, or 8. # Safety out_micros must point to a writable uint32_t.

public static PamojaStatus pamoja_hdc1080_humidity_conversion_micros(byte bits, out uint outMicros)

Parameters

bits byte
outMicros uint

Returns

PamojaStatus

pamoja_hdc1080_humidity_register(uint)

Builds the HDC1080 humidity register that decodes to a relative humidity. # Returns The 14-bit code in bits 15:2, clamped to full scale.

public static extern ushort pamoja_hdc1080_humidity_register(uint milliPercent)

Parameters

milliPercent uint

Returns

ushort

pamoja_hdc1080_measurement_bytes(ushort, ushort, Span<byte>)

Builds the four bytes an HDC1080 sends for a pair of raw registers. # Returns [PamojaStatus::Ok] on success, with the four bytes written to out_bytes, or [PamojaStatus::InvalidArgument] if out_bytes is null. # Safety out_bytes must point to at least four writable bytes.

public static PamojaStatus pamoja_hdc1080_measurement_bytes(ushort temperatureRaw, ushort humidityRaw, Span<byte> outBytes)

Parameters

temperatureRaw ushort
humidityRaw ushort
outBytes Span<byte>

Returns

PamojaStatus

pamoja_hdc1080_measurement_from_physical(int, uint, out PamojaHdc1080Measurement)

Builds the HDC1080 measurement a sensor reporting these physical values would send.

Returns [PamojaStatus::Ok], with *out_measurement filled in, or

[PamojaStatus::InvalidArgument] if the pointer is null. # Safety out_measurement must point to a writable PamojaHdc1080Measurement.

public static PamojaStatus pamoja_hdc1080_measurement_from_physical(int milliCelsius, uint milliPercent, out PamojaHdc1080Measurement outMeasurement)

Parameters

milliCelsius int
milliPercent uint
outMeasurement PamojaHdc1080Measurement

Returns

PamojaStatus

pamoja_hdc1080_milli_celsius(ushort)

Converts a raw HDC1080 temperature register to milli-degrees Celsius. # Returns The temperature, exact in integer arithmetic.

public static extern int pamoja_hdc1080_milli_celsius(ushort raw)

Parameters

raw ushort

Returns

int

pamoja_hdc1080_milli_percent(ushort)

Converts a raw HDC1080 humidity register to milli-percent. # Returns The relative humidity, exact in integer arithmetic.

public static extern uint pamoja_hdc1080_milli_percent(ushort raw)

Parameters

raw ushort

Returns

uint

pamoja_hdc1080_parse_measurement(ReadOnlySpan<byte>, nuint, out PamojaHdc1080Measurement)

Parses the four bytes an HDC1080 sequential read returns. # Returns [PamojaStatus::Ok] on success, with *out_measurement filled in, or [PamojaStatus::InvalidArgument] if the buffer is not four bytes. The part sends no checksum, so a well-sized read always decodes. # Safety bytes must point to at least bytes_len readable bytes, and out_measurement must point to a writable PamojaHdc1080Measurement.

public static PamojaStatus pamoja_hdc1080_parse_measurement(ReadOnlySpan<byte> bytes, nuint bytesLen, out PamojaHdc1080Measurement outMeasurement)

Parameters

bytes ReadOnlySpan<byte>
bytesLen nuint
outMeasurement PamojaHdc1080Measurement

Returns

PamojaStatus

pamoja_hdc1080_relative_humidity(ushort)

Converts a raw HDC1080 humidity register to a relative humidity percentage. # Returns The relative humidity.

public static extern float pamoja_hdc1080_relative_humidity(ushort raw)

Parameters

raw ushort

Returns

float

pamoja_hdc1080_serial_id(ushort, ushort, ushort)

Joins the three HDC1080 serial-ID registers into the 40-bit serial number. # Returns The serial number.

public static extern ulong pamoja_hdc1080_serial_id(ushort high, ushort mid, ushort low)

Parameters

high ushort
mid ushort
low ushort

Returns

ulong

pamoja_hdc1080_serial_id_registers(ulong, out ushort)

Splits a serial number back into the three HDC1080 serial-ID registers. # Returns [PamojaStatus::Ok] on success, with the three registers written to out_registers high word first, or [PamojaStatus::InvalidArgument] if the pointer is null. # Safety out_registers must point to at least three writable uint16_t values.

public static PamojaStatus pamoja_hdc1080_serial_id_registers(ulong serial, out ushort outRegisters)

Parameters

serial ulong
outRegisters ushort

Returns

PamojaStatus

pamoja_hdc1080_temperature_conversion_micros(byte, out uint)

Returns how long an HDC1080 temperature conversion takes at a resolution. # Returns [PamojaStatus::Ok] on success, with *out_micros set, or [PamojaStatus::InvalidArgument] if bits is not 14 or 11. # Safety out_micros must point to a writable uint32_t.

public static PamojaStatus pamoja_hdc1080_temperature_conversion_micros(byte bits, out uint outMicros)

Parameters

bits byte
outMicros uint

Returns

PamojaStatus

pamoja_hdc1080_temperature_register(int)

Builds the HDC1080 temperature register that decodes to a temperature. # Returns The 14-bit code in bits 15:2, clamped to the part's range.

public static extern ushort pamoja_hdc1080_temperature_register(int milliCelsius)

Parameters

milliCelsius int

Returns

ushort

pamoja_i2c_address_frame(PamojaI2cAddress, PamojaI2cDirection, Span<byte>, nuint, out nuint)

Writes the address bytes a controller puts on the bus.

public static PamojaStatus pamoja_i2c_address_frame(PamojaI2cAddress address, PamojaI2cDirection direction, Span<byte> outFrame, nuint outFrameCap, out nuint outLen)

Parameters

address PamojaI2cAddress
direction PamojaI2cDirection
outFrame Span<byte>
outFrameCap nuint
outLen nuint

Returns

PamojaStatus

pamoja_i2c_address_frame_len(PamojaI2cAddress)

Returns how many bytes an address frame occupies.

public static extern nuint pamoja_i2c_address_frame_len(PamojaI2cAddress address)

Parameters

address PamojaI2cAddress

Returns

nuint

pamoja_i2c_address_is_general_call(PamojaI2cAddress)

Reports whether an address is the general call address 0x00.

public static bool pamoja_i2c_address_is_general_call(PamojaI2cAddress address)

Parameters

address PamojaI2cAddress

Returns

bool

pamoja_i2c_address_is_reserved(PamojaI2cAddress)

Reports whether an address falls in a reserved range.

public static bool pamoja_i2c_address_is_reserved(PamojaI2cAddress address)

Parameters

address PamojaI2cAddress

Returns

bool

pamoja_i2c_address_seven_bit(byte, out PamojaI2cAddress)

Validates a 7-bit I2C address.

public static PamojaStatus pamoja_i2c_address_seven_bit(byte address, out PamojaI2cAddress outAddress)

Parameters

address byte
outAddress PamojaI2cAddress

Returns

PamojaStatus

pamoja_i2c_address_ten_bit(ushort, out PamojaI2cAddress)

Validates a 10-bit I2C address.

public static PamojaStatus pamoja_i2c_address_ten_bit(ushort address, out PamojaI2cAddress outAddress)

Parameters

address ushort
outAddress PamojaI2cAddress

Returns

PamojaStatus

pamoja_image_digest(ReadOnlySpan<byte>, nuint, Span<byte>)

Hashes a complete image, for a publisher filling in a manifest.

public static PamojaStatus pamoja_image_digest(ReadOnlySpan<byte> image, nuint imageLen, Span<byte> outDigest)

Parameters

image ReadOnlySpan<byte>
imageLen nuint
outDigest Span<byte>

Returns

PamojaStatus

pamoja_image_verifier_finish(nint, out uint, Span<byte>)

Settles an image against its manifest, consuming the verifier.

public static PamojaStatus pamoja_image_verifier_finish(nint verifier, out uint outSize, Span<byte> outDigest)

Parameters

verifier nint
outSize uint
outDigest Span<byte>

Returns

PamojaStatus

pamoja_image_verifier_free(nint)

Releases a verifier handle that will not be settled.

public static extern void pamoja_image_verifier_free(nint verifier)

Parameters

verifier nint

pamoja_image_verifier_new(PamojaManifest)

Creates a verifier that hashes an image against a manifest.

public static extern nint pamoja_image_verifier_new(PamojaManifest manifest)

Parameters

manifest PamojaManifest

Returns

nint

pamoja_image_verifier_update(nint, ReadOnlySpan<byte>, nuint)

Takes the next piece of the image.

public static PamojaStatus pamoja_image_verifier_update(nint verifier, ReadOnlySpan<byte> chunk, nuint len)

Parameters

verifier nint
chunk ReadOnlySpan<byte>
len nuint

Returns

PamojaStatus

pamoja_ina219_bus_millivolts(ushort)

Converts a raw INA219 bus-voltage register to millivolts.

public static extern uint pamoja_ina219_bus_millivolts(ushort raw)

Parameters

raw ushort

Returns

uint

pamoja_ina219_bus_register(uint)

Builds the INA219 bus-voltage register for a bus voltage.

public static extern ushort pamoja_ina219_bus_register(uint millivolts)

Parameters

millivolts uint

Returns

ushort

pamoja_ina219_calibration(uint, uint)

Computes the INA219 calibration register.

public static extern ushort pamoja_ina219_calibration(uint currentLsbMicroamps, uint shuntMilliohms)

Parameters

currentLsbMicroamps uint
shuntMilliohms uint

Returns

ushort

pamoja_ina219_conversion_ready(ushort)

Reports whether an INA219 register says a conversion is ready.

public static bool pamoja_ina219_conversion_ready(ushort raw)

Parameters

raw ushort

Returns

bool

pamoja_ina219_current_microamps(short, uint)

Converts a raw INA219 current register to microamps.

public static extern int pamoja_ina219_current_microamps(short raw, uint currentLsbMicroamps)

Parameters

raw short
currentLsbMicroamps uint

Returns

int

pamoja_ina219_current_register(int, uint)

Builds the INA219 current register for a current.

public static extern short pamoja_ina219_current_register(int microamps, uint currentLsbMicroamps)

Parameters

microamps int
currentLsbMicroamps uint

Returns

short

pamoja_ina219_math_overflow(ushort)

Reports whether an INA219 register flags a math overflow.

public static bool pamoja_ina219_math_overflow(ushort raw)

Parameters

raw ushort

Returns

bool

pamoja_ina219_minimum_current_lsb_microamps(uint)

Returns the smallest current resolution covering an expected maximum.

public static extern uint pamoja_ina219_minimum_current_lsb_microamps(uint maxExpectedMicroamps)

Parameters

maxExpectedMicroamps uint

Returns

uint

pamoja_ina219_power_microwatts(ushort, uint)

Converts a raw INA219 power register to microwatts.

public static extern uint pamoja_ina219_power_microwatts(ushort raw, uint currentLsbMicroamps)

Parameters

raw ushort
currentLsbMicroamps uint

Returns

uint

pamoja_ina219_power_register(uint, uint)

Builds the INA219 power register for a power.

public static extern ushort pamoja_ina219_power_register(uint microwatts, uint currentLsbMicroamps)

Parameters

microwatts uint
currentLsbMicroamps uint

Returns

ushort

pamoja_ina219_shunt_microvolts(short)

Converts a raw INA219 shunt-voltage register to microvolts.

public static extern int pamoja_ina219_shunt_microvolts(short raw)

Parameters

raw short

Returns

int

pamoja_ina219_shunt_register(int)

Builds the INA219 shunt-voltage register for a shunt voltage.

public static extern short pamoja_ina219_shunt_register(int microvolts)

Parameters

microvolts int

Returns

short

pamoja_ina226_active_alert_function(PamojaIna226MaskEnable, out PamojaIna226AlertFunction)

Returns the alert function an INA226 pin actually responds to. # Returns true when one limit function is selected, with *out_function set to it; false when none is, so the pin only ever signals a completed conversion. # Safety out_function must point to a writable PamojaIna226AlertFunction.

public static bool pamoja_ina226_active_alert_function(PamojaIna226MaskEnable mask, out PamojaIna226AlertFunction outFunction)

Parameters

mask PamojaIna226MaskEnable
outFunction PamojaIna226AlertFunction

Returns

bool

pamoja_ina226_address(byte, byte, out byte)

Returns the I2C address an INA226's A1 and A0 pin codes select. # Returns [PamojaStatus::Ok] on success, with *out_address set to a 7-bit address in 0x40..=0x4F, or [PamojaStatus::InvalidArgument] if either code is above 3. # Safety out_address must point to a writable uint8_t.

public static PamojaStatus pamoja_ina226_address(byte a1, byte a0, out byte outAddress)

Parameters

a1 byte
a0 byte
outAddress byte

Returns

PamojaStatus

pamoja_ina226_averaging_samples(byte)

Returns how many samples an INA226 averaging code folds into one result. # Returns The sample count, from 1 to 1024.

public static extern ushort pamoja_ina226_averaging_samples(byte code)

Parameters

code byte

Returns

ushort

pamoja_ina226_bus_microvolts(ushort)

Converts a raw INA226 bus-voltage register to microvolts. # Returns The bus voltage, exact in integer arithmetic at 1.25 mV per count.

public static extern uint pamoja_ina226_bus_microvolts(ushort raw)

Parameters

raw ushort

Returns

uint

pamoja_ina226_bus_register(uint)

Builds the INA226 bus-voltage register a monitor reports for a bus voltage. # Returns The register value, at 1.25 mV per count.

public static extern ushort pamoja_ina226_bus_register(uint microvolts)

Parameters

microvolts uint

Returns

ushort

pamoja_ina226_bus_volts(ushort)

Converts a raw INA226 bus-voltage register to volts. # Returns The bus voltage.

public static extern float pamoja_ina226_bus_volts(ushort raw)

Parameters

raw ushort

Returns

float

pamoja_ina226_calibration(uint, uint)

Computes the INA226 calibration register for a shunt and current resolution. # Returns The register value to write.

public static extern ushort pamoja_ina226_calibration(uint currentLsbMicroamps, uint shuntMilliohms)

Parameters

currentLsbMicroamps uint
shuntMilliohms uint

Returns

ushort

pamoja_ina226_config_from_register(ushort, out PamojaIna226Config)

Parses an INA226 configuration register value. # Returns [PamojaStatus::Ok], with *out_config filled in. Every register value decodes, so this fails only on a null pointer. # Safety out_config must point to a writable PamojaIna226Config.

public static PamojaStatus pamoja_ina226_config_from_register(ushort raw, out PamojaIna226Config outConfig)

Parameters

raw ushort
outConfig PamojaIna226Config

Returns

PamojaStatus

pamoja_ina226_config_to_register(PamojaIna226Config)

Assembles an INA226 configuration register value. # Returns The register value to write.

public static extern ushort pamoja_ina226_config_to_register(PamojaIna226Config config)

Parameters

config PamojaIna226Config

Returns

ushort

pamoja_ina226_conversion_micros(byte)

Returns the conversion time an INA226 code selects. # Returns The time in microseconds.

public static extern uint pamoja_ina226_conversion_micros(byte code)

Parameters

code byte

Returns

uint

pamoja_ina226_current_amps(short, uint)

Converts a raw INA226 current register to amps. # Returns The current.

public static extern float pamoja_ina226_current_amps(short raw, uint currentLsbMicroamps)

Parameters

raw short
currentLsbMicroamps uint

Returns

float

pamoja_ina226_current_microamps(short, uint)

Converts a raw INA226 current register to microamps. # Returns The current, at the resolution the calibration selected.

public static extern int pamoja_ina226_current_microamps(short raw, uint currentLsbMicroamps)

Parameters

raw short
currentLsbMicroamps uint

Returns

int

pamoja_ina226_current_register(int, uint)

Builds the INA226 current register a monitor reports for a current. # Returns The signed register value, or zero if current_lsb_microamps is zero.

public static extern short pamoja_ina226_current_register(int microamps, uint currentLsbMicroamps)

Parameters

microamps int
currentLsbMicroamps uint

Returns

short

pamoja_ina226_current_register_from_shunt(short, ushort)

Computes the INA226 current register the chip derives from a shunt reading. # Returns The signed current register the part's own arithmetic produces.

public static extern short pamoja_ina226_current_register_from_shunt(short shunt, ushort calibration)

Parameters

shunt short
calibration ushort

Returns

short

pamoja_ina226_die_id(ushort, out PamojaIna226DieId)

Splits an INA226 die-ID register into its device and revision fields. # Returns [PamojaStatus::Ok], with *out_die_id filled in. Every register value decodes, so this fails only on a null pointer. # Safety out_die_id must point to a writable PamojaIna226DieId.

public static PamojaStatus pamoja_ina226_die_id(ushort raw, out PamojaIna226DieId outDieId)

Parameters

raw ushort
outDieId PamojaIna226DieId

Returns

PamojaStatus

pamoja_ina226_identify(ushort, ushort, out PamojaIna226DieId)

Checks that a pair of identification registers belongs to an INA226. # Returns [PamojaStatus::Ok] on success, with *out_die_id filled in, or [PamojaStatus::Codec] if either register carries something other than the values the datasheet fixes, which means a different part, or nothing at all, answered at that address. # Safety out_die_id must point to a writable PamojaIna226DieId.

public static PamojaStatus pamoja_ina226_identify(ushort manufacturerId, ushort dieId, out PamojaIna226DieId outDieId)

Parameters

manufacturerId ushort
dieId ushort
outDieId PamojaIna226DieId

Returns

PamojaStatus

pamoja_ina226_is_continuous(byte)

Reports whether an INA226 mode code keeps converting after the first result. # Returns true for the continuous modes.

public static bool pamoja_ina226_is_continuous(byte code)

Parameters

code byte

Returns

bool

pamoja_ina226_mask_enable_from_register(ushort, out PamojaIna226MaskEnable)

Parses an INA226 Mask/Enable register value. # Returns [PamojaStatus::Ok], with *out_mask filled in. Every register value decodes, so this fails only on a null pointer. # Safety out_mask must point to a writable PamojaIna226MaskEnable.

public static PamojaStatus pamoja_ina226_mask_enable_from_register(ushort raw, out PamojaIna226MaskEnable outMask)

Parameters

raw ushort
outMask PamojaIna226MaskEnable

Returns

PamojaStatus

pamoja_ina226_mask_enable_to_register(PamojaIna226MaskEnable)

Assembles an INA226 Mask/Enable register value. # Returns The register value to write, with the read-only flags written as zero.

public static extern ushort pamoja_ina226_mask_enable_to_register(PamojaIna226MaskEnable mask)

Parameters

mask PamojaIna226MaskEnable

Returns

ushort

pamoja_ina226_measures_bus(byte)

Reports whether an INA226 mode code converts the bus voltage. # Returns true when the bus is measured in that mode.

public static bool pamoja_ina226_measures_bus(byte code)

Parameters

code byte

Returns

bool

pamoja_ina226_measures_shunt(byte)

Reports whether an INA226 mode code converts the shunt voltage. # Returns true when the shunt is measured in that mode.

public static bool pamoja_ina226_measures_shunt(byte code)

Parameters

code byte

Returns

bool

pamoja_ina226_minimum_current_lsb_microamps(uint)

Returns the smallest current resolution that still covers an expected maximum. # Returns The current LSB in microamps.

public static extern uint pamoja_ina226_minimum_current_lsb_microamps(uint maxExpectedMicroamps)

Parameters

maxExpectedMicroamps uint

Returns

uint

pamoja_ina226_power_microwatts(ushort, uint)

Converts a raw INA226 power register to microwatts. # Returns The power. The power LSB is fixed at twenty-five times the current LSB.

public static extern uint pamoja_ina226_power_microwatts(ushort raw, uint currentLsbMicroamps)

Parameters

raw ushort
currentLsbMicroamps uint

Returns

uint

pamoja_ina226_power_register(uint, uint)

Builds the INA226 power register a monitor reports for a power. # Returns The register value, or zero if current_lsb_microamps is zero.

public static extern ushort pamoja_ina226_power_register(uint microwatts, uint currentLsbMicroamps)

Parameters

microwatts uint
currentLsbMicroamps uint

Returns

ushort

pamoja_ina226_power_register_from_current(short, ushort)

Computes the INA226 power register the chip derives from a current reading. # Returns The power register the part's own arithmetic produces.

public static extern ushort pamoja_ina226_power_register_from_current(short current, ushort bus)

Parameters

current short
bus ushort

Returns

ushort

pamoja_ina226_power_watts(ushort, uint)

Converts a raw INA226 power register to watts. # Returns The power.

public static extern float pamoja_ina226_power_watts(ushort raw, uint currentLsbMicroamps)

Parameters

raw ushort
currentLsbMicroamps uint

Returns

float

pamoja_ina226_shunt_millivolts(short)

Converts a raw INA226 shunt-voltage register to millivolts. # Returns The shunt voltage.

public static extern float pamoja_ina226_shunt_millivolts(short raw)

Parameters

raw short

Returns

float

pamoja_ina226_shunt_nanovolts(short)

Converts a raw INA226 shunt-voltage register to nanovolts. # Returns The shunt voltage, exact in integer arithmetic at 2.5 uV per count.

public static extern int pamoja_ina226_shunt_nanovolts(short raw)

Parameters

raw short

Returns

int

pamoja_ina226_shunt_register(int)

Builds the INA226 shunt-voltage register a monitor reports for a shunt voltage. # Returns The signed register value, at 2.5 uV per count.

public static extern short pamoja_ina226_shunt_register(int nanovolts)

Parameters

nanovolts int

Returns

short

pamoja_ina226_update_micros(PamojaIna226Config)

Returns how often an INA226 in a configuration updates its results. # Returns The interval in microseconds: every conversion the mode takes, averaged.

public static extern uint pamoja_ina226_update_micros(PamojaIna226Config config)

Parameters

config PamojaIna226Config

Returns

uint

pamoja_kalman_estimate(nint)

Reads a Kalman filter's current estimate.

public static extern float pamoja_kalman_estimate(nint kalman)

Parameters

kalman nint

Returns

float

pamoja_kalman_free(nint)

Releases a Kalman handle. Passing null is a no-op.

public static extern void pamoja_kalman_free(nint kalman)

Parameters

kalman nint

pamoja_kalman_new(float, float, float)

Creates a one-dimensional Kalman filter.

public static extern nint pamoja_kalman_new(float processNoise, float measurementNoise, float initial)

Parameters

processNoise float
measurementNoise float
initial float

Returns

nint

pamoja_kalman_update(nint, float)

Folds a reading into a Kalman filter and returns the estimate.

public static extern float pamoja_kalman_update(nint kalman, float reading)

Parameters

kalman nint
reading float

Returns

float

pamoja_keyexpr_canonize(string)

Rewrites a key expression into its canonical form.

public static nint pamoja_keyexpr_canonize(string key)

Parameters

key string

Returns

nint

pamoja_keyexpr_is_canon(string)

Reports whether a key expression is already canonical.

public static bool pamoja_keyexpr_is_canon(string key)

Parameters

key string

Returns

bool

pamoja_keyexpr_is_valid(string)

Reports whether a key expression is well formed.

public static bool pamoja_keyexpr_is_valid(string key)

Parameters

key string

Returns

bool

pamoja_keyexpr_matches(string, string)

Reports whether a pattern selects a key.

public static bool pamoja_keyexpr_matches(string pattern, string key)

Parameters

pattern string
key string

Returns

bool

pamoja_kit_deadband(float, float, float)

Suppresses movement within a band around a center value.

public static extern float pamoja_kit_deadband(float value, float center, float width)

Parameters

value float
center float
width float

Returns

float

pamoja_ladder_buffered(nint, out nuint)

Reports how many messages a ladder has buffered.

public static PamojaStatus pamoja_ladder_buffered(nint ladder, out nuint outCount)

Parameters

ladder nint
outCount nuint

Returns

PamojaStatus

pamoja_ladder_connect(nint)

Connects every rung of a ladder.

public static extern PamojaStatus pamoja_ladder_connect(nint ladder)

Parameters

ladder nint

Returns

PamojaStatus

pamoja_ladder_flush(nint, out nuint)

Replays the buffer of a ladder over its rungs.

public static PamojaStatus pamoja_ladder_flush(nint ladder, out nuint outSent)

Parameters

ladder nint
outSent nuint

Returns

PamojaStatus

pamoja_ladder_free(nint)

Releases a ladder handle.

public static extern void pamoja_ladder_free(nint ladder)

Parameters

ladder nint

pamoja_ladder_new(nint)

Creates a ladder buffering into a store.

public static extern nint pamoja_ladder_new(nint store)

Parameters

store nint

Returns

nint

pamoja_ladder_rung(nint, nint)

Adds a rung to a ladder.

public static extern PamojaStatus pamoja_ladder_rung(nint ladder, nint transport)

Parameters

ladder nint
transport nint

Returns

PamojaStatus

pamoja_ladder_send(nint, nint, ReadOnlySpan<byte>, nuint, out PamojaDelivery)

Sends a payload through a ladder.

public static PamojaStatus pamoja_ladder_send(nint ladder, nint topic, ReadOnlySpan<byte> payload, nuint payloadLen, out PamojaDelivery outDelivery)

Parameters

ladder nint
topic nint
payload ReadOnlySpan<byte>
payloadLen nuint
outDelivery PamojaDelivery

Returns

PamojaStatus

pamoja_last_error_message()

Returns the calling thread's most recent error message, or null.

public static extern nint pamoja_last_error_message()

Returns

nint

Returns the level a link cost calls for.

public static extern PamojaTelemetryLevel pamoja_link_cost_threshold(PamojaLinkCost cost)

Parameters

cost PamojaLinkCost

Returns

PamojaTelemetryLevel

pamoja_loopback_broker_free(nint)

Releases a broker handle.

public static extern void pamoja_loopback_broker_free(nint broker)

Parameters

broker nint

pamoja_loopback_broker_new()

Creates an in-process broker.

public static extern nint pamoja_loopback_broker_new()

Returns

nint

pamoja_loopback_transport_connect(nint)

Marks a loopback link connected.

public static extern PamojaStatus pamoja_loopback_transport_connect(nint transport)

Parameters

transport nint

Returns

PamojaStatus

pamoja_loopback_transport_disconnect(nint)

Marks a loopback link disconnected.

public static extern void pamoja_loopback_transport_disconnect(nint transport)

Parameters

transport nint

pamoja_loopback_transport_free(nint)

Releases a loopback link handle.

public static extern void pamoja_loopback_transport_free(nint transport)

Parameters

transport nint

pamoja_loopback_transport_is_connected(nint)

Reports whether a loopback link is connected.

public static bool pamoja_loopback_transport_is_connected(nint transport)

Parameters

transport nint

Returns

bool

pamoja_loopback_transport_new(nint)

Creates a link to a broker.

public static extern nint pamoja_loopback_transport_new(nint broker)

Parameters

broker nint

Returns

nint

pamoja_loopback_transport_recv(nint, out nint)

Waits for the next message on a loopback link.

public static PamojaStatus pamoja_loopback_transport_recv(nint transport, out nint outMessage)

Parameters

transport nint
outMessage nint

Returns

PamojaStatus

pamoja_loopback_transport_send(nint, nint, ReadOnlySpan<byte>, nuint)

Publishes a payload on a loopback link.

public static PamojaStatus pamoja_loopback_transport_send(nint transport, nint topic, ReadOnlySpan<byte> payload, nuint payloadLen)

Parameters

transport nint
topic nint
payload ReadOnlySpan<byte>
payloadLen nuint

Returns

PamojaStatus

pamoja_loopback_transport_subscribe(nint, nint)

Subscribes a loopback link to a topic.

public static extern PamojaStatus pamoja_loopback_transport_subscribe(nint transport, nint topic)

Parameters

transport nint
topic nint

Returns

PamojaStatus

Returns the time on air of a payload, in microseconds.

public static extern ulong pamoja_lora_airtime_us(PamojaLoraLink link, nuint payloadLen)

Parameters

link PamojaLoraLink
payloadLen nuint

Returns

ulong

Returns LoRa link settings with the LoRa defaults filled in.

public static extern PamojaLoraLink pamoja_lora_link_default(byte spreadingFactor, uint bandwidthHz)

Parameters

spreadingFactor byte
bandwidthHz uint

Returns

PamojaLoraLink

Returns the silence a duty-cycle limit forces after a transmission.

public static extern ulong pamoja_lora_min_off_time_us(PamojaLoraLink link, nuint payloadLen, uint dutyCyclePermille)

Parameters

link PamojaLoraLink
payloadLen nuint
dutyCyclePermille uint

Returns

ulong

pamoja_lora_plan_builder_build(nint, out nint)

Finishes a plan, consuming the builder.

public static PamojaStatus pamoja_lora_plan_builder_build(nint builder, out nint outPlan)

Parameters

builder nint
outPlan nint

Returns

PamojaStatus

pamoja_lora_plan_builder_free(nint)

Releases a plan builder that will not be built.

public static extern void pamoja_lora_plan_builder_free(nint builder)

Parameters

builder nint

pamoja_lora_plan_builder_new(string, out nint)

Creates an empty plan builder.

public static PamojaStatus pamoja_lora_plan_builder_new(string name, out nint outBuilder)

Parameters

name string
outBuilder nint

Returns

PamojaStatus

pamoja_lora_plan_builder_push_backoff(nint, byte, byte)

Appends the next entry in the adaptive back-off chain.

public static extern PamojaStatus pamoja_lora_plan_builder_push_backoff(nint builder, byte hasLower, byte dataRate)

Parameters

builder nint
hasLower byte
dataRate byte

Returns

PamojaStatus

pamoja_lora_plan_builder_push_channel_block(nint, uint, in PamojaLoraChannelBlock)

Appends a run of evenly spaced channels to the plan.

public static PamojaStatus pamoja_lora_plan_builder_push_channel_block(nint builder, uint which, in PamojaLoraChannelBlock block)

Parameters

builder nint
which uint
block PamojaLoraChannelBlock

Returns

PamojaStatus

pamoja_lora_plan_builder_push_data_rate(nint, uint, in PamojaLoraDataRate)

Appends a data rate to the end of a direction's table.

public static PamojaStatus pamoja_lora_plan_builder_push_data_rate(nint builder, uint direction, in PamojaLoraDataRate rate)

Parameters

builder nint
direction uint
rate PamojaLoraDataRate

Returns

PamojaStatus

pamoja_lora_plan_builder_push_max_payload(nint, uint, byte, ushort, ushort)

Appends a payload limit to the end of one of the plan's tables.

public static extern PamojaStatus pamoja_lora_plan_builder_push_max_payload(nint builder, uint table, byte present, ushort macPayload, ushort application)

Parameters

builder nint
table uint
present byte
macPayload ushort
application ushort

Returns

PamojaStatus

pamoja_lora_plan_builder_push_rx1_row(nint, byte, ReadOnlySpan<byte>, nuint)

Appends one uplink data rate's row of RX1 downlink data rates.

public static PamojaStatus pamoja_lora_plan_builder_push_rx1_row(nint builder, byte dwellLimited, ReadOnlySpan<byte> offsets, nuint offsetsLen)

Parameters

builder nint
dwellLimited byte
offsets ReadOnlySpan<byte>
offsetsLen nuint

Returns

PamojaStatus

pamoja_lora_plan_builder_push_sub_band(nint, in PamojaLoraSubBand)

Appends a sub-band and its transmit limits to the plan.

public static PamojaStatus pamoja_lora_plan_builder_push_sub_band(nint builder, in PamojaLoraSubBand band)

Parameters

builder nint
band PamojaLoraSubBand

Returns

PamojaStatus

pamoja_lora_plan_builder_set_beacon(nint, in PamojaLoraBeacon, byte)

Sets the plan's Class B beacon and whether it limits dwell time.

public static PamojaStatus pamoja_lora_plan_builder_set_beacon(nint builder, in PamojaLoraBeacon beacon, byte hasDwellTimeLimit)

Parameters

builder nint
beacon PamojaLoraBeacon
hasDwellTimeLimit byte

Returns

PamojaStatus

pamoja_lora_plan_builder_set_power(nint, sbyte, byte, byte)

Sets the plan's transmit-power ladder.

public static extern PamojaStatus pamoja_lora_plan_builder_set_power(nint builder, sbyte defaultMaxEirpDbm, byte txPowerStepDb, byte maxTxPowerIndex)

Parameters

builder nint
defaultMaxEirpDbm sbyte
txPowerStepDb byte
maxTxPowerIndex byte

Returns

PamojaStatus

pamoja_lora_plan_builder_set_rx(nint, uint, byte, byte)

Sets the plan's receive windows.

public static extern PamojaStatus pamoja_lora_plan_builder_set_rx(nint builder, uint rx2FrequencyHz, byte rx2DataRate, byte maxRx1DataRateOffset)

Parameters

builder nint
rx2FrequencyHz uint
rx2DataRate byte
maxRx1DataRateOffset byte

Returns

PamojaStatus

pamoja_lora_plan_channel_block(nint, uint, ushort, out PamojaLoraChannelBlock)

Returns one of the plan's channel blocks.

public static PamojaStatus pamoja_lora_plan_channel_block(nint plan, uint which, ushort index, out PamojaLoraChannelBlock outBlock)

Parameters

plan nint
which uint
index ushort
outBlock PamojaLoraChannelBlock

Returns

PamojaStatus

pamoja_lora_plan_channel_frequency_hz(nint, ushort, out uint)

Returns the center frequency of one of the plan's default channels.

public static PamojaStatus pamoja_lora_plan_channel_frequency_hz(nint plan, ushort channel, out uint outFrequencyHz)

Parameters

plan nint
channel ushort
outFrequencyHz uint

Returns

PamojaStatus

pamoja_lora_plan_data_rate(nint, uint, byte, out PamojaLoraDataRate)

Returns the data rate a number selects.

public static PamojaStatus pamoja_lora_plan_data_rate(nint plan, uint direction, byte dataRate, out PamojaLoraDataRate outRate)

Parameters

plan nint
direction uint
dataRate byte
outRate PamojaLoraDataRate

Returns

PamojaStatus

pamoja_lora_plan_duty_cycle_permille(nint, uint, out uint)

Returns the share of time a transmitter may hold a frequency.

public static PamojaStatus pamoja_lora_plan_duty_cycle_permille(nint plan, uint frequencyHz, out uint outPermille)

Parameters

plan nint
frequencyHz uint
outPermille uint

Returns

PamojaStatus

pamoja_lora_plan_for_region(uint, out nint)

Returns the published channel plan for a region.

public static PamojaStatus pamoja_lora_plan_for_region(uint region, out nint outPlan)

Parameters

region uint
outPlan nint

Returns

PamojaStatus

pamoja_lora_plan_free(nint)

Releases a channel plan.

public static extern void pamoja_lora_plan_free(nint plan)

Parameters

plan nint

pamoja_lora_plan_info(nint, out PamojaLoraPlanInfo)

Reads the scalar facts of a plan in one call.

public static PamojaStatus pamoja_lora_plan_info(nint plan, out PamojaLoraPlanInfo outInfo)

Parameters

plan nint
outInfo PamojaLoraPlanInfo

Returns

PamojaStatus

Returns the radio settings an uplink data rate selects.

public static PamojaStatus pamoja_lora_plan_link_settings(nint plan, byte dataRate, out PamojaLoraLink outLink)

Parameters

plan nint
dataRate byte
outLink PamojaLoraLink

Returns

PamojaStatus

pamoja_lora_plan_max_eirp_dbm(nint, uint, out sbyte)

Returns the power ceiling that applies at a frequency, in dBm EIRP.

public static PamojaStatus pamoja_lora_plan_max_eirp_dbm(nint plan, uint frequencyHz, out sbyte outDbm)

Parameters

plan nint
frequencyHz uint
outDbm sbyte

Returns

PamojaStatus

pamoja_lora_plan_max_payload(nint, uint, byte, out PamojaLoraMaxPayload)

Returns what a data rate may carry in one frame.

public static PamojaStatus pamoja_lora_plan_max_payload(nint plan, uint table, byte dataRate, out PamojaLoraMaxPayload outPayload)

Parameters

plan nint
table uint
dataRate byte
outPayload PamojaLoraMaxPayload

Returns

PamojaStatus

pamoja_lora_plan_name(nint)

Returns the plan's name as an owned string.

public static extern nint pamoja_lora_plan_name(nint plan)

Parameters

plan nint

Returns

nint

pamoja_lora_plan_next_backoff_data_rate(nint, byte, out byte)

Returns the next lower data rate for adaptive back-off.

public static PamojaStatus pamoja_lora_plan_next_backoff_data_rate(nint plan, byte dataRate, out byte outDataRate)

Parameters

plan nint
dataRate byte
outDataRate byte

Returns

PamojaStatus

pamoja_lora_plan_rx1_data_rate(nint, byte, byte, byte, out byte)

Returns the downlink data rate the first receive window listens at.

public static PamojaStatus pamoja_lora_plan_rx1_data_rate(nint plan, byte uplinkDataRate, byte offset, byte dwellLimited, out byte outDataRate)

Parameters

plan nint
uplinkDataRate byte
offset byte
dwellLimited byte
outDataRate byte

Returns

PamojaStatus

pamoja_lora_plan_sub_band(nint, ushort, out PamojaLoraSubBand)

Returns one of the plan's sub-bands.

public static PamojaStatus pamoja_lora_plan_sub_band(nint plan, ushort index, out PamojaLoraSubBand outBand)

Parameters

plan nint
index ushort
outBand PamojaLoraSubBand

Returns

PamojaStatus

pamoja_lora_plan_tx_power_dbm(nint, byte, sbyte, out sbyte)

Returns the radiated power a transmit-power index selects, in dBm.

public static PamojaStatus pamoja_lora_plan_tx_power_dbm(nint plan, byte index, sbyte maxEirpDbm, out sbyte outDbm)

Parameters

plan nint
index byte
maxEirpDbm sbyte
outDbm sbyte

Returns

PamojaStatus

pamoja_lora_region_is_available(uint)

Reports whether a region is compiled into this build.

public static extern byte pamoja_lora_region_is_available(uint region)

Parameters

region uint

Returns

byte

Returns the duration of one symbol on a link, in microseconds.

public static extern ulong pamoja_lora_symbol_time_us(PamojaLoraLink link)

Parameters

link PamojaLoraLink

Returns

ulong

pamoja_lorawan_device_accept_join(nint, ReadOnlySpan<byte>, nuint, ushort, out nint)

Turns the join accept a network sent into the settings it grants.

public static PamojaStatus pamoja_lorawan_device_accept_join(nint device, ReadOnlySpan<byte> bytes, nuint bytesLen, ushort devNonce, out nint outAccept)

Parameters

device nint
bytes ReadOnlySpan<byte>
bytesLen nuint
devNonce ushort
outAccept nint

Returns

PamojaStatus

pamoja_lorawan_device_free(nint)

Releases a device handle. Passing null is a no-op.

public static extern void pamoja_lorawan_device_free(nint device)

Parameters

device nint

pamoja_lorawan_device_join_request(nint, ushort, out nint)

Builds the join request a device broadcasts to activate.

public static PamojaStatus pamoja_lorawan_device_join_request(nint device, ushort devNonce, out nint outFrame)

Parameters

device nint
devNonce ushort
outFrame nint

Returns

PamojaStatus

pamoja_lorawan_device_new(ReadOnlySpan<byte>, nuint, ReadOnlySpan<byte>, nuint, ReadOnlySpan<byte>, nuint, out nint)

Creates a device from the root credentials activation uses.

public static PamojaStatus pamoja_lorawan_device_new(ReadOnlySpan<byte> devEui, nuint devEuiLen, ReadOnlySpan<byte> appEui, nuint appEuiLen, ReadOnlySpan<byte> appKey, nuint appKeyLen, out nint outDevice)

Parameters

devEui ReadOnlySpan<byte>
devEuiLen nuint
appEui ReadOnlySpan<byte>
appEuiLen nuint
appKey ReadOnlySpan<byte>
appKeyLen nuint
outDevice nint

Returns

PamojaStatus

pamoja_lorawan_grant_accept(PamojaLorawanGrant, ReadOnlySpan<byte>, nuint, ReadOnlySpan<byte>, nuint, ushort, out nint)

Builds the signed join-accept a network sends to admit a device.

public static PamojaStatus pamoja_lorawan_grant_accept(PamojaLorawanGrant grant, ReadOnlySpan<byte> cflist, nuint cflistLen, ReadOnlySpan<byte> appKey, nuint appKeyLen, ushort devNonce, out nint outFrame)

Parameters

grant PamojaLorawanGrant
cflist ReadOnlySpan<byte>
cflistLen nuint
appKey ReadOnlySpan<byte>
appKeyLen nuint
devNonce ushort
outFrame nint

Returns

PamojaStatus

pamoja_lorawan_grant_session(PamojaLorawanGrant, ReadOnlySpan<byte>, nuint, ReadOnlySpan<byte>, nuint, ushort, out nint)

Derives the session a grant activates.

public static PamojaStatus pamoja_lorawan_grant_session(PamojaLorawanGrant grant, ReadOnlySpan<byte> cflist, nuint cflistLen, ReadOnlySpan<byte> appKey, nuint appKeyLen, ushort devNonce, out nint outSession)

Parameters

grant PamojaLorawanGrant
cflist ReadOnlySpan<byte>
cflistLen nuint
appKey ReadOnlySpan<byte>
appKeyLen nuint
devNonce ushort
outSession nint

Returns

PamojaStatus

pamoja_lorawan_header_parse(ReadOnlySpan<byte>, nuint, out PamojaLorawanHeader)

Reads a frame far enough to route it, without any key.

public static PamojaStatus pamoja_lorawan_header_parse(ReadOnlySpan<byte> bytes, nuint bytesLen, out PamojaLorawanHeader outHeader)

Parameters

bytes ReadOnlySpan<byte>
bytesLen nuint
outHeader PamojaLorawanHeader

Returns

PamojaStatus

pamoja_lorawan_join_accept_dev_addr(nint)

Returns the device address a join grants.

public static extern uint pamoja_lorawan_join_accept_dev_addr(nint accept)

Parameters

accept nint

Returns

uint

pamoja_lorawan_join_accept_dl_settings(nint)

Returns the downlink settings byte a join grants.

public static extern byte pamoja_lorawan_join_accept_dl_settings(nint accept)

Parameters

accept nint

Returns

byte

pamoja_lorawan_join_accept_free(nint)

Releases an accepted join handle. Passing null is a no-op.

public static extern void pamoja_lorawan_join_accept_free(nint accept)

Parameters

accept nint

pamoja_lorawan_join_accept_net_id(nint)

Returns the identifier of the network that accepted a join.

public static extern uint pamoja_lorawan_join_accept_net_id(nint accept)

Parameters

accept nint

Returns

uint

pamoja_lorawan_join_accept_rx_delay(nint)

Returns the delay before the first receive window, in seconds.

public static extern byte pamoja_lorawan_join_accept_rx_delay(nint accept)

Parameters

accept nint

Returns

byte

pamoja_lorawan_join_accept_session(nint, out nint)

Takes the activated session a join grants.

public static PamojaStatus pamoja_lorawan_join_accept_session(nint accept, out nint outSession)

Parameters

accept nint
outSession nint

Returns

PamojaStatus

pamoja_lorawan_join_request_app_eui(nint, Span<byte>)

Copies the application identifier out of a verified join-request.

public static bool pamoja_lorawan_join_request_app_eui(nint request, Span<byte> outAppEui)

Parameters

request nint
outAppEui Span<byte>

Returns

bool

pamoja_lorawan_join_request_dev_eui(nint, Span<byte>)

Copies the device identifier out of a verified join-request.

public static bool pamoja_lorawan_join_request_dev_eui(nint request, Span<byte> outDevEui)

Parameters

request nint
outDevEui Span<byte>

Returns

bool

pamoja_lorawan_join_request_dev_nonce(nint)

Returns the nonce a verified join-request carried.

public static extern ushort pamoja_lorawan_join_request_dev_nonce(nint request)

Parameters

request nint

Returns

ushort

pamoja_lorawan_join_request_free(nint)

Releases a verified join-request handle. Passing null is a no-op.

public static extern void pamoja_lorawan_join_request_free(nint request)

Parameters

request nint

pamoja_lorawan_join_request_parse(ReadOnlySpan<byte>, nuint, ReadOnlySpan<byte>, nuint, out nint)

Verifies a join-request and reads the identifiers out of it.

public static PamojaStatus pamoja_lorawan_join_request_parse(ReadOnlySpan<byte> bytes, nuint bytesLen, ReadOnlySpan<byte> appKey, nuint appKeyLen, out nint outRequest)

Parameters

bytes ReadOnlySpan<byte>
bytesLen nuint
appKey ReadOnlySpan<byte>
appKeyLen nuint
outRequest nint

Returns

PamojaStatus

pamoja_lorawan_rx_ack(nint)

Reports whether a decoded frame acknowledges the last confirmed one.

public static bool pamoja_lorawan_rx_ack(nint rx)

Parameters

rx nint

Returns

bool

pamoja_lorawan_rx_adr(nint)

Reports whether a decoded frame takes part in adaptive data rate.

public static bool pamoja_lorawan_rx_adr(nint rx)

Parameters

rx nint

Returns

bool

pamoja_lorawan_rx_confirmed(nint)

Reports whether a decoded frame asks to be acknowledged.

public static bool pamoja_lorawan_rx_confirmed(nint rx)

Parameters

rx nint

Returns

bool

pamoja_lorawan_rx_dev_addr(nint)

Returns the device address a decoded frame carries.

public static extern uint pamoja_lorawan_rx_dev_addr(nint rx)

Parameters

rx nint

Returns

uint

pamoja_lorawan_rx_direction(nint)

Returns the direction a decoded frame traveled.

public static extern PamojaLorawanDirection pamoja_lorawan_rx_direction(nint rx)

Parameters

rx nint

Returns

PamojaLorawanDirection

pamoja_lorawan_rx_fcnt(nint)

Returns the low 16 bits of the frame counter.

public static extern ushort pamoja_lorawan_rx_fcnt(nint rx)

Parameters

rx nint

Returns

ushort

pamoja_lorawan_rx_fopts(nint)

Returns a pointer to the frame options a decoded frame carries.

public static extern nint pamoja_lorawan_rx_fopts(nint rx)

Parameters

rx nint

Returns

nint

pamoja_lorawan_rx_fopts_len(nint)

Returns the length of the frame options a decoded frame carries.

public static extern nuint pamoja_lorawan_rx_fopts_len(nint rx)

Parameters

rx nint

Returns

nuint

pamoja_lorawan_rx_fpending(nint)

Reports whether the network has more downlink data waiting.

public static bool pamoja_lorawan_rx_fpending(nint rx)

Parameters

rx nint

Returns

bool

pamoja_lorawan_rx_fport(nint, out byte)

Returns the port a decoded frame was sent on.

public static bool pamoja_lorawan_rx_fport(nint rx, out byte outFport)

Parameters

rx nint
outFport byte

Returns

bool

pamoja_lorawan_rx_free(nint)

Releases a decoded frame handle. Passing null is a no-op.

public static extern void pamoja_lorawan_rx_free(nint rx)

Parameters

rx nint

pamoja_lorawan_rx_payload(nint)

Returns a pointer to the decrypted payload of a decoded frame.

public static extern nint pamoja_lorawan_rx_payload(nint rx)

Parameters

rx nint

Returns

nint

pamoja_lorawan_rx_payload_len(nint)

Returns the length of the decrypted payload of a decoded frame.

public static extern nuint pamoja_lorawan_rx_payload_len(nint rx)

Parameters

rx nint

Returns

nuint

pamoja_lorawan_session_decode(nint, ReadOnlySpan<byte>, nuint, uint, out nint)

Verifies a received frame, then decrypts it.

public static PamojaStatus pamoja_lorawan_session_decode(nint session, ReadOnlySpan<byte> bytes, nuint bytesLen, uint fcnt, out nint outRx)

Parameters

session nint
bytes ReadOnlySpan<byte>
bytesLen nuint
fcnt uint
outRx nint

Returns

PamojaStatus

pamoja_lorawan_session_dev_addr(nint)

Returns the device address a session is bound to.

public static extern uint pamoja_lorawan_session_dev_addr(nint session)

Parameters

session nint

Returns

uint

Encodes a downlink data frame.

public static PamojaStatus pamoja_lorawan_session_encode_downlink(nint session, uint fcnt, byte fport, ReadOnlySpan<byte> payload, nuint payloadLen, ReadOnlySpan<byte> fopts, nuint foptsLen, PamojaLorawanFlags flags, out nint outFrame)

Parameters

session nint
fcnt uint
fport byte
payload ReadOnlySpan<byte>
payloadLen nuint
fopts ReadOnlySpan<byte>
foptsLen nuint
flags PamojaLorawanFlags
outFrame nint

Returns

PamojaStatus

Encodes an uplink data frame.

public static PamojaStatus pamoja_lorawan_session_encode_uplink(nint session, uint fcnt, byte fport, ReadOnlySpan<byte> payload, nuint payloadLen, ReadOnlySpan<byte> fopts, nuint foptsLen, PamojaLorawanFlags flags, out nint outFrame)

Parameters

session nint
fcnt uint
fport byte
payload ReadOnlySpan<byte>
payloadLen nuint
fopts ReadOnlySpan<byte>
foptsLen nuint
flags PamojaLorawanFlags
outFrame nint

Returns

PamojaStatus

pamoja_lorawan_session_free(nint)

Releases a session handle. Passing null is a no-op.

public static extern void pamoja_lorawan_session_free(nint session)

Parameters

session nint

pamoja_lorawan_session_new(uint, ReadOnlySpan<byte>, nuint, ReadOnlySpan<byte>, nuint, out nint)

Creates a LoRaWAN session from a device address and its keys.

public static PamojaStatus pamoja_lorawan_session_new(uint devAddr, ReadOnlySpan<byte> nwkSKey, nuint nwkSKeyLen, ReadOnlySpan<byte> appSKey, nuint appSKeyLen, out nint outSession)

Parameters

devAddr uint
nwkSKey ReadOnlySpan<byte>
nwkSKeyLen nuint
appSKey ReadOnlySpan<byte>
appSKeyLen nuint
outSession nint

Returns

PamojaStatus

pamoja_manifest_decode(ReadOnlySpan<byte>, nuint, out PamojaManifest)

Reads a manifest body back from its bytes.

public static PamojaStatus pamoja_manifest_decode(ReadOnlySpan<byte> bytes, nuint len, out PamojaManifest outManifest)

Parameters

bytes ReadOnlySpan<byte>
len nuint
outManifest PamojaManifest

Returns

PamojaStatus

pamoja_manifest_encode(PamojaManifest)

Encodes the body of a manifest.

public static extern nint pamoja_manifest_encode(PamojaManifest manifest)

Parameters

manifest PamojaManifest

Returns

nint

pamoja_manifest_sign(PamojaManifest, nint)

Signs a manifest into the envelope offered to a device.

public static extern nint pamoja_manifest_sign(PamojaManifest manifest, nint author)

Parameters

manifest PamojaManifest
author nint

Returns

nint

Returns the confirmation count to stamp on the command being sent.

public static extern byte pamoja_mavlink_command_confirmation(nint command)

Parameters

command nint

Returns

byte

Releases a command tracker.

public static extern void pamoja_mavlink_command_free(nint command)

Parameters

command nint

Returns the command id being tracked.

public static extern ushort pamoja_mavlink_command_id(nint command)

Parameters

command nint

Returns

ushort

Starts tracking a command.

public static extern nint pamoja_mavlink_command_new(ushort command, byte maxRetries)

Parameters

command ushort
maxRetries byte

Returns

nint

Classifies an incoming frame against the command in flight.

public static PamojaStatus pamoja_mavlink_command_on_frame(nint command, nint frame, out uint outKind, out byte outValue)

Parameters

command nint
frame nint
outKind uint
outValue byte

Returns

PamojaStatus

Records a timeout and reports whether the command may be resent.

public static byte pamoja_mavlink_command_on_timeout(nint command, out byte outConfirmation)

Parameters

command nint
outConfirmation byte

Returns

byte

Returns the CRC-16/MCRF4XX checksum of a byte string.

public static ushort pamoja_mavlink_crc16_mcrf4xx(ReadOnlySpan<byte> bytes, nuint bytesLen)

Parameters

bytes ReadOnlySpan<byte>
bytesLen nuint

Returns

ushort

Adds or replaces the seed for a message id.

public static extern PamojaStatus pamoja_mavlink_dialect_add(nint dialect, uint msgid, byte crcExtra)

Parameters

dialect nint
msgid uint
crcExtra byte

Returns

PamojaStatus

Adds a schema's message to a dialect table.

public static extern PamojaStatus pamoja_mavlink_dialect_add_schema(nint dialect, nint schema)

Parameters

dialect nint
schema nint

Returns

PamojaStatus

Returns the seed a dialect resolves a message id to.

public static PamojaStatus pamoja_mavlink_dialect_crc_extra(nint dialect, uint msgid, out byte outCrcExtra)

Parameters

dialect nint
msgid uint
outCrcExtra byte

Returns

PamojaStatus

Releases a dialect table.

public static extern void pamoja_mavlink_dialect_free(nint dialect)

Parameters

dialect nint

Creates an empty dialect table.

public static extern nint pamoja_mavlink_dialect_new()

Returns

nint

Returns a pointer to a frame's bytes.

public static nint pamoja_mavlink_frame_bytes(nint frame, out nuint outLen)

Parameters

frame nint
outLen nuint

Returns

nint

Assembles a frame carrying a message.

public static PamojaStatus pamoja_mavlink_frame_encode(byte version, PamojaMavlinkHeader header, uint msgid, ReadOnlySpan<byte> payload, nuint payloadLen, byte crcExtra, out nint outFrame)

Parameters

version byte
header PamojaMavlinkHeader
msgid uint
payload ReadOnlySpan<byte>
payloadLen nuint
crcExtra byte
outFrame nint

Returns

PamojaStatus

Releases a frame.

public static extern void pamoja_mavlink_frame_free(nint frame)

Parameters

frame nint

Returns the addressing fields a frame carries.

public static PamojaStatus pamoja_mavlink_frame_header(nint frame, out PamojaMavlinkHeader outHeader)

Parameters

frame nint
outHeader PamojaMavlinkHeader

Returns

PamojaStatus

Returns the incompatibility flags a v2 frame declares.

public static extern byte pamoja_mavlink_frame_incompat_flags(nint frame)

Parameters

frame nint

Returns

byte

Reports whether a frame carries a signature.

public static extern byte pamoja_mavlink_frame_is_signed(nint frame)

Parameters

frame nint

Returns

byte

Returns the id of the message a frame carries.

public static extern uint pamoja_mavlink_frame_message_id(nint frame)

Parameters

frame nint

Returns

uint

Parses one frame against a known CRC_EXTRA.

public static PamojaStatus pamoja_mavlink_frame_parse(ReadOnlySpan<byte> bytes, nuint bytesLen, byte crcExtra, out nint outFrame)

Parameters

bytes ReadOnlySpan<byte>
bytesLen nuint
crcExtra byte
outFrame nint

Returns

PamojaStatus

Parses one frame, looking its CRC_EXTRA up as it goes.

public static PamojaStatus pamoja_mavlink_frame_parse_known(ReadOnlySpan<byte> bytes, nuint bytesLen, nint dialect, out nint outFrame)

Parameters

bytes ReadOnlySpan<byte>
bytesLen nuint
dialect nint
outFrame nint

Returns

PamojaStatus

Returns a pointer to a frame's payload.

public static nint pamoja_mavlink_frame_payload(nint frame, out nuint outLen)

Parameters

frame nint
outLen nuint

Returns

nint

Copies a frame's signature block out.

public static PamojaStatus pamoja_mavlink_frame_signature(nint frame, Span<byte> outSignature)

Parameters

frame nint
outSignature Span<byte>

Returns

PamojaStatus

Returns the wire format a frame uses.

public static extern byte pamoja_mavlink_frame_version(nint frame)

Parameters

frame nint

Returns

byte

Returns the CRC_EXTRA the common dialect publishes for a message id.

public static PamojaStatus pamoja_mavlink_known_crc_extra(uint msgid, out byte outCrcExtra)

Parameters

msgid uint
outCrcExtra byte

Returns

PamojaStatus

Derives the CRC_EXTRA seed of a message from its definition.

public static PamojaStatus pamoja_mavlink_message_crc_extra(string name, ReadOnlySpan<PamojaMavlinkField> fields, nuint fieldCount, out byte outCrcExtra)

Parameters

name string
fields ReadOnlySpan<PamojaMavlinkField>
fieldCount nuint
outCrcExtra byte

Returns

PamojaStatus

Reads a message out of a frame payload.

public static PamojaStatus pamoja_mavlink_message_decode(nint schema, ReadOnlySpan<byte> payload, nuint payloadLen, out nint outMessage)

Parameters

schema nint
payload ReadOnlySpan<byte>
payloadLen nuint
outMessage nint

Returns

PamojaStatus

Releases a message.

public static extern void pamoja_mavlink_message_free(nint message)

Parameters

message nint

Copies the raw bytes of a byte-wide array field out.

public static PamojaStatus pamoja_mavlink_message_get_bytes(nint message, string field, Span<byte> outBytes, nuint outBytesLen)

Parameters

message nint
field string
outBytes Span<byte>
outBytesLen nuint

Returns

PamojaStatus

Reads a floating-point field.

public static PamojaStatus pamoja_mavlink_message_get_float(nint message, string field, nuint index, out double outValue)

Parameters

message nint
field string
index nuint
outValue double

Returns

PamojaStatus

Reads a field as a signed integer.

public static PamojaStatus pamoja_mavlink_message_get_int(nint message, string field, nuint index, out long outValue)

Parameters

message nint
field string
index nuint
outValue long

Returns

PamojaStatus

Reads a field as a double, whatever its type.

public static PamojaStatus pamoja_mavlink_message_get_number(nint message, string field, nuint index, out double outValue)

Parameters

message nint
field string
index nuint
outValue double

Returns

PamojaStatus

Reads a field as an unsigned integer.

public static PamojaStatus pamoja_mavlink_message_get_uint(nint message, string field, nuint index, out ulong outValue)

Parameters

message nint
field string
index nuint
outValue ulong

Returns

PamojaStatus

Creates a message with every field zero.

public static PamojaStatus pamoja_mavlink_message_new(nint schema, out nint outMessage)

Parameters

schema nint
outMessage nint

Returns

PamojaStatus

Returns a pointer to a message's payload bytes.

public static nint pamoja_mavlink_message_payload(nint message, out nuint outLen)

Parameters

message nint
outLen nuint

Returns

nint

Writes the raw bytes of a byte-wide array field.

public static PamojaStatus pamoja_mavlink_message_set_bytes(nint message, string field, ReadOnlySpan<byte> bytes, nuint bytesLen)

Parameters

message nint
field string
bytes ReadOnlySpan<byte>
bytesLen nuint

Returns

PamojaStatus

Writes a floating-point field.

public static PamojaStatus pamoja_mavlink_message_set_float(nint message, string field, nuint index, double value)

Parameters

message nint
field string
index nuint
value double

Returns

PamojaStatus

Writes a signed integer into a field.

public static PamojaStatus pamoja_mavlink_message_set_int(nint message, string field, nuint index, long value)

Parameters

message nint
field string
index nuint
value long

Returns

PamojaStatus

Writes a double into a field, converting it to the field's type.

public static PamojaStatus pamoja_mavlink_message_set_number(nint message, string field, nuint index, double value)

Parameters

message nint
field string
index nuint
value double

Returns

PamojaStatus

Writes an unsigned integer into a field.

public static PamojaStatus pamoja_mavlink_message_set_uint(nint message, string field, nuint index, ulong value)

Parameters

message nint
field string
index nuint
value ulong

Returns

PamojaStatus

Builds a v2 frame carrying a message.

public static PamojaStatus pamoja_mavlink_message_to_frame(nint message, PamojaMavlinkHeader header, out nint outFrame)

Parameters

message nint
header PamojaMavlinkHeader
outFrame nint

Returns

PamojaStatus

Returns the next sequence number the receiver expects.

public static extern ushort pamoja_mavlink_mission_receiver_expected(nint receiver)

Parameters

receiver nint

Returns

ushort

Releases a receiver.

public static extern void pamoja_mavlink_mission_receiver_free(nint receiver)

Parameters

receiver nint

Reports whether the transfer has finished.

public static extern byte pamoja_mavlink_mission_receiver_is_complete(nint receiver)

Parameters

receiver nint

Returns

byte

Creates a receiver for a plan from a target vehicle.

public static extern nint pamoja_mavlink_mission_receiver_new(byte targetSystem, byte targetComponent, byte missionType)

Parameters

targetSystem byte
targetComponent byte
missionType byte

Returns

nint

Handles an incoming frame, if it is one the transfer is waiting for.

public static PamojaStatus pamoja_mavlink_mission_receiver_on_frame(nint receiver, nint frame, PamojaMavlinkHeader header, out uint outKind, out nint outAccepted, out nint outReply)

Parameters

receiver nint
frame nint
header PamojaMavlinkHeader
outKind uint
outAccepted nint
outReply nint

Returns

PamojaStatus

Builds the frame that starts a download.

public static PamojaStatus pamoja_mavlink_mission_receiver_request_list(nint receiver, PamojaMavlinkHeader header, out nint outFrame)

Parameters

receiver nint
header PamojaMavlinkHeader
outFrame nint

Returns

PamojaStatus

Appends an item to the plan.

public static PamojaStatus pamoja_mavlink_mission_sender_add_item(nint sender, ReadOnlySpan<byte> payload, nuint payloadLen)

Parameters

sender nint
payload ReadOnlySpan<byte>
payloadLen nuint

Returns

PamojaStatus

Builds the frame that opens an upload.

public static PamojaStatus pamoja_mavlink_mission_sender_count(nint sender, PamojaMavlinkHeader header, out nint outFrame)

Parameters

sender nint
header PamojaMavlinkHeader
outFrame nint

Returns

PamojaStatus

Releases a sender.

public static extern void pamoja_mavlink_mission_sender_free(nint sender)

Parameters

sender nint

Returns the number of items in the plan.

public static extern ushort pamoja_mavlink_mission_sender_len(nint sender)

Parameters

sender nint

Returns

ushort

Creates a sender for a plan bound for a target vehicle.

public static extern nint pamoja_mavlink_mission_sender_new(byte targetSystem, byte targetComponent, byte missionType)

Parameters

targetSystem byte
targetComponent byte
missionType byte

Returns

nint

Handles an incoming frame, if it is one the transfer answers.

public static PamojaStatus pamoja_mavlink_mission_sender_on_frame(nint sender, nint frame, PamojaMavlinkHeader header, out uint outKind, out byte outResult, out nint outReply)

Parameters

sender nint
frame nint
header PamojaMavlinkHeader
outKind uint
outResult byte
outReply nint

Returns

PamojaStatus

Builds a global-frame position setpoint frame.

public static PamojaStatus pamoja_mavlink_offboard_global_position(PamojaMavlinkHeader header, uint timeBootMs, byte coordinateFrame, byte targetSystem, byte targetComponent, int latInt, int lonInt, float alt, out nint outFrame)

Parameters

header PamojaMavlinkHeader
timeBootMs uint
coordinateFrame byte
targetSystem byte
targetComponent byte
latInt int
lonInt int
alt float
outFrame nint

Returns

PamojaStatus

Builds a local-frame position setpoint frame.

public static PamojaStatus pamoja_mavlink_offboard_local_position(PamojaMavlinkHeader header, uint timeBootMs, byte coordinateFrame, byte targetSystem, byte targetComponent, float x, float y, float z, out nint outFrame)

Parameters

header PamojaMavlinkHeader
timeBootMs uint
coordinateFrame byte
targetSystem byte
targetComponent byte
x float
y float
z float
outFrame nint

Returns

PamojaStatus

Builds a local-frame velocity setpoint frame.

public static PamojaStatus pamoja_mavlink_offboard_local_velocity(PamojaMavlinkHeader header, uint timeBootMs, byte coordinateFrame, byte targetSystem, byte targetComponent, float vx, float vy, float vz, out nint outFrame)

Parameters

header PamojaMavlinkHeader
timeBootMs uint
coordinateFrame byte
targetSystem byte
targetComponent byte
vx float
vy float
vz float
outFrame nint

Returns

PamojaStatus

Builds a setpoint type_mask from the fields to use.

public static extern ushort pamoja_mavlink_offboard_type_mask(uint flags)

Parameters

flags uint

Returns

ushort

Releases a parser.

public static extern void pamoja_mavlink_parser_free(nint parser)

Parameters

parser nint

Creates a parser with an empty buffer.

public static extern nint pamoja_mavlink_parser_new()

Returns

nint

Takes the next completed frame out of the parser.

public static PamojaStatus pamoja_mavlink_parser_next(nint parser, out nint outFrame)

Parameters

parser nint
outFrame nint

Returns

PamojaStatus

Returns how many completed frames are waiting.

public static extern nuint pamoja_mavlink_parser_pending(nint parser)

Parameters

parser nint

Returns

nuint

Feeds bytes off a link into the parser.

public static PamojaStatus pamoja_mavlink_parser_push(nint parser, ReadOnlySpan<byte> bytes, nuint bytesLen, nint dialect)

Parameters

parser nint
bytes ReadOnlySpan<byte>
bytesLen nuint
dialect nint

Returns

PamojaStatus

Assembles a v2 frame carrying a message this build does not type.

public static PamojaStatus pamoja_mavlink_raw_message_to_frame(PamojaMavlinkHeader header, uint msgid, byte crcExtra, ReadOnlySpan<byte> payload, nuint payloadLen, out nint outFrame)

Parameters

header PamojaMavlinkHeader
msgid uint
crcExtra byte
payload ReadOnlySpan<byte>
payloadLen nuint
outFrame nint

Returns

PamojaStatus

Returns the shape at a position in the built-in registry.

public static PamojaStatus pamoja_mavlink_schema_at(nuint index, out nint outSchema)

Parameters

index nuint
outSchema nint

Returns

PamojaStatus

Puts the declared fields in wire order and finishes the shape.

public static PamojaStatus pamoja_mavlink_schema_builder_build(nint builder, out nint outSchema)

Parameters

builder nint
outSchema nint

Returns

PamojaStatus

Adds a MAVLink 2 extension field, in declared order.

public static PamojaStatus pamoja_mavlink_schema_builder_extension(nint builder, string name, uint fieldType, byte arrayLen)

Parameters

builder nint
name string
fieldType uint
arrayLen byte

Returns

PamojaStatus

Adds a base field, in the order the definition declares it.

public static PamojaStatus pamoja_mavlink_schema_builder_field(nint builder, string name, uint fieldType, byte arrayLen)

Parameters

builder nint
name string
fieldType uint
arrayLen byte

Returns

PamojaStatus

Releases a builder that was never built.

public static extern void pamoja_mavlink_schema_builder_free(nint builder)

Parameters

builder nint

Starts describing a message.

public static nint pamoja_mavlink_schema_builder_new(uint msgid, string name)

Parameters

msgid uint
name string

Returns

nint

Returns how many messages this build types.

public static extern nuint pamoja_mavlink_schema_count()

Returns

nuint

Returns the CRC_EXTRA seed a schema implies.

public static extern byte pamoja_mavlink_schema_crc_extra(nint schema)

Parameters

schema nint

Returns

byte

Describes one field of a message.

public static PamojaStatus pamoja_mavlink_schema_field(nint schema, nuint index, out PamojaMavlinkFieldInfo outField)

Parameters

schema nint
index nuint
outField PamojaMavlinkFieldInfo

Returns

PamojaStatus

Returns how many fields a message has.

public static extern nuint pamoja_mavlink_schema_field_count(nint schema)

Parameters

schema nint

Returns

nuint

Returns the shape of a message the engine types, by id.

public static PamojaStatus pamoja_mavlink_schema_for_id(uint msgid, out nint outSchema)

Parameters

msgid uint
outSchema nint

Returns

PamojaStatus

Returns the shape of a message the engine types, by name.

public static PamojaStatus pamoja_mavlink_schema_for_name(string name, out nint outSchema)

Parameters

name string
outSchema nint

Returns

PamojaStatus

Releases a schema.

public static extern void pamoja_mavlink_schema_free(nint schema)

Parameters

schema nint

Returns the id of the message a schema describes.

public static extern uint pamoja_mavlink_schema_id(nint schema)

Parameters

schema nint

Returns

uint

Returns the name of the message a schema describes.

public static extern nint pamoja_mavlink_schema_name(nint schema)

Parameters

schema nint

Returns

nint

Returns the length of the message on the wire, in bytes.

public static extern nuint pamoja_mavlink_schema_wire_len(nint schema)

Parameters

schema nint

Returns

nuint

Releases a signer.

public static extern void pamoja_mavlink_signer_free(nint signer)

Parameters

signer nint

Returns the link a signer signs on.

public static extern byte pamoja_mavlink_signer_link_id(nint signer)

Parameters

signer nint

Returns

byte

Creates a signer.

public static PamojaStatus pamoja_mavlink_signer_new(ReadOnlySpan<byte> key, byte linkId, ulong timestamp, out nint outSigner)

Parameters

key ReadOnlySpan<byte>
linkId byte
timestamp ulong
outSigner nint

Returns

PamojaStatus

Signs a message into a v2 frame.

public static PamojaStatus pamoja_mavlink_signer_sign(nint signer, PamojaMavlinkHeader header, uint msgid, ReadOnlySpan<byte> payload, nuint payloadLen, byte crcExtra, out nint outFrame)

Parameters

signer nint
header PamojaMavlinkHeader
msgid uint
payload ReadOnlySpan<byte>
payloadLen nuint
crcExtra byte
outFrame nint

Returns

PamojaStatus

Converts Unix time into the timestamp MAVLink signing counts in.

public static extern ulong pamoja_mavlink_timestamp_from_unix_micros(ulong unixMicros)

Parameters

unixMicros ulong

Returns

ulong

Releases a verifier.

public static extern void pamoja_mavlink_verifier_free(nint verifier)

Parameters

verifier nint

Creates a verifier.

public static PamojaStatus pamoja_mavlink_verifier_new(ReadOnlySpan<byte> key, out nint outVerifier)

Parameters

key ReadOnlySpan<byte>
outVerifier nint

Returns

PamojaStatus

Sets how far a timestamp may run ahead of the last accepted.

public static extern PamojaStatus pamoja_mavlink_verifier_set_window(nint verifier, ulong window)

Parameters

verifier nint
window ulong

Returns

PamojaStatus

Checks a frame's signature and its place in the sequence.

public static extern PamojaStatus pamoja_mavlink_verifier_verify(nint verifier, nint frame)

Parameters

verifier nint
frame nint

Returns

PamojaStatus

pamoja_median_free(nint)

Releases a median filter handle. Passing null is a no-op.

public static extern void pamoja_median_free(nint median)

Parameters

median nint

pamoja_median_new()

Creates an empty median filter.

public static extern nint pamoja_median_new()

Returns

nint

pamoja_median_update(nint, float)

Folds a reading in and returns the median of the window.

public static extern float pamoja_median_update(nint median, float reading)

Parameters

median nint
reading float

Returns

float

pamoja_median_value(nint, out float)

Reads the current median, if the filter has a reading.

public static bool pamoja_median_value(nint median, out float outValue)

Parameters

median nint
outValue float

Returns

bool

pamoja_mesh_crc16(ReadOnlySpan<byte>, nuint)

Computes the CRC-16 a mesh frame carries.

public static ushort pamoja_mesh_crc16(ReadOnlySpan<byte> data, nuint dataLen)

Parameters

data ReadOnlySpan<byte>
dataLen nuint

Returns

ushort

pamoja_mesh_frame_broadcast(uint, ushort, ReadOnlySpan<byte>, nuint, out nint)

Builds a mesh frame addressed to every node.

public static PamojaStatus pamoja_mesh_frame_broadcast(uint src, ushort id, ReadOnlySpan<byte> payload, nuint payloadLen, out nint outFrame)

Parameters

src uint
id ushort
payload ReadOnlySpan<byte>
payloadLen nuint
outFrame nint

Returns

PamojaStatus

pamoja_mesh_frame_bytes(nint)

Returns a pointer to the whole frame as it goes on the air.

public static extern nint pamoja_mesh_frame_bytes(nint frame)

Parameters

frame nint

Returns

nint

pamoja_mesh_frame_bytes_len(nint)

Returns the length of the whole frame.

public static extern nuint pamoja_mesh_frame_bytes_len(nint frame)

Parameters

frame nint

Returns

nuint

pamoja_mesh_frame_dst(nint)

Returns the address a frame is addressed to.

public static extern uint pamoja_mesh_frame_dst(nint frame)

Parameters

frame nint

Returns

uint

pamoja_mesh_frame_free(nint)

Releases a mesh frame handle. Passing null is a no-op.

public static extern void pamoja_mesh_frame_free(nint frame)

Parameters

frame nint

pamoja_mesh_frame_hop_limit(nint)

Returns how many further relays a frame may take.

public static extern byte pamoja_mesh_frame_hop_limit(nint frame)

Parameters

frame nint

Returns

byte

pamoja_mesh_frame_id(nint)

Returns the sequence number a frame carries.

public static extern ushort pamoja_mesh_frame_id(nint frame)

Parameters

frame nint

Returns

ushort

pamoja_mesh_frame_is_broadcast(nint)

Reports whether a frame is addressed to every node.

public static bool pamoja_mesh_frame_is_broadcast(nint frame)

Parameters

frame nint

Returns

bool

pamoja_mesh_frame_new(uint, uint, ushort, ReadOnlySpan<byte>, nuint, out nint)

Builds a mesh frame addressed to one node.

public static PamojaStatus pamoja_mesh_frame_new(uint src, uint dst, ushort id, ReadOnlySpan<byte> payload, nuint payloadLen, out nint outFrame)

Parameters

src uint
dst uint
id ushort
payload ReadOnlySpan<byte>
payloadLen nuint
outFrame nint

Returns

PamojaStatus

pamoja_mesh_frame_parse(ReadOnlySpan<byte>, nuint, out nint)

Parses a mesh frame received off a radio.

public static PamojaStatus pamoja_mesh_frame_parse(ReadOnlySpan<byte> bytes, nuint bytesLen, out nint outFrame)

Parameters

bytes ReadOnlySpan<byte>
bytesLen nuint
outFrame nint

Returns

PamojaStatus

pamoja_mesh_frame_payload(nint)

Returns a pointer to the payload a frame carries.

public static extern nint pamoja_mesh_frame_payload(nint frame)

Parameters

frame nint

Returns

nint

pamoja_mesh_frame_payload_len(nint)

Returns the length of the payload a frame carries.

public static extern nuint pamoja_mesh_frame_payload_len(nint frame)

Parameters

frame nint

Returns

nuint

pamoja_mesh_frame_relayed(nint, out nint)

Returns the same frame with one hop spent, ready to forward.

public static bool pamoja_mesh_frame_relayed(nint frame, out nint outFrame)

Parameters

frame nint
outFrame nint

Returns

bool

pamoja_mesh_frame_set_hop_limit(nint, byte)

Sets the number of relays a frame may still take.

public static extern void pamoja_mesh_frame_set_hop_limit(nint frame, byte hopLimit)

Parameters

frame nint
hopLimit byte

pamoja_mesh_frame_src(nint)

Returns the address of the node a frame came from.

public static extern uint pamoja_mesh_frame_src(nint frame)

Parameters

frame nint

Returns

uint

pamoja_mesh_frame_version(nint)

Returns the protocol version a frame declares.

public static extern byte pamoja_mesh_frame_version(nint frame)

Parameters

frame nint

Returns

byte

pamoja_mesh_seen_capacity(nint)

Returns how many packets a duplicate cache remembers.

public static extern nuint pamoja_mesh_seen_capacity(nint cache)

Parameters

cache nint

Returns

nuint

pamoja_mesh_seen_contains(nint, uint, ushort)

Reports whether a packet is remembered, without recording it.

public static bool pamoja_mesh_seen_contains(nint cache, uint src, ushort id)

Parameters

cache nint
src uint
id ushort

Returns

bool

pamoja_mesh_seen_free(nint)

Releases a duplicate cache handle. Passing null is a no-op.

public static extern void pamoja_mesh_seen_free(nint cache)

Parameters

cache nint

pamoja_mesh_seen_new(nuint)

Creates an empty duplicate cache of the size given.

public static extern nint pamoja_mesh_seen_new(nuint capacity)

Parameters

capacity nuint

Returns

nint

pamoja_mesh_seen_record(nint, uint, ushort)

Records a packet and reports whether it was new.

public static bool pamoja_mesh_seen_record(nint cache, uint src, ushort id)

Parameters

cache nint
src uint
id ushort

Returns

bool

pamoja_message_free(nint)

Releases a message handle.

public static extern void pamoja_message_free(nint message)

Parameters

message nint

pamoja_message_payload(nint)

Returns a pointer to a message payload.

public static extern nint pamoja_message_payload(nint message)

Parameters

message nint

Returns

nint

pamoja_message_payload_len(nint)

Returns the length in bytes of a message payload.

public static extern nuint pamoja_message_payload_len(nint message)

Parameters

message nint

Returns

nuint

pamoja_message_topic(nint)

Returns the topic a message arrived on.

public static extern nint pamoja_message_topic(nint message)

Parameters

message nint

Returns

nint

pamoja_modbus_crc16(ReadOnlySpan<byte>, nuint)

Computes the CRC-16/MODBUS that every RTU frame ends with.

public static ushort pamoja_modbus_crc16(ReadOnlySpan<byte> bytes, nuint bytesLen)

Parameters

bytes ReadOnlySpan<byte>
bytesLen nuint

Returns

ushort

pamoja_modbus_frame_address(nint)

Returns the unit address a frame is addressed to or came from.

public static extern byte pamoja_modbus_frame_address(nint frame)

Parameters

frame nint

Returns

byte

pamoja_modbus_frame_coils(nint, ushort, out nint)

Reads the coils out of a read-bits response, one byte per coil.

public static PamojaStatus pamoja_modbus_frame_coils(nint frame, ushort count, out nint outBuffer)

Parameters

frame nint
count ushort
outBuffer nint

Returns

PamojaStatus

pamoja_modbus_frame_exception(nint)

Returns the exception code a device reported, or 0 for none.

public static extern byte pamoja_modbus_frame_exception(nint frame)

Parameters

frame nint

Returns

byte

pamoja_modbus_frame_free(nint)

Releases a parsed frame handle. Passing null is a no-op.

public static extern void pamoja_modbus_frame_free(nint frame)

Parameters

frame nint

pamoja_modbus_frame_function(nint)

Returns a frame's function code as it appeared on the wire.

public static extern byte pamoja_modbus_frame_function(nint frame)

Parameters

frame nint

Returns

byte

pamoja_modbus_frame_parse(ReadOnlySpan<byte>, nuint, out nint)

Parses a received RTU frame, verifying its CRC.

public static PamojaStatus pamoja_modbus_frame_parse(ReadOnlySpan<byte> bytes, nuint bytesLen, out nint outFrame)

Parameters

bytes ReadOnlySpan<byte>
bytesLen nuint
outFrame nint

Returns

PamojaStatus

pamoja_modbus_frame_pdu(nint)

Returns a pointer to a frame's PDU.

public static extern nint pamoja_modbus_frame_pdu(nint frame)

Parameters

frame nint

Returns

nint

pamoja_modbus_frame_pdu_len(nint)

Returns the length in bytes of a frame's PDU.

public static extern nuint pamoja_modbus_frame_pdu_len(nint frame)

Parameters

frame nint

Returns

nuint

pamoja_modbus_frame_registers(nint, out nint)

Reads the 16-bit registers out of a read-registers response.

public static PamojaStatus pamoja_modbus_frame_registers(nint frame, out nint outRegisters)

Parameters

frame nint
outRegisters nint

Returns

PamojaStatus

pamoja_modbus_raw(byte, byte, ReadOnlySpan<byte>, nuint, out nint)

Builds a request frame from a raw function code and data.

public static PamojaStatus pamoja_modbus_raw(byte address, byte function, ReadOnlySpan<byte> data, nuint dataLen, out nint outBuffer)

Parameters

address byte
function byte
data ReadOnlySpan<byte>
dataLen nuint
outBuffer nint

Returns

PamojaStatus

pamoja_modbus_read_coils(byte, ushort, ushort, out nint)

Builds a read-coils request frame (function 0x01).

public static PamojaStatus pamoja_modbus_read_coils(byte address, ushort start, ushort count, out nint outBuffer)

Parameters

address byte
start ushort
count ushort
outBuffer nint

Returns

PamojaStatus

pamoja_modbus_read_discrete_inputs(byte, ushort, ushort, out nint)

Builds a read-discrete-inputs request frame (function 0x02).

public static PamojaStatus pamoja_modbus_read_discrete_inputs(byte address, ushort start, ushort count, out nint outBuffer)

Parameters

address byte
start ushort
count ushort
outBuffer nint

Returns

PamojaStatus

pamoja_modbus_read_holding_registers(byte, ushort, ushort, out nint)

Builds a read-holding-registers request frame (function 0x03).

public static PamojaStatus pamoja_modbus_read_holding_registers(byte address, ushort start, ushort count, out nint outBuffer)

Parameters

address byte
start ushort
count ushort
outBuffer nint

Returns

PamojaStatus

pamoja_modbus_read_holding_registers_reply(byte, ReadOnlySpan<ushort>, nuint, out nint)

Builds the reply to a read-holding-registers request.

public static PamojaStatus pamoja_modbus_read_holding_registers_reply(byte address, ReadOnlySpan<ushort> values, nuint valuesLen, out nint outBuffer)

Parameters

address byte
values ReadOnlySpan<ushort>
valuesLen nuint
outBuffer nint

Returns

PamojaStatus

pamoja_modbus_read_input_registers(byte, ushort, ushort, out nint)

Builds a read-input-registers request frame (function 0x04).

public static PamojaStatus pamoja_modbus_read_input_registers(byte address, ushort start, ushort count, out nint outBuffer)

Parameters

address byte
start ushort
count ushort
outBuffer nint

Returns

PamojaStatus

pamoja_modbus_read_input_registers_reply(byte, ReadOnlySpan<ushort>, nuint, out nint)

Builds the reply to a read-input-registers request.

public static PamojaStatus pamoja_modbus_read_input_registers_reply(byte address, ReadOnlySpan<ushort> values, nuint valuesLen, out nint outBuffer)

Parameters

address byte
values ReadOnlySpan<ushort>
valuesLen nuint
outBuffer nint

Returns

PamojaStatus

pamoja_modbus_write_multiple_coils(byte, ushort, ReadOnlySpan<byte>, nuint, out nint)

Builds a write-multiple-coils request frame (function 0x0F).

public static PamojaStatus pamoja_modbus_write_multiple_coils(byte address, ushort start, ReadOnlySpan<byte> values, nuint count, out nint outBuffer)

Parameters

address byte
start ushort
values ReadOnlySpan<byte>
count nuint
outBuffer nint

Returns

PamojaStatus

pamoja_modbus_write_multiple_registers(byte, ushort, ReadOnlySpan<ushort>, nuint, out nint)

Builds a write-multiple-registers request frame (function 0x10).

public static PamojaStatus pamoja_modbus_write_multiple_registers(byte address, ushort start, ReadOnlySpan<ushort> values, nuint count, out nint outBuffer)

Parameters

address byte
start ushort
values ReadOnlySpan<ushort>
count nuint
outBuffer nint

Returns

PamojaStatus

pamoja_modbus_write_single_coil(byte, ushort, bool, out nint)

Builds a write-single-coil request frame (function 0x05).

public static PamojaStatus pamoja_modbus_write_single_coil(byte address, ushort coil, bool on, out nint outBuffer)

Parameters

address byte
coil ushort
on bool
outBuffer nint

Returns

PamojaStatus

pamoja_modbus_write_single_register(byte, ushort, ushort, out nint)

Builds a write-single-register request frame (function 0x06).

public static PamojaStatus pamoja_modbus_write_single_register(byte address, ushort register, ushort value, out nint outBuffer)

Parameters

address byte
register ushort
value ushort
outBuffer nint

Returns

PamojaStatus

pamoja_mqtt_client_connect(nint)

Connects to the broker and starts the background event loop.

public static extern PamojaStatus pamoja_mqtt_client_connect(nint client)

Parameters

client nint

Returns

PamojaStatus

pamoja_mqtt_client_disconnect(nint)

Closes the connection and stops the background event loop.

public static extern PamojaStatus pamoja_mqtt_client_disconnect(nint client)

Parameters

client nint

Returns

PamojaStatus

pamoja_mqtt_client_free(nint)

Releases a client handle. Passing null is a no-op.

public static extern void pamoja_mqtt_client_free(nint client)

Parameters

client nint

pamoja_mqtt_client_is_connected(nint)

Reports whether the client currently holds an active connection.

public static bool pamoja_mqtt_client_is_connected(nint client)

Parameters

client nint

Returns

bool

pamoja_mqtt_client_new(ref PamojaMqttConfig)

Creates a disconnected MQTT client, or returns null on failure.

public static nint pamoja_mqtt_client_new(ref PamojaMqttConfig config)

Parameters

config PamojaMqttConfig

Returns

nint

pamoja_mqtt_client_publish(nint, nint, nint, nuint)

Publishes a payload to a topic.

public static extern PamojaStatus pamoja_mqtt_client_publish(nint client, nint topic, nint payload, nuint payloadLen)

Parameters

client nint
topic nint
payload nint
payloadLen nuint

Returns

PamojaStatus

pamoja_mqtt_client_recv(nint, out nint)

Awaits the next message; sets outMessage to null at end of stream.

public static PamojaStatus pamoja_mqtt_client_recv(nint client, out nint outMessage)

Parameters

client nint
outMessage nint

Returns

PamojaStatus

pamoja_mqtt_client_subscribe(nint, nint)

Subscribes to a topic filter.

public static extern PamojaStatus pamoja_mqtt_client_subscribe(nint client, nint topic)

Parameters

client nint
topic nint

Returns

PamojaStatus

pamoja_mqtt_message_free(nint)

Releases a message handle. Passing null is a no-op.

public static extern void pamoja_mqtt_message_free(nint message)

Parameters

message nint

pamoja_mqtt_message_payload(nint)

Returns a pointer to a message's payload bytes.

public static extern nint pamoja_mqtt_message_payload(nint message)

Parameters

message nint

Returns

nint

pamoja_mqtt_message_payload_len(nint)

Returns the length in bytes of a message's payload.

public static extern nuint pamoja_mqtt_message_payload_len(nint message)

Parameters

message nint

Returns

nuint

pamoja_mqtt_message_topic(nint)

Returns a pointer to a message's null-terminated UTF-8 topic.

public static extern nint pamoja_mqtt_message_topic(nint message)

Parameters

message nint

Returns

nint

pamoja_opt3001_config_bits(PamojaOpt3001Config)

Assembles the 16-bit OPT3001 configuration register value. # Returns The register value to write, with the read-only status bits written as zero.

public static extern ushort pamoja_opt3001_config_bits(PamojaOpt3001Config config)

Parameters

config PamojaOpt3001Config

Returns

ushort

pamoja_opt3001_config_from_bits(ushort, out PamojaOpt3001Config)

Parses a 16-bit OPT3001 configuration register value. # Returns [PamojaStatus::Ok], with *out_config filled in. Every register value decodes, so this fails only on a null pointer. # Safety out_config must point to a writable PamojaOpt3001Config.

public static PamojaStatus pamoja_opt3001_config_from_bits(ushort bits, out PamojaOpt3001Config outConfig)

Parameters

bits ushort
outConfig PamojaOpt3001Config

Returns

PamojaStatus

pamoja_opt3001_conversion_millis(bool)

Returns the conversion time an OPT3001 setting selects. # Returns The time in milliseconds: 800 for the long conversion, 100 otherwise.

public static ushort pamoja_opt3001_conversion_millis(bool longConversion)

Parameters

longConversion bool

Returns

ushort

pamoja_opt3001_fault_count(byte)

Returns how many consecutive faults an OPT3001 fault-count code requires. # Returns The fault count: 1, 2, 4, or 8.

public static extern byte pamoja_opt3001_fault_count(byte code)

Parameters

code byte

Returns

byte

pamoja_opt3001_full_scale_milli_lux(byte, out uint)

Returns the full scale an OPT3001 range number covers. # Returns true when the range is one the part defines, with *out_milli_lux set to the full scale; false for a reserved range number, which has none. # Safety out_milli_lux must point to a writable uint32_t.

public static bool pamoja_opt3001_full_scale_milli_lux(byte rangeNumber, out uint outMilliLux)

Parameters

rangeNumber byte
outMilliLux uint

Returns

bool

pamoja_opt3001_is_automatic_range(byte)

Reports whether an OPT3001 range number sets the full scale automatically. # Returns true for the automatic range number, which has no fixed full scale.

public static bool pamoja_opt3001_is_automatic_range(byte rangeNumber)

Parameters

rangeNumber byte

Returns

bool

pamoja_opt3001_lsb_milli_lux(byte, out uint)

Returns the illuminance one count carries at an OPT3001 exponent. # Returns true when the exponent is one the part defines, with *out_milli_lux set to the step; false for a reserved exponent. # Safety out_milli_lux must point to a writable uint32_t.

public static bool pamoja_opt3001_lsb_milli_lux(byte exponent, out uint outMilliLux)

Parameters

exponent byte
outMilliLux uint

Returns

bool

pamoja_opt3001_lux(ushort)

Converts a raw OPT3001 result register to lux. # Returns The illuminance.

public static extern float pamoja_opt3001_lux(ushort raw)

Parameters

raw ushort

Returns

float

pamoja_opt3001_milli_lux(ushort)

Converts a raw OPT3001 result register to milli-lux. # Returns The illuminance, exact in integer arithmetic.

public static extern uint pamoja_opt3001_milli_lux(ushort raw)

Parameters

raw ushort

Returns

uint

pamoja_opt3001_raw_from_milli_lux(uint)

Builds the OPT3001 result register that decodes to an illuminance. # Returns The register value, using the smallest exponent that fits and saturating at full scale.

public static extern ushort pamoja_opt3001_raw_from_milli_lux(uint milliLux)

Parameters

milliLux uint

Returns

ushort

pamoja_opt3001_word_from_bytes(ReadOnlySpan<byte>, nuint, out ushort)

Reads the two bytes an OPT3001 sends for a register, most significant first. # Returns [PamojaStatus::Ok] on success, with *out_word set, or [PamojaStatus::InvalidArgument] if the buffer is not two bytes. # Safety bytes must point to at least bytes_len readable bytes, and out_word must point to a writable uint16_t.

public static PamojaStatus pamoja_opt3001_word_from_bytes(ReadOnlySpan<byte> bytes, nuint bytesLen, out ushort outWord)

Parameters

bytes ReadOnlySpan<byte>
bytesLen nuint
outWord ushort

Returns

PamojaStatus

pamoja_opt3001_word_to_bytes(ushort, Span<byte>)

Builds the two bytes an OPT3001 sends for a register, most significant first. # Returns [PamojaStatus::Ok] on success, with the two bytes written to out_bytes, or [PamojaStatus::InvalidArgument] if out_bytes is null. # Safety out_bytes must point to at least two writable bytes.

public static PamojaStatus pamoja_opt3001_word_to_bytes(ushort word, Span<byte> outBytes)

Parameters

word ushort
outBytes Span<byte>

Returns

PamojaStatus

pamoja_pca9685_channel_register(byte, out byte)

Returns the first of a PCA9685 channel's four registers.

public static PamojaStatus pamoja_pca9685_channel_register(byte channel, out byte outRegister)

Parameters

channel byte
outRegister byte

Returns

PamojaStatus

pamoja_pca9685_frequency_for_prescale(byte, uint)

Returns the update rate a PCA9685 prescale value produces.

public static extern float pamoja_pca9685_frequency_for_prescale(byte prescale, uint oscHz)

Parameters

prescale byte
oscHz uint

Returns

float

pamoja_pca9685_prescale_for_frequency(uint, uint)

Returns the prescale value that sets a PCA9685 update rate.

public static extern byte pamoja_pca9685_prescale_for_frequency(uint updateRateHz, uint oscHz)

Parameters

updateRateHz uint
oscHz uint

Returns

byte

pamoja_pid_free(nint)

Releases a PID handle. Passing null is a no-op.

public static extern void pamoja_pid_free(nint pid)

Parameters

pid nint

pamoja_pid_new(float, float, float)

Creates a PID controller with no output limits.

public static extern nint pamoja_pid_new(float kp, float ki, float kd)

Parameters

kp float
ki float
kd float

Returns

nint

pamoja_pid_new_with_limits(float, float, float, float, float)

Creates a PID controller clamped to the given output range.

public static extern nint pamoja_pid_new_with_limits(float kp, float ki, float kd, float min, float max)

Parameters

kp float
ki float
kd float
min float
max float

Returns

nint

pamoja_pid_reset(nint)

Clears a PID controller's integral and last error.

public static extern void pamoja_pid_reset(nint pid)

Parameters

pid nint

pamoja_pid_update(nint, float, float, float)

Advances a PID controller by one step.

public static extern float pamoja_pid_update(nint pid, float setpoint, float measurement, float dt)

Parameters

pid nint
setpoint float
measurement float
dt float

Returns

float

pamoja_pin_edge_triggered_by(PamojaPinEdge, PamojaPinLevel, PamojaPinLevel)

Reports whether a transition fires an interrupt trigger.

public static bool pamoja_pin_edge_triggered_by(PamojaPinEdge edge, PamojaPinLevel from, PamojaPinLevel to)

Parameters

edge PamojaPinEdge
from PamojaPinLevel
to PamojaPinLevel

Returns

bool

pamoja_pin_level_from_bool(bool)

Returns the level a boolean names.

public static PamojaPinLevel pamoja_pin_level_from_bool(bool high)

Parameters

high bool

Returns

PamojaPinLevel

pamoja_pin_level_inverted(PamojaPinLevel)

Returns the opposite level.

public static extern PamojaPinLevel pamoja_pin_level_inverted(PamojaPinLevel level)

Parameters

level PamojaPinLevel

Returns

PamojaPinLevel

pamoja_pin_polarity_is_asserted(PamojaPinPolarity, PamojaPinLevel)

Reports whether a physical level means the signal is asserted.

public static bool pamoja_pin_polarity_is_asserted(PamojaPinPolarity polarity, PamojaPinLevel level)

Parameters

polarity PamojaPinPolarity
level PamojaPinLevel

Returns

bool

pamoja_pin_polarity_level(PamojaPinPolarity, bool)

Returns the physical level representing a logical state.

public static PamojaPinLevel pamoja_pin_polarity_level(PamojaPinPolarity polarity, bool asserted)

Parameters

polarity PamojaPinPolarity
asserted bool

Returns

PamojaPinLevel

pamoja_power_plan_interval_for_us(PamojaPowerPlan, PamojaPowerMode)

Returns the work interval a plan uses in a mode.

public static extern ulong pamoja_power_plan_interval_for_us(PamojaPowerPlan plan, PamojaPowerMode mode)

Parameters

plan PamojaPowerPlan
mode PamojaPowerMode

Returns

ulong

pamoja_power_plan_interval_us(PamojaPowerPlan, float)

Returns the work interval a plan calls for at a state of charge.

public static extern ulong pamoja_power_plan_interval_us(PamojaPowerPlan plan, float soc)

Parameters

plan PamojaPowerPlan
soc float

Returns

ulong

pamoja_power_plan_mode(PamojaPowerPlan, float)

Returns the mode a plan calls for at a state of charge.

public static extern PamojaPowerMode pamoja_power_plan_mode(PamojaPowerPlan plan, float soc)

Parameters

plan PamojaPowerPlan
soc float

Returns

PamojaPowerMode

pamoja_power_plan_mode_while_charging(PamojaPowerPlan, float, byte)

Returns the mode, eased one step toward full duty while charging.

public static extern PamojaPowerMode pamoja_power_plan_mode_while_charging(PamojaPowerPlan plan, float soc, byte charging)

Parameters

plan PamojaPowerPlan
soc float
charging byte

Returns

PamojaPowerMode

pamoja_power_plan_new(ulong, ulong, ulong)

Creates a power plan with the default thresholds.

public static extern PamojaPowerPlan pamoja_power_plan_new(ulong activeUs, ulong saverUs, ulong criticalUs)

Parameters

activeUs ulong
saverUs ulong
criticalUs ulong

Returns

PamojaPowerPlan

pamoja_power_plan_with_thresholds(PamojaPowerPlan, float, float)

Returns a plan with the state-of-charge thresholds moved.

public static extern PamojaPowerPlan pamoja_power_plan_with_thresholds(PamojaPowerPlan plan, float saverBelow, float criticalBelow)

Parameters

plan PamojaPowerPlan
saverBelow float
criticalBelow float

Returns

PamojaPowerPlan

pamoja_profile_control(nint, out PamojaControlSpec)

Returns the control policy a profile applies.

public static PamojaStatus pamoja_profile_control(nint profile, out PamojaControlSpec control)

Parameters

profile nint
control PamojaControlSpec

Returns

PamojaStatus

pamoja_profile_controller(nint)

Builds the decision logic a profile describes.

public static extern nint pamoja_profile_controller(nint profile)

Parameters

profile nint

Returns

nint

pamoja_profile_flood_sensor()

Creates a flood sensor.

public static extern nint pamoja_profile_flood_sensor()

Returns

nint

pamoja_profile_free(nint)

Releases a profile handle.

public static extern void pamoja_profile_free(nint profile)

Parameters

profile nint

pamoja_profile_from_json(string)

Loads a profile from its JSON manifest.

public static nint pamoja_profile_from_json(string manifest)

Parameters

manifest string

Returns

nint

pamoja_profile_irrigation_node()

Creates an irrigation node.

public static extern nint pamoja_profile_irrigation_node()

Returns

nint

pamoja_profile_name(nint)

Returns a profile's stable name.

public static extern nint pamoja_profile_name(nint profile)

Parameters

profile nint

Returns

nint

pamoja_profile_power(nint, out PamojaPowerSchedule)

Returns the sampling schedule a profile keeps.

public static PamojaStatus pamoja_profile_power(nint profile, out PamojaPowerSchedule schedule)

Parameters

profile nint
schedule PamojaPowerSchedule

Returns

PamojaStatus

pamoja_profile_power_plan(nint, out PamojaPowerPlan)

Assembles a profile's schedule into a power governor.

public static PamojaStatus pamoja_profile_power_plan(nint profile, out PamojaPowerPlan plan)

Parameters

profile nint
plan PamojaPowerPlan

Returns

PamojaStatus

pamoja_profile_to_json(nint)

Serializes a profile to its JSON manifest.

public static extern nint pamoja_profile_to_json(nint profile)

Parameters

profile nint

Returns

nint

pamoja_profile_topic(nint)

Returns the topic a profile publishes each reading to.

public static extern nint pamoja_profile_topic(nint profile)

Parameters

profile nint

Returns

nint

pamoja_profile_vaccine_fridge_monitor()

Creates a cold-chain fridge monitor.

public static extern nint pamoja_profile_vaccine_fridge_monitor()

Returns

nint

pamoja_profile_well_level()

Creates a well-level monitor.

public static extern nint pamoja_profile_well_level()

Returns

nint

pamoja_public_identity_fingerprint(ReadOnlySpan<byte>, Span<byte>)

Writes the 16-character hex fingerprint of a public key.

public static PamojaStatus pamoja_public_identity_fingerprint(ReadOnlySpan<byte> publicKey, Span<byte> outFingerprint)

Parameters

publicKey ReadOnlySpan<byte>
outFingerprint Span<byte>

Returns

PamojaStatus

pamoja_public_identity_verify(ReadOnlySpan<byte>, ReadOnlySpan<byte>, nuint, ReadOnlySpan<byte>)

Verifies that a signature covers a payload for a public key.

public static PamojaStatus pamoja_public_identity_verify(ReadOnlySpan<byte> publicKey, ReadOnlySpan<byte> payload, nuint payloadLen, ReadOnlySpan<byte> signature)

Parameters

publicKey ReadOnlySpan<byte>
payload ReadOnlySpan<byte>
payloadLen nuint
signature ReadOnlySpan<byte>

Returns

PamojaStatus

pamoja_public_identity_verify_message(ReadOnlySpan<byte>, ReadOnlySpan<byte>, nuint, out nint)

Verifies a signed message, returning the payload it carries.

public static PamojaStatus pamoja_public_identity_verify_message(ReadOnlySpan<byte> publicKey, ReadOnlySpan<byte> message, nuint messageLen, out nint outBuffer)

Parameters

publicKey ReadOnlySpan<byte>
message ReadOnlySpan<byte>
messageLen nuint
outBuffer nint

Returns

PamojaStatus

pamoja_pwm_counts(PamojaPwm, out ushort, out ushort)

Reads the counts back out of a channel's four register bytes.

public static PamojaStatus pamoja_pwm_counts(PamojaPwm pwm, out ushort outOn, out ushort outOff)

Parameters

pwm PamojaPwm
outOn ushort
outOff ushort

Returns

PamojaStatus

pamoja_pwm_duty(ushort)

Builds a PWM setting with no phase delay.

public static extern PamojaPwm pamoja_pwm_duty(ushort off)

Parameters

off ushort

Returns

PamojaPwm

pamoja_pwm_from_counts(ushort, ushort)

Builds a PWM setting from explicit on and off counts.

public static extern PamojaPwm pamoja_pwm_from_counts(ushort on, ushort off)

Parameters

on ushort
off ushort

Returns

PamojaPwm

pamoja_pwm_full_off()

The setting that holds a channel continuously low.

public static extern PamojaPwm pamoja_pwm_full_off()

Returns

PamojaPwm

pamoja_pwm_full_on()

The setting that holds a channel continuously high.

public static extern PamojaPwm pamoja_pwm_full_on()

Returns

PamojaPwm

pamoja_pwm_servo(uint, uint)

Builds the PWM setting for a servo pulse width.

public static extern PamojaPwm pamoja_pwm_servo(uint pulseMicros, uint updateRateHz)

Parameters

pulseMicros uint
updateRateHz uint

Returns

PamojaPwm

pamoja_ramp_free(nint)

Releases a ramp handle. Passing null is a no-op.

public static extern void pamoja_ramp_free(nint ramp)

Parameters

ramp nint

pamoja_ramp_new(float, float)

Creates a rate limiter.

public static extern nint pamoja_ramp_new(float start, float maxStep)

Parameters

start float
maxStep float

Returns

nint

pamoja_ramp_set(nint, float)

Forces a ramp to a value without rate limiting.

public static extern void pamoja_ramp_set(nint ramp, float value)

Parameters

ramp nint
value float

pamoja_ramp_update(nint, float)

Moves a ramp one step toward a target.

public static extern float pamoja_ramp_update(nint ramp, float target)

Parameters

ramp nint
target float

Returns

float

pamoja_ramp_value(nint)

Reads a ramp's current value.

public static extern float pamoja_ramp_value(nint ramp)

Parameters

ramp nint

Returns

float

pamoja_readings_data(nint)

Returns a pointer to a decoded float reading series.

public static extern nint pamoja_readings_data(nint readings)

Parameters

readings nint

Returns

nint

pamoja_readings_free(nint)

Releases a decoded reading series. Passing null is a no-op.

public static extern void pamoja_readings_free(nint readings)

Parameters

readings nint

pamoja_readings_len(nint)

Returns the number of float readings in a decoded series.

public static extern nuint pamoja_readings_len(nint readings)

Parameters

readings nint

Returns

nuint

pamoja_recording_actuator_apply(nint, float)

Applies a command, which is recorded rather than acted on.

public static extern PamojaStatus pamoja_recording_actuator_apply(nint actuator, float command)

Parameters

actuator nint
command float

Returns

PamojaStatus

pamoja_recording_actuator_commands(nint, Span<float>, nuint)

Copies out the commands an actuator recorded.

public static nuint pamoja_recording_actuator_commands(nint actuator, Span<float> outCommands, nuint capacity)

Parameters

actuator nint
outCommands Span<float>
capacity nuint

Returns

nuint

pamoja_recording_actuator_free(nint)

Releases a recording actuator handle.

public static extern void pamoja_recording_actuator_free(nint actuator)

Parameters

actuator nint

pamoja_recording_actuator_len(nint)

Reports how many commands an actuator has been given.

public static extern nuint pamoja_recording_actuator_len(nint actuator)

Parameters

actuator nint

Returns

nuint

pamoja_recording_actuator_new()

Creates an actuator that records every command.

public static extern nint pamoja_recording_actuator_new()

Returns

nint

pamoja_registers_data(nint)

Returns a pointer to the registers a device returned.

public static extern nint pamoja_registers_data(nint registers)

Parameters

registers nint

Returns

nint

pamoja_registers_free(nint)

Releases a register series. Passing null is a no-op.

public static extern void pamoja_registers_free(nint registers)

Parameters

registers nint

pamoja_registers_len(nint)

Returns how many registers a device returned.

public static extern nuint pamoja_registers_len(nint registers)

Parameters

registers nint

Returns

nuint

pamoja_replay_free(nint)

Releases a replay handle.

public static extern void pamoja_replay_free(nint replay)

Parameters

replay nint

pamoja_replay_new(ReadOnlySpan<float>, nuint, bool)

Creates a sensor that reads back a recorded series.

public static nint pamoja_replay_new(ReadOnlySpan<float> readings, nuint count, bool repeating)

Parameters

readings ReadOnlySpan<float>
count nuint
repeating bool

Returns

nint

pamoja_replay_read(nint, out float)

Takes the next reading from a replay.

public static PamojaStatus pamoja_replay_read(nint replay, out float outReading)

Parameters

replay nint
outReading float

Returns

PamojaStatus

pamoja_reporter_adapt_to(nint, PamojaLinkCost)

Moves the threshold to match what the link now costs.

public static extern void pamoja_reporter_adapt_to(nint reporter, PamojaLinkCost cost)

Parameters

reporter nint
cost PamojaLinkCost

pamoja_reporter_count(nint, PamojaTelemetryLevel)

Returns how many events a reporter has seen at a level.

public static extern uint pamoja_reporter_count(nint reporter, PamojaTelemetryLevel level)

Parameters

reporter nint
level PamojaTelemetryLevel

Returns

uint

pamoja_reporter_dropped(nint)

Returns how many events the threshold dropped.

public static extern uint pamoja_reporter_dropped(nint reporter)

Parameters

reporter nint

Returns

uint

pamoja_reporter_emitted(nint)

Returns how many events passed the threshold and were shipped.

public static extern uint pamoja_reporter_emitted(nint reporter)

Parameters

reporter nint

Returns

uint

pamoja_reporter_free(nint)

Releases a reporter handle.

public static extern void pamoja_reporter_free(nint reporter)

Parameters

reporter nint

pamoja_reporter_new(PamojaTelemetryLevel)

Creates a reporter that ships events at or above a level.

public static extern nint pamoja_reporter_new(PamojaTelemetryLevel threshold)

Parameters

threshold PamojaTelemetryLevel

Returns

nint

pamoja_reporter_record(nint, PamojaTelemetryLevel)

Records an event and reports whether it is worth shipping.

public static bool pamoja_reporter_record(nint reporter, PamojaTelemetryLevel level)

Parameters

reporter nint
level PamojaTelemetryLevel

Returns

bool

pamoja_reporter_set_threshold(nint, PamojaTelemetryLevel)

Moves the level a reporter ships from.

public static extern void pamoja_reporter_set_threshold(nint reporter, PamojaTelemetryLevel threshold)

Parameters

reporter nint
threshold PamojaTelemetryLevel

pamoja_reporter_snapshot(nint)

Takes a snapshot of a reporter's counters.

public static extern PamojaTelemetrySnapshot pamoja_reporter_snapshot(nint reporter)

Parameters

reporter nint

Returns

PamojaTelemetrySnapshot

pamoja_reporter_threshold(nint)

Returns the level a reporter is currently shipping from.

public static extern PamojaTelemetryLevel pamoja_reporter_threshold(nint reporter)

Parameters

reporter nint

Returns

PamojaTelemetryLevel

pamoja_reporter_total(nint)

Returns how many events a reporter has seen across every level.

public static extern uint pamoja_reporter_total(nint reporter)

Parameters

reporter nint

Returns

uint

pamoja_ros2_dds_topic(string, PamojaEntityKind)

Returns the DDS topic a fully qualified name maps onto.

public static nint pamoja_ros2_dds_topic(string fqn, PamojaEntityKind kind)

Parameters

fqn string
kind PamojaEntityKind

Returns

nint

pamoja_ros2_dds_type_name(string)

Returns the DDS type name an interface type maps onto.

public static nint pamoja_ros2_dds_type_name(string rosType)

Parameters

rosType string

Returns

nint

pamoja_ros2_entity_key(uint, string, string, PamojaTypeHash)

Builds the Zenoh key an entity is published on.

public static nint pamoja_ros2_entity_key(uint domainId, string fqn, string rosType, PamojaTypeHash hash)

Parameters

domainId uint
fqn string
rosType string
hash PamojaTypeHash

Returns

nint

pamoja_ros2_entity_kind_prefix(PamojaEntityKind)

Returns the DDS topic prefix a subsystem uses.

public static extern nint pamoja_ros2_entity_kind_prefix(PamojaEntityKind kind)

Parameters

kind PamojaEntityKind

Returns

nint

pamoja_ros2_name_is_fully_qualified(string)

Reports whether a name is fully qualified.

public static bool pamoja_ros2_name_is_fully_qualified(string name)

Parameters

name string

Returns

bool

pamoja_ros2_name_is_valid(string)

Reports whether a string is a valid ROS 2 name.

public static bool pamoja_ros2_name_is_valid(string name)

Parameters

name string

Returns

bool

pamoja_ros2_percent_mangle(string)

Percent-mangles a name the way a DDS partition requires.

public static nint pamoja_ros2_percent_mangle(string name)

Parameters

name string

Returns

nint

pamoja_ros2_twist_from_cdr(ReadOnlySpan<byte>, nuint, out PamojaRos2Twist)

Decodes a twist from its CDR representation.

public static PamojaStatus pamoja_ros2_twist_from_cdr(ReadOnlySpan<byte> data, nuint dataLen, out PamojaRos2Twist twist)

Parameters

data ReadOnlySpan<byte>
dataLen nuint
twist PamojaRos2Twist

Returns

PamojaStatus

pamoja_ros2_twist_to_cdr(PamojaRos2Twist)

Encodes a twist into its CDR representation.

public static extern nint pamoja_ros2_twist_to_cdr(PamojaRos2Twist twist)

Parameters

twist PamojaRos2Twist

Returns

nint

pamoja_ros2_type_hash_parse(string, out PamojaTypeHash)

Parses a RIHS01 type hash string.

public static PamojaStatus pamoja_ros2_type_hash_parse(string text, out PamojaTypeHash hash)

Parameters

text string
hash PamojaTypeHash

Returns

PamojaStatus

pamoja_ros2_type_hash_to_string(PamojaTypeHash)

Renders a type hash back to its RIHS01 string.

public static extern nint pamoja_ros2_type_hash_to_string(PamojaTypeHash hash)

Parameters

hash PamojaTypeHash

Returns

nint

pamoja_router_address(nint)

Returns the address a router answers for.

public static extern uint pamoja_router_address(nint router)

Parameters

router nint

Returns

uint

pamoja_router_capacity(nint)

Returns how many routes a table can hold.

public static extern nuint pamoja_router_capacity(nint router)

Parameters

router nint

Returns

nuint

pamoja_router_cost(nint, uint, out ushort)

Returns what the known route to a node costs.

public static bool pamoja_router_cost(nint router, uint dst, out ushort outCost)

Parameters

router nint
dst uint
outCost ushort

Returns

bool

pamoja_router_forget(nint, uint)

Forgets the route to a node.

public static extern void pamoja_router_forget(nint router, uint dst)

Parameters

router nint
dst uint

pamoja_router_forward(nint, uint, out uint)

Decides what to do with a packet bound for a node.

public static PamojaForward pamoja_router_forward(nint router, uint dst, out uint outNextHop)

Parameters

router nint
dst uint
outNextHop uint

Returns

PamojaForward

pamoja_router_free(nint)

Releases a routing table handle. Passing null is a no-op.

public static extern void pamoja_router_free(nint router)

Parameters

router nint

pamoja_router_len(nint)

Returns how many routes a table currently holds.

public static extern nuint pamoja_router_len(nint router)

Parameters

router nint

Returns

nuint

pamoja_router_new(uint, nuint)

Creates an empty routing table of the size given.

public static extern nint pamoja_router_new(uint address, nuint capacity)

Parameters

address uint
capacity nuint

Returns

nint

pamoja_router_next_hop(nint, uint, out uint)

Returns the neighbour on the way to a node.

public static bool pamoja_router_next_hop(nint router, uint dst, out uint outNextHop)

Parameters

router nint
dst uint
outNextHop uint

Returns

bool

pamoja_router_observe(nint, uint, uint, ushort)

Learns a route from a packet that arrived.

public static bool pamoja_router_observe(nint router, uint origin, uint via, ushort cost)

Parameters

router nint
origin uint
via uint
cost ushort

Returns

bool

pamoja_router_route(nint, uint, out PamojaRoute)

Returns the whole route to a node.

public static bool pamoja_router_route(nint router, uint dst, out PamojaRoute outRoute)

Parameters

router nint
dst uint
outRoute PamojaRoute

Returns

bool

pamoja_samples_data(nint)

Returns a pointer to a decoded integer sample series.

public static extern nint pamoja_samples_data(nint samples)

Parameters

samples nint

Returns

nint

pamoja_samples_free(nint)

Releases a decoded sample series. Passing null is a no-op.

public static extern void pamoja_samples_free(nint samples)

Parameters

samples nint

pamoja_samples_len(nint)

Returns the number of integer samples in a decoded series.

public static extern nuint pamoja_samples_len(nint samples)

Parameters

samples nint

Returns

nuint

pamoja_scd4x_allowed_during_measurement(ushort)

Reports whether an SCD4x accepts a command while it is measuring. # Returns true when the command may be sent without stopping periodic measurements.

public static bool pamoja_scd4x_allowed_during_measurement(ushort command)

Parameters

command ushort

Returns

bool

pamoja_scd4x_ambient_pressure_pascals(ushort)

Reads an SCD4x ambient-pressure word back as a pressure. # Returns The pressure in pascals.

public static extern uint pamoja_scd4x_ambient_pressure_pascals(ushort word)

Parameters

word ushort

Returns

uint

pamoja_scd4x_ambient_pressure_word(uint)

Builds the SCD4x ambient-pressure word for a pressure. # Returns The word to write, at 100 pascals per count.

public static extern ushort pamoja_scd4x_ambient_pressure_word(uint pascals)

Parameters

pascals uint

Returns

ushort

pamoja_scd4x_automatic_self_calibration_enabled(ushort)

Reports whether an SCD4x word says automatic self-calibration is on. # Returns true when the part recalibrates itself against clean air.

public static bool pamoja_scd4x_automatic_self_calibration_enabled(ushort word)

Parameters

word ushort

Returns

bool

pamoja_scd4x_automatic_self_calibration_word(bool)

Builds the SCD4x word that turns automatic self-calibration on or off. # Returns The word to write.

public static ushort pamoja_scd4x_automatic_self_calibration_word(bool enabled)

Parameters

enabled bool

Returns

ushort

pamoja_scd4x_celsius(ushort)

Converts a raw SCD4x temperature word to degrees Celsius. # Returns The temperature.

public static extern float pamoja_scd4x_celsius(ushort raw)

Parameters

raw ushort

Returns

float

pamoja_scd4x_command_frame(ushort, Span<byte>)

Builds the two bytes that address an SCD4x command, most significant first. # Returns [PamojaStatus::Ok] on success, with the two bytes written to out_bytes, or [PamojaStatus::InvalidArgument] if out_bytes is null. # Safety out_bytes must point to at least two writable bytes.

public static PamojaStatus pamoja_scd4x_command_frame(ushort command, Span<byte> outBytes)

Parameters

command ushort
outBytes Span<byte>

Returns

PamojaStatus

pamoja_scd4x_crc(ReadOnlySpan<byte>, nuint)

Computes the CRC-8 an SCD4x appends to every data word. # Returns The checksum over data, or 0 if the pointer is null with a non-zero length. # Safety data must point to at least data_len readable bytes, or be null when data_len is 0.

public static byte pamoja_scd4x_crc(ReadOnlySpan<byte> data, nuint dataLen)

Parameters

data ReadOnlySpan<byte>
dataLen nuint

Returns

byte

pamoja_scd4x_data_ready(ushort)

Reports whether an SCD4x data-ready word says a fresh result is waiting. # Returns true when any of the low eleven bits is set.

public static bool pamoja_scd4x_data_ready(ushort word)

Parameters

word ushort

Returns

bool

pamoja_scd4x_forced_recalibration_correction_ppm(ushort, out int)

Reads the correction a forced recalibration applied. # Returns true when the recalibration took, with *out_ppm set to the correction in parts per million; false when the part reported that it failed. # Safety out_ppm must point to a writable int32_t.

public static bool pamoja_scd4x_forced_recalibration_correction_ppm(ushort word, out int outPpm)

Parameters

word ushort
outPpm int

Returns

bool

pamoja_scd4x_forced_recalibration_word(bool, int)

Builds the word an SCD4x returns for a forced-recalibration outcome. # Returns The word, which is the failure sentinel when succeeded is false.

public static ushort pamoja_scd4x_forced_recalibration_word(bool succeeded, int correctionPpm)

Parameters

succeeded bool
correctionPpm int

Returns

ushort

pamoja_scd4x_humidity_milli_percent(ushort)

Converts a raw SCD4x humidity word to milli-percent. # Returns The relative humidity, exact in integer arithmetic.

public static extern uint pamoja_scd4x_humidity_milli_percent(ushort raw)

Parameters

raw ushort

Returns

uint

pamoja_scd4x_humidity_raw(uint)

Builds the SCD4x humidity word that decodes to a relative humidity. # Returns The raw word, saturating at full scale.

public static extern ushort pamoja_scd4x_humidity_raw(uint milliPercent)

Parameters

milliPercent uint

Returns

ushort

pamoja_scd4x_max_duration_ms(ushort, out ushort)

Returns how long an SCD4x command may take before its result can be read. # Returns true when the command has a documented execution time, with *out_millis set to it; false when it completes as soon as it is acknowledged. # Safety out_millis must point to a writable uint16_t.

public static bool pamoja_scd4x_max_duration_ms(ushort command, out ushort outMillis)

Parameters

command ushort
outMillis ushort

Returns

bool

pamoja_scd4x_measurement_bytes(ushort, ushort, ushort, Span<byte>)

Builds the nine bytes an SCD4x sends for a set of raw words, each CRC included. # Returns [PamojaStatus::Ok] on success, with the nine bytes written to out_bytes, or [PamojaStatus::InvalidArgument] if out_bytes is null. # Safety out_bytes must point to at least nine writable bytes.

public static PamojaStatus pamoja_scd4x_measurement_bytes(ushort co2Ppm, ushort temperatureRaw, ushort humidityRaw, Span<byte> outBytes)

Parameters

co2Ppm ushort
temperatureRaw ushort
humidityRaw ushort
outBytes Span<byte>

Returns

PamojaStatus

pamoja_scd4x_measurement_from_physical(ushort, int, uint, out PamojaScd4xMeasurement)

Builds the SCD4x measurement a sensor reporting these physical values would send. # Returns [PamojaStatus::Ok], with *out_measurement filled in, or [PamojaStatus::InvalidArgument] if the pointer is null. # Safety out_measurement must point to a writable PamojaScd4xMeasurement.

public static PamojaStatus pamoja_scd4x_measurement_from_physical(ushort co2Ppm, int milliCelsius, uint humidityMilliPercent, out PamojaScd4xMeasurement outMeasurement)

Parameters

co2Ppm ushort
milliCelsius int
humidityMilliPercent uint
outMeasurement PamojaScd4xMeasurement

Returns

PamojaStatus

pamoja_scd4x_milli_celsius(ushort)

Converts a raw SCD4x temperature word to milli-degrees Celsius. # Returns The temperature, exact in integer arithmetic.

public static extern int pamoja_scd4x_milli_celsius(ushort raw)

Parameters

raw ushort

Returns

int

pamoja_scd4x_parse_measurement(ReadOnlySpan<byte>, nuint, out PamojaScd4xMeasurement)

Parses and CRC-checks a nine-byte SCD4x measurement frame. # Returns [PamojaStatus::Ok] on success, with *out_measurement filled in, or [PamojaStatus::Codec] if any word fails its checksum, which means the read was corrupted on the bus and should be repeated. # Safety frame must point to at least frame_len readable bytes, and out_measurement must point to a writable PamojaScd4xMeasurement.

public static PamojaStatus pamoja_scd4x_parse_measurement(ReadOnlySpan<byte> frame, nuint frameLen, out PamojaScd4xMeasurement outMeasurement)

Parameters

frame ReadOnlySpan<byte>
frameLen nuint
outMeasurement PamojaScd4xMeasurement

Returns

PamojaStatus

pamoja_scd4x_relative_humidity_percent(ushort)

Converts a raw SCD4x humidity word to a relative humidity percentage. # Returns The relative humidity.

public static extern float pamoja_scd4x_relative_humidity_percent(ushort raw)

Parameters

raw ushort

Returns

float

pamoja_scd4x_self_test_passed(ushort)

Reports whether an SCD4x self-test word says the part is healthy. # Returns true when the self test found no malfunction.

public static bool pamoja_scd4x_self_test_passed(ushort word)

Parameters

word ushort

Returns

bool

pamoja_scd4x_serial_number(ReadOnlySpan<byte>, nuint, out ulong)

Reads the 48-bit serial number out of a nine-byte SCD4x frame. # Returns [PamojaStatus::Ok] on success, with *out_serial set, or [PamojaStatus::Codec] if any word fails its checksum. # Safety frame must point to at least frame_len readable bytes, and out_serial must point to a writable uint64_t.

public static PamojaStatus pamoja_scd4x_serial_number(ReadOnlySpan<byte> frame, nuint frameLen, out ulong outSerial)

Parameters

frame ReadOnlySpan<byte>
frameLen nuint
outSerial ulong

Returns

PamojaStatus

pamoja_scd4x_serial_number_frame(ulong, Span<byte>)

Builds the nine bytes an SCD4x sends for a serial number, each CRC included. # Returns [PamojaStatus::Ok] on success, with the nine bytes written to out_bytes, or [PamojaStatus::InvalidArgument] if out_bytes is null. # Safety out_bytes must point to at least nine writable bytes.

public static PamojaStatus pamoja_scd4x_serial_number_frame(ulong serial, Span<byte> outBytes)

Parameters

serial ulong
outBytes Span<byte>

Returns

PamojaStatus

pamoja_scd4x_temperature_offset_milli_celsius(ushort)

Reads an SCD4x temperature-offset word back as an offset. # Returns The offset in milli-degrees Celsius.

public static extern uint pamoja_scd4x_temperature_offset_milli_celsius(ushort word)

Parameters

word ushort

Returns

uint

pamoja_scd4x_temperature_offset_word(uint)

Builds the SCD4x temperature-offset word for an offset. # Returns The word to write, which scales by 2^16 rather than by the 2^16 - 1 the measurement words use.

public static extern ushort pamoja_scd4x_temperature_offset_word(uint milliCelsius)

Parameters

milliCelsius uint

Returns

ushort

pamoja_scd4x_temperature_raw(int)

Builds the SCD4x temperature word that decodes to a temperature. # Returns The raw word, saturating at the ends of the part's range.

public static extern ushort pamoja_scd4x_temperature_raw(int milliCelsius)

Parameters

milliCelsius int

Returns

ushort

pamoja_scd4x_word(ReadOnlySpan<byte>, nuint, out ushort)

Reads a CRC-checked three-byte SCD4x word frame. # Returns [PamojaStatus::Ok] on success, with *out_word set, or [PamojaStatus::Codec] if the CRC does not match. # Safety frame must point to at least frame_len readable bytes, and out_word must point to a writable uint16_t.

public static PamojaStatus pamoja_scd4x_word(ReadOnlySpan<byte> frame, nuint frameLen, out ushort outWord)

Parameters

frame ReadOnlySpan<byte>
frameLen nuint
outWord ushort

Returns

PamojaStatus

pamoja_scd4x_word_frame(ushort, Span<byte>)

Builds the three bytes an SCD4x sends for a word: the word then its CRC. # Returns [PamojaStatus::Ok] on success, with the three bytes written to out_bytes, or [PamojaStatus::InvalidArgument] if out_bytes is null. # Safety out_bytes must point to at least three writable bytes.

public static PamojaStatus pamoja_scd4x_word_frame(ushort value, Span<byte> outBytes)

Parameters

value ushort
outBytes Span<byte>

Returns

PamojaStatus

pamoja_scd4x_write_frame(ushort, ushort, Span<byte>)

Builds the five bytes that write a word to an SCD4x: command, word, CRC. # Returns [PamojaStatus::Ok] on success, with the five bytes written to out_bytes, or [PamojaStatus::InvalidArgument] if out_bytes is null. # Safety out_bytes must point to at least five writable bytes.

public static PamojaStatus pamoja_scd4x_write_frame(ushort command, ushort value, Span<byte> outBytes)

Parameters

command ushort
value ushort
outBytes Span<byte>

Returns

PamojaStatus

pamoja_serial_cobs_decode(ReadOnlySpan<byte>, nuint, out nint)

Reads the payload back out of a COBS frame.

public static PamojaStatus pamoja_serial_cobs_decode(ReadOnlySpan<byte> frame, nuint frameLen, out nint outBuffer)

Parameters

frame ReadOnlySpan<byte>
frameLen nuint
outBuffer nint

Returns

PamojaStatus

pamoja_serial_cobs_encode(ReadOnlySpan<byte>, nuint, out nint)

Frames a payload as a COBS packet.

public static PamojaStatus pamoja_serial_cobs_encode(ReadOnlySpan<byte> payload, nuint payloadLen, out nint outBuffer)

Parameters

payload ReadOnlySpan<byte>
payloadLen nuint
outBuffer nint

Returns

PamojaStatus

pamoja_serial_cobs_max_encoded_len(nuint)

Returns the largest COBS frame a payload of this length can produce.

public static extern nuint pamoja_serial_cobs_max_encoded_len(nuint payloadLen)

Parameters

payloadLen nuint

Returns

nuint

pamoja_serial_slip_decode(ReadOnlySpan<byte>, nuint, out nint)

Reads the payload back out of a SLIP frame.

public static PamojaStatus pamoja_serial_slip_decode(ReadOnlySpan<byte> frame, nuint frameLen, out nint outBuffer)

Parameters

frame ReadOnlySpan<byte>
frameLen nuint
outBuffer nint

Returns

PamojaStatus

pamoja_serial_slip_encode(ReadOnlySpan<byte>, nuint, out nint)

Frames a payload as a SLIP packet (RFC 1055).

public static PamojaStatus pamoja_serial_slip_encode(ReadOnlySpan<byte> payload, nuint payloadLen, out nint outBuffer)

Parameters

payload ReadOnlySpan<byte>
payloadLen nuint
outBuffer nint

Returns

PamojaStatus

pamoja_serial_slip_max_encoded_len(nuint)

Returns the largest SLIP frame a payload of this length can produce.

public static extern nuint pamoja_serial_slip_max_encoded_len(nuint payloadLen)

Parameters

payloadLen nuint

Returns

nuint

pamoja_session_establish(nint, ReadOnlySpan<byte>, ReadOnlySpan<byte>, nuint, PamojaSessionRole)

Establishes a session with a peer.

public static nint pamoja_session_establish(nint local, ReadOnlySpan<byte> peerPublicKey, ReadOnlySpan<byte> salt, nuint saltLen, PamojaSessionRole role)

Parameters

local nint
peerPublicKey ReadOnlySpan<byte>
salt ReadOnlySpan<byte>
saltLen nuint
role PamojaSessionRole

Returns

nint

pamoja_session_free(nint)

Releases a session handle.

public static extern void pamoja_session_free(nint session)

Parameters

session nint

pamoja_session_hkdf_sha256(ReadOnlySpan<byte>, nuint, ReadOnlySpan<byte>, nuint, ReadOnlySpan<byte>, nuint, Span<byte>, nuint)

Expands input keying material into as many bytes as asked for.

public static PamojaStatus pamoja_session_hkdf_sha256(ReadOnlySpan<byte> salt, nuint saltLen, ReadOnlySpan<byte> ikm, nuint ikmLen, ReadOnlySpan<byte> info, nuint infoLen, Span<byte> outBytes, nuint outLen)

Parameters

salt ReadOnlySpan<byte>
saltLen nuint
ikm ReadOnlySpan<byte>
ikmLen nuint
info ReadOnlySpan<byte>
infoLen nuint
outBytes Span<byte>
outLen nuint

Returns

PamojaStatus

pamoja_session_hmac_sha256(ReadOnlySpan<byte>, nuint, ReadOnlySpan<byte>, nuint, Span<byte>)

Computes a keyed hash over a message.

public static PamojaStatus pamoja_session_hmac_sha256(ReadOnlySpan<byte> key, nuint keyLen, ReadOnlySpan<byte> message, nuint messageLen, Span<byte> outDigest)

Parameters

key ReadOnlySpan<byte>
keyLen nuint
message ReadOnlySpan<byte>
messageLen nuint
outDigest Span<byte>

Returns

PamojaStatus

pamoja_session_open(nint, PamojaSealed, Span<byte>, nuint, ReadOnlySpan<byte>, nuint)

Opens a message from the peer, decrypting it in place.

public static PamojaStatus pamoja_session_open(nint session, PamojaSealed sealedHeader, Span<byte> buf, nuint len, ReadOnlySpan<byte> aad, nuint aadLen)

Parameters

session nint
sealedHeader PamojaSealed
buf Span<byte>
len nuint
aad ReadOnlySpan<byte>
aadLen nuint

Returns

PamojaStatus

pamoja_session_seal(nint, Span<byte>, nuint, ReadOnlySpan<byte>, nuint, out PamojaSealed)

Seals a message for the peer, encrypting it in place.

public static PamojaStatus pamoja_session_seal(nint session, Span<byte> buf, nuint len, ReadOnlySpan<byte> aad, nuint aadLen, out PamojaSealed outSealed)

Parameters

session nint
buf Span<byte>
len nuint
aad ReadOnlySpan<byte>
aadLen nuint
outSealed PamojaSealed

Returns

PamojaStatus

pamoja_sht3x_celsius(ushort)

Converts a raw SHT3x temperature word to degrees Celsius. # Returns The temperature.

public static extern float pamoja_sht3x_celsius(ushort raw)

Parameters

raw ushort

Returns

float

pamoja_sht3x_crc(ReadOnlySpan<byte>, nuint)

Computes the CRC-8 an SHT3x appends to every data word. # Returns The checksum over data, or 0 if the pointer is null with a non-zero length. # Safety data must point to at least data_len readable bytes, or be null when data_len is 0.

public static byte pamoja_sht3x_crc(ReadOnlySpan<byte> data, nuint dataLen)

Parameters

data ReadOnlySpan<byte>
dataLen nuint

Returns

byte

pamoja_sht3x_fahrenheit(ushort)

Converts a raw SHT3x temperature word to degrees Fahrenheit. # Returns The temperature.

public static extern float pamoja_sht3x_fahrenheit(ushort raw)

Parameters

raw ushort

Returns

float

pamoja_sht3x_humidity_raw_from_milli_percent(uint)

Builds the SHT3x humidity word that decodes to a relative humidity. # Returns The raw word, saturating at full scale.

public static extern ushort pamoja_sht3x_humidity_raw_from_milli_percent(uint milliPercent)

Parameters

milliPercent uint

Returns

ushort

pamoja_sht3x_humidity_raw_from_relative_humidity(float)

Builds the SHT3x humidity word that decodes to a relative humidity percentage. # Returns The raw word, saturating at full scale.

public static extern ushort pamoja_sht3x_humidity_raw_from_relative_humidity(float percent)

Parameters

percent float

Returns

ushort

pamoja_sht3x_interval_micros(byte, out uint)

Returns the gap between SHT3x periodic measurements at a rate. # Returns [PamojaStatus::Ok] on success, with *out_micros set, or [PamojaStatus::InvalidArgument] if the code is out of range. # Safety out_micros must point to a writable uint32_t.

public static PamojaStatus pamoja_sht3x_interval_micros(byte rate, out uint outMicros)

Parameters

rate byte
outMicros uint

Returns

PamojaStatus

pamoja_sht3x_max_measurement_micros(byte, out uint)

Returns how long an SHT3x measurement may take at a repeatability. # Returns [PamojaStatus::Ok] on success, with *out_micros set to the datasheet's worst case, or [PamojaStatus::InvalidArgument] if the code is out of range. # Safety out_micros must point to a writable uint32_t.

public static PamojaStatus pamoja_sht3x_max_measurement_micros(byte repeatability, out uint outMicros)

Parameters

repeatability byte
outMicros uint

Returns

PamojaStatus

pamoja_sht3x_measurement_bytes(ushort, ushort, Span<byte>)

Builds the six bytes an SHT3x sends for a pair of raw words. # Returns [PamojaStatus::Ok] on success, with the six bytes written to out_bytes, or [PamojaStatus::InvalidArgument] if out_bytes is null. # Safety out_bytes must point to at least six writable bytes.

public static PamojaStatus pamoja_sht3x_measurement_bytes(ushort temperatureRaw, ushort humidityRaw, Span<byte> outBytes)

Parameters

temperatureRaw ushort
humidityRaw ushort
outBytes Span<byte>

Returns

PamojaStatus

pamoja_sht3x_milli_celsius(ushort)

Converts a raw SHT3x temperature word to milli-degrees Celsius. # Returns The temperature, exact in integer arithmetic.

public static extern int pamoja_sht3x_milli_celsius(ushort raw)

Parameters

raw ushort

Returns

int

pamoja_sht3x_milli_fahrenheit(ushort)

Converts a raw SHT3x temperature word to milli-degrees Fahrenheit. # Returns The temperature, exact in integer arithmetic.

public static extern int pamoja_sht3x_milli_fahrenheit(ushort raw)

Parameters

raw ushort

Returns

int

pamoja_sht3x_milli_percent(ushort)

Converts a raw SHT3x humidity word to milli-percent. # Returns The relative humidity, exact in integer arithmetic.

public static extern uint pamoja_sht3x_milli_percent(ushort raw)

Parameters

raw ushort

Returns

uint

pamoja_sht3x_parse_measurement(ReadOnlySpan<byte>, nuint, out PamojaSht3xMeasurement)

Parses and CRC-checks a six-byte SHT3x measurement frame. # Returns [PamojaStatus::Ok] on success, with *out_measurement filled in, or [PamojaStatus::Codec] if either word fails its checksum, which means the read was corrupted on the bus and should be repeated. # Safety frame must point to at least frame_len readable bytes, and out_measurement must point to a writable PamojaSht3xMeasurement.

public static PamojaStatus pamoja_sht3x_parse_measurement(ReadOnlySpan<byte> frame, nuint frameLen, out PamojaSht3xMeasurement outMeasurement)

Parameters

frame ReadOnlySpan<byte>
frameLen nuint
outMeasurement PamojaSht3xMeasurement

Returns

PamojaStatus

pamoja_sht3x_parse_status(ReadOnlySpan<byte>, nuint, out PamojaSht3xStatus)

Parses and CRC-checks a three-byte SHT3x status frame. # Returns [PamojaStatus::Ok] on success, with *out_status filled in, or [PamojaStatus::Codec] if the CRC does not match. # Safety frame must point to at least frame_len readable bytes, and out_status must point to a writable PamojaSht3xStatus.

public static PamojaStatus pamoja_sht3x_parse_status(ReadOnlySpan<byte> frame, nuint frameLen, out PamojaSht3xStatus outStatus)

Parameters

frame ReadOnlySpan<byte>
frameLen nuint
outStatus PamojaSht3xStatus

Returns

PamojaStatus

pamoja_sht3x_periodic(byte, byte, out ushort)

Returns the SHT3x periodic-mode command for a repeatability and rate. # Returns [PamojaStatus::Ok] on success, with *out_command set, or [PamojaStatus::InvalidArgument] if either code is outside its range. # Safety out_command must point to a writable uint16_t.

public static PamojaStatus pamoja_sht3x_periodic(byte repeatability, byte rate, out ushort outCommand)

Parameters

repeatability byte
rate byte
outCommand ushort

Returns

PamojaStatus

pamoja_sht3x_relative_humidity(ushort)

Converts a raw SHT3x humidity word to a relative humidity percentage. # Returns The relative humidity.

public static extern float pamoja_sht3x_relative_humidity(ushort raw)

Parameters

raw ushort

Returns

float

pamoja_sht3x_single_shot(byte, bool, out ushort)

Returns the SHT3x single-shot command for a repeatability and clock mode. # Returns [PamojaStatus::Ok] on success, with *out_command set, or [PamojaStatus::InvalidArgument] if repeatability is not 0, 1, or 2. # Safety out_command must point to a writable uint16_t.

public static PamojaStatus pamoja_sht3x_single_shot(byte repeatability, bool clockStretching, out ushort outCommand)

Parameters

repeatability byte
clockStretching bool
outCommand ushort

Returns

PamojaStatus

pamoja_sht3x_status_bytes(ushort, Span<byte>)

Builds the three bytes an SHT3x sends for a status word, CRC last. # Returns [PamojaStatus::Ok] on success, with the three bytes written to out_bytes, or [PamojaStatus::InvalidArgument] if out_bytes is null. # Safety out_bytes must point to at least three writable bytes.

public static PamojaStatus pamoja_sht3x_status_bytes(ushort bits, Span<byte> outBytes)

Parameters

bits ushort
outBytes Span<byte>

Returns

PamojaStatus

pamoja_sht3x_status_from_bits(ushort, out PamojaSht3xStatus)

Splits an SHT3x status word into its flags. # Returns [PamojaStatus::Ok], with *out_status filled in. Every word decodes, so this fails only on a null pointer. # Safety out_status must point to a writable PamojaSht3xStatus.

public static PamojaStatus pamoja_sht3x_status_from_bits(ushort bits, out PamojaSht3xStatus outStatus)

Parameters

bits ushort
outStatus PamojaSht3xStatus

Returns

PamojaStatus

pamoja_sht3x_temperature_raw_from_celsius(float)

Builds the SHT3x temperature word that decodes to a temperature in Celsius. # Returns The raw word, saturating at the ends of the part's range.

public static extern ushort pamoja_sht3x_temperature_raw_from_celsius(float celsius)

Parameters

celsius float

Returns

ushort

pamoja_sht3x_temperature_raw_from_milli_celsius(int)

Builds the SHT3x temperature word that decodes to a temperature. # Returns The raw word, saturating at the ends of the part's range.

public static extern ushort pamoja_sht3x_temperature_raw_from_milli_celsius(int milliCelsius)

Parameters

milliCelsius int

Returns

ushort

pamoja_sht3x_temperature_raw_from_milli_fahrenheit(int)

Builds the SHT3x temperature word that decodes to a temperature in Fahrenheit. # Returns The raw word, saturating at the ends of the part's range.

public static extern ushort pamoja_sht3x_temperature_raw_from_milli_fahrenheit(int milliFahrenheit)

Parameters

milliFahrenheit int

Returns

ushort

pamoja_sht3x_typical_measurement_micros(byte, out uint)

Returns how long an SHT3x measurement typically takes at a repeatability. # Returns [PamojaStatus::Ok] on success, with *out_micros set, or [PamojaStatus::InvalidArgument] if the code is out of range. # Safety out_micros must point to a writable uint32_t.

public static PamojaStatus pamoja_sht3x_typical_measurement_micros(byte repeatability, out uint outMicros)

Parameters

repeatability byte
outMicros uint

Returns

PamojaStatus

pamoja_sht3x_word(ReadOnlySpan<byte>, nuint, out ushort)

Reads a CRC-checked three-byte SHT3x word frame. # Returns [PamojaStatus::Ok] on success, with *out_word set, or [PamojaStatus::Codec] if the CRC does not match. # Safety frame must point to at least frame_len readable bytes, and out_word must point to a writable uint16_t.

public static PamojaStatus pamoja_sht3x_word(ReadOnlySpan<byte> frame, nuint frameLen, out ushort outWord)

Parameters

frame ReadOnlySpan<byte>
frameLen nuint
outWord ushort

Returns

PamojaStatus

pamoja_sht3x_word_bytes(ushort, Span<byte>)

Builds the three bytes an SHT3x sends for a word: the word then its CRC. # Returns [PamojaStatus::Ok] on success, with the three bytes written to out_bytes, or [PamojaStatus::InvalidArgument] if out_bytes is null. # Safety out_bytes must point to at least three writable bytes.

public static PamojaStatus pamoja_sht3x_word_bytes(ushort value, Span<byte> outBytes)

Parameters

value ushort
outBytes Span<byte>

Returns

PamojaStatus

pamoja_sim_robot_apply(nint, PamojaTwist)

Drives a simulated robot for one time step.

public static extern PamojaStatus pamoja_sim_robot_apply(nint robot, PamojaTwist command)

Parameters

robot nint
command PamojaTwist

Returns

PamojaStatus

pamoja_sim_robot_free(nint)

Releases a simulated robot handle.

public static extern void pamoja_sim_robot_free(nint robot)

Parameters

robot nint

pamoja_sim_robot_new(PamojaPose, float)

Creates a robot that moves only in arithmetic.

public static extern nint pamoja_sim_robot_new(PamojaPose start, float dt)

Parameters

start PamojaPose
dt float

Returns

nint

pamoja_sim_robot_pose(nint)

Reads where a simulated robot has got to.

public static extern PamojaPose pamoja_sim_robot_pose(nint robot)

Parameters

robot nint

Returns

PamojaPose

pamoja_sim_sensor_free(nint)

Releases a simulated sensor handle.

public static extern void pamoja_sim_sensor_free(nint sensor)

Parameters

sensor nint

pamoja_sim_sensor_new(float, float, float, uint)

Creates a sensor that reads around a baseline.

public static extern nint pamoja_sim_sensor_new(float baseline, float driftPerRead, float noise, uint seed)

Parameters

baseline float
driftPerRead float
noise float
seed uint

Returns

nint

pamoja_sim_sensor_read(nint, out float)

Takes the next reading from a simulated sensor.

public static PamojaStatus pamoja_sim_sensor_read(nint sensor, out float outReading)

Parameters

sensor nint
outReading float

Returns

PamojaStatus

pamoja_slip_decoder_discarded(nint)

Returns how many corrupt frames a SLIP decoder has discarded.

public static extern ulong pamoja_slip_decoder_discarded(nint decoder)

Parameters

decoder nint

Returns

ulong

pamoja_slip_decoder_feed(nint, ReadOnlySpan<byte>, nuint, out nint)

Feeds a chunk of the byte stream to a SLIP decoder.

public static PamojaStatus pamoja_slip_decoder_feed(nint decoder, ReadOnlySpan<byte> bytes, nuint bytesLen, out nint outFrames)

Parameters

decoder nint
bytes ReadOnlySpan<byte>
bytesLen nuint
outFrames nint

Returns

PamojaStatus

pamoja_slip_decoder_free(nint)

Releases a SLIP decoder handle. Passing null is a no-op.

public static extern void pamoja_slip_decoder_free(nint decoder)

Parameters

decoder nint

pamoja_slip_decoder_new()

Creates a streaming SLIP decoder.

public static extern nint pamoja_slip_decoder_new()

Returns

nint

pamoja_slip_decoder_reset(nint)

Discards any partly assembled SLIP frame.

public static extern void pamoja_slip_decoder_reset(nint decoder)

Parameters

decoder nint

pamoja_smoother_free(nint)

Releases a smoother handle. Passing null is a no-op.

public static extern void pamoja_smoother_free(nint smoother)

Parameters

smoother nint

pamoja_smoother_new(float)

Creates an exponential smoother.

public static extern nint pamoja_smoother_new(float weight)

Parameters

weight float

Returns

nint

pamoja_smoother_reset(nint)

Clears a smoother back to its initial state.

public static extern void pamoja_smoother_reset(nint smoother)

Parameters

smoother nint

pamoja_smoother_update(nint, float)

Folds a sample into a smoother and returns the smoothed value.

public static extern float pamoja_smoother_update(nint smoother, float sample)

Parameters

smoother nint
sample float

Returns

float

pamoja_smoother_value(nint, out float)

Reads a smoother's current value, if it has one.

public static bool pamoja_smoother_value(nint smoother, out float outValue)

Parameters

smoother nint
outValue float

Returns

bool

pamoja_spi_mode_cpol_cpha(byte, out bool, out bool)

Returns the clock polarity and phase an SPI mode number names.

public static PamojaStatus pamoja_spi_mode_cpol_cpha(byte mode, out bool outCpol, out bool outCpha)

Parameters

mode byte
outCpol bool
outCpha bool

Returns

PamojaStatus

pamoja_spi_mode_from_cpol_cpha(bool, bool)

Returns the SPI mode number a clock polarity and phase name.

public static byte pamoja_spi_mode_from_cpol_cpha(bool cpol, bool cpha)

Parameters

cpol bool
cpha bool

Returns

byte

pamoja_stepper_coils(nint)

Returns the coil pattern a stepper holds, without advancing.

public static extern byte pamoja_stepper_coils(nint stepper)

Parameters

stepper nint

Returns

byte

pamoja_stepper_free(nint)

Releases a stepper handle. Passing null is a no-op.

public static extern void pamoja_stepper_free(nint stepper)

Parameters

stepper nint

pamoja_stepper_new(PamojaStepDrive)

Creates a stepper at the start of a drive pattern.

public static extern nint pamoja_stepper_new(PamojaStepDrive drive)

Parameters

drive PamojaStepDrive

Returns

nint

pamoja_stepper_step(nint, PamojaStepDirection)

Advances a stepper and returns the coil pattern to apply.

public static extern byte pamoja_stepper_step(nint stepper, PamojaStepDirection direction)

Parameters

stepper nint
direction PamojaStepDirection

Returns

byte

pamoja_stepper_step_count(PamojaStepDrive)

Returns how many steps one electrical cycle of a drive takes.

public static extern nuint pamoja_stepper_step_count(PamojaStepDrive drive)

Parameters

drive PamojaStepDrive

Returns

nuint

pamoja_stepper_steps(nint)

Returns how many steps a stepper has taken, signed by direction.

public static extern int pamoja_stepper_steps(nint stepper)

Parameters

stepper nint

Returns

int

pamoja_stepper_steps_for_degrees(float, uint)

Returns how many steps a rotation of an angle takes.

public static extern int pamoja_stepper_steps_for_degrees(float degrees, uint stepsPerRevolution)

Parameters

degrees float
stepsPerRevolution uint

Returns

int

pamoja_store_append(nint, ReadOnlySpan<byte>, nuint)

Adds a record to the end of a buffer.

public static PamojaStatus pamoja_store_append(nint store, ReadOnlySpan<byte> record, nuint recordLen)

Parameters

store nint
record ReadOnlySpan<byte>
recordLen nuint

Returns

PamojaStatus

pamoja_store_drain_to(nint, nint, nint, out nuint)

Sends every held record over a transport.

public static PamojaStatus pamoja_store_drain_to(nint store, nint transport, nint topic, out nuint outSent)

Parameters

store nint
transport nint
topic nint
outSent nuint

Returns

PamojaStatus

pamoja_store_file(nint)

Opens a buffer backed by a directory.

public static extern nint pamoja_store_file(nint dir)

Parameters

dir nint

Returns

nint

pamoja_store_free(nint)

Releases a store handle.

public static extern void pamoja_store_free(nint store)

Parameters

store nint

pamoja_store_len(nint, out nuint)

Reports how many records a buffer holds.

public static PamojaStatus pamoja_store_len(nint store, out nuint outLen)

Parameters

store nint
outLen nuint

Returns

PamojaStatus

pamoja_store_memory(nuint)

Creates a buffer held in memory.

public static extern nint pamoja_store_memory(nuint capacity)

Parameters

capacity nuint

Returns

nint

pamoja_store_peek(nint, out nint)

Reads the oldest record without removing it.

public static PamojaStatus pamoja_store_peek(nint store, out nint outRecord)

Parameters

store nint
outRecord nint

Returns

PamojaStatus

pamoja_store_pop(nint, out nint)

Removes and returns the oldest record.

public static PamojaStatus pamoja_store_pop(nint store, out nint outRecord)

Parameters

store nint
outRecord nint

Returns

PamojaStatus

pamoja_string_data(nint)

Returns a pointer to an owned string's bytes.

public static extern nint pamoja_string_data(nint text)

Parameters

text nint

Returns

nint

pamoja_string_free(nint)

Releases an owned string.

public static extern void pamoja_string_free(nint text)

Parameters

text nint

pamoja_string_len(nint)

Returns the length in bytes of an owned string.

public static extern nuint pamoja_string_len(nint text)

Parameters

text nint

Returns

nuint

pamoja_surge_falling(float)

Creates a detector for falls of at least the given size.

public static extern nint pamoja_surge_falling(float limit)

Parameters

limit float

Returns

nint

pamoja_surge_free(nint)

Releases a surge handle. Passing null is a no-op.

public static extern void pamoja_surge_free(nint surge)

Parameters

surge nint

pamoja_surge_rising(float)

Creates a detector for rises of at least the given size.

public static extern nint pamoja_surge_rising(float limit)

Parameters

limit float

Returns

nint

pamoja_surge_update(nint, float, out float)

Feeds a value to a surge detector, reporting a qualifying step.

public static bool pamoja_surge_update(nint surge, float value, out float outDelta)

Parameters

surge nint
value float
outDelta float

Returns

bool

pamoja_thermostat_cooling(float, float)

Creates a cooling thermostat.

public static extern nint pamoja_thermostat_cooling(float setpoint, float hysteresis)

Parameters

setpoint float
hysteresis float

Returns

nint

pamoja_thermostat_free(nint)

Releases a thermostat handle. Passing null is a no-op.

public static extern void pamoja_thermostat_free(nint thermostat)

Parameters

thermostat nint

pamoja_thermostat_heating(float, float)

Creates a heating thermostat.

public static extern nint pamoja_thermostat_heating(float setpoint, float hysteresis)

Parameters

setpoint float
hysteresis float

Returns

nint

pamoja_thermostat_is_on(nint)

Reports a thermostat's current load state.

public static bool pamoja_thermostat_is_on(nint thermostat)

Parameters

thermostat nint

Returns

bool

pamoja_thermostat_update(nint, float)

Feeds a reading to a thermostat and returns the load state.

public static bool pamoja_thermostat_update(nint thermostat, float reading)

Parameters

thermostat nint
reading float

Returns

bool

pamoja_tmp117_averaging_conversions(byte)

Returns how many conversions a TMP117 averaging code folds into one result. # Returns The conversion count: 1, 8, 32, or 64.

public static extern byte pamoja_tmp117_averaging_conversions(byte code)

Parameters

code byte

Returns

byte

pamoja_tmp117_averaging_micros(byte)

Returns how long a TMP117 averaging code takes to convert. # Returns The conversion time in microseconds.

public static extern uint pamoja_tmp117_averaging_micros(byte code)

Parameters

code byte

Returns

uint

pamoja_tmp117_celsius(short)

Converts a raw TMP117 temperature register to degrees Celsius. # Returns The temperature.

public static extern float pamoja_tmp117_celsius(short raw)

Parameters

raw short

Returns

float

pamoja_tmp117_config_bits(PamojaTmp117Config)

Assembles the 16-bit TMP117 configuration register value. # Returns The register value to write.

public static extern ushort pamoja_tmp117_config_bits(PamojaTmp117Config config)

Parameters

config PamojaTmp117Config

Returns

ushort

pamoja_tmp117_config_from_bits(ushort, out PamojaTmp117Config)

Parses a 16-bit TMP117 configuration register value. # Returns [PamojaStatus::Ok], with *out_config filled in. Every register value decodes, so this fails only on a null pointer. # Safety out_config must point to a writable PamojaTmp117Config.

public static PamojaStatus pamoja_tmp117_config_from_bits(ushort bits, out PamojaTmp117Config outConfig)

Parameters

bits ushort
outConfig PamojaTmp117Config

Returns

PamojaStatus

pamoja_tmp117_cycle_micros(byte, byte)

Returns how often a TMP117 updates its result for a cycle and averaging code. # Returns The longer of the nominal cycle and the time the averaging takes.

public static extern uint pamoja_tmp117_cycle_micros(byte cycle, byte averaging)

Parameters

cycle byte
averaging byte

Returns

uint

pamoja_tmp117_cycle_nominal_micros(byte)

Returns the nominal cycle a TMP117 conversion-cycle code selects. # Returns The cycle in microseconds, before the averaging setting extends it.

public static extern uint pamoja_tmp117_cycle_nominal_micros(byte code)

Parameters

code byte

Returns

uint

pamoja_tmp117_data_ready(ushort)

Reports whether a TMP117 configuration register says a result is ready. # Returns true when a conversion completed since the register was last read.

public static bool pamoja_tmp117_data_ready(ushort config)

Parameters

config ushort

Returns

bool

pamoja_tmp117_device_id(ushort)

Reads the device identifier out of a TMP117 device-ID register. # Returns The low twelve bits, which are 0x117 for a TMP117.

public static extern ushort pamoja_tmp117_device_id(ushort raw)

Parameters

raw ushort

Returns

ushort

pamoja_tmp117_eeprom_busy(ushort)

Reports whether a TMP117 configuration register says an EEPROM write is running. # Returns true while the write is in progress.

public static bool pamoja_tmp117_eeprom_busy(ushort config)

Parameters

config ushort

Returns

bool

pamoja_tmp117_eeprom_unlock_busy(ushort)

Reports whether a TMP117 EEPROM unlock register says a write is running. # Returns true while the write is in progress.

public static bool pamoja_tmp117_eeprom_unlock_busy(ushort unlock)

Parameters

unlock ushort

Returns

bool

pamoja_tmp117_high_alert(ushort)

Reports whether a TMP117 configuration register flags a high alert. # Returns true when a result went above the high limit.

public static bool pamoja_tmp117_high_alert(ushort config)

Parameters

config ushort

Returns

bool

pamoja_tmp117_low_alert(ushort)

Reports whether a TMP117 configuration register flags a low alert. # Returns true when a result went below the low limit.

public static bool pamoja_tmp117_low_alert(ushort config)

Parameters

config ushort

Returns

bool

pamoja_tmp117_micro_celsius(short)

Converts a raw TMP117 temperature register to micro-degrees Celsius. # Returns The temperature, truncated toward zero at the last digit.

public static extern int pamoja_tmp117_micro_celsius(short raw)

Parameters

raw short

Returns

int

pamoja_tmp117_nano_celsius(short)

Converts a raw TMP117 temperature register to nano-degrees Celsius. # Returns The temperature, exact in integer arithmetic at the part's 7.8125 m°C step.

public static extern long pamoja_tmp117_nano_celsius(short raw)

Parameters

raw short

Returns

long

pamoja_tmp117_raw_from_celsius(float)

Builds the TMP117 temperature register that decodes to a temperature in Celsius. # Returns The nearest register value, saturating at the ends of the part's range.

public static extern short pamoja_tmp117_raw_from_celsius(float celsius)

Parameters

celsius float

Returns

short

pamoja_tmp117_raw_from_micro_celsius(int)

Builds the TMP117 temperature register that decodes to a temperature. # Returns The nearest register value, saturating at the ends of the part's range.

public static extern short pamoja_tmp117_raw_from_micro_celsius(int microCelsius)

Parameters

microCelsius int

Returns

short

pamoja_tmp117_revision(ushort)

Reads the die revision out of a TMP117 device-ID register. # Returns The high four bits.

public static extern byte pamoja_tmp117_revision(ushort raw)

Parameters

raw ushort

Returns

byte

pamoja_tmp117_temperature_bytes(short, Span<byte>)

Builds the two bytes a TMP117 sends for a temperature register. # Returns [PamojaStatus::Ok] on success, with the two bytes written to out_bytes, or [PamojaStatus::InvalidArgument] if out_bytes is null. # Safety out_bytes must point to at least two writable bytes.

public static PamojaStatus pamoja_tmp117_temperature_bytes(short raw, Span<byte> outBytes)

Parameters

raw short
outBytes Span<byte>

Returns

PamojaStatus

pamoja_tmp117_temperature_from_bytes(ReadOnlySpan<byte>, nuint, out short)

Reads the two bytes a TMP117 sends for a temperature register. # Returns [PamojaStatus::Ok] on success, with *out_raw set, or [PamojaStatus::InvalidArgument] if the buffer is not two bytes. # Safety bytes must point to at least bytes_len readable bytes, and out_raw must point to a writable int16_t.

public static PamojaStatus pamoja_tmp117_temperature_from_bytes(ReadOnlySpan<byte> bytes, nuint bytesLen, out short outRaw)

Parameters

bytes ReadOnlySpan<byte>
bytesLen nuint
outRaw short

Returns

PamojaStatus

pamoja_transport_coap(ref PamojaCoapConfig)

Creates a CoAP transport for composing.

public static nint pamoja_transport_coap(ref PamojaCoapConfig config)

Parameters

config PamojaCoapConfig

Returns

nint

pamoja_transport_connect(nint)

Connects a transport.

public static extern PamojaStatus pamoja_transport_connect(nint transport)

Parameters

transport nint

Returns

PamojaStatus

pamoja_transport_degraded(nint, uint, uint, uint)

Wraps a transport in a link that loses packets and goes down.

public static extern nint pamoja_transport_degraded(nint transport, uint dropEvery, uint up, uint down)

Parameters

transport nint
dropEvery uint
up uint
down uint

Returns

nint

pamoja_transport_faulty(nint, nuint)

Wraps a transport so a set number of its next sends fail.

public static extern nint pamoja_transport_faulty(nint transport, nuint failures)

Parameters

transport nint
failures nuint

Returns

nint

pamoja_transport_free(nint)

Releases a transport handle.

public static extern void pamoja_transport_free(nint transport)

Parameters

transport nint

pamoja_transport_loopback(nint)

Creates a loopback transport for composing.

public static extern nint pamoja_transport_loopback(nint broker)

Parameters

broker nint

Returns

nint

pamoja_transport_mqtt(ref PamojaMqttConfig)

Creates an MQTT transport for composing.

public static nint pamoja_transport_mqtt(ref PamojaMqttConfig config)

Parameters

config PamojaMqttConfig

Returns

nint

pamoja_transport_send(nint, nint, ReadOnlySpan<byte>, nuint)

Sends a payload over a transport.

public static PamojaStatus pamoja_transport_send(nint transport, nint topic, ReadOnlySpan<byte> payload, nuint payloadLen)

Parameters

transport nint
topic nint
payload ReadOnlySpan<byte>
payloadLen nuint

Returns

PamojaStatus

pamoja_transport_subscribe(nint, nint)

Subscribes a transport to a topic.

public static extern PamojaStatus pamoja_transport_subscribe(nint transport, nint topic)

Parameters

transport nint
topic nint

Returns

PamojaStatus

pamoja_trend_free(nint)

Releases a trend estimator handle. Passing null is a no-op.

public static extern void pamoja_trend_free(nint trend)

Parameters

trend nint

pamoja_trend_new()

Creates an empty trend estimator.

public static extern nint pamoja_trend_new()

Returns

nint

pamoja_trend_push(nint, float)

Adds a reading to a trend estimator.

public static extern void pamoja_trend_push(nint trend, float reading)

Parameters

trend nint
reading float

pamoja_trend_slope(nint, out float)

Reads the slope a trend estimator has fitted, if it has enough readings.

public static bool pamoja_trend_slope(nint trend, out float outValue)

Parameters

trend nint
outValue float

Returns

bool

pamoja_updater_adopt(nint, ReadOnlySpan<byte>, nuint, bool, ulong, out PamojaDelegation)

Adopts a delegation naming a release key.

public static PamojaStatus pamoja_updater_adopt(nint updater, ReadOnlySpan<byte> bytes, nuint len, bool hasNow, ulong now, out PamojaDelegation outDelegation)

Parameters

updater nint
bytes ReadOnlySpan<byte>
len nuint
hasNow bool
now ulong
outDelegation PamojaDelegation

Returns

PamojaStatus

pamoja_updater_begin(nint, ReadOnlySpan<byte>, nuint, bool, ulong, out byte)

Checks a manifest and opens its slot for a transfer in pieces.

public static PamojaStatus pamoja_updater_begin(nint updater, ReadOnlySpan<byte> envelope, nuint envelopeLen, bool hasNow, ulong now, out byte outSlot)

Parameters

updater nint
envelope ReadOnlySpan<byte>
envelopeLen nuint
hasNow bool
now ulong
outSlot byte

Returns

PamojaStatus

pamoja_updater_confirm(nint, out byte)

Confirms the pending image.

public static PamojaStatus pamoja_updater_confirm(nint updater, out byte outSlot)

Parameters

updater nint
outSlot byte

Returns

PamojaStatus

pamoja_updater_delegation(nint, out PamojaDelegation)

Reads the delegation an updater currently honours.

public static bool pamoja_updater_delegation(nint updater, out PamojaDelegation outDelegation)

Parameters

updater nint
outDelegation PamojaDelegation

Returns

bool

pamoja_updater_finish(nint, out byte)

Finishes an opened image and marks the slot bootable if it matched.

public static PamojaStatus pamoja_updater_finish(nint updater, out byte outSlot)

Parameters

updater nint
outSlot byte

Returns

PamojaStatus

pamoja_updater_free(nint)

Releases an updater handle.

public static extern void pamoja_updater_free(nint updater)

Parameters

updater nint

pamoja_updater_installed_sequence(nint, out ulong)

Reads the highest sequence number the device already holds.

public static PamojaStatus pamoja_updater_installed_sequence(nint updater, out ulong outSequence)

Parameters

updater nint
outSequence ulong

Returns

PamojaStatus

pamoja_updater_new(PamojaDevice, byte, uint)

Creates an updater over a device's slots.

public static extern nint pamoja_updater_new(PamojaDevice device, byte slotCount, uint slotCapacity)

Parameters

device PamojaDevice
slotCount byte
slotCapacity uint

Returns

nint

pamoja_updater_on_boot(nint, out PamojaBoot)

Decides what to run, recording the decision before returning it.

public static PamojaStatus pamoja_updater_on_boot(nint updater, out PamojaBoot outBoot)

Parameters

updater nint
outBoot PamojaBoot

Returns

PamojaStatus

pamoja_updater_progress(nint, out uint, out uint)

Reports how much of an opened image has arrived.

public static PamojaStatus pamoja_updater_progress(nint updater, out uint outWritten, out uint outTotal)

Parameters

updater nint
outWritten uint
outTotal uint

Returns

PamojaStatus

pamoja_updater_provision(nint, byte, ulong)

Records that a slot holds a confirmed image at a sequence number.

public static extern PamojaStatus pamoja_updater_provision(nint updater, byte slot, ulong sequence)

Parameters

updater nint
slot byte
sequence ulong

Returns

PamojaStatus

pamoja_updater_revert(nint, out byte)

Fails the pending image and goes back to the confirmed one.

public static PamojaStatus pamoja_updater_revert(nint updater, out byte outSlot)

Parameters

updater nint
outSlot byte

Returns

PamojaStatus

pamoja_updater_slot_count(nint)

Returns how many slots a device has.

public static extern byte pamoja_updater_slot_count(nint updater)

Parameters

updater nint

Returns

byte

pamoja_updater_slot_record(nint, byte, out PamojaSlotRecord)

Reads what a device believes about one slot.

public static PamojaStatus pamoja_updater_slot_record(nint updater, byte slot, out PamojaSlotRecord outRecord)

Parameters

updater nint
slot byte
outRecord PamojaSlotRecord

Returns

PamojaStatus

pamoja_updater_stage(nint, ReadOnlySpan<byte>, nuint, ReadOnlySpan<byte>, nuint, bool, ulong, out byte)

Checks a manifest and stages an image held whole.

public static PamojaStatus pamoja_updater_stage(nint updater, ReadOnlySpan<byte> envelope, nuint envelopeLen, ReadOnlySpan<byte> image, nuint imageLen, bool hasNow, ulong now, out byte outSlot)

Parameters

updater nint
envelope ReadOnlySpan<byte>
envelopeLen nuint
image ReadOnlySpan<byte>
imageLen nuint
hasNow bool
now ulong
outSlot byte

Returns

PamojaStatus

pamoja_updater_write(nint, ReadOnlySpan<byte>, nuint)

Takes the next piece of an opened image.

public static PamojaStatus pamoja_updater_write(nint updater, ReadOnlySpan<byte> chunk, nuint len)

Parameters

updater nint
chunk ReadOnlySpan<byte>
len nuint

Returns

PamojaStatus

pamoja_version()

Returns the version string of the native pamoja library.

public static extern nint pamoja_version()

Returns

nint

pamoja_window_capacity(nint)

Returns how many readings a window holds before dropping.

public static extern nuint pamoja_window_capacity(nint window)

Parameters

window nint

Returns

nuint

pamoja_window_free(nint)

Releases a rolling window handle. Passing null is a no-op.

public static extern void pamoja_window_free(nint window)

Parameters

window nint

pamoja_window_len(nint)

Returns how many readings a window holds.

public static extern nuint pamoja_window_len(nint window)

Parameters

window nint

Returns

nuint

pamoja_window_max(nint, out float)

Reads the largest reading in a window, if it has any.

public static bool pamoja_window_max(nint window, out float outValue)

Parameters

window nint
outValue float

Returns

bool

pamoja_window_mean(nint, out float)

Reads the mean of a window's readings, if it has any.

public static bool pamoja_window_mean(nint window, out float outValue)

Parameters

window nint
outValue float

Returns

bool

pamoja_window_min(nint, out float)

Reads the smallest reading in a window, if it has any.

public static bool pamoja_window_min(nint window, out float outValue)

Parameters

window nint
outValue float

Returns

bool

pamoja_window_new()

Creates an empty rolling window.

public static extern nint pamoja_window_new()

Returns

nint

pamoja_window_push(nint, float)

Adds a reading to a window, dropping the oldest once full.

public static extern void pamoja_window_push(nint window, float reading)

Parameters

window nint
reading float

pamoja_window_range(nint, out float)

Reads the spread across a window's readings, if it has any.

public static bool pamoja_window_range(nint window, out float outValue)

Parameters

window nint
outValue float

Returns

bool

pamoja_window_variance(nint, out float)

Reads the variance of a window's readings, if it has enough.

public static bool pamoja_window_variance(nint window, out float outValue)

Parameters

window nint
outValue float

Returns

bool