Class NativeMethods
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
AuditSignatureLen
The length in bytes of an audit entry signature.
public const int AuditSignatureLen = 64
Field Value
Bme280CalibrationHumidityLen
The BME280 humidity calibration block length.
public const int Bme280CalibrationHumidityLen = 7
Field Value
Bme280CalibrationTempPressLen
The BME280 temperature and pressure calibration block length.
public const int Bme280CalibrationTempPressLen = 26
Field Value
Bme280MeasurementLen
The length of a BME280 burst measurement read.
public const int Bme280MeasurementLen = 8
Field Value
Bmp280CalibrationLen
The length of a BMP280 calibration block.
public const int Bmp280CalibrationLen = 24
Field Value
Bmp280DataLen
The length of a BMP280 burst data read.
public const int Bmp280DataLen = 6
Field Value
Ds18b20ScratchpadLen
The length of a DS18B20 scratchpad, the ninth byte its CRC.
public const int Ds18b20ScratchpadLen = 9
Field Value
Hdc1080MeasurementLen
The length of a HDC1080 measurement frame.
public const int Hdc1080MeasurementLen = 4
Field Value
I2cReservedBelow
The first 7-bit address above the reserved block at the bottom.
public const byte I2cReservedBelow = 8
Field Value
I2cReservedFrom
The lowest 7-bit address the I2C specification keeps for itself.
public const byte I2cReservedFrom = 120
Field Value
J1939BroadcastAddress
The destination address every node on the bus reads.
public const byte J1939BroadcastAddress = 255
Field Value
J1939NotAvailable
The byte a J1939 sender writes for a signal it is not reporting.
public const byte J1939NotAvailable = 255
Field Value
J1939PriorityControl
The priority a control message takes, ahead of ordinary traffic.
public const byte J1939PriorityControl = 3
Field Value
J1939PriorityDefault
The priority ordinary traffic takes.
public const byte J1939PriorityDefault = 6
Field Value
J1939PriorityLowest
The priority that yields to everything else on the bus.
public const byte J1939PriorityLowest = 7
Field Value
LoraChannelsDefault
The channels a device starts with before a network adds any.
public const uint LoraChannelsDefault = 1
Field Value
LoraChannelsJoin
The channels a device must use to send a join request.
public const uint LoraChannelsJoin = 0
Field Value
LoraDirectionDownlink
The downlink direction, for a table that differs between the two.
public const uint LoraDirectionDownlink = 1
Field Value
LoraDirectionUplink
The uplink direction, for a table that differs between the two.
public const uint LoraDirectionUplink = 0
Field Value
LoraModulationFsk
A data rate carried by FSK modulation.
public const byte LoraModulationFsk = 1
Field Value
LoraModulationLora
A data rate carried by LoRa modulation.
public const byte LoraModulationLora = 0
Field Value
LoraModulationLrFhss
A data rate carried by long-range frequency-hopping spread spectrum.
public const byte LoraModulationLrFhss = 2
Field Value
LoraModulationReserved
A data-rate number the region reserves, which carries nothing.
public const byte LoraModulationReserved = 3
Field Value
LoraPayloadTableDownlinkDirect
The downlink payload limits for a device that will not.
public const uint LoraPayloadTableDownlinkDirect = 3
Field Value
LoraPayloadTableDownlinkRepeater
The downlink payload limits for a device that may sit behind a repeater.
public const uint LoraPayloadTableDownlinkRepeater = 2
Field Value
LoraPayloadTableDwellLimited
The payload limits that apply under a dwell-time limit.
public const uint LoraPayloadTableDwellLimited = 4
Field Value
LoraPayloadTableUplinkDirect
The uplink payload limits for a device that will not.
public const uint LoraPayloadTableUplinkDirect = 1
Field Value
LoraPayloadTableUplinkRepeater
The uplink payload limits for a device that may sit behind a repeater.
public const uint LoraPayloadTableUplinkRepeater = 0
Field Value
LoraRegionAs923
The AS923 band.
public const uint LoraRegionAs923 = 6
Field Value
LoraRegionAu915
The AU915-928 band.
public const uint LoraRegionAu915 = 4
Field Value
LoraRegionCn470
The CN470-510 band.
public const uint LoraRegionCn470 = 5
Field Value
LoraRegionEu433
The EU433 band.
public const uint LoraRegionEu433 = 3
Field Value
LoraRegionEu868
The EU863-870 band.
public const uint LoraRegionEu868 = 1
Field Value
LoraRegionIn865
The IN865-867 band.
public const uint LoraRegionIn865 = 8
Field Value
LoraRegionKr920
The KR920-923 band.
public const uint LoraRegionKr920 = 7
Field Value
LoraRegionRu864
The RU864-870 band.
public const uint LoraRegionRu864 = 9
Field Value
LoraRegionUs915
The US902-928 band.
public const uint LoraRegionUs915 = 2
Field Value
LorawanEuiLen
The length of a LoRaWAN EUI, in bytes.
public const int LorawanEuiLen = 8
Field Value
LorawanKeyLen
The length of a LoRaWAN key, in bytes.
public const int LorawanKeyLen = 16
Field Value
LorawanPayloadMax
The largest LoRaWAN application payload, in bytes.
public const int LorawanPayloadMax = 243
Field Value
MavlinkAckFinal
The command finished.
public const uint MavlinkAckFinal = 3
Field Value
MavlinkAckInProgress
The command is still running.
public const uint MavlinkAckInProgress = 2
Field Value
MavlinkAckUnrelated
An acknowledgment was for a different command.
public const uint MavlinkAckUnrelated = 1
Field Value
MavlinkDefaultTimestampWindow
The default window a verifier accepts a timestamp within.
public const ulong MavlinkDefaultTimestampWindow = 6000000
Field Value
MavlinkKeyLen
The length of a signing key, in bytes.
public const int MavlinkKeyLen = 32
Field Value
MavlinkMaxFrame
The largest frame, in bytes, header, checksum and signature included.
public const int MavlinkMaxFrame = 280
Field Value
MavlinkMaxPayload
The largest payload a frame can carry, in bytes.
public const int MavlinkMaxPayload = 255
Field Value
MavlinkMaxRetries
The retransmissions the mission protocol recommends before giving up.
public const byte MavlinkMaxRetries = 5
Field Value
MavlinkReceiverAck
A receiver answered with the acknowledgment that ends the transfer.
public const uint MavlinkReceiverAck = 2
Field Value
MavlinkReceiverRequest
A receiver answered with a request for the next item.
public const uint MavlinkReceiverRequest = 1
Field Value
MavlinkSenderFinished
A sender saw the receiver's acknowledgment.
public const uint MavlinkSenderFinished = 2
Field Value
MavlinkSenderReply
A sender answered with a frame to send.
public const uint MavlinkSenderReply = 1
Field Value
MavlinkSignatureLen
The length of a v2 signature block, in bytes.
public const int MavlinkSignatureLen = 13
Field Value
MavlinkStepIgnored
The frame was not one the machine handles.
public const uint MavlinkStepIgnored = 0
Field Value
MavlinkVersionV1
The original wire format, with a six-byte header.
public const byte MavlinkVersionV1 = 1
Field Value
MavlinkVersionV2
The current wire format, with a 24-bit message id and signing.
public const byte MavlinkVersionV2 = 2
Field Value
MeshBroadcast
The destination address that means every node.
public const uint MeshBroadcast = 4294967295
Field Value
MeshDefaultHopLimit
The hop limit a mesh frame starts with unless one is set.
public const byte MeshDefaultHopLimit = 3
Field Value
MeshFrameMax
The largest mesh frame, in bytes, header and checksum included.
public const int MeshFrameMax = 250
Field Value
MeshHeaderLen
How many bytes of a mesh frame are header.
public const int MeshHeaderLen = 12
Field Value
MeshPayloadMax
The largest payload a single mesh frame can carry, in bytes.
public const int MeshPayloadMax = 236
Field Value
MeshSeenDefaultCapacity
A duplicate-cache size for a caller with no reason to choose one.
public const int MeshSeenDefaultCapacity = 64
Field Value
Opt3001RegisterLen
The length of a OPT3001 register.
public const int Opt3001RegisterLen = 2
Field Value
RoutingDefaultCapacity
A routing table size for a caller with no reason to choose one.
public const int RoutingDefaultCapacity = 64
Field Value
Scd4xCommandLen
The length of a SCD4x command frame.
public const int Scd4xCommandLen = 2
Field Value
Scd4xMeasurementLen
The length of a SCD4x measurement frame.
public const int Scd4xMeasurementLen = 9
Field Value
Scd4xWordLen
The length of a SCD4x word and its checksum.
public const int Scd4xWordLen = 3
Field Value
Scd4xWriteLen
The length of a SCD4x command-and-value frame.
public const int Scd4xWriteLen = 5
Field Value
SessionKeyLen
The length in bytes of an agreement seed, key, or digest.
public const int SessionKeyLen = 32
Field Value
SessionTagLen
The length in bytes of the tag on a sealed message.
public const int SessionTagLen = 16
Field Value
Sht3xMeasurementLen
The length of a SHT3x measurement frame.
public const int Sht3xMeasurementLen = 6
Field Value
Sht3xWordLen
The length of a SHT3x word and its checksum.
public const int Sht3xWordLen = 3
Field Value
Tmp117RegisterLen
The length of a TMP117 register.
public const int Tmp117RegisterLen = 2
Field Value
UpdateFormatRaw
The payload format meaning the payload is the image itself.
public const byte UpdateFormatRaw = 1
Field Value
UpdateStructureVersion
The manifest structure version this build writes.
public const byte UpdateStructureVersion = 1
Field Value
WindowCapacity
The number of readings a windowed helper keeps.
public const int WindowCapacity = 32
Field Value
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
configPamojaAds1115Config
Returns
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
bitsushortoutConfigPamojaAds1115Config
Returns
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
pgabyte
Returns
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
dataRatebyte
Returns
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
Returns
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
Returns
pamoja_agreement_key_free(nint)
Releases an agreement key handle.
public static extern void pamoja_agreement_key_free(nint key)
Parameters
keynint
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
seedReadOnlySpan<byte>seedLennuint
Returns
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
Returns
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
Returns
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
anomalynint
pamoja_anomaly_new(float)
Creates an anomaly detector at a deviation threshold.
public static extern nint pamoja_anomaly_new(float sigmas)
Parameters
sigmasfloat
Returns
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
Returns
pamoja_audit_entry_free(nint)
Releases an entry handle.
public static extern void pamoja_audit_entry_free(nint entry)
Parameters
entrynint
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
bytesReadOnlySpan<byte>lennuint
Returns
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
entrynint
Returns
pamoja_audit_entry_payload(nint)
Copies out the record an entry carries.
public static extern nint pamoja_audit_entry_payload(nint entry)
Parameters
entrynint
Returns
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
Returns
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
Returns
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
entrynint
Returns
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
lognintpayloadReadOnlySpan<byte>payloadLennuint
Returns
pamoja_audit_log_free(nint)
Releases a log handle.
public static extern void pamoja_audit_log_free(nint log)
Parameters
lognint
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
identitynint
Returns
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
Returns
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
Returns
pamoja_audit_verifier_free(nint)
Releases a verifier handle.
public static extern void pamoja_audit_verifier_free(nint verifier)
Parameters
verifiernint
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
publicKeyReadOnlySpan<byte>
Returns
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
publicKeyReadOnlySpan<byte>entriesReadOnlySpan<nint>countnuint
Returns
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
calibrationnint
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
tempPressReadOnlySpan<byte>tempPressLennuinthumidityReadOnlySpan<byte>humidityLennuintoutCalibrationnint
Returns
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
calibrationnintmeasurementReadOnlySpan<byte>measurementLennuintoutMeasurementPamojaBme280Measurement
Returns
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
calibrationnintoutCoefficientsPamojaBmp280Coefficients
Returns
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
calibrationnint
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
bytesReadOnlySpan<byte>bytesLennuintoutCalibrationnint
Returns
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
Returns
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
calibrationnintmeasurementReadOnlySpan<byte>measurementLennuintoutReadingPamojaBmp280Reading
Returns
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
configPamojaBmp280Config
Returns
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
bitsbyteoutConfigPamojaBmp280Config
Returns
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
configPamojaBmp280CtrlMeas
Returns
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
bitsbyteoutConfigPamojaBmp280CtrlMeas
Returns
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
statusbyte
Returns
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
Returns
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
statusbyte
Returns
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
codebyte
Returns
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
dataReadOnlySpan<byte>dataLennuintoutMeasurementPamojaBmp280Measurement
Returns
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
codebyte
Returns
pamoja_buffer_data(nint)
Returns a pointer to a byte buffer's contents.
public static extern nint pamoja_buffer_data(nint buffer)
Parameters
buffernint
Returns
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
buffernint
pamoja_buffer_len(nint)
Returns the length in bytes of a byte buffer.
public static extern nuint pamoja_buffer_len(nint buffer)
Parameters
buffernint
Returns
pamoja_calibration_apply(nint, float)
Converts a raw reading into calibrated units.
public static extern float pamoja_calibration_apply(nint calibration, float raw)
Parameters
Returns
pamoja_calibration_free(nint)
Releases a calibration handle. Passing null is a no-op.
public static extern void pamoja_calibration_free(nint calibration)
Parameters
calibrationnint
pamoja_calibration_linear(float, float)
Creates a linear calibration.
public static extern nint pamoja_calibration_linear(float scale, float offset)
Parameters
Returns
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
Returns
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
dlcbyte
Returns
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
framenint
Returns
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
framenint
Returns
pamoja_can_frame_dlc(nint)
Returns a frame's data length code.
public static extern byte pamoja_can_frame_dlc(nint frame)
Parameters
framenint
Returns
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
Returns
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
framenint
pamoja_can_frame_id(nint)
Returns a frame's identifier.
public static extern uint pamoja_can_frame_id(nint frame)
Parameters
framenint
Returns
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
framenint
Returns
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
framenint
Returns
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
framenint
Returns
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
framenint
Returns
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
Returns
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
Returns
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
Returns
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
Returns
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
iduintextendedbooloutMessagePamojaJ1939Id
Returns
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
lennuint
Returns
pamoja_can_signals_new()
Builds a J1939 payload with every signal marked not available.
public static extern PamojaJ1939Signals pamoja_can_signals_new()
Returns
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
signalsPamojaJ1939Signalsatnuintvalueushort
Returns
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
signalsPamojaJ1939Signalsatnuintvaluebyte
Returns
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
signalsPamojaJ1939SignalsatnuintoutValueushort
Returns
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
signalsPamojaJ1939SignalsatnuintoutValuebyte
Returns
pamoja_cdr_reader_free(nint)
Releases a CDR decoder handle.
public static extern void pamoja_cdr_reader_free(nint reader)
Parameters
readernint
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
dataReadOnlySpan<byte>dataLennuint
Returns
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
Returns
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
Returns
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
Returns
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
Returns
pamoja_cdr_writer_free(nint)
Releases a CDR encoder handle.
public static extern void pamoja_cdr_writer_free(nint writer)
Parameters
writernint
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
writernint
Returns
pamoja_cdr_writer_new()
Creates a CDR encoder.
public static extern nint pamoja_cdr_writer_new()
Returns
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
Returns
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
Returns
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
Returns
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
Returns
pamoja_coap_client_connect(nint)
Binds the local socket of a CoAP endpoint.
public static extern PamojaStatus pamoja_coap_client_connect(nint client)
Parameters
clientnint
Returns
pamoja_coap_client_disconnect(nint)
Releases the socket a CoAP endpoint holds.
public static extern PamojaStatus pamoja_coap_client_disconnect(nint client)
Parameters
clientnint
Returns
pamoja_coap_client_free(nint)
Releases a CoAP endpoint handle.
public static extern void pamoja_coap_client_free(nint client)
Parameters
clientnint
pamoja_coap_client_is_connected(nint)
Reports whether a CoAP endpoint is bound.
public static bool pamoja_coap_client_is_connected(nint client)
Parameters
clientnint
Returns
pamoja_coap_client_new(ref PamojaCoapConfig)
Creates a disconnected CoAP endpoint.
public static nint pamoja_coap_client_new(ref PamojaCoapConfig config)
Parameters
configPamojaCoapConfig
Returns
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
Returns
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
clientninttopicnintpayloadReadOnlySpan<byte>payloadLennuint
Returns
pamoja_coap_client_subscribe(nint, nint)
Observes a CoAP resource path.
public static extern PamojaStatus pamoja_coap_client_subscribe(nint client, nint topic)
Parameters
Returns
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
decodernint
Returns
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
decodernintbytesReadOnlySpan<byte>bytesLennuintoutFramesnint
Returns
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
decodernint
pamoja_cobs_decoder_new()
Creates a streaming COBS decoder.
public static extern nint pamoja_cobs_decoder_new()
Returns
pamoja_cobs_decoder_reset(nint)
Discards any partly assembled COBS frame.
public static extern void pamoja_cobs_decoder_reset(nint decoder)
Parameters
decodernint
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
cborReadOnlySpan<byte>cborLennuintoutBuffernint
Returns
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
bytesReadOnlySpan<byte>bytesLennuintoutSamplesnint
Returns
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
samplesReadOnlySpan<long>countnuintoutBuffernint
Returns
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
jsonReadOnlySpan<byte>jsonLennuintoutBuffernint
Returns
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
scalefloatbytesReadOnlySpan<byte>bytesLennuintoutReadingsnint
Returns
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
scalefloatreadingsReadOnlySpan<float>countnuintoutBuffernint
Returns
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
controllernintreadingfloatreactionPamojaReaction
Returns
pamoja_controller_free(nint)
Releases a controller handle.
public static extern void pamoja_controller_free(nint controller)
Parameters
controllernint
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
Returns
pamoja_controller_monitor()
Creates a controller that reports readings without judging them.
public static extern nint pamoja_controller_monitor()
Returns
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
Returns
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
Returns
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
fromPamojaCoordinatetoPamojaCoordinate
Returns
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
fromPamojaCoordinatetoPamojaCoordinate
Returns
pamoja_debounce_free(nint)
Releases a debouncer handle. Passing null is a no-op.
public static extern void pamoja_debounce_free(nint debounce)
Parameters
debouncenint
pamoja_debounce_new(ushort, bool)
Creates a boolean debouncer.
public static nint pamoja_debounce_new(ushort samples, bool initial)
Parameters
Returns
pamoja_debounce_state(nint)
Reports a debouncer's settled state.
public static bool pamoja_debounce_state(nint debounce)
Parameters
debouncenint
Returns
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
Returns
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
bytesReadOnlySpan<byte>lennuintanchorPublicKeyReadOnlySpan<byte>outDelegationPamojaDelegation
Returns
pamoja_delegation_sign(PamojaDelegation, nint)
Signs a delegation naming a release key.
public static extern nint pamoja_delegation_sign(PamojaDelegation delegation, nint anchor)
Parameters
delegationPamojaDelegationanchornint
Returns
pamoja_depletion_free(nint)
Releases a depletion handle. Passing null is a no-op.
public static extern void pamoja_depletion_free(nint depletion)
Parameters
depletionnint
pamoja_depletion_new(float)
Creates a depletion estimator.
public static extern nint pamoja_depletion_new(float threshold)
Parameters
thresholdfloat
Returns
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
Returns
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
identitynint
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
seedReadOnlySpan<byte>seedLennuint
Returns
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
Returns
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
Returns
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
identitynintpayloadReadOnlySpan<byte>payloadLennuintoutBuffernint
Returns
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
Returns
pamoja_ds18b20_celsius(short)
Converts a raw DS18B20 temperature register to degrees Celsius.
public static extern float pamoja_ds18b20_celsius(short raw)
Parameters
rawshort
Returns
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
Returns
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
dataReadOnlySpan<byte>dataLennuint
Returns
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
Returns
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
rawshort
Returns
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
bytesReadOnlySpan<byte>bytesLennuintoutReadingPamojaDs18b20Reading
Returns
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
configBytebyte
Returns
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
Returns
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
dutyPamojaDutyCycle
Returns
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
Returns
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
Returns
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
dutyPamojaDutyCycle
Returns
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
bytesReadOnlySpan<byte>lennuint
Returns
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
bytesReadOnlySpan<byte>lennuintpublicKeyReadOnlySpan<byte>outManifestPamojaManifest
Returns
pamoja_event_bus_free(nint)
Releases an event bus endpoint.
public static extern void pamoja_event_bus_free(nint bus)
Parameters
busnint
pamoja_event_bus_new(nuint)
Creates an event bus.
public static extern nint pamoja_event_bus_new(nuint capacity)
Parameters
capacitynuint
Returns
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
Returns
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
busnintpayloadReadOnlySpan<byte>payloadLennuint
Returns
pamoja_event_bus_subscribe(nint)
Takes another endpoint on an event bus.
public static extern nint pamoja_event_bus_subscribe(nint bus)
Parameters
busnint
Returns
pamoja_frames_count(nint)
Returns how many frames a decoder call produced.
public static extern nuint pamoja_frames_count(nint frames)
Parameters
framesnint
Returns
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
Returns
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
framesnint
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
Returns
pamoja_geofence_contains(nint, PamojaCoordinate)
Reports whether a fix lies inside a geofence.
public static bool pamoja_geofence_contains(nint geofence, PamojaCoordinate point)
Parameters
geofencenintpointPamojaCoordinate
Returns
pamoja_geofence_free(nint)
Releases a geofence handle. Passing null is a no-op.
public static extern void pamoja_geofence_free(nint geofence)
Parameters
geofencenint
pamoja_geofence_new(PamojaCoordinate, double)
Creates a circular geofence.
public static extern nint pamoja_geofence_new(PamojaCoordinate center, double radiusM)
Parameters
centerPamojaCoordinateradiusMdouble
Returns
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
geofencenintpointPamojaCoordinate
Returns
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
rawushort
Returns
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
rawushortoutConfigPamojaHdc1080Config
Returns
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
configPamojaHdc1080ConfigoutRegisterushort
Returns
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
configPamojaHdc1080ConfigoutMicrosuint
Returns
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
Returns
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
milliPercentuint
Returns
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
Returns
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
milliCelsiusintmilliPercentuintoutMeasurementPamojaHdc1080Measurement
Returns
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
rawushort
Returns
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
rawushort
Returns
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
bytesReadOnlySpan<byte>bytesLennuintoutMeasurementPamojaHdc1080Measurement
Returns
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
rawushort
Returns
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
Returns
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
Returns
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
Returns
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
milliCelsiusint
Returns
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
addressPamojaI2cAddressdirectionPamojaI2cDirectionoutFrameSpan<byte>outFrameCapnuintoutLennuint
Returns
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
addressPamojaI2cAddress
Returns
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
addressPamojaI2cAddress
Returns
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
addressPamojaI2cAddress
Returns
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
addressbyteoutAddressPamojaI2cAddress
Returns
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
addressushortoutAddressPamojaI2cAddress
Returns
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
imageReadOnlySpan<byte>imageLennuintoutDigestSpan<byte>
Returns
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
Returns
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
verifiernint
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
manifestPamojaManifest
Returns
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
verifiernintchunkReadOnlySpan<byte>lennuint
Returns
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
rawushort
Returns
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
millivoltsuint
Returns
pamoja_ina219_calibration(uint, uint)
Computes the INA219 calibration register.
public static extern ushort pamoja_ina219_calibration(uint currentLsbMicroamps, uint shuntMilliohms)
Parameters
Returns
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
rawushort
Returns
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
Returns
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
Returns
pamoja_ina219_math_overflow(ushort)
Reports whether an INA219 register flags a math overflow.
public static bool pamoja_ina219_math_overflow(ushort raw)
Parameters
rawushort
Returns
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
maxExpectedMicroampsuint
Returns
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
Returns
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
Returns
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
rawshort
Returns
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
microvoltsint
Returns
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
maskPamojaIna226MaskEnableoutFunctionPamojaIna226AlertFunction
Returns
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
Returns
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
codebyte
Returns
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
rawushort
Returns
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
microvoltsuint
Returns
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
rawushort
Returns
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
Returns
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
rawushortoutConfigPamojaIna226Config
Returns
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
configPamojaIna226Config
Returns
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
codebyte
Returns
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
Returns
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
Returns
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
Returns
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
Returns
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
rawushortoutDieIdPamojaIna226DieId
Returns
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
manufacturerIdushortdieIdushortoutDieIdPamojaIna226DieId
Returns
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
codebyte
Returns
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
rawushortoutMaskPamojaIna226MaskEnable
Returns
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
Returns
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
codebyte
Returns
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
codebyte
Returns
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
maxExpectedMicroampsuint
Returns
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
Returns
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
Returns
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
Returns
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
Returns
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
rawshort
Returns
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
rawshort
Returns
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
nanovoltsint
Returns
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
configPamojaIna226Config
Returns
pamoja_kalman_estimate(nint)
Reads a Kalman filter's current estimate.
public static extern float pamoja_kalman_estimate(nint kalman)
Parameters
kalmannint
Returns
pamoja_kalman_free(nint)
Releases a Kalman handle. Passing null is a no-op.
public static extern void pamoja_kalman_free(nint kalman)
Parameters
kalmannint
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
Returns
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
Returns
pamoja_keyexpr_canonize(string)
Rewrites a key expression into its canonical form.
public static nint pamoja_keyexpr_canonize(string key)
Parameters
keystring
Returns
pamoja_keyexpr_is_canon(string)
Reports whether a key expression is already canonical.
public static bool pamoja_keyexpr_is_canon(string key)
Parameters
keystring
Returns
pamoja_keyexpr_is_valid(string)
Reports whether a key expression is well formed.
public static bool pamoja_keyexpr_is_valid(string key)
Parameters
keystring
Returns
pamoja_keyexpr_matches(string, string)
Reports whether a pattern selects a key.
public static bool pamoja_keyexpr_matches(string pattern, string key)
Parameters
Returns
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
Returns
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
Returns
pamoja_ladder_connect(nint)
Connects every rung of a ladder.
public static extern PamojaStatus pamoja_ladder_connect(nint ladder)
Parameters
laddernint
Returns
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
Returns
pamoja_ladder_free(nint)
Releases a ladder handle.
public static extern void pamoja_ladder_free(nint ladder)
Parameters
laddernint
pamoja_ladder_new(nint)
Creates a ladder buffering into a store.
public static extern nint pamoja_ladder_new(nint store)
Parameters
storenint
Returns
pamoja_ladder_rung(nint, nint)
Adds a rung to a ladder.
public static extern PamojaStatus pamoja_ladder_rung(nint ladder, nint transport)
Parameters
Returns
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
ladderninttopicnintpayloadReadOnlySpan<byte>payloadLennuintoutDeliveryPamojaDelivery
Returns
pamoja_last_error_message()
Returns the calling thread's most recent error message, or null.
public static extern nint pamoja_last_error_message()
Returns
pamoja_link_cost_threshold(PamojaLinkCost)
Returns the level a link cost calls for.
public static extern PamojaTelemetryLevel pamoja_link_cost_threshold(PamojaLinkCost cost)
Parameters
costPamojaLinkCost
Returns
pamoja_loopback_broker_free(nint)
Releases a broker handle.
public static extern void pamoja_loopback_broker_free(nint broker)
Parameters
brokernint
pamoja_loopback_broker_new()
Creates an in-process broker.
public static extern nint pamoja_loopback_broker_new()
Returns
pamoja_loopback_transport_connect(nint)
Marks a loopback link connected.
public static extern PamojaStatus pamoja_loopback_transport_connect(nint transport)
Parameters
transportnint
Returns
pamoja_loopback_transport_disconnect(nint)
Marks a loopback link disconnected.
public static extern void pamoja_loopback_transport_disconnect(nint transport)
Parameters
transportnint
pamoja_loopback_transport_free(nint)
Releases a loopback link handle.
public static extern void pamoja_loopback_transport_free(nint transport)
Parameters
transportnint
pamoja_loopback_transport_is_connected(nint)
Reports whether a loopback link is connected.
public static bool pamoja_loopback_transport_is_connected(nint transport)
Parameters
transportnint
Returns
pamoja_loopback_transport_new(nint)
Creates a link to a broker.
public static extern nint pamoja_loopback_transport_new(nint broker)
Parameters
brokernint
Returns
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
Returns
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
transportninttopicnintpayloadReadOnlySpan<byte>payloadLennuint
Returns
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
Returns
pamoja_lora_airtime_us(PamojaLoraLink, nuint)
Returns the time on air of a payload, in microseconds.
public static extern ulong pamoja_lora_airtime_us(PamojaLoraLink link, nuint payloadLen)
Parameters
linkPamojaLoraLinkpayloadLennuint
Returns
pamoja_lora_link_default(byte, uint)
Returns LoRa link settings with the LoRa defaults filled in.
public static extern PamojaLoraLink pamoja_lora_link_default(byte spreadingFactor, uint bandwidthHz)
Parameters
Returns
pamoja_lora_min_off_time_us(PamojaLoraLink, nuint, uint)
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
linkPamojaLoraLinkpayloadLennuintdutyCyclePermilleuint
Returns
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
Returns
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
buildernint
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
Returns
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
Returns
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
buildernintwhichuintblockPamojaLoraChannelBlock
Returns
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
buildernintdirectionuintratePamojaLoraDataRate
Returns
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
Returns
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
buildernintdwellLimitedbyteoffsetsReadOnlySpan<byte>offsetsLennuint
Returns
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
buildernintbandPamojaLoraSubBand
Returns
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
buildernintbeaconPamojaLoraBeaconhasDwellTimeLimitbyte
Returns
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
Returns
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
Returns
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
plannintwhichuintindexushortoutBlockPamojaLoraChannelBlock
Returns
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
Returns
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
plannintdirectionuintdataRatebyteoutRatePamojaLoraDataRate
Returns
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
Returns
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
Returns
pamoja_lora_plan_free(nint)
Releases a channel plan.
public static extern void pamoja_lora_plan_free(nint plan)
Parameters
plannint
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
plannintoutInfoPamojaLoraPlanInfo
Returns
pamoja_lora_plan_link_settings(nint, byte, out PamojaLoraLink)
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
plannintdataRatebyteoutLinkPamojaLoraLink
Returns
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
Returns
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
planninttableuintdataRatebyteoutPayloadPamojaLoraMaxPayload
Returns
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
plannint
Returns
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
Returns
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
Returns
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
plannintindexushortoutBandPamojaLoraSubBand
Returns
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
Returns
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
regionuint
Returns
pamoja_lora_symbol_time_us(PamojaLoraLink)
Returns the duration of one symbol on a link, in microseconds.
public static extern ulong pamoja_lora_symbol_time_us(PamojaLoraLink link)
Parameters
linkPamojaLoraLink
Returns
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
Returns
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
devicenint
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
Returns
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
devEuiReadOnlySpan<byte>devEuiLennuintappEuiReadOnlySpan<byte>appEuiLennuintappKeyReadOnlySpan<byte>appKeyLennuintoutDevicenint
Returns
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
grantPamojaLorawanGrantcflistReadOnlySpan<byte>cflistLennuintappKeyReadOnlySpan<byte>appKeyLennuintdevNonceushortoutFramenint
Returns
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
grantPamojaLorawanGrantcflistReadOnlySpan<byte>cflistLennuintappKeyReadOnlySpan<byte>appKeyLennuintdevNonceushortoutSessionnint
Returns
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
bytesReadOnlySpan<byte>bytesLennuintoutHeaderPamojaLorawanHeader
Returns
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
acceptnint
Returns
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
acceptnint
Returns
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
acceptnint
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
acceptnint
Returns
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
acceptnint
Returns
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
Returns
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
Returns
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
Returns
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
requestnint
Returns
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
requestnint
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
bytesReadOnlySpan<byte>bytesLennuintappKeyReadOnlySpan<byte>appKeyLennuintoutRequestnint
Returns
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
rxnint
Returns
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
rxnint
Returns
pamoja_lorawan_rx_confirmed(nint)
Reports whether a decoded frame asks to be acknowledged.
public static bool pamoja_lorawan_rx_confirmed(nint rx)
Parameters
rxnint
Returns
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
rxnint
Returns
pamoja_lorawan_rx_direction(nint)
Returns the direction a decoded frame traveled.
public static extern PamojaLorawanDirection pamoja_lorawan_rx_direction(nint rx)
Parameters
rxnint
Returns
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
rxnint
Returns
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
rxnint
Returns
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
rxnint
Returns
pamoja_lorawan_rx_fpending(nint)
Reports whether the network has more downlink data waiting.
public static bool pamoja_lorawan_rx_fpending(nint rx)
Parameters
rxnint
Returns
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
Returns
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
rxnint
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
rxnint
Returns
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
rxnint
Returns
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
Returns
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
sessionnint
Returns
pamoja_lorawan_session_encode_downlink(nint, uint, byte, ReadOnlySpan<byte>, nuint, ReadOnlySpan<byte>, nuint, PamojaLorawanFlags, out nint)
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
sessionnintfcntuintfportbytepayloadReadOnlySpan<byte>payloadLennuintfoptsReadOnlySpan<byte>foptsLennuintflagsPamojaLorawanFlagsoutFramenint
Returns
pamoja_lorawan_session_encode_uplink(nint, uint, byte, ReadOnlySpan<byte>, nuint, ReadOnlySpan<byte>, nuint, PamojaLorawanFlags, out nint)
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
sessionnintfcntuintfportbytepayloadReadOnlySpan<byte>payloadLennuintfoptsReadOnlySpan<byte>foptsLennuintflagsPamojaLorawanFlagsoutFramenint
Returns
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
sessionnint
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
devAddruintnwkSKeyReadOnlySpan<byte>nwkSKeyLennuintappSKeyReadOnlySpan<byte>appSKeyLennuintoutSessionnint
Returns
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
bytesReadOnlySpan<byte>lennuintoutManifestPamojaManifest
Returns
pamoja_manifest_encode(PamojaManifest)
Encodes the body of a manifest.
public static extern nint pamoja_manifest_encode(PamojaManifest manifest)
Parameters
manifestPamojaManifest
Returns
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
manifestPamojaManifestauthornint
Returns
pamoja_mavlink_command_confirmation(nint)
Returns the confirmation count to stamp on the command being sent.
public static extern byte pamoja_mavlink_command_confirmation(nint command)
Parameters
commandnint
Returns
pamoja_mavlink_command_free(nint)
Releases a command tracker.
public static extern void pamoja_mavlink_command_free(nint command)
Parameters
commandnint
pamoja_mavlink_command_id(nint)
Returns the command id being tracked.
public static extern ushort pamoja_mavlink_command_id(nint command)
Parameters
commandnint
Returns
pamoja_mavlink_command_new(ushort, byte)
Starts tracking a command.
public static extern nint pamoja_mavlink_command_new(ushort command, byte maxRetries)
Parameters
Returns
pamoja_mavlink_command_on_frame(nint, nint, out uint, out byte)
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
Returns
pamoja_mavlink_command_on_timeout(nint, out byte)
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
Returns
pamoja_mavlink_crc16_mcrf4xx(ReadOnlySpan<byte>, nuint)
Returns the CRC-16/MCRF4XX checksum of a byte string.
public static ushort pamoja_mavlink_crc16_mcrf4xx(ReadOnlySpan<byte> bytes, nuint bytesLen)
Parameters
bytesReadOnlySpan<byte>bytesLennuint
Returns
pamoja_mavlink_dialect_add(nint, uint, byte)
Adds or replaces the seed for a message id.
public static extern PamojaStatus pamoja_mavlink_dialect_add(nint dialect, uint msgid, byte crcExtra)
Parameters
Returns
pamoja_mavlink_dialect_add_schema(nint, nint)
Adds a schema's message to a dialect table.
public static extern PamojaStatus pamoja_mavlink_dialect_add_schema(nint dialect, nint schema)
Parameters
Returns
pamoja_mavlink_dialect_crc_extra(nint, uint, out byte)
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
Returns
pamoja_mavlink_dialect_free(nint)
Releases a dialect table.
public static extern void pamoja_mavlink_dialect_free(nint dialect)
Parameters
dialectnint
pamoja_mavlink_dialect_new()
Creates an empty dialect table.
public static extern nint pamoja_mavlink_dialect_new()
Returns
pamoja_mavlink_frame_bytes(nint, out nuint)
Returns a pointer to a frame's bytes.
public static nint pamoja_mavlink_frame_bytes(nint frame, out nuint outLen)
Parameters
Returns
pamoja_mavlink_frame_encode(byte, PamojaMavlinkHeader, uint, ReadOnlySpan<byte>, nuint, byte, out 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
versionbyteheaderPamojaMavlinkHeadermsgiduintpayloadReadOnlySpan<byte>payloadLennuintcrcExtrabyteoutFramenint
Returns
pamoja_mavlink_frame_free(nint)
Releases a frame.
public static extern void pamoja_mavlink_frame_free(nint frame)
Parameters
framenint
pamoja_mavlink_frame_header(nint, out PamojaMavlinkHeader)
Returns the addressing fields a frame carries.
public static PamojaStatus pamoja_mavlink_frame_header(nint frame, out PamojaMavlinkHeader outHeader)
Parameters
framenintoutHeaderPamojaMavlinkHeader
Returns
pamoja_mavlink_frame_incompat_flags(nint)
Returns the incompatibility flags a v2 frame declares.
public static extern byte pamoja_mavlink_frame_incompat_flags(nint frame)
Parameters
framenint
Returns
pamoja_mavlink_frame_is_signed(nint)
Reports whether a frame carries a signature.
public static extern byte pamoja_mavlink_frame_is_signed(nint frame)
Parameters
framenint
Returns
pamoja_mavlink_frame_message_id(nint)
Returns the id of the message a frame carries.
public static extern uint pamoja_mavlink_frame_message_id(nint frame)
Parameters
framenint
Returns
pamoja_mavlink_frame_parse(ReadOnlySpan<byte>, nuint, byte, out nint)
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
bytesReadOnlySpan<byte>bytesLennuintcrcExtrabyteoutFramenint
Returns
pamoja_mavlink_frame_parse_known(ReadOnlySpan<byte>, nuint, nint, out nint)
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
bytesReadOnlySpan<byte>bytesLennuintdialectnintoutFramenint
Returns
pamoja_mavlink_frame_payload(nint, out nuint)
Returns a pointer to a frame's payload.
public static nint pamoja_mavlink_frame_payload(nint frame, out nuint outLen)
Parameters
Returns
pamoja_mavlink_frame_signature(nint, Span<byte>)
Copies a frame's signature block out.
public static PamojaStatus pamoja_mavlink_frame_signature(nint frame, Span<byte> outSignature)
Parameters
Returns
pamoja_mavlink_frame_version(nint)
Returns the wire format a frame uses.
public static extern byte pamoja_mavlink_frame_version(nint frame)
Parameters
framenint
Returns
pamoja_mavlink_known_crc_extra(uint, out 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
Returns
pamoja_mavlink_message_crc_extra(string, ReadOnlySpan<PamojaMavlinkField>, nuint, out byte)
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
namestringfieldsReadOnlySpan<PamojaMavlinkField>fieldCountnuintoutCrcExtrabyte
Returns
pamoja_mavlink_message_decode(nint, ReadOnlySpan<byte>, nuint, out nint)
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
schemanintpayloadReadOnlySpan<byte>payloadLennuintoutMessagenint
Returns
pamoja_mavlink_message_free(nint)
Releases a message.
public static extern void pamoja_mavlink_message_free(nint message)
Parameters
messagenint
pamoja_mavlink_message_get_bytes(nint, string, Span<byte>, nuint)
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
Returns
pamoja_mavlink_message_get_float(nint, string, nuint, out double)
Reads a floating-point field.
public static PamojaStatus pamoja_mavlink_message_get_float(nint message, string field, nuint index, out double outValue)
Parameters
Returns
pamoja_mavlink_message_get_int(nint, string, nuint, out long)
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
Returns
pamoja_mavlink_message_get_number(nint, string, nuint, out double)
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
Returns
pamoja_mavlink_message_get_uint(nint, string, nuint, out ulong)
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
Returns
pamoja_mavlink_message_new(nint, out nint)
Creates a message with every field zero.
public static PamojaStatus pamoja_mavlink_message_new(nint schema, out nint outMessage)
Parameters
Returns
pamoja_mavlink_message_payload(nint, out nuint)
Returns a pointer to a message's payload bytes.
public static nint pamoja_mavlink_message_payload(nint message, out nuint outLen)
Parameters
Returns
pamoja_mavlink_message_set_bytes(nint, string, ReadOnlySpan<byte>, nuint)
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
messagenintfieldstringbytesReadOnlySpan<byte>bytesLennuint
Returns
pamoja_mavlink_message_set_float(nint, string, nuint, double)
Writes a floating-point field.
public static PamojaStatus pamoja_mavlink_message_set_float(nint message, string field, nuint index, double value)
Parameters
Returns
pamoja_mavlink_message_set_int(nint, string, nuint, long)
Writes a signed integer into a field.
public static PamojaStatus pamoja_mavlink_message_set_int(nint message, string field, nuint index, long value)
Parameters
Returns
pamoja_mavlink_message_set_number(nint, string, nuint, double)
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
Returns
pamoja_mavlink_message_set_uint(nint, string, nuint, ulong)
Writes an unsigned integer into a field.
public static PamojaStatus pamoja_mavlink_message_set_uint(nint message, string field, nuint index, ulong value)
Parameters
Returns
pamoja_mavlink_message_to_frame(nint, PamojaMavlinkHeader, out nint)
Builds a v2 frame carrying a message.
public static PamojaStatus pamoja_mavlink_message_to_frame(nint message, PamojaMavlinkHeader header, out nint outFrame)
Parameters
messagenintheaderPamojaMavlinkHeaderoutFramenint
Returns
pamoja_mavlink_mission_receiver_expected(nint)
Returns the next sequence number the receiver expects.
public static extern ushort pamoja_mavlink_mission_receiver_expected(nint receiver)
Parameters
receivernint
Returns
pamoja_mavlink_mission_receiver_free(nint)
Releases a receiver.
public static extern void pamoja_mavlink_mission_receiver_free(nint receiver)
Parameters
receivernint
pamoja_mavlink_mission_receiver_is_complete(nint)
Reports whether the transfer has finished.
public static extern byte pamoja_mavlink_mission_receiver_is_complete(nint receiver)
Parameters
receivernint
Returns
pamoja_mavlink_mission_receiver_new(byte, byte, 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
Returns
pamoja_mavlink_mission_receiver_on_frame(nint, nint, PamojaMavlinkHeader, out uint, out nint, out 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
Returns
pamoja_mavlink_mission_receiver_request_list(nint, PamojaMavlinkHeader, out nint)
Builds the frame that starts a download.
public static PamojaStatus pamoja_mavlink_mission_receiver_request_list(nint receiver, PamojaMavlinkHeader header, out nint outFrame)
Parameters
receivernintheaderPamojaMavlinkHeaderoutFramenint
Returns
pamoja_mavlink_mission_sender_add_item(nint, ReadOnlySpan<byte>, nuint)
Appends an item to the plan.
public static PamojaStatus pamoja_mavlink_mission_sender_add_item(nint sender, ReadOnlySpan<byte> payload, nuint payloadLen)
Parameters
sendernintpayloadReadOnlySpan<byte>payloadLennuint
Returns
pamoja_mavlink_mission_sender_count(nint, PamojaMavlinkHeader, out nint)
Builds the frame that opens an upload.
public static PamojaStatus pamoja_mavlink_mission_sender_count(nint sender, PamojaMavlinkHeader header, out nint outFrame)
Parameters
sendernintheaderPamojaMavlinkHeaderoutFramenint
Returns
pamoja_mavlink_mission_sender_free(nint)
Releases a sender.
public static extern void pamoja_mavlink_mission_sender_free(nint sender)
Parameters
sendernint
pamoja_mavlink_mission_sender_len(nint)
Returns the number of items in the plan.
public static extern ushort pamoja_mavlink_mission_sender_len(nint sender)
Parameters
sendernint
Returns
pamoja_mavlink_mission_sender_new(byte, byte, byte)
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
Returns
pamoja_mavlink_mission_sender_on_frame(nint, nint, PamojaMavlinkHeader, out uint, out byte, out 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
Returns
pamoja_mavlink_offboard_global_position(PamojaMavlinkHeader, uint, byte, byte, byte, int, int, float, out nint)
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
headerPamojaMavlinkHeadertimeBootMsuintcoordinateFramebytetargetSystembytetargetComponentbytelatIntintlonIntintaltfloatoutFramenint
Returns
pamoja_mavlink_offboard_local_position(PamojaMavlinkHeader, uint, byte, byte, byte, float, float, float, out nint)
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
headerPamojaMavlinkHeadertimeBootMsuintcoordinateFramebytetargetSystembytetargetComponentbytexfloatyfloatzfloatoutFramenint
Returns
pamoja_mavlink_offboard_local_velocity(PamojaMavlinkHeader, uint, byte, byte, byte, float, float, float, out nint)
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
headerPamojaMavlinkHeadertimeBootMsuintcoordinateFramebytetargetSystembytetargetComponentbytevxfloatvyfloatvzfloatoutFramenint
Returns
pamoja_mavlink_offboard_type_mask(uint)
Builds a setpoint type_mask from the fields to use.
public static extern ushort pamoja_mavlink_offboard_type_mask(uint flags)
Parameters
flagsuint
Returns
pamoja_mavlink_parser_free(nint)
Releases a parser.
public static extern void pamoja_mavlink_parser_free(nint parser)
Parameters
parsernint
pamoja_mavlink_parser_new()
Creates a parser with an empty buffer.
public static extern nint pamoja_mavlink_parser_new()
Returns
pamoja_mavlink_parser_next(nint, out nint)
Takes the next completed frame out of the parser.
public static PamojaStatus pamoja_mavlink_parser_next(nint parser, out nint outFrame)
Parameters
Returns
pamoja_mavlink_parser_pending(nint)
Returns how many completed frames are waiting.
public static extern nuint pamoja_mavlink_parser_pending(nint parser)
Parameters
parsernint
Returns
pamoja_mavlink_parser_push(nint, ReadOnlySpan<byte>, nuint, nint)
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
parsernintbytesReadOnlySpan<byte>bytesLennuintdialectnint
Returns
pamoja_mavlink_raw_message_to_frame(PamojaMavlinkHeader, uint, byte, ReadOnlySpan<byte>, nuint, out nint)
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
headerPamojaMavlinkHeadermsgiduintcrcExtrabytepayloadReadOnlySpan<byte>payloadLennuintoutFramenint
Returns
pamoja_mavlink_schema_at(nuint, out nint)
Returns the shape at a position in the built-in registry.
public static PamojaStatus pamoja_mavlink_schema_at(nuint index, out nint outSchema)
Parameters
Returns
pamoja_mavlink_schema_builder_build(nint, out nint)
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
Returns
pamoja_mavlink_schema_builder_extension(nint, string, uint, byte)
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
Returns
pamoja_mavlink_schema_builder_field(nint, string, uint, byte)
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
Returns
pamoja_mavlink_schema_builder_free(nint)
Releases a builder that was never built.
public static extern void pamoja_mavlink_schema_builder_free(nint builder)
Parameters
buildernint
pamoja_mavlink_schema_builder_new(uint, string)
Starts describing a message.
public static nint pamoja_mavlink_schema_builder_new(uint msgid, string name)
Parameters
Returns
pamoja_mavlink_schema_count()
Returns how many messages this build types.
public static extern nuint pamoja_mavlink_schema_count()
Returns
pamoja_mavlink_schema_crc_extra(nint)
Returns the CRC_EXTRA seed a schema implies.
public static extern byte pamoja_mavlink_schema_crc_extra(nint schema)
Parameters
schemanint
Returns
pamoja_mavlink_schema_field(nint, nuint, out PamojaMavlinkFieldInfo)
Describes one field of a message.
public static PamojaStatus pamoja_mavlink_schema_field(nint schema, nuint index, out PamojaMavlinkFieldInfo outField)
Parameters
schemanintindexnuintoutFieldPamojaMavlinkFieldInfo
Returns
pamoja_mavlink_schema_field_count(nint)
Returns how many fields a message has.
public static extern nuint pamoja_mavlink_schema_field_count(nint schema)
Parameters
schemanint
Returns
pamoja_mavlink_schema_for_id(uint, out nint)
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
Returns
pamoja_mavlink_schema_for_name(string, out nint)
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
Returns
pamoja_mavlink_schema_free(nint)
Releases a schema.
public static extern void pamoja_mavlink_schema_free(nint schema)
Parameters
schemanint
pamoja_mavlink_schema_id(nint)
Returns the id of the message a schema describes.
public static extern uint pamoja_mavlink_schema_id(nint schema)
Parameters
schemanint
Returns
pamoja_mavlink_schema_name(nint)
Returns the name of the message a schema describes.
public static extern nint pamoja_mavlink_schema_name(nint schema)
Parameters
schemanint
Returns
pamoja_mavlink_schema_wire_len(nint)
Returns the length of the message on the wire, in bytes.
public static extern nuint pamoja_mavlink_schema_wire_len(nint schema)
Parameters
schemanint
Returns
pamoja_mavlink_signer_free(nint)
Releases a signer.
public static extern void pamoja_mavlink_signer_free(nint signer)
Parameters
signernint
pamoja_mavlink_signer_link_id(nint)
Returns the link a signer signs on.
public static extern byte pamoja_mavlink_signer_link_id(nint signer)
Parameters
signernint
Returns
pamoja_mavlink_signer_new(ReadOnlySpan<byte>, byte, ulong, out nint)
Creates a signer.
public static PamojaStatus pamoja_mavlink_signer_new(ReadOnlySpan<byte> key, byte linkId, ulong timestamp, out nint outSigner)
Parameters
keyReadOnlySpan<byte>linkIdbytetimestampulongoutSignernint
Returns
pamoja_mavlink_signer_sign(nint, PamojaMavlinkHeader, uint, ReadOnlySpan<byte>, nuint, byte, out nint)
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
signernintheaderPamojaMavlinkHeadermsgiduintpayloadReadOnlySpan<byte>payloadLennuintcrcExtrabyteoutFramenint
Returns
pamoja_mavlink_timestamp_from_unix_micros(ulong)
Converts Unix time into the timestamp MAVLink signing counts in.
public static extern ulong pamoja_mavlink_timestamp_from_unix_micros(ulong unixMicros)
Parameters
unixMicrosulong
Returns
pamoja_mavlink_verifier_free(nint)
Releases a verifier.
public static extern void pamoja_mavlink_verifier_free(nint verifier)
Parameters
verifiernint
pamoja_mavlink_verifier_new(ReadOnlySpan<byte>, out nint)
Creates a verifier.
public static PamojaStatus pamoja_mavlink_verifier_new(ReadOnlySpan<byte> key, out nint outVerifier)
Parameters
keyReadOnlySpan<byte>outVerifiernint
Returns
pamoja_mavlink_verifier_set_window(nint, ulong)
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
Returns
pamoja_mavlink_verifier_verify(nint, nint)
Checks a frame's signature and its place in the sequence.
public static extern PamojaStatus pamoja_mavlink_verifier_verify(nint verifier, nint frame)
Parameters
Returns
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
mediannint
pamoja_median_new()
Creates an empty median filter.
public static extern nint pamoja_median_new()
Returns
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
Returns
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
Returns
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
dataReadOnlySpan<byte>dataLennuint
Returns
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
Returns
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
framenint
Returns
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
framenint
Returns
pamoja_mesh_frame_dst(nint)
Returns the address a frame is addressed to.
public static extern uint pamoja_mesh_frame_dst(nint frame)
Parameters
framenint
Returns
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
framenint
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
framenint
Returns
pamoja_mesh_frame_id(nint)
Returns the sequence number a frame carries.
public static extern ushort pamoja_mesh_frame_id(nint frame)
Parameters
framenint
Returns
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
framenint
Returns
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
Returns
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
bytesReadOnlySpan<byte>bytesLennuintoutFramenint
Returns
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
framenint
Returns
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
framenint
Returns
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
Returns
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
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
framenint
Returns
pamoja_mesh_frame_version(nint)
Returns the protocol version a frame declares.
public static extern byte pamoja_mesh_frame_version(nint frame)
Parameters
framenint
Returns
pamoja_mesh_seen_capacity(nint)
Returns how many packets a duplicate cache remembers.
public static extern nuint pamoja_mesh_seen_capacity(nint cache)
Parameters
cachenint
Returns
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
Returns
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
cachenint
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
capacitynuint
Returns
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
Returns
pamoja_message_free(nint)
Releases a message handle.
public static extern void pamoja_message_free(nint message)
Parameters
messagenint
pamoja_message_payload(nint)
Returns a pointer to a message payload.
public static extern nint pamoja_message_payload(nint message)
Parameters
messagenint
Returns
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
messagenint
Returns
pamoja_message_topic(nint)
Returns the topic a message arrived on.
public static extern nint pamoja_message_topic(nint message)
Parameters
messagenint
Returns
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
bytesReadOnlySpan<byte>bytesLennuint
Returns
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
framenint
Returns
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
Returns
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
framenint
Returns
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
framenint
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
framenint
Returns
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
bytesReadOnlySpan<byte>bytesLennuintoutFramenint
Returns
pamoja_modbus_frame_pdu(nint)
Returns a pointer to a frame's PDU.
public static extern nint pamoja_modbus_frame_pdu(nint frame)
Parameters
framenint
Returns
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
framenint
Returns
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
Returns
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
Returns
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
Returns
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
Returns
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
Returns
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
addressbytevaluesReadOnlySpan<ushort>valuesLennuintoutBuffernint
Returns
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
Returns
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
addressbytevaluesReadOnlySpan<ushort>valuesLennuintoutBuffernint
Returns
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
Returns
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
Returns
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
Returns
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
Returns
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
clientnint
Returns
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
clientnint
Returns
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
clientnint
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
clientnint
Returns
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
configPamojaMqttConfig
Returns
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
Returns
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
Returns
pamoja_mqtt_client_subscribe(nint, nint)
Subscribes to a topic filter.
public static extern PamojaStatus pamoja_mqtt_client_subscribe(nint client, nint topic)
Parameters
Returns
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
messagenint
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
messagenint
Returns
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
messagenint
Returns
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
messagenint
Returns
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
configPamojaOpt3001Config
Returns
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
bitsushortoutConfigPamojaOpt3001Config
Returns
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
longConversionbool
Returns
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
codebyte
Returns
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
Returns
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
rangeNumberbyte
Returns
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
Returns
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
rawushort
Returns
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
rawushort
Returns
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
milliLuxuint
Returns
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
bytesReadOnlySpan<byte>bytesLennuintoutWordushort
Returns
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
Returns
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
Returns
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
Returns
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
Returns
pamoja_pid_free(nint)
Releases a PID handle. Passing null is a no-op.
public static extern void pamoja_pid_free(nint pid)
Parameters
pidnint
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
Returns
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
Returns
pamoja_pid_reset(nint)
Clears a PID controller's integral and last error.
public static extern void pamoja_pid_reset(nint pid)
Parameters
pidnint
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
Returns
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
edgePamojaPinEdgefromPamojaPinLeveltoPamojaPinLevel
Returns
pamoja_pin_level_from_bool(bool)
Returns the level a boolean names.
public static PamojaPinLevel pamoja_pin_level_from_bool(bool high)
Parameters
highbool
Returns
pamoja_pin_level_inverted(PamojaPinLevel)
Returns the opposite level.
public static extern PamojaPinLevel pamoja_pin_level_inverted(PamojaPinLevel level)
Parameters
levelPamojaPinLevel
Returns
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
polarityPamojaPinPolaritylevelPamojaPinLevel
Returns
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
polarityPamojaPinPolarityassertedbool
Returns
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
planPamojaPowerPlanmodePamojaPowerMode
Returns
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
planPamojaPowerPlansocfloat
Returns
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
planPamojaPowerPlansocfloat
Returns
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
planPamojaPowerPlansocfloatchargingbyte
Returns
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
Returns
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
planPamojaPowerPlansaverBelowfloatcriticalBelowfloat
Returns
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
profilenintcontrolPamojaControlSpec
Returns
pamoja_profile_controller(nint)
Builds the decision logic a profile describes.
public static extern nint pamoja_profile_controller(nint profile)
Parameters
profilenint
Returns
pamoja_profile_flood_sensor()
Creates a flood sensor.
public static extern nint pamoja_profile_flood_sensor()
Returns
pamoja_profile_free(nint)
Releases a profile handle.
public static extern void pamoja_profile_free(nint profile)
Parameters
profilenint
pamoja_profile_from_json(string)
Loads a profile from its JSON manifest.
public static nint pamoja_profile_from_json(string manifest)
Parameters
manifeststring
Returns
pamoja_profile_irrigation_node()
Creates an irrigation node.
public static extern nint pamoja_profile_irrigation_node()
Returns
pamoja_profile_name(nint)
Returns a profile's stable name.
public static extern nint pamoja_profile_name(nint profile)
Parameters
profilenint
Returns
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
profilenintschedulePamojaPowerSchedule
Returns
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
profilenintplanPamojaPowerPlan
Returns
pamoja_profile_to_json(nint)
Serializes a profile to its JSON manifest.
public static extern nint pamoja_profile_to_json(nint profile)
Parameters
profilenint
Returns
pamoja_profile_topic(nint)
Returns the topic a profile publishes each reading to.
public static extern nint pamoja_profile_topic(nint profile)
Parameters
profilenint
Returns
pamoja_profile_vaccine_fridge_monitor()
Creates a cold-chain fridge monitor.
public static extern nint pamoja_profile_vaccine_fridge_monitor()
Returns
pamoja_profile_well_level()
Creates a well-level monitor.
public static extern nint pamoja_profile_well_level()
Returns
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
publicKeyReadOnlySpan<byte>outFingerprintSpan<byte>
Returns
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
publicKeyReadOnlySpan<byte>payloadReadOnlySpan<byte>payloadLennuintsignatureReadOnlySpan<byte>
Returns
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
publicKeyReadOnlySpan<byte>messageReadOnlySpan<byte>messageLennuintoutBuffernint
Returns
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
Returns
pamoja_pwm_duty(ushort)
Builds a PWM setting with no phase delay.
public static extern PamojaPwm pamoja_pwm_duty(ushort off)
Parameters
offushort
Returns
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
Returns
pamoja_pwm_full_off()
The setting that holds a channel continuously low.
public static extern PamojaPwm pamoja_pwm_full_off()
Returns
pamoja_pwm_full_on()
The setting that holds a channel continuously high.
public static extern PamojaPwm pamoja_pwm_full_on()
Returns
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
Returns
pamoja_ramp_free(nint)
Releases a ramp handle. Passing null is a no-op.
public static extern void pamoja_ramp_free(nint ramp)
Parameters
rampnint
pamoja_ramp_new(float, float)
Creates a rate limiter.
public static extern nint pamoja_ramp_new(float start, float maxStep)
Parameters
Returns
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
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
Returns
pamoja_ramp_value(nint)
Reads a ramp's current value.
public static extern float pamoja_ramp_value(nint ramp)
Parameters
rampnint
Returns
pamoja_readings_data(nint)
Returns a pointer to a decoded float reading series.
public static extern nint pamoja_readings_data(nint readings)
Parameters
readingsnint
Returns
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
readingsnint
pamoja_readings_len(nint)
Returns the number of float readings in a decoded series.
public static extern nuint pamoja_readings_len(nint readings)
Parameters
readingsnint
Returns
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
Returns
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
Returns
pamoja_recording_actuator_free(nint)
Releases a recording actuator handle.
public static extern void pamoja_recording_actuator_free(nint actuator)
Parameters
actuatornint
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
actuatornint
Returns
pamoja_recording_actuator_new()
Creates an actuator that records every command.
public static extern nint pamoja_recording_actuator_new()
Returns
pamoja_registers_data(nint)
Returns a pointer to the registers a device returned.
public static extern nint pamoja_registers_data(nint registers)
Parameters
registersnint
Returns
pamoja_registers_free(nint)
Releases a register series. Passing null is a no-op.
public static extern void pamoja_registers_free(nint registers)
Parameters
registersnint
pamoja_registers_len(nint)
Returns how many registers a device returned.
public static extern nuint pamoja_registers_len(nint registers)
Parameters
registersnint
Returns
pamoja_replay_free(nint)
Releases a replay handle.
public static extern void pamoja_replay_free(nint replay)
Parameters
replaynint
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
readingsReadOnlySpan<float>countnuintrepeatingbool
Returns
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
Returns
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
reporternintcostPamojaLinkCost
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
reporternintlevelPamojaTelemetryLevel
Returns
pamoja_reporter_dropped(nint)
Returns how many events the threshold dropped.
public static extern uint pamoja_reporter_dropped(nint reporter)
Parameters
reporternint
Returns
pamoja_reporter_emitted(nint)
Returns how many events passed the threshold and were shipped.
public static extern uint pamoja_reporter_emitted(nint reporter)
Parameters
reporternint
Returns
pamoja_reporter_free(nint)
Releases a reporter handle.
public static extern void pamoja_reporter_free(nint reporter)
Parameters
reporternint
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
thresholdPamojaTelemetryLevel
Returns
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
reporternintlevelPamojaTelemetryLevel
Returns
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
reporternintthresholdPamojaTelemetryLevel
pamoja_reporter_snapshot(nint)
Takes a snapshot of a reporter's counters.
public static extern PamojaTelemetrySnapshot pamoja_reporter_snapshot(nint reporter)
Parameters
reporternint
Returns
pamoja_reporter_threshold(nint)
Returns the level a reporter is currently shipping from.
public static extern PamojaTelemetryLevel pamoja_reporter_threshold(nint reporter)
Parameters
reporternint
Returns
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
reporternint
Returns
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
fqnstringkindPamojaEntityKind
Returns
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
rosTypestring
Returns
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
domainIduintfqnstringrosTypestringhashPamojaTypeHash
Returns
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
kindPamojaEntityKind
Returns
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
namestring
Returns
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
namestring
Returns
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
namestring
Returns
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
dataReadOnlySpan<byte>dataLennuinttwistPamojaRos2Twist
Returns
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
twistPamojaRos2Twist
Returns
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
textstringhashPamojaTypeHash
Returns
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
hashPamojaTypeHash
Returns
pamoja_router_address(nint)
Returns the address a router answers for.
public static extern uint pamoja_router_address(nint router)
Parameters
routernint
Returns
pamoja_router_capacity(nint)
Returns how many routes a table can hold.
public static extern nuint pamoja_router_capacity(nint router)
Parameters
routernint
Returns
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
Returns
pamoja_router_forget(nint, uint)
Forgets the route to a node.
public static extern void pamoja_router_forget(nint router, uint dst)
Parameters
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
Returns
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
routernint
pamoja_router_len(nint)
Returns how many routes a table currently holds.
public static extern nuint pamoja_router_len(nint router)
Parameters
routernint
Returns
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
Returns
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
Returns
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
Returns
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
routernintdstuintoutRoutePamojaRoute
Returns
pamoja_samples_data(nint)
Returns a pointer to a decoded integer sample series.
public static extern nint pamoja_samples_data(nint samples)
Parameters
samplesnint
Returns
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
samplesnint
pamoja_samples_len(nint)
Returns the number of integer samples in a decoded series.
public static extern nuint pamoja_samples_len(nint samples)
Parameters
samplesnint
Returns
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
commandushort
Returns
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
wordushort
Returns
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
pascalsuint
Returns
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
wordushort
Returns
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
enabledbool
Returns
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
rawushort
Returns
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
Returns
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
dataReadOnlySpan<byte>dataLennuint
Returns
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
wordushort
Returns
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
Returns
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
Returns
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
rawushort
Returns
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
milliPercentuint
Returns
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
Returns
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
Returns
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
co2PpmushortmilliCelsiusinthumidityMilliPercentuintoutMeasurementPamojaScd4xMeasurement
Returns
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
rawushort
Returns
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
frameReadOnlySpan<byte>frameLennuintoutMeasurementPamojaScd4xMeasurement
Returns
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
rawushort
Returns
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
wordushort
Returns
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
frameReadOnlySpan<byte>frameLennuintoutSerialulong
Returns
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
Returns
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
wordushort
Returns
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
milliCelsiusuint
Returns
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
milliCelsiusint
Returns
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
frameReadOnlySpan<byte>frameLennuintoutWordushort
Returns
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
Returns
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
Returns
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
frameReadOnlySpan<byte>frameLennuintoutBuffernint
Returns
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
payloadReadOnlySpan<byte>payloadLennuintoutBuffernint
Returns
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
payloadLennuint
Returns
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
frameReadOnlySpan<byte>frameLennuintoutBuffernint
Returns
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
payloadReadOnlySpan<byte>payloadLennuintoutBuffernint
Returns
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
payloadLennuint
Returns
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
localnintpeerPublicKeyReadOnlySpan<byte>saltReadOnlySpan<byte>saltLennuintrolePamojaSessionRole
Returns
pamoja_session_free(nint)
Releases a session handle.
public static extern void pamoja_session_free(nint session)
Parameters
sessionnint
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
saltReadOnlySpan<byte>saltLennuintikmReadOnlySpan<byte>ikmLennuintinfoReadOnlySpan<byte>infoLennuintoutBytesSpan<byte>outLennuint
Returns
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
keyReadOnlySpan<byte>keyLennuintmessageReadOnlySpan<byte>messageLennuintoutDigestSpan<byte>
Returns
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
sessionnintsealedHeaderPamojaSealedbufSpan<byte>lennuintaadReadOnlySpan<byte>aadLennuint
Returns
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
sessionnintbufSpan<byte>lennuintaadReadOnlySpan<byte>aadLennuintoutSealedPamojaSealed
Returns
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
rawushort
Returns
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
dataReadOnlySpan<byte>dataLennuint
Returns
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
rawushort
Returns
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
milliPercentuint
Returns
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
percentfloat
Returns
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
Returns
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
Returns
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
Returns
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
rawushort
Returns
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
rawushort
Returns
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
rawushort
Returns
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
frameReadOnlySpan<byte>frameLennuintoutMeasurementPamojaSht3xMeasurement
Returns
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
frameReadOnlySpan<byte>frameLennuintoutStatusPamojaSht3xStatus
Returns
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
Returns
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
rawushort
Returns
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
Returns
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
Returns
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
bitsushortoutStatusPamojaSht3xStatus
Returns
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
celsiusfloat
Returns
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
milliCelsiusint
Returns
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
milliFahrenheitint
Returns
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
Returns
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
frameReadOnlySpan<byte>frameLennuintoutWordushort
Returns
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
Returns
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
robotnintcommandPamojaTwist
Returns
pamoja_sim_robot_free(nint)
Releases a simulated robot handle.
public static extern void pamoja_sim_robot_free(nint robot)
Parameters
robotnint
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
startPamojaPosedtfloat
Returns
pamoja_sim_robot_pose(nint)
Reads where a simulated robot has got to.
public static extern PamojaPose pamoja_sim_robot_pose(nint robot)
Parameters
robotnint
Returns
pamoja_sim_sensor_free(nint)
Releases a simulated sensor handle.
public static extern void pamoja_sim_sensor_free(nint sensor)
Parameters
sensornint
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
Returns
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
Returns
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
decodernint
Returns
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
decodernintbytesReadOnlySpan<byte>bytesLennuintoutFramesnint
Returns
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
decodernint
pamoja_slip_decoder_new()
Creates a streaming SLIP decoder.
public static extern nint pamoja_slip_decoder_new()
Returns
pamoja_slip_decoder_reset(nint)
Discards any partly assembled SLIP frame.
public static extern void pamoja_slip_decoder_reset(nint decoder)
Parameters
decodernint
pamoja_smoother_free(nint)
Releases a smoother handle. Passing null is a no-op.
public static extern void pamoja_smoother_free(nint smoother)
Parameters
smoothernint
pamoja_smoother_new(float)
Creates an exponential smoother.
public static extern nint pamoja_smoother_new(float weight)
Parameters
weightfloat
Returns
pamoja_smoother_reset(nint)
Clears a smoother back to its initial state.
public static extern void pamoja_smoother_reset(nint smoother)
Parameters
smoothernint
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
Returns
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
Returns
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
Returns
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
Returns
pamoja_stepper_coils(nint)
Returns the coil pattern a stepper holds, without advancing.
public static extern byte pamoja_stepper_coils(nint stepper)
Parameters
steppernint
Returns
pamoja_stepper_free(nint)
Releases a stepper handle. Passing null is a no-op.
public static extern void pamoja_stepper_free(nint stepper)
Parameters
steppernint
pamoja_stepper_new(PamojaStepDrive)
Creates a stepper at the start of a drive pattern.
public static extern nint pamoja_stepper_new(PamojaStepDrive drive)
Parameters
drivePamojaStepDrive
Returns
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
steppernintdirectionPamojaStepDirection
Returns
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
drivePamojaStepDrive
Returns
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
steppernint
Returns
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
Returns
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
storenintrecordReadOnlySpan<byte>recordLennuint
Returns
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
Returns
pamoja_store_file(nint)
Opens a buffer backed by a directory.
public static extern nint pamoja_store_file(nint dir)
Parameters
dirnint
Returns
pamoja_store_free(nint)
Releases a store handle.
public static extern void pamoja_store_free(nint store)
Parameters
storenint
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
Returns
pamoja_store_memory(nuint)
Creates a buffer held in memory.
public static extern nint pamoja_store_memory(nuint capacity)
Parameters
capacitynuint
Returns
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
Returns
pamoja_store_pop(nint, out nint)
Removes and returns the oldest record.
public static PamojaStatus pamoja_store_pop(nint store, out nint outRecord)
Parameters
Returns
pamoja_string_data(nint)
Returns a pointer to an owned string's bytes.
public static extern nint pamoja_string_data(nint text)
Parameters
textnint
Returns
pamoja_string_free(nint)
Releases an owned string.
public static extern void pamoja_string_free(nint text)
Parameters
textnint
pamoja_string_len(nint)
Returns the length in bytes of an owned string.
public static extern nuint pamoja_string_len(nint text)
Parameters
textnint
Returns
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
limitfloat
Returns
pamoja_surge_free(nint)
Releases a surge handle. Passing null is a no-op.
public static extern void pamoja_surge_free(nint surge)
Parameters
surgenint
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
limitfloat
Returns
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
Returns
pamoja_thermostat_cooling(float, float)
Creates a cooling thermostat.
public static extern nint pamoja_thermostat_cooling(float setpoint, float hysteresis)
Parameters
Returns
pamoja_thermostat_free(nint)
Releases a thermostat handle. Passing null is a no-op.
public static extern void pamoja_thermostat_free(nint thermostat)
Parameters
thermostatnint
pamoja_thermostat_heating(float, float)
Creates a heating thermostat.
public static extern nint pamoja_thermostat_heating(float setpoint, float hysteresis)
Parameters
Returns
pamoja_thermostat_is_on(nint)
Reports a thermostat's current load state.
public static bool pamoja_thermostat_is_on(nint thermostat)
Parameters
thermostatnint
Returns
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
Returns
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
codebyte
Returns
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
codebyte
Returns
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
rawshort
Returns
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
configPamojaTmp117Config
Returns
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
bitsushortoutConfigPamojaTmp117Config
Returns
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
Returns
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
codebyte
Returns
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
configushort
Returns
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
rawushort
Returns
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
configushort
Returns
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
unlockushort
Returns
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
configushort
Returns
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
configushort
Returns
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
rawshort
Returns
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
rawshort
Returns
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
celsiusfloat
Returns
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
microCelsiusint
Returns
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
rawushort
Returns
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
Returns
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
bytesReadOnlySpan<byte>bytesLennuintoutRawshort
Returns
pamoja_transport_coap(ref PamojaCoapConfig)
Creates a CoAP transport for composing.
public static nint pamoja_transport_coap(ref PamojaCoapConfig config)
Parameters
configPamojaCoapConfig
Returns
pamoja_transport_connect(nint)
Connects a transport.
public static extern PamojaStatus pamoja_transport_connect(nint transport)
Parameters
transportnint
Returns
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
Returns
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
Returns
pamoja_transport_free(nint)
Releases a transport handle.
public static extern void pamoja_transport_free(nint transport)
Parameters
transportnint
pamoja_transport_loopback(nint)
Creates a loopback transport for composing.
public static extern nint pamoja_transport_loopback(nint broker)
Parameters
brokernint
Returns
pamoja_transport_mqtt(ref PamojaMqttConfig)
Creates an MQTT transport for composing.
public static nint pamoja_transport_mqtt(ref PamojaMqttConfig config)
Parameters
configPamojaMqttConfig
Returns
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
transportninttopicnintpayloadReadOnlySpan<byte>payloadLennuint
Returns
pamoja_transport_subscribe(nint, nint)
Subscribes a transport to a topic.
public static extern PamojaStatus pamoja_transport_subscribe(nint transport, nint topic)
Parameters
Returns
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
trendnint
pamoja_trend_new()
Creates an empty trend estimator.
public static extern nint pamoja_trend_new()
Returns
pamoja_trend_push(nint, float)
Adds a reading to a trend estimator.
public static extern void pamoja_trend_push(nint trend, float reading)
Parameters
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
Returns
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
updaternintbytesReadOnlySpan<byte>lennuinthasNowboolnowulongoutDelegationPamojaDelegation
Returns
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
Returns
pamoja_updater_confirm(nint, out byte)
Confirms the pending image.
public static PamojaStatus pamoja_updater_confirm(nint updater, out byte outSlot)
Parameters
Returns
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
updaternintoutDelegationPamojaDelegation
Returns
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
Returns
pamoja_updater_free(nint)
Releases an updater handle.
public static extern void pamoja_updater_free(nint updater)
Parameters
updaternint
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
Returns
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
devicePamojaDeviceslotCountbyteslotCapacityuint
Returns
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
updaternintoutBootPamojaBoot
Returns
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
Returns
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
Returns
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
Returns
pamoja_updater_slot_count(nint)
Returns how many slots a device has.
public static extern byte pamoja_updater_slot_count(nint updater)
Parameters
updaternint
Returns
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
updaternintslotbyteoutRecordPamojaSlotRecord
Returns
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
updaternintenvelopeReadOnlySpan<byte>envelopeLennuintimageReadOnlySpan<byte>imageLennuinthasNowboolnowulongoutSlotbyte
Returns
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
updaternintchunkReadOnlySpan<byte>lennuint
Returns
pamoja_version()
Returns the version string of the native pamoja library.
public static extern nint pamoja_version()
Returns
pamoja_window_capacity(nint)
Returns how many readings a window holds before dropping.
public static extern nuint pamoja_window_capacity(nint window)
Parameters
windownint
Returns
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
windownint
pamoja_window_len(nint)
Returns how many readings a window holds.
public static extern nuint pamoja_window_len(nint window)
Parameters
windownint
Returns
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
Returns
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
Returns
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
Returns
pamoja_window_new()
Creates an empty rolling window.
public static extern nint pamoja_window_new()
Returns
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
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
Returns
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)