Table of Contents

Class NativeMethods

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

The P/Invoke declarations for the actuator drivers that run over an I2C bus and their simulated parts, mirroring pamoja.h one-to-one.

public static class NativeMethods
Inheritance
NativeMethods
Inherited Members

Remarks

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

Fields

AuditDigestLen

The length in bytes of an audit entry hash.

public const int AuditDigestLen = 32

Field Value

int

AuditSignatureLen

The length in bytes of an audit entry signature.

public const int AuditSignatureLen = 64

Field Value

int

Bme280CalibrationHumidityLen

The BME280 humidity calibration block length.

public const int Bme280CalibrationHumidityLen = 7

Field Value

int

Bme280CalibrationTempPressLen

The BME280 temperature and pressure calibration block length.

public const int Bme280CalibrationTempPressLen = 26

Field Value

int

Bme280MeasurementLen

The length of a BME280 burst measurement read.

public const int Bme280MeasurementLen = 8

Field Value

int

Bmp280CalibrationLen

The length of a BMP280 calibration block.

public const int Bmp280CalibrationLen = 24

Field Value

int

Bmp280DataLen

The length of a BMP280 burst data read.

public const int Bmp280DataLen = 6

Field Value

int

CanBusDevice

A bus kind: a kernel CAN interface reached through SocketCAN.

public const byte CanBusDevice = 0

Field Value

byte

CanBusSimulated

A bus kind: a bus inside the program.

public const byte CanBusSimulated = 1

Field Value

byte

ChirpstackApplicationId

The field naming the application.

public const byte ChirpstackApplicationId = 2

Field Value

byte

ChirpstackDeduplicationId

The field naming the uplink's deduplication identifier.

public const byte ChirpstackDeduplicationId = 0

Field Value

byte

ChirpstackDeviceName

The field naming the device.

public const byte ChirpstackDeviceName = 3

Field Value

byte

ChirpstackTime

The field naming when the uplink was received.

public const byte ChirpstackTime = 1

Field Value

byte

Ds18b20ScratchpadLen

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

public const int Ds18b20ScratchpadLen = 9

Field Value

int

GatewayEuiLen

The length of a gateway's unique identifier.

public const int GatewayEuiLen = 8

Field Value

int

GatewayModulationFsk

An FSK packet, whose bitrate is in its bitrate field.

public const byte GatewayModulationFsk = 1

Field Value

byte

GatewayModulationLora

A LoRa packet, whose settings are in the link.

public const byte GatewayModulationLora = 0

Field Value

byte

GatewayNetworkData

A session frame arrived, decrypted into the caller buffer.

public const byte GatewayNetworkData = 1

Field Value

byte

GatewayNetworkForeign

The frame belongs to a device this site never granted.

public const byte GatewayNetworkForeign = 2

Field Value

byte

GatewayNetworkJoined

A device joined, and its accept is in the event.

public const byte GatewayNetworkJoined = 0

Field Value

byte

GatewayNetworkRx1Downstream

The first receive window answers on a run of downlink channels.

public const byte GatewayNetworkRx1Downstream = 1

Field Value

byte

GatewayNetworkRx1Same

The first receive window answers on the frequency the uplink arrived on.

public const byte GatewayNetworkRx1Same = 0

Field Value

byte

GatewayProtocolVersion

The protocol version every datagram starts with.

public const byte GatewayProtocolVersion = 2

Field Value

byte

GatewayPullAck

The server acknowledging a PULL_DATA.

public const byte GatewayPullAck = 4

Field Value

byte

GatewayPullData

The gateway holding its route open.

public const byte GatewayPullData = 2

Field Value

byte

GatewayPullResp

The server sending a packet to transmit.

public const byte GatewayPullResp = 3

Field Value

byte

GatewayPushAck

The server acknowledging a PUSH_DATA.

public const byte GatewayPushAck = 1

Field Value

byte

GatewayPushData

The gateway forwarding what it heard.

public const byte GatewayPushData = 0

Field Value

byte

A frame the server asks the station to transmit.

public const byte GatewayStationDownlink = 5

Field Value

byte

GatewayStationJoinRequest

A join request the station heard.

public const byte GatewayStationJoinRequest = 0

Field Value

byte

GatewayStationOther

A kind this build does not model, readable only as its text.

public const byte GatewayStationOther = 9

Field Value

byte

GatewayStationProprietary

A frame of a kind this protocol does not describe, carried whole.

public const byte GatewayStationProprietary = 2

Field Value

byte

GatewayStationRouterConfig

How the server tells the station to configure its radios.

public const byte GatewayStationRouterConfig = 4

Field Value

byte

GatewayStationSchedule

Frames the server asks the station to transmit to a group.

public const byte GatewayStationSchedule = 6

Field Value

byte

GatewayStationTextFeatures

What a version says the station can do.

public const byte GatewayStationTextFeatures = 4

Field Value

byte

GatewayStationTextFirmware

The firmware a version reports.

public const byte GatewayStationTextFirmware = 1

Field Value

byte

GatewayStationTextHwspec

The concentrator a configuration is written for.

public const byte GatewayStationTextHwspec = 6

Field Value

byte

GatewayStationTextModel

The hardware model a version reports.

public const byte GatewayStationTextModel = 3

Field Value

byte

GatewayStationTextMsgtype

The word a message calls itself on the wire.

public const byte GatewayStationTextMsgtype = 7

Field Value

byte

GatewayStationTextPackage

The package a version reports.

public const byte GatewayStationTextPackage = 2

Field Value

byte

GatewayStationTextRegion

The region a configuration names.

public const byte GatewayStationTextRegion = 5

Field Value

byte

GatewayStationTextStation

The station software a version reports.

public const byte GatewayStationTextStation = 0

Field Value

byte

GatewayStationTimeSync

The clock the two keep between them.

public const byte GatewayStationTimeSync = 8

Field Value

byte

GatewayStationTransmitted

What became of a frame the station was asked to transmit.

public const byte GatewayStationTransmitted = 7

Field Value

byte

A data frame the station heard.

public const byte GatewayStationUplink = 1

Field Value

byte

GatewayStationVersion

What the station reports about itself when a session opens.

public const byte GatewayStationVersion = 3

Field Value

byte

GatewayTxAck

The gateway reporting what became of a PULL_RESP.

public const byte GatewayTxAck = 5

Field Value

byte

Hdc1080MeasurementLen

The length of a HDC1080 measurement frame.

public const int Hdc1080MeasurementLen = 4

Field Value

int

I2cBusAdapter

A bus kind: the kernel's adapter.

public const byte I2cBusAdapter = 0

Field Value

byte

I2cBusScripted

A bus kind: a script.

public const byte I2cBusScripted = 2

Field Value

byte

I2cBusSimulated

A bus kind: simulated parts.

public const byte I2cBusSimulated = 1

Field Value

byte

I2cPartBytes

A part kind: registers a byte wide.

public const byte I2cPartBytes = 0

Field Value

byte

I2cPartCommands

A part kind: commands that leave replies.

public const byte I2cPartCommands = 2

Field Value

byte

I2cPartWords

A part kind: registers sixteen bits wide.

public const byte I2cPartWords = 1

Field Value

byte

I2cReservedBelow

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

public const byte I2cReservedBelow = 8

Field Value

byte

I2cReservedFrom

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

public const byte I2cReservedFrom = 120

Field Value

byte

Ina219ConfigReset

The INA219 configuration register's power-on value.

public const ushort Ina219ConfigReset = 14751

Field Value

ushort

J1939BroadcastAddress

The destination address every node on the bus reads.

public const byte J1939BroadcastAddress = 255

Field Value

byte

J1939NotAvailable

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

public const byte J1939NotAvailable = 255

Field Value

byte

J1939PriorityControl

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

public const byte J1939PriorityControl = 3

Field Value

byte

J1939PriorityDefault

The priority ordinary traffic takes.

public const byte J1939PriorityDefault = 6

Field Value

byte

J1939PriorityLowest

The priority that yields to everything else on the bus.

public const byte J1939PriorityLowest = 7

Field Value

byte

LoraChannelListMhz800

The 800 MHz channel list numbering.

public const byte LoraChannelListMhz800 = 1

Field Value

byte

LoraChannelListMhz900

The 900 MHz channel list numbering.

public const byte LoraChannelListMhz900 = 2

Field Value

byte

LoraChannelListNone

A plan that reads a type 1 channel list against no numbering.

public const byte LoraChannelListNone = 0

Field Value

byte

LoraChannelsDefault

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

public const uint LoraChannelsDefault = 1

Field Value

uint

The numbered downlink channels a fixed plan answers the first receive window on.

public const uint LoraChannelsDownlink = 2

Field Value

uint

LoraChannelsJoin

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

public const uint LoraChannelsJoin = 0

Field Value

uint

LoraCn470Antenna20MhzA

The CN470-510 plan for a 20 MHz antenna, type A.

public const uint LoraCn470Antenna20MhzA = 1

Field Value

uint

LoraCn470Antenna20MhzB

The CN470-510 plan for a 20 MHz antenna, type B.

public const uint LoraCn470Antenna20MhzB = 2

Field Value

uint

LoraCn470Antenna26MhzA

The CN470-510 plan for a 26 MHz antenna, type A.

public const uint LoraCn470Antenna26MhzA = 3

Field Value

uint

LoraCn470Antenna26MhzB

The CN470-510 plan for a 26 MHz antenna, type B.

public const uint LoraCn470Antenna26MhzB = 4

Field Value

uint

LoraCn470Channels96

The 96-channel CN470-510 plan.

public const uint LoraCn470Channels96 = 5

Field Value

uint

LoraCn470None

No CN470-510 plan.

public const uint LoraCn470None = 0

Field Value

uint

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

public const uint LoraDirectionDownlink = 1

Field Value

uint

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

public const uint LoraDirectionUplink = 0

Field Value

uint

LoraJoinOctetPasses

Join channels tried in octet passes.

public const byte LoraJoinOctetPasses = 1

Field Value

byte

LoraJoinRandom

Join channels chosen at random.

public const byte LoraJoinRandom = 0

Field Value

byte

LoraMaskAll

A mask control that turns every channel on or off, then sets a group.

public const byte LoraMaskAll = 3

Field Value

byte

LoraMaskBanks

A mask control whose ten low bits switch banks of eight.

public const byte LoraMaskBanks = 1

Field Value

byte

LoraMaskGroup

A mask control that sets one group of sixteen channels.

public const byte LoraMaskGroup = 0

Field Value

byte

LoraMaskPairedBanks

A mask control that switches banks of eight with their 500 kHz channel.

public const byte LoraMaskPairedBanks = 2

Field Value

byte

LoraMaskReserved

A mask control the region reserves.

public const byte LoraMaskReserved = 4

Field Value

byte

LoraModulationFsk

A data rate carried by FSK modulation.

public const byte LoraModulationFsk = 1

Field Value

byte

LoraModulationLora

A data rate carried by LoRa modulation.

public const byte LoraModulationLora = 0

Field Value

byte

LoraModulationLrFhss

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

public const byte LoraModulationLrFhss = 2

Field Value

byte

LoraModulationReserved

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

public const byte LoraModulationReserved = 3

Field Value

byte

LoraPayloadTableDownlinkDirect

The downlink payload limits for a device that will not.

public const uint LoraPayloadTableDownlinkDirect = 3

Field Value

uint

LoraPayloadTableDownlinkRepeater

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

public const uint LoraPayloadTableDownlinkRepeater = 2

Field Value

uint

LoraPayloadTableDwellLimited

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

public const uint LoraPayloadTableDwellLimited = 4

Field Value

uint

LoraPayloadTableUplinkDirect

The uplink payload limits for a device that will not.

public const uint LoraPayloadTableUplinkDirect = 1

Field Value

uint

LoraPayloadTableUplinkRepeater

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

public const uint LoraPayloadTableUplinkRepeater = 0

Field Value

uint

LoraPlanKindDynamic

A plan whose network creates channels and moves them.

public const byte LoraPlanKindDynamic = 0

Field Value

byte

LoraPlanKindFixed

A plan whose channels are numbered in advance and only enabled or disabled.

public const byte LoraPlanKindFixed = 1

Field Value

byte

LoraPowerConducted

Power indexes that count down from a conducted ceiling.

public const byte LoraPowerConducted = 1

Field Value

byte

LoraPowerEirp

Power indexes that count down from a radiated ceiling.

public const byte LoraPowerEirp = 0

Field Value

byte

LoraRadioCorrupt

A reception outcome: a frame arrived whose check failed, and was dropped.

public const byte LoraRadioCorrupt = 2

Field Value

byte

LoraRadioDefaultSpiHz

The SPI clock a radio opens at when the call passes 0, in hertz.

public const uint LoraRadioDefaultSpiHz = 2000000

Field Value

uint

LoraRadioFrame

A reception outcome: a frame arrived and checked.

public const byte LoraRadioFrame = 0

Field Value

byte

LoraRadioNothing

A reception outcome: nothing has arrived since the last frame was taken.

public const byte LoraRadioNothing = 3

Field Value

byte

LoraRadioSx126x

The family of an SX1261, SX1262, SX1268, or LLCC68.

public const byte LoraRadioSx126x = 0

Field Value

byte

LoraRadioSx127x

The family of an SX1276, SX1277, SX1278, or SX1279.

public const byte LoraRadioSx127x = 1

Field Value

byte

LoraRadioSyncWordPrivate

The sync word of a private network, and both families' reset value.

public const byte LoraRadioSyncWordPrivate = 18

Field Value

byte

LoraRadioSyncWordPublic

The sync word of a public network such as LoRaWAN.

public const byte LoraRadioSyncWordPublic = 52

Field Value

byte

LoraRadioTimeout

A reception outcome: no frame arrived before the timeout.

public const byte LoraRadioTimeout = 1

Field Value

byte

LoraRegionAs923

The AS923 band.

public const uint LoraRegionAs923 = 6

Field Value

uint

LoraRegionAu915

The AU915-928 band.

public const uint LoraRegionAu915 = 4

Field Value

uint

LoraRegionCn470

The CN470-510 band.

public const uint LoraRegionCn470 = 5

Field Value

uint

LoraRegionEu433

The EU433 band.

public const uint LoraRegionEu433 = 3

Field Value

uint

LoraRegionEu868

The EU863-870 band.

public const uint LoraRegionEu868 = 1

Field Value

uint

LoraRegionIn865

The IN865-867 band.

public const uint LoraRegionIn865 = 8

Field Value

uint

LoraRegionKr920

The KR920-923 band.

public const uint LoraRegionKr920 = 7

Field Value

uint

LoraRegionRu864

The RU864-870 band.

public const uint LoraRegionRu864 = 9

Field Value

uint

LoraRegionUs915

The US902-928 band.

public const uint LoraRegionUs915 = 2

Field Value

uint

LorawanCfListFrequencies

How many frequencies a type 0 channel list carries.

public const int LorawanCfListFrequencies = 5

Field Value

int

LorawanCfListLen

The number of bytes a channel list occupies.

public const int LorawanCfListLen = 16

Field Value

int

LorawanCfListMaskGroups

How many sixteen-bit masks a type 1 channel list carries.

public const int LorawanCfListMaskGroups = 6

Field Value

int

LorawanCfListTypeChannelMasks

The CFListType byte of a list of channel mask groups.

public const byte LorawanCfListTypeChannelMasks = 1

Field Value

byte

LorawanCfListTypeFrequencies

The CFListType byte of a list of frequencies.

public const byte LorawanCfListTypeFrequencies = 0

Field Value

byte

LorawanClockPort

The port clock synchronization is spoken on, TS003-2.0.0.

public const byte LorawanClockPort = 202

Field Value

byte

LorawanEuiLen

The length of a LoRaWAN EUI, in bytes.

public const int LorawanEuiLen = 8

Field Value

int

LorawanFirmwarePort

The port firmware management is spoken on, TS006-1.0.0.

public const byte LorawanFirmwarePort = 203

Field Value

byte

LorawanFragmentPort

The port fragmented data block transport is spoken on, TS004-2.0.0.

public const byte LorawanFragmentPort = 201

Field Value

byte

LorawanImageCorrupt

One is there, but it is corrupt or its signature does not verify.

public const byte LorawanImageCorrupt = 1

Field Value

byte

LorawanImageNone

The device holds no firmware upgrade image.

public const byte LorawanImageNone = 0

Field Value

byte

LorawanImageValid

One is there, and it can be installed.

public const byte LorawanImageValid = 3

Field Value

byte

LorawanImageWrongHardware

One is there and authentic, but it is not for this hardware.

public const byte LorawanImageWrongHardware = 2

Field Value

byte

LorawanKeyLen

The length of a LoRaWAN key, in bytes.

public const int LorawanKeyLen = 16

Field Value

int

LorawanMaxFragments

The most fragments one session carries.

public const ushort LorawanMaxFragments = 16383

Field Value

ushort

LorawanMulticastPort

The port remote multicast setup is spoken on, TS005-2.0.0.

public const byte LorawanMulticastPort = 200

Field Value

byte

LorawanPayloadMax

The largest LoRaWAN application payload, in bytes.

public const int LorawanPayloadMax = 243

Field Value

int

LorawanRelayDeviceControlled

The device itself decides.

public const byte LorawanRelayDeviceControlled = 3

Field Value

byte

LorawanRelayDisabled

The device never sends through a relay, the default.

public const byte LorawanRelayDisabled = 0

Field Value

byte

LorawanRelayDynamic

It does once a run of uplinks goes unanswered.

public const byte LorawanRelayDynamic = 2

Field Value

byte

LorawanRelayEnabled

It always does.

public const byte LorawanRelayEnabled = 1

Field Value

byte

LorawanRelayHeardDevice

The relay's own device read the frame.

public const byte LorawanRelayHeardDevice = 0

Field Value

byte

The frame carried a downlink to pass on to an end device.

public const byte LorawanRelayHeardDownlink = 1

Field Value

byte

LorawanRelayHeardUndeliverable

It carried one that cannot be passed on.

public const byte LorawanRelayHeardUndeliverable = 2

Field Value

byte

LorawanRelayInitialized

No wake-on-radio frame has gone out yet.

public const byte LorawanRelayInitialized = 0

Field Value

byte

LorawanRelaySynchronized

The device knows when the relay next scans.

public const byte LorawanRelaySynchronized = 2

Field Value

byte

LorawanRelayUnsynchronized

One went out unanswered, so the next preamble spans a scan period.

public const byte LorawanRelayUnsynchronized = 1

Field Value

byte

LorawanSavedLen

How many bytes a saved device state takes.

public const int LorawanSavedLen = 1678

Field Value

int

LorawanVersion103

LoRaWAN 1.0.3.

public const byte LorawanVersion103 = 3

Field Value

byte

LorawanVersion104

TS001-1.0.4, the LoRaWAN 1.0.4 link layer.

public const byte LorawanVersion104 = 4

Field Value

byte

LorawanWakeJoinRequest

A wake-on-radio frame ahead of a join request the relay lets through.

public const byte LorawanWakeJoinRequest = 0

Field Value

byte

LorawanWakeNotified

One from a device the relay tells its network about.

public const byte LorawanWakeNotified = 2

Field Value

byte

One ahead of a trusted device's uplink.

public const byte LorawanWakeUplink = 1

Field Value

byte

LorawanWorJoinRequest

A WOR frame ahead of a join request.

public const byte LorawanWorJoinRequest = 0

Field Value

byte

The uplink goes out at the time the exchange named.

public const byte LorawanWorNextUplink = 0

Field Value

byte

LorawanWorNextWakeUp

The relay is woken again first.

public const byte LorawanWorNextWakeUp = 1

Field Value

byte

A WOR frame ahead of a Class A uplink.

public const byte LorawanWorUplink = 1

Field Value

byte

MavlinkAckFinal

The command finished.

public const uint MavlinkAckFinal = 3

Field Value

uint

MavlinkAckInProgress

The command is still running.

public const uint MavlinkAckInProgress = 2

Field Value

uint

MavlinkAckUnrelated

An acknowledgment was for a different command.

public const uint MavlinkAckUnrelated = 1

Field Value

uint

MavlinkDefaultTimestampWindow

The default window a verifier accepts a timestamp within.

public const ulong MavlinkDefaultTimestampWindow = 6000000

Field Value

ulong

MavlinkKeyLen

The length of a signing key, in bytes.

public const int MavlinkKeyLen = 32

Field Value

int

MavlinkMaxFrame

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

public const int MavlinkMaxFrame = 280

Field Value

int

MavlinkMaxPayload

The largest payload a frame can carry, in bytes.

public const int MavlinkMaxPayload = 255

Field Value

int

MavlinkMaxRetries

The retransmissions the mission protocol recommends before giving up.

public const byte MavlinkMaxRetries = 5

Field Value

byte

MavlinkReceiverAck

A receiver answered with the acknowledgment that ends the transfer.

public const uint MavlinkReceiverAck = 2

Field Value

uint

MavlinkReceiverRequest

A receiver answered with a request for the next item.

public const uint MavlinkReceiverRequest = 1

Field Value

uint

MavlinkSenderFinished

A sender saw the receiver's acknowledgment.

public const uint MavlinkSenderFinished = 2

Field Value

uint

MavlinkSenderReply

A sender answered with a frame to send.

public const uint MavlinkSenderReply = 1

Field Value

uint

MavlinkSignatureLen

The length of a v2 signature block, in bytes.

public const int MavlinkSignatureLen = 13

Field Value

int

MavlinkStepIgnored

The frame was not one the machine handles.

public const uint MavlinkStepIgnored = 0

Field Value

uint

MavlinkVersionV1

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

public const byte MavlinkVersionV1 = 1

Field Value

byte

MavlinkVersionV2

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

public const byte MavlinkVersionV2 = 2

Field Value

byte

MeshBroadcast

The destination address that means every node.

public const uint MeshBroadcast = 4294967295

Field Value

uint

MeshDefaultHopLimit

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

public const byte MeshDefaultHopLimit = 3

Field Value

byte

MeshFrameMax

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

public const int MeshFrameMax = 250

Field Value

int

MeshHeaderLen

How many bytes of a mesh frame are header.

public const int MeshHeaderLen = 12

Field Value

int

MeshPayloadMax

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

public const int MeshPayloadMax = 236

Field Value

int

MeshSeenDefaultCapacity

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

public const int MeshSeenDefaultCapacity = 64

Field Value

int

ModbusClientBroadcastRead

A client error kind: a read was addressed to the broadcast address.

public const byte ModbusClientBroadcastRead = 2

Field Value

byte

ModbusClientException

A client error kind: the device refused the request with an exception.

public const byte ModbusClientException = 9

Field Value

byte

ModbusClientFrame

A client error kind: the reply failed its CRC or is not the shape its function gives.

public const byte ModbusClientFrame = 5

Field Value

byte

ModbusClientMismatch

A client error kind: a well-formed reply that does not answer the request.

public const byte ModbusClientMismatch = 8

Field Value

byte

ModbusClientOk

A client error kind: the call succeeded.

public const byte ModbusClientOk = 0

Field Value

byte

ModbusClientPort

A client error kind: the serial port failed.

public const byte ModbusClientPort = 3

Field Value

byte

ModbusClientRequest

A client error kind: the request could not be built.

public const byte ModbusClientRequest = 1

Field Value

byte

ModbusClientTimeout

A client error kind: no complete reply arrived within the response timeout.

public const byte ModbusClientTimeout = 4

Field Value

byte

ModbusClientWrongFunction

A client error kind: a reply answered another function.

public const byte ModbusClientWrongFunction = 7

Field Value

byte

ModbusClientWrongUnit

A client error kind: a reply came back from another unit.

public const byte ModbusClientWrongUnit = 6

Field Value

byte

Opt3001RegisterLen

The length of a OPT3001 register.

public const int Opt3001RegisterLen = 2

Field Value

int

ParityEven

A parity bit that makes the count of ones even.

public const byte ParityEven = 1

Field Value

byte

ParityNone

No parity bit.

public const byte ParityNone = 0

Field Value

byte

ParityOdd

A parity bit that makes the count of ones odd.

public const byte ParityOdd = 2

Field Value

byte

Pca9685DefaultAddress

The address a PCA9685 answers at with its six address pins low.

public const byte Pca9685DefaultAddress = 64

Field Value

byte

Pca9685DefaultFrequencyHz

The frequency a PCA9685 driver runs at unless given another, in hertz.

public const uint Pca9685DefaultFrequencyHz = 200

Field Value

uint

Pca9685Mode1AutoIncrement

MODE1's auto-increment bit.

public const byte Pca9685Mode1AutoIncrement = 32

Field Value

byte

Pca9685Mode1Extclk

MODE1's EXTCLK bit.

public const byte Pca9685Mode1Extclk = 64

Field Value

byte

Pca9685Mode1Reset

A PCA9685's MODE1 at power-up.

public const byte Pca9685Mode1Reset = 17

Field Value

byte

Pca9685Mode1Restart

MODE1's RESTART bit.

public const byte Pca9685Mode1Restart = 128

Field Value

byte

Pca9685Mode1Sleep

MODE1's SLEEP bit.

public const byte Pca9685Mode1Sleep = 16

Field Value

byte

Pca9685Mode2Reset

A PCA9685's MODE2 at power-up.

public const byte Pca9685Mode2Reset = 4

Field Value

byte

Pca9685OscillatorStartupMicros

How long a PCA9685's oscillator takes to run once woken, in microseconds.

public const uint Pca9685OscillatorStartupMicros = 500

Field Value

uint

Pca9685PreScaleMin

The smallest value a PCA9685 loads into PRE_SCALE.

public const byte Pca9685PreScaleMin = 3

Field Value

byte

Pca9685PreScaleReset

A PCA9685's PRE_SCALE at power-up.

public const byte Pca9685PreScaleReset = 30

Field Value

byte

Pca9685RegisterAllLedOnL

The first of a PCA9685's four ALL_LED registers.

public const byte Pca9685RegisterAllLedOnL = 250

Field Value

byte

Pca9685RegisterLed0OnL

The first of a PCA9685's channel 0 registers.

public const byte Pca9685RegisterLed0OnL = 6

Field Value

byte

Pca9685RegisterMode1

A PCA9685's mode register 1.

public const byte Pca9685RegisterMode1 = 0

Field Value

byte

Pca9685RegisterMode2

A PCA9685's mode register 2.

public const byte Pca9685RegisterMode2 = 1

Field Value

byte

Pca9685RegisterPreScale

A PCA9685's prescaler.

public const byte Pca9685RegisterPreScale = 254

Field Value

byte

RoutingDefaultCapacity

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

public const int RoutingDefaultCapacity = 64

Field Value

int

Scd4xCommandLen

The length of a SCD4x command frame.

public const int Scd4xCommandLen = 2

Field Value

int

Scd4xMeasurementLen

The length of a SCD4x measurement frame.

public const int Scd4xMeasurementLen = 9

Field Value

int

Scd4xWordLen

The length of a SCD4x word and its checksum.

public const int Scd4xWordLen = 3

Field Value

int

Scd4xWriteLen

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

public const int Scd4xWriteLen = 5

Field Value

int

SerialPortDevice

A port kind: the kernel's serial device.

public const byte SerialPortDevice = 0

Field Value

byte

SerialPortLooped

A port kind: the port's own output, looped back to its input.

public const byte SerialPortLooped = 1

Field Value

byte

SerialPortPaired

A port kind: the other end of a null-modem pair.

public const byte SerialPortPaired = 2

Field Value

byte

SerialPortScripted

A port kind: a script of the writes a driver is expected to make.

public const byte SerialPortScripted = 4

Field Value

byte

SerialPortSimulated

A port kind: a simulated device that answers each write.

public const byte SerialPortSimulated = 3

Field Value

byte

SessionKeyLen

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

public const int SessionKeyLen = 32

Field Value

int

SessionTagLen

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

public const int SessionTagLen = 16

Field Value

int

Sht3xMeasurementLen

The length of a SHT3x measurement frame.

public const int Sht3xMeasurementLen = 6

Field Value

int

Sht3xWordLen

The length of a SHT3x word and its checksum.

public const int Sht3xWordLen = 3

Field Value

int

StepperDefaultPulseMicros

How long a step and direction driver holds the direction before a step pulse, and the pulse itself, unless given another, in microseconds.

public const uint StepperDefaultPulseMicros = 10

Field Value

uint

StepperDefaultStepMicros

The pause a stepper driver takes after each step unless given another, in microseconds.

public const uint StepperDefaultStepMicros = 2000

Field Value

uint

Sx126xCommandMax

The most bytes an SX126x command or command header takes.

public const int Sx126xCommandMax = 10

Field Value

int

Sx126xErrorAdcCalibration

The device error for a failed ADC calibration.

public const ushort Sx126xErrorAdcCalibration = 8

Field Value

ushort

Sx126xErrorImageCalibration

The device error for a failed image calibration.

public const ushort Sx126xErrorImageCalibration = 16

Field Value

ushort

Sx126xErrorPaRamp

The device error for a power-amplifier ramp that failed.

public const ushort Sx126xErrorPaRamp = 256

Field Value

ushort

Sx126xErrorPllCalibration

The device error for a failed PLL calibration.

public const ushort Sx126xErrorPllCalibration = 4

Field Value

ushort

Sx126xErrorPllLock

The device error for a PLL that failed to lock.

public const ushort Sx126xErrorPllLock = 64

Field Value

ushort

Sx126xErrorRc13mCalibration

The device error for a failed RC13M calibration.

public const ushort Sx126xErrorRc13mCalibration = 2

Field Value

ushort

Sx126xErrorRc64kCalibration

The device error for a failed RC64k calibration.

public const ushort Sx126xErrorRc64kCalibration = 1

Field Value

ushort

Sx126xErrorXoscStart

The device error for a crystal oscillator that failed to start.

public const ushort Sx126xErrorXoscStart = 32

Field Value

ushort

Sx126xIrqAll

Every interrupt the chip defines.

public const ushort Sx126xIrqAll = 17407

Field Value

ushort

Sx126xIrqCadDetected

The interrupt raised when channel activity detection hears a signal.

public const ushort Sx126xIrqCadDetected = 256

Field Value

ushort

Sx126xIrqCadDone

The interrupt raised when channel activity detection finishes.

public const ushort Sx126xIrqCadDone = 128

Field Value

ushort

Sx126xIrqCrcError

The interrupt raised when a received payload fails its CRC.

public const ushort Sx126xIrqCrcError = 64

Field Value

ushort

Sx126xIrqHeaderError

The interrupt raised when a LoRa header fails its CRC.

public const ushort Sx126xIrqHeaderError = 32

Field Value

ushort

Sx126xIrqHeaderValid

The interrupt raised when a valid LoRa header is received.

public const ushort Sx126xIrqHeaderValid = 16

Field Value

ushort

Sx126xIrqLrFhssHop

The interrupt raised on an LR-FHSS frequency hop.

public const ushort Sx126xIrqLrFhssHop = 16384

Field Value

ushort

Sx126xIrqPreambleDetected

The interrupt raised when a preamble is detected.

public const ushort Sx126xIrqPreambleDetected = 4

Field Value

ushort

Sx126xIrqRxDone

The interrupt raised when a frame has been received.

public const ushort Sx126xIrqRxDone = 2

Field Value

ushort

Sx126xIrqSyncWordValid

The interrupt raised when a valid sync word is detected.

public const ushort Sx126xIrqSyncWordValid = 8

Field Value

ushort

Sx126xIrqTimeout

The interrupt raised when a transmit or receive timeout expires.

public const ushort Sx126xIrqTimeout = 512

Field Value

ushort

Sx126xIrqTxDone

The interrupt raised when a frame has been sent.

public const ushort Sx126xIrqTxDone = 1

Field Value

ushort

Sx126xRegisterLoraSyncWord

The register the two bytes of the LoRa sync word are written to.

public const ushort Sx126xRegisterLoraSyncWord = 1856

Field Value

ushort

Sx126xRxContinuous

The SetRx timeout that keeps the receiver listening until told otherwise.

public const uint Sx126xRxContinuous = 16777215

Field Value

uint

Sx126xSyncWordPrivate

The LoRa sync word private networks use.

public const ushort Sx126xSyncWordPrivate = 5156

Field Value

ushort

Sx126xSyncWordPublic

The LoRa sync word public LoRaWAN networks use.

public const ushort Sx126xSyncWordPublic = 13380

Field Value

ushort

Sx127xDio0CadDone

RegDioMapping1 with DIO0 signaling CadDone.

public const byte Sx127xDio0CadDone = 128

Field Value

byte

Sx127xDio0RxDone

RegDioMapping1 with DIO0 signaling RxDone.

public const byte Sx127xDio0RxDone = 0

Field Value

byte

Sx127xDio0TxDone

RegDioMapping1 with DIO0 signaling TxDone.

public const byte Sx127xDio0TxDone = 64

Field Value

byte

Sx127xImageCalRunning

The RegImageCal bit set while a calibration runs.

public const byte Sx127xImageCalRunning = 32

Field Value

byte

Sx127xImageCalStart

The RegImageCal bit that starts a calibration.

public const byte Sx127xImageCalStart = 64

Field Value

byte

Sx127xIrqAll

The SX127x interrupt flag 0xFF.

public const byte Sx127xIrqAll = 255

Field Value

byte

Sx127xIrqCadDetected

The SX127x interrupt flag 0x01.

public const byte Sx127xIrqCadDetected = 1

Field Value

byte

Sx127xIrqCadDone

The SX127x interrupt flag 0x04.

public const byte Sx127xIrqCadDone = 4

Field Value

byte

Sx127xIrqFhssChangeChannel

The SX127x interrupt flag 0x02.

public const byte Sx127xIrqFhssChangeChannel = 2

Field Value

byte

Sx127xIrqPayloadCrcError

The SX127x interrupt flag 0x20.

public const byte Sx127xIrqPayloadCrcError = 32

Field Value

byte

Sx127xIrqRxDone

The SX127x interrupt flag 0x40.

public const byte Sx127xIrqRxDone = 64

Field Value

byte

Sx127xIrqRxTimeout

The SX127x interrupt flag 0x80.

public const byte Sx127xIrqRxTimeout = 128

Field Value

byte

Sx127xIrqTxDone

The SX127x interrupt flag 0x08.

public const byte Sx127xIrqTxDone = 8

Field Value

byte

Sx127xIrqValidHeader

The SX127x interrupt flag 0x10.

public const byte Sx127xIrqValidHeader = 16

Field Value

byte

Sx127xLnaBoosted

RegLna with maximum gain and the high frequency LNA boost.

public const byte Sx127xLnaBoosted = 35

Field Value

byte

Sx127xModeCad

The SX127x operating mode code 7.

public const byte Sx127xModeCad = 7

Field Value

byte

Sx127xModeFsRx

The SX127x operating mode code 4.

public const byte Sx127xModeFsRx = 4

Field Value

byte

Sx127xModeFsTx

The SX127x operating mode code 2.

public const byte Sx127xModeFsTx = 2

Field Value

byte

Sx127xModeRxContinuous

The SX127x operating mode code 5.

public const byte Sx127xModeRxContinuous = 5

Field Value

byte

Sx127xModeRxSingle

The SX127x operating mode code 6.

public const byte Sx127xModeRxSingle = 6

Field Value

byte

Sx127xModeSleep

The SX127x operating mode code 0.

public const byte Sx127xModeSleep = 0

Field Value

byte

Sx127xModeStandby

The SX127x operating mode code 1.

public const byte Sx127xModeStandby = 1

Field Value

byte

Sx127xModeTx

The SX127x operating mode code 3.

public const byte Sx127xModeTx = 3

Field Value

byte

Sx127xPaDacDefault

RegPaDac at its reset value.

public const byte Sx127xPaDacDefault = 132

Field Value

byte

Sx127xPaDacHighPower

RegPaDac with the +20 dBm setting on PA_BOOST.

public const byte Sx127xPaDacHighPower = 135

Field Value

byte

Sx127xRegDetectOptimize

The SX127x register at 0x31.

public const byte Sx127xRegDetectOptimize = 49

Field Value

byte

Sx127xRegDetectionThreshold

The SX127x register at 0x37.

public const byte Sx127xRegDetectionThreshold = 55

Field Value

byte

Sx127xRegDioMapping1

The SX127x register at 0x40.

public const byte Sx127xRegDioMapping1 = 64

Field Value

byte

Sx127xRegDioMapping2

The SX127x register at 0x41.

public const byte Sx127xRegDioMapping2 = 65

Field Value

byte

Sx127xRegFifo

The SX127x register at 0x00.

public const byte Sx127xRegFifo = 0

Field Value

byte

Sx127xRegFifoAddrPtr

The SX127x register at 0x0D.

public const byte Sx127xRegFifoAddrPtr = 13

Field Value

byte

Sx127xRegFifoRxBaseAddr

The SX127x register at 0x0F.

public const byte Sx127xRegFifoRxBaseAddr = 15

Field Value

byte

Sx127xRegFifoRxCurrentAddr

The SX127x register at 0x10.

public const byte Sx127xRegFifoRxCurrentAddr = 16

Field Value

byte

Sx127xRegFifoTxBaseAddr

The SX127x register at 0x0E.

public const byte Sx127xRegFifoTxBaseAddr = 14

Field Value

byte

Sx127xRegFrfLsb

The SX127x register at 0x08.

public const byte Sx127xRegFrfLsb = 8

Field Value

byte

Sx127xRegFrfMid

The SX127x register at 0x07.

public const byte Sx127xRegFrfMid = 7

Field Value

byte

Sx127xRegFrfMsb

The SX127x register at 0x06.

public const byte Sx127xRegFrfMsb = 6

Field Value

byte

Sx127xRegHighBwOptimize1

The SX127x register at 0x36.

public const byte Sx127xRegHighBwOptimize1 = 54

Field Value

byte

Sx127xRegHighBwOptimize2

The SX127x register at 0x3A.

public const byte Sx127xRegHighBwOptimize2 = 58

Field Value

byte

Sx127xRegHopChannel

The SX127x register at 0x1C.

public const byte Sx127xRegHopChannel = 28

Field Value

byte

Sx127xRegIfFreq1

The SX127x register at 0x30.

public const byte Sx127xRegIfFreq1 = 48

Field Value

byte

Sx127xRegIfFreq2

The SX127x register at 0x2F.

public const byte Sx127xRegIfFreq2 = 47

Field Value

byte

Sx127xRegImageCal

The SX127x register at 0x3B.

public const byte Sx127xRegImageCal = 59

Field Value

byte

Sx127xRegInvertIq

The SX127x register at 0x33.

public const byte Sx127xRegInvertIq = 51

Field Value

byte

Sx127xRegInvertIq2

The SX127x register at 0x3B.

public const byte Sx127xRegInvertIq2 = 59

Field Value

byte

Sx127xRegIrqFlags

The SX127x register at 0x12.

public const byte Sx127xRegIrqFlags = 18

Field Value

byte

Sx127xRegIrqFlagsMask

The SX127x register at 0x11.

public const byte Sx127xRegIrqFlagsMask = 17

Field Value

byte

Sx127xRegLna

The SX127x register at 0x0C.

public const byte Sx127xRegLna = 12

Field Value

byte

Sx127xRegMaxPayloadLength

The SX127x register at 0x23.

public const byte Sx127xRegMaxPayloadLength = 35

Field Value

byte

Sx127xRegModemConfig1

The SX127x register at 0x1D.

public const byte Sx127xRegModemConfig1 = 29

Field Value

byte

Sx127xRegModemConfig2

The SX127x register at 0x1E.

public const byte Sx127xRegModemConfig2 = 30

Field Value

byte

Sx127xRegModemConfig3

The SX127x register at 0x26.

public const byte Sx127xRegModemConfig3 = 38

Field Value

byte

Sx127xRegModemStat

The SX127x register at 0x18.

public const byte Sx127xRegModemStat = 24

Field Value

byte

Sx127xRegOcp

The SX127x register at 0x0B.

public const byte Sx127xRegOcp = 11

Field Value

byte

Sx127xRegOpMode

The SX127x register at 0x01.

public const byte Sx127xRegOpMode = 1

Field Value

byte

Sx127xRegPaConfig

The SX127x register at 0x09.

public const byte Sx127xRegPaConfig = 9

Field Value

byte

Sx127xRegPaDac

The SX127x register at 0x4D.

public const byte Sx127xRegPaDac = 77

Field Value

byte

Sx127xRegPaRamp

The SX127x register at 0x0A.

public const byte Sx127xRegPaRamp = 10

Field Value

byte

Sx127xRegPayloadLength

The SX127x register at 0x22.

public const byte Sx127xRegPayloadLength = 34

Field Value

byte

Sx127xRegPktRssiValue

The SX127x register at 0x1A.

public const byte Sx127xRegPktRssiValue = 26

Field Value

byte

Sx127xRegPktSnrValue

The SX127x register at 0x19.

public const byte Sx127xRegPktSnrValue = 25

Field Value

byte

Sx127xRegPreambleLsb

The SX127x register at 0x21.

public const byte Sx127xRegPreambleLsb = 33

Field Value

byte

Sx127xRegPreambleMsb

The SX127x register at 0x20.

public const byte Sx127xRegPreambleMsb = 32

Field Value

byte

Sx127xRegRssiValue

The SX127x register at 0x1B.

public const byte Sx127xRegRssiValue = 27

Field Value

byte

Sx127xRegRssiWideband

The SX127x register at 0x2C.

public const byte Sx127xRegRssiWideband = 44

Field Value

byte

Sx127xRegRxNbBytes

The SX127x register at 0x13.

public const byte Sx127xRegRxNbBytes = 19

Field Value

byte

Sx127xRegSymbTimeoutLsb

The SX127x register at 0x1F.

public const byte Sx127xRegSymbTimeoutLsb = 31

Field Value

byte

Sx127xRegSyncWord

The SX127x register at 0x39.

public const byte Sx127xRegSyncWord = 57

Field Value

byte

Sx127xRegTcxo

The SX127x register at 0x4B.

public const byte Sx127xRegTcxo = 75

Field Value

byte

Sx127xRegVersion

The SX127x register at 0x42.

public const byte Sx127xRegVersion = 66

Field Value

byte

Sx127xSyncWordPrivate

The SX127x private sync word, and the chip's reset value.

public const byte Sx127xSyncWordPrivate = 18

Field Value

byte

Sx127xSyncWordPublic

The SX127x sync word reserved for LoRaWAN.

public const byte Sx127xSyncWordPublic = 52

Field Value

byte

Sx127xTcxoInputOn

RegTcxo for a module clocked by a TCXO.

public const byte Sx127xTcxoInputOn = 25

Field Value

byte

Sx127xVersion

The RegVersion value of an SX1276, SX1277, SX1278, or SX1279.

public const byte Sx127xVersion = 18

Field Value

byte

Sx127xWrite

The bit of an SX127x address byte that makes an access a write.

public const byte Sx127xWrite = 128

Field Value

byte

Tmp117RegisterLen

The length of a TMP117 register.

public const int Tmp117RegisterLen = 2

Field Value

int

UpdateBlockHeaderLength

The bytes a block carrying a signed update puts in front of it.

public const int UpdateBlockHeaderLength = 6

Field Value

int

UpdateFormatRaw

The payload format meaning the payload is the image itself.

public const byte UpdateFormatRaw = 1

Field Value

byte

UpdateStructureVersion

The manifest structure version this build writes.

public const byte UpdateStructureVersion = 1

Field Value

byte

WindowCapacity

The most readings a windowed helper keeps, and the number it keeps unless told fewer.

public const int WindowCapacity = 32

Field Value

int

Methods

pamoja_ackermann_curvature(PamojaAckermann, float)

Returns the path curvature of a steering angle.

public static extern float pamoja_ackermann_curvature(PamojaAckermann car, float steering)

Parameters

car PamojaAckermann
steering float

Returns

float

pamoja_ackermann_steering_angle(PamojaAckermann, float, float)

Returns the steering angle for a forward speed and a yaw rate.

public static extern float pamoja_ackermann_steering_angle(PamojaAckermann car, float linear, float angular)

Parameters

car PamojaAckermann
linear float
angular float

Returns

float

pamoja_ackermann_turn_radius(PamojaAckermann, float)

Returns the turn radius of a steering angle, infinity with the wheels straight.

public static extern float pamoja_ackermann_turn_radius(PamojaAckermann car, float steering)

Parameters

car PamojaAckermann
steering float

Returns

float

pamoja_ackermann_yaw_rate(PamojaAckermann, float, float)

Returns the yaw rate a forward speed and a steering angle produce.

public static extern float pamoja_ackermann_yaw_rate(PamojaAckermann car, float linear, float steering)

Parameters

car PamojaAckermann
linear float
steering float

Returns

float

pamoja_ads1115_config(nint, out PamojaAds1115Config)

Copies the configuration an ADS1115 driver writes.

public static PamojaStatus pamoja_ads1115_config(nint sensor, out PamojaAds1115Config outConfig)

Parameters

sensor nint
outConfig PamojaAds1115Config

Returns

PamojaStatus

pamoja_ads1115_config_bits(PamojaAds1115Config)

Assembles the 16-bit ADS1115 configuration register value.

public static extern ushort pamoja_ads1115_config_bits(PamojaAds1115Config config)

Parameters

config PamojaAds1115Config

Returns

ushort

pamoja_ads1115_config_from_bits(ushort, out PamojaAds1115Config)

Parses a 16-bit ADS1115 configuration register value.

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

Parameters

bits ushort
outConfig PamojaAds1115Config

Returns

PamojaStatus

pamoja_ads1115_conversion_micros(byte)

Returns how long an ADS1115 conversion takes at a data-rate code, in microseconds.

public static extern uint pamoja_ads1115_conversion_micros(byte dataRate)

Parameters

dataRate byte

Returns

uint

pamoja_ads1115_free(nint)

Releases an ADS1115 driver. Passing null is a no-op.

public static extern void pamoja_ads1115_free(nint sensor)

Parameters

sensor nint

pamoja_ads1115_full_scale_microvolts(byte)

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

public static extern uint pamoja_ads1115_full_scale_microvolts(byte pga)

Parameters

pga byte

Returns

uint

pamoja_ads1115_init(nint)

Configures an ADS1115 and reads the configuration back.

public static extern PamojaStatus pamoja_ads1115_init(nint sensor)

Parameters

sensor nint

Returns

PamojaStatus

pamoja_ads1115_new(nint, byte, PamojaAds1115Settings, out nint)

Creates an ADS1115 driver on a bus.

public static PamojaStatus pamoja_ads1115_new(nint bus, byte address, PamojaAds1115Settings settings, out nint outSensor)

Parameters

bus nint
address byte
settings PamojaAds1115Settings
outSensor nint

Returns

PamojaStatus

pamoja_ads1115_sample(nint, out PamojaAds1115Sample)

Runs one ADS1115 conversion of the configured input.

public static PamojaStatus pamoja_ads1115_sample(nint sensor, out PamojaAds1115Sample outSample)

Parameters

sensor nint
outSample PamojaAds1115Sample

Returns

PamojaStatus

pamoja_ads1115_sample_input(nint, byte, out PamojaAds1115Sample)

Runs one ADS1115 conversion of another input.

public static PamojaStatus pamoja_ads1115_sample_input(nint sensor, byte mux, out PamojaAds1115Sample outSample)

Parameters

sensor nint
mux byte
outSample PamojaAds1115Sample

Returns

PamojaStatus

pamoja_ads1115_samples_per_second(byte)

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

public static extern ushort pamoja_ads1115_samples_per_second(byte dataRate)

Parameters

dataRate byte

Returns

ushort

pamoja_ads1115_settings_default()

Returns the settings an ADS1115 driver starts with.

public static extern PamojaAds1115Settings pamoja_ads1115_settings_default()

Returns

PamojaAds1115Settings

pamoja_ads1115_sim_part(byte)

Creates a simulated ADS1115 reading its default voltage.

public static extern nint pamoja_ads1115_sim_part(byte address)

Parameters

address byte

Returns

nint

pamoja_ads1115_sim_reporting(byte, byte, float)

Creates a simulated ADS1115 that reads what it is asked to.

public static extern nint pamoja_ads1115_sim_reporting(byte address, byte pga, float volts)

Parameters

address byte
pga byte
volts float

Returns

nint

pamoja_ads1115_to_nanovolts(byte, short)

Converts a raw ADS1115 conversion result to nanovolts.

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

Parameters

pga byte
raw short

Returns

long

pamoja_ads1115_to_volts(byte, short)

Converts a raw ADS1115 conversion result to volts.

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

Parameters

pga byte
raw short

Returns

float

pamoja_agreement_key_free(nint)

Releases an agreement key handle.

public static extern void pamoja_agreement_key_free(nint key)

Parameters

key nint

pamoja_agreement_key_from_seed(ReadOnlySpan<byte>, nuint)

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

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

Parameters

seed ReadOnlySpan<byte>
seedLen nuint

Returns

nint

pamoja_agreement_key_public(nint, Span<byte>)

Copies out the public key to hand to a peer.

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

Parameters

key nint
outPublicKey Span<byte>

Returns

PamojaStatus

pamoja_anomaly_capacity(nint)

Returns how many readings an anomaly detector's baseline keeps.

public static extern nuint pamoja_anomaly_capacity(nint anomaly)

Parameters

anomaly nint

Returns

nuint

pamoja_anomaly_check(nint, float)

Folds a reading in and reports whether it stands out.

public static bool pamoja_anomaly_check(nint anomaly, float reading)

Parameters

anomaly nint
reading float

Returns

bool

pamoja_anomaly_free(nint)

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

public static extern void pamoja_anomaly_free(nint anomaly)

Parameters

anomaly nint

pamoja_anomaly_new(float)

Creates an anomaly detector at a deviation threshold.

public static extern nint pamoja_anomaly_new(float sigmas)

Parameters

sigmas float

Returns

nint

pamoja_anomaly_with_capacity(float, nuint)

Creates an anomaly detector whose baseline keeps up to a capacity, or null for one out of range.

public static extern nint pamoja_anomaly_with_capacity(float sigmas, nuint capacity)

Parameters

sigmas float
capacity nuint

Returns

nint

pamoja_audit_entry_digest(nint, Span<byte>)

Copies out the hash of this entry.

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

Parameters

entry nint
outDigest Span<byte>

Returns

PamojaStatus

pamoja_audit_entry_free(nint)

Releases an entry handle.

public static extern void pamoja_audit_entry_free(nint entry)

Parameters

entry nint

pamoja_audit_entry_from_bytes(ReadOnlySpan<byte>, nuint)

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

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

Parameters

bytes ReadOnlySpan<byte>
len nuint

Returns

nint

pamoja_audit_entry_index(nint)

Returns the position of an entry in its chain.

public static extern ulong pamoja_audit_entry_index(nint entry)

Parameters

entry nint

Returns

ulong

pamoja_audit_entry_payload(nint)

Copies out the record an entry carries.

public static extern nint pamoja_audit_entry_payload(nint entry)

Parameters

entry nint

Returns

nint

pamoja_audit_entry_previous(nint, Span<byte>)

Copies out the hash of the entry before this one.

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

Parameters

entry nint
outPrevious Span<byte>

Returns

PamojaStatus

pamoja_audit_entry_signature(nint, Span<byte>)

Copies out the signature over an entry.

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

Parameters

entry nint
outSignature Span<byte>

Returns

PamojaStatus

pamoja_audit_entry_to_bytes(nint)

Encodes an entry for storage or transmission.

public static extern nint pamoja_audit_entry_to_bytes(nint entry)

Parameters

entry nint

Returns

nint

pamoja_audit_log_append(nint, ReadOnlySpan<byte>, nuint)

Appends a payload, signing and chaining it.

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

Parameters

log nint
payload ReadOnlySpan<byte>
payloadLen nuint

Returns

nint

pamoja_audit_log_free(nint)

Releases a log handle.

public static extern void pamoja_audit_log_free(nint log)

Parameters

log nint

pamoja_audit_log_new(nint)

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

public static extern nint pamoja_audit_log_new(nint identity)

Parameters

identity nint

Returns

nint

pamoja_audit_log_resume(nint, nint)

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

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

Parameters

identity nint
last nint

Returns

nint

pamoja_audit_verifier_check(nint, nint)

Checks the next entry of a chain.

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

Parameters

verifier nint
entry nint

Returns

PamojaStatus

pamoja_audit_verifier_free(nint)

Releases a verifier handle.

public static extern void pamoja_audit_verifier_free(nint verifier)

Parameters

verifier nint

pamoja_audit_verifier_new(ReadOnlySpan<byte>)

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

public static nint pamoja_audit_verifier_new(ReadOnlySpan<byte> publicKey)

Parameters

publicKey ReadOnlySpan<byte>

Returns

nint

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

Checks a whole chain that has already arrived.

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

Parameters

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

Returns

PamojaStatus

pamoja_bme280_calibration_free(nint)

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

public static extern void pamoja_bme280_calibration_free(nint calibration)

Parameters

calibration nint

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

Builds a BME280 calibration from its register bytes.

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

Parameters

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

Returns

PamojaStatus

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

Turns a BME280 burst read into a compensated reading.

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

Parameters

calibration nint
measurement ReadOnlySpan<byte>
measurementLen nuint
outMeasurement PamojaBme280Measurement

Returns

PamojaStatus

pamoja_bme280_config_bits(PamojaBme280Config)

Assembles a BME280 config register value.

public static extern byte pamoja_bme280_config_bits(PamojaBme280Config config)

Parameters

config PamojaBme280Config

Returns

byte

pamoja_bme280_config_from_bits(byte, out PamojaBme280Config)

Parses a BME280 config register value.

public static PamojaStatus pamoja_bme280_config_from_bits(byte bits, out PamojaBme280Config outConfig)

Parameters

bits byte
outConfig PamojaBme280Config

Returns

PamojaStatus

pamoja_bme280_ctrl_hum_bits(byte)

Assembles a BME280 ctrl_hum register value from a humidity oversampling code.

public static extern byte pamoja_bme280_ctrl_hum_bits(byte humidity)

Parameters

humidity byte

Returns

byte

pamoja_bme280_ctrl_hum_from_bits(byte)

Parses a BME280 ctrl_hum register value into its humidity oversampling code.

public static extern byte pamoja_bme280_ctrl_hum_from_bits(byte bits)

Parameters

bits byte

Returns

byte

pamoja_bme280_ctrl_meas_bits(PamojaBme280CtrlMeas)

Assembles a BME280 ctrl_meas register value.

public static extern byte pamoja_bme280_ctrl_meas_bits(PamojaBme280CtrlMeas config)

Parameters

config PamojaBme280CtrlMeas

Returns

byte

pamoja_bme280_ctrl_meas_from_bits(byte, out PamojaBme280CtrlMeas)

Parses a BME280 ctrl_meas register value.

public static PamojaStatus pamoja_bme280_ctrl_meas_from_bits(byte bits, out PamojaBme280CtrlMeas outConfig)

Parameters

bits byte
outConfig PamojaBme280CtrlMeas

Returns

PamojaStatus

pamoja_bme280_filter_coefficient(byte)

Returns the IIR filter coefficient a BME280 code selects.

public static extern byte pamoja_bme280_filter_coefficient(byte code)

Parameters

code byte

Returns

byte

pamoja_bme280_free(nint)

Releases a BME280 driver. Passing null is a no-op.

public static extern void pamoja_bme280_free(nint sensor)

Parameters

sensor nint

pamoja_bme280_image_updating(byte)

Reports whether a BME280 status byte says the calibration image is loading.

public static bool pamoja_bme280_image_updating(byte status)

Parameters

status byte

Returns

bool

pamoja_bme280_init(nint)

Resets, identifies, calibrates, and configures a BME280.

public static extern PamojaStatus pamoja_bme280_init(nint sensor)

Parameters

sensor nint

Returns

PamojaStatus

pamoja_bme280_max_measurement_micros(byte, byte, byte)

Returns the longest one BME280 measurement can take, in microseconds.

public static extern uint pamoja_bme280_max_measurement_micros(byte temperature, byte pressure, byte humidity)

Parameters

temperature byte
pressure byte
humidity byte

Returns

uint

pamoja_bme280_measure(nint, out PamojaBme280Measurement)

Runs one forced BME280 measurement and compensates it.

public static PamojaStatus pamoja_bme280_measure(nint sensor, out PamojaBme280Measurement outMeasurement)

Parameters

sensor nint
outMeasurement PamojaBme280Measurement

Returns

PamojaStatus

pamoja_bme280_measuring(byte)

Reports whether a BME280 status byte says a conversion is running.

public static bool pamoja_bme280_measuring(byte status)

Parameters

status byte

Returns

bool

pamoja_bme280_new(nint, byte, PamojaBme280Settings, out nint)

Creates a BME280 driver on a bus.

public static PamojaStatus pamoja_bme280_new(nint bus, byte address, PamojaBme280Settings settings, out nint outSensor)

Parameters

bus nint
address byte
settings PamojaBme280Settings
outSensor nint

Returns

PamojaStatus

pamoja_bme280_oversampling_factor(byte)

Returns how many samples a BME280 oversampling code averages.

public static extern byte pamoja_bme280_oversampling_factor(byte code)

Parameters

code byte

Returns

byte

pamoja_bme280_settings_default()

Returns the settings a BME280 driver starts with.

public static extern PamojaBme280Settings pamoja_bme280_settings_default()

Returns

PamojaBme280Settings

pamoja_bme280_sim_burst(Span<byte>)

Copies the one measurement a simulated BME280 holds.

public static PamojaStatus pamoja_bme280_sim_burst(Span<byte> outBurst)

Parameters

outBurst Span<byte>

Returns

PamojaStatus

pamoja_bme280_sim_burst_for(float, float, float, Span<byte>)

Builds the data registers a simulated BME280 holds for a reading.

public static PamojaStatus pamoja_bme280_sim_burst_for(float celsius, float hectopascals, float relativeHumidity, Span<byte> outBurst)

Parameters

celsius float
hectopascals float
relativeHumidity float
outBurst Span<byte>

Returns

PamojaStatus

pamoja_bme280_sim_calibration(Span<byte>, Span<byte>)

Copies the calibration a simulated BME280 holds.

public static PamojaStatus pamoja_bme280_sim_calibration(Span<byte> outTempPress, Span<byte> outHumidity)

Parameters

outTempPress Span<byte>
outHumidity Span<byte>

Returns

PamojaStatus

pamoja_bme280_sim_part(byte)

Creates a simulated BME280 holding a real part's calibration and measurement.

public static extern nint pamoja_bme280_sim_part(byte address)

Parameters

address byte

Returns

nint

pamoja_bme280_sim_reporting(byte, float, float, float)

Creates a simulated BME280 that reads what it is asked to.

public static extern nint pamoja_bme280_sim_reporting(byte address, float celsius, float hectopascals, float relativeHumidity)

Parameters

address byte
celsius float
hectopascals float
relativeHumidity float

Returns

nint

pamoja_bme280_standby_micros(byte)

Returns the normal-mode standby period a BME280 code selects, in microseconds.

public static extern uint pamoja_bme280_standby_micros(byte code)

Parameters

code byte

Returns

uint

pamoja_bme280_typical_measurement_micros(byte, byte, byte)

Returns the typical time one BME280 measurement takes, in microseconds.

public static extern uint pamoja_bme280_typical_measurement_micros(byte temperature, byte pressure, byte humidity)

Parameters

temperature byte
pressure byte
humidity byte

Returns

uint

pamoja_bmp280_calibration_coefficients(nint, out PamojaBmp280Coefficients)

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

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

Parameters

calibration nint
outCoefficients PamojaBmp280Coefficients

Returns

PamojaStatus

pamoja_bmp280_calibration_free(nint)

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

public static extern void pamoja_bmp280_calibration_free(nint calibration)

Parameters

calibration nint

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

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

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

Parameters

bytes ReadOnlySpan<byte>
bytesLen nuint
outCalibration nint

Returns

PamojaStatus

pamoja_bmp280_calibration_to_bytes(nint, Span<byte>)

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

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

Parameters

calibration nint
outBytes Span<byte>

Returns

PamojaStatus

pamoja_bmp280_coefficients(nint, out PamojaBmp280Coefficients)

Copies the trimming coefficients a BMP280 driver read at initialization.

public static bool pamoja_bmp280_coefficients(nint sensor, out PamojaBmp280Coefficients outCoefficients)

Parameters

sensor nint
outCoefficients PamojaBmp280Coefficients

Returns

bool

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

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

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

Parameters

calibration nint
measurement ReadOnlySpan<byte>
measurementLen nuint
outReading PamojaBmp280Reading

Returns

PamojaStatus

pamoja_bmp280_config_bits(PamojaBmp280Config)

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

public static extern byte pamoja_bmp280_config_bits(PamojaBmp280Config config)

Parameters

config PamojaBmp280Config

Returns

byte

pamoja_bmp280_config_from_bits(byte, out PamojaBmp280Config)

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

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

Parameters

bits byte
outConfig PamojaBmp280Config

Returns

PamojaStatus

pamoja_bmp280_ctrl_meas_bits(PamojaBmp280CtrlMeas)

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

public static extern byte pamoja_bmp280_ctrl_meas_bits(PamojaBmp280CtrlMeas config)

Parameters

config PamojaBmp280CtrlMeas

Returns

byte

pamoja_bmp280_ctrl_meas_from_bits(byte, out PamojaBmp280CtrlMeas)

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

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

Parameters

bits byte
outConfig PamojaBmp280CtrlMeas

Returns

PamojaStatus

pamoja_bmp280_free(nint)

Releases a BMP280 driver. Passing null is a no-op.

public static extern void pamoja_bmp280_free(nint sensor)

Parameters

sensor nint

pamoja_bmp280_image_updating(byte)

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

public static bool pamoja_bmp280_image_updating(byte status)

Parameters

status byte

Returns

bool

pamoja_bmp280_init(nint)

Resets, identifies, and configures a BMP280.

public static extern PamojaStatus pamoja_bmp280_init(nint sensor)

Parameters

sensor nint

Returns

PamojaStatus

pamoja_bmp280_measure(nint, out PamojaBmp280Reading)

Runs one forced BMP280 measurement and compensates it.

public static PamojaStatus pamoja_bmp280_measure(nint sensor, out PamojaBmp280Reading outReading)

Parameters

sensor nint
outReading PamojaBmp280Reading

Returns

PamojaStatus

pamoja_bmp280_measurement_bytes(uint, uint, Span<byte>)

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

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

Parameters

pressure uint
temperature uint
outBytes Span<byte>

Returns

PamojaStatus

pamoja_bmp280_measuring(byte)

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

public static bool pamoja_bmp280_measuring(byte status)

Parameters

status byte

Returns

bool

pamoja_bmp280_new(nint, byte, PamojaBmp280Settings, out nint)

Creates a BMP280 driver on a bus.

public static PamojaStatus pamoja_bmp280_new(nint bus, byte address, PamojaBmp280Settings settings, out nint outSensor)

Parameters

bus nint
address byte
settings PamojaBmp280Settings
outSensor nint

Returns

PamojaStatus

pamoja_bmp280_oversampling_factor(byte)

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

public static extern byte pamoja_bmp280_oversampling_factor(byte code)

Parameters

code byte

Returns

byte

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

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

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

Parameters

data ReadOnlySpan<byte>
dataLen nuint
outMeasurement PamojaBmp280Measurement

Returns

PamojaStatus

pamoja_bmp280_settings_default()

Returns the settings a BMP280 driver starts with.

public static extern PamojaBmp280Settings pamoja_bmp280_settings_default()

Returns

PamojaBmp280Settings

pamoja_bmp280_sim_burst(Span<byte>)

Copies the six data registers a simulated BMP280 holds.

public static PamojaStatus pamoja_bmp280_sim_burst(Span<byte> outBurst)

Parameters

outBurst Span<byte>

Returns

PamojaStatus

pamoja_bmp280_sim_burst_for(float, float, Span<byte>)

Builds the six data registers a simulated BMP280 holds for a reading.

public static PamojaStatus pamoja_bmp280_sim_burst_for(float celsius, float hectopascals, Span<byte> outBurst)

Parameters

celsius float
hectopascals float
outBurst Span<byte>

Returns

PamojaStatus

pamoja_bmp280_sim_calibration(Span<byte>)

Copies the 24 trimming bytes a simulated BMP280 holds.

public static PamojaStatus pamoja_bmp280_sim_calibration(Span<byte> outCalibration)

Parameters

outCalibration Span<byte>

Returns

PamojaStatus

pamoja_bmp280_sim_part(byte)

Creates a simulated BMP280 holding a real part's trimming and measurement.

public static extern nint pamoja_bmp280_sim_part(byte address)

Parameters

address byte

Returns

nint

pamoja_bmp280_sim_reporting(byte, float, float)

Creates a simulated BMP280 that reads what it is asked to.

public static extern nint pamoja_bmp280_sim_reporting(byte address, float celsius, float hectopascals)

Parameters

address byte
celsius float
hectopascals float

Returns

nint

pamoja_bmp280_standby_micros(byte)

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

public static extern uint pamoja_bmp280_standby_micros(byte code)

Parameters

code byte

Returns

uint

pamoja_buffer_data(nint)

Returns a pointer to a byte buffer's contents.

public static extern nint pamoja_buffer_data(nint buffer)

Parameters

buffer nint

Returns

nint

pamoja_buffer_free(nint)

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

public static extern void pamoja_buffer_free(nint buffer)

Parameters

buffer nint

pamoja_buffer_len(nint)

Returns the length in bytes of a byte buffer.

public static extern nuint pamoja_buffer_len(nint buffer)

Parameters

buffer nint

Returns

nuint

pamoja_calibration_apply(nint, float)

Converts a raw reading into calibrated units.

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

Parameters

calibration nint
raw float

Returns

float

pamoja_calibration_free(nint)

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

public static extern void pamoja_calibration_free(nint calibration)

Parameters

calibration nint

pamoja_calibration_linear(float, float)

Creates a linear calibration.

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

Parameters

scale float
offset float

Returns

nint

pamoja_calibration_two_point(float, float, float, float)

Creates a calibration fitted through two reference points.

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

Parameters

rawLow float
valueLow float
rawHigh float
valueHigh float

Returns

nint

pamoja_can_bus_clear_filters(nint)

Keeps every frame again.

public static extern PamojaStatus pamoja_can_bus_clear_filters(nint bus)

Parameters

bus nint

Returns

PamojaStatus

pamoja_can_bus_free(nint)

Releases a node; it leaves the bus. Passing null is a no-op.

public static extern void pamoja_can_bus_free(nint bus)

Parameters

bus nint

pamoja_can_bus_join(nint, out nint)

Puts another node on the same bus.

public static PamojaStatus pamoja_can_bus_join(nint bus, out nint outBus)

Parameters

bus nint
outBus nint

Returns

PamojaStatus

pamoja_can_bus_kind(nint)

Returns what a node's bus is.

public static extern byte pamoja_can_bus_kind(nint bus)

Parameters

bus nint

Returns

byte

pamoja_can_bus_open(string, out nint)

Opens a kernel CAN interface through SocketCAN.

public static PamojaStatus pamoja_can_bus_open(string interfaceName, out nint outBus)

Parameters

interfaceName string
outBus nint

Returns

PamojaStatus

pamoja_can_bus_receive(nint, ulong, out nint)

Takes the next frame the node keeps, leaving the handle null on a timeout.

public static PamojaStatus pamoja_can_bus_receive(nint bus, ulong timeoutMicros, out nint outFrame)

Parameters

bus nint
timeoutMicros ulong
outFrame nint

Returns

PamojaStatus

pamoja_can_bus_received(nint)

Returns how many frames a node has received.

public static extern nuint pamoja_can_bus_received(nint bus)

Parameters

bus nint

Returns

nuint

pamoja_can_bus_send(nint, nint)

Sends a frame to every other node on the bus.

public static extern PamojaStatus pamoja_can_bus_send(nint bus, nint frame)

Parameters

bus nint
frame nint

Returns

PamojaStatus

pamoja_can_bus_sent(nint)

Returns how many frames a node has sent.

public static extern nuint pamoja_can_bus_sent(nint bus)

Parameters

bus nint

Returns

nuint

pamoja_can_bus_set_filters(nint, ReadOnlySpan<PamojaCanFilter>, nuint)

Keeps only the frames that pass at least one of the filters.

public static PamojaStatus pamoja_can_bus_set_filters(nint bus, ReadOnlySpan<PamojaCanFilter> filters, nuint len)

Parameters

bus nint
filters ReadOnlySpan<PamojaCanFilter>
len nuint

Returns

PamojaStatus

pamoja_can_bus_simulated()

Makes a new bus inside the program, with the returned node the first on it.

public static extern nint pamoja_can_bus_simulated()

Returns

nint

pamoja_can_bus_waited_micros(nint)

Returns how long receives on a node have waited without a frame, in microseconds.

public static extern ulong pamoja_can_bus_waited_micros(nint bus)

Parameters

bus nint

Returns

ulong

pamoja_can_dlc_to_len(byte)

Returns the payload length a data length code encodes.

public static extern nuint pamoja_can_dlc_to_len(byte dlc)

Parameters

dlc byte

Returns

nuint

pamoja_can_filter_exact(uint, bool)

A filter that passes one identifier and nothing else.

public static PamojaCanFilter pamoja_can_filter_exact(uint id, bool extended)

Parameters

id uint
extended bool

Returns

PamojaCanFilter

pamoja_can_filter_matches(PamojaCanFilter, uint, bool)

Reports whether a frame with an identifier passes a filter.

public static bool pamoja_can_filter_matches(PamojaCanFilter filter, uint id, bool extended)

Parameters

filter PamojaCanFilter
id uint
extended bool

Returns

bool

pamoja_can_filter_pgn(uint)

A filter that passes one J1939 parameter group.

public static extern PamojaCanFilter pamoja_can_filter_pgn(uint pgn)

Parameters

pgn uint

Returns

PamojaCanFilter

pamoja_can_frame_data(nint)

Returns a pointer to a frame's payload bytes.

public static extern nint pamoja_can_frame_data(nint frame)

Parameters

frame nint

Returns

nint

pamoja_can_frame_data_len(nint)

Returns how many bytes the payload pointer covers.

public static extern nuint pamoja_can_frame_data_len(nint frame)

Parameters

frame nint

Returns

nuint

pamoja_can_frame_dlc(nint)

Returns a frame's data length code.

public static extern byte pamoja_can_frame_dlc(nint frame)

Parameters

frame nint

Returns

byte

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

Builds a CAN-FD frame.

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

Parameters

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

Returns

PamojaStatus

pamoja_can_frame_free(nint)

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

public static extern void pamoja_can_frame_free(nint frame)

Parameters

frame nint

pamoja_can_frame_id(nint)

Returns a frame's identifier.

public static extern uint pamoja_can_frame_id(nint frame)

Parameters

frame nint

Returns

uint

pamoja_can_frame_is_extended(nint)

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

public static bool pamoja_can_frame_is_extended(nint frame)

Parameters

frame nint

Returns

bool

pamoja_can_frame_is_fd(nint)

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

public static bool pamoja_can_frame_is_fd(nint frame)

Parameters

frame nint

Returns

bool

pamoja_can_frame_is_remote(nint)

Reports whether a frame is a remote transmission request.

public static bool pamoja_can_frame_is_remote(nint frame)

Parameters

frame nint

Returns

bool

pamoja_can_frame_len(nint)

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

public static extern nuint pamoja_can_frame_len(nint frame)

Parameters

frame nint

Returns

nuint

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

Builds a classic CAN 2.0 frame.

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

Parameters

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

Returns

PamojaStatus

pamoja_can_frame_remote(uint, bool, nuint, out nint)

Builds a remote transmission request.

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

Parameters

id uint
extended bool
len nuint
outFrame nint

Returns

PamojaStatus

pamoja_can_j1939_broadcast(byte, uint, byte)

Composes the identifier of a J1939 broadcast.

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

Parameters

priority byte
pgn uint
source byte

Returns

uint

pamoja_can_j1939_compose(byte, uint, byte, byte)

Composes the extended identifier a set of J1939 fields describes.

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

Parameters

priority byte
pgn uint
source byte
destination byte

Returns

uint

pamoja_can_j1939_decode(uint, bool, out PamojaJ1939Id)

Decodes the J1939 fields out of an extended CAN identifier.

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

Parameters

id uint
extended bool
outMessage PamojaJ1939Id

Returns

bool

pamoja_can_len_to_dlc(nuint)

Returns the data length code that encodes a payload length.

public static extern byte pamoja_can_len_to_dlc(nuint len)

Parameters

len nuint

Returns

byte

pamoja_can_signals_new()

Builds a J1939 payload with every signal marked not available.

public static extern PamojaJ1939Signals pamoja_can_signals_new()

Returns

PamojaJ1939Signals

pamoja_can_signals_set_u16(PamojaJ1939Signals, nuint, ushort)

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

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

Parameters

signals PamojaJ1939Signals
at nuint
value ushort

Returns

PamojaJ1939Signals

pamoja_can_signals_set_u8(PamojaJ1939Signals, nuint, byte)

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

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

Parameters

signals PamojaJ1939Signals
at nuint
value byte

Returns

PamojaJ1939Signals

pamoja_can_signals_u16(PamojaJ1939Signals, nuint, out ushort)

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

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

Parameters

signals PamojaJ1939Signals
at nuint
outValue ushort

Returns

bool

pamoja_can_signals_u8(PamojaJ1939Signals, nuint, out byte)

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

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

Parameters

signals PamojaJ1939Signals
at nuint
outValue byte

Returns

bool

pamoja_cdr_reader_free(nint)

Releases a CDR decoder handle.

public static extern void pamoja_cdr_reader_free(nint reader)

Parameters

reader nint

pamoja_cdr_reader_new(ReadOnlySpan<byte>, nuint)

Creates a CDR decoder over encoded bytes.

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

Parameters

data ReadOnlySpan<byte>
dataLen nuint

Returns

nint

pamoja_cdr_reader_read_f32(nint, out float)

Reads the next 32-bit float.

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

Parameters

reader nint
value float

Returns

PamojaStatus

pamoja_cdr_reader_read_f64(nint, out double)

Reads the next 64-bit float.

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

Parameters

reader nint
value double

Returns

PamojaStatus

pamoja_cdr_reader_read_i32(nint, out int)

Reads the next 32-bit signed integer.

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

Parameters

reader nint
value int

Returns

PamojaStatus

pamoja_cdr_reader_read_u32(nint, out uint)

Reads the next 32-bit unsigned integer.

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

Parameters

reader nint
value uint

Returns

PamojaStatus

pamoja_cdr_writer_free(nint)

Releases a CDR encoder handle.

public static extern void pamoja_cdr_writer_free(nint writer)

Parameters

writer nint

pamoja_cdr_writer_into_bytes(nint)

Takes the encoded bytes, consuming the encoder.

public static extern nint pamoja_cdr_writer_into_bytes(nint writer)

Parameters

writer nint

Returns

nint

pamoja_cdr_writer_new()

Creates a CDR encoder.

public static extern nint pamoja_cdr_writer_new()

Returns

nint

pamoja_cdr_writer_write_f32(nint, float)

Appends a 32-bit float.

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

Parameters

writer nint
value float

Returns

PamojaStatus

pamoja_cdr_writer_write_f64(nint, double)

Appends a 64-bit float.

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

Parameters

writer nint
value double

Returns

PamojaStatus

pamoja_cdr_writer_write_i32(nint, int)

Appends a 32-bit signed integer.

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

Parameters

writer nint
value int

Returns

PamojaStatus

pamoja_cdr_writer_write_u32(nint, uint)

Appends a 32-bit unsigned integer.

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

Parameters

writer nint
value uint

Returns

PamojaStatus

Finds the gateway that heard an uplink best.

public static PamojaStatus pamoja_chirpstack_uplink_best_reception(nint uplink, out uint outIndex)

Parameters

uplink nint
outIndex uint

Returns

PamojaStatus

Copies out the application payload an uplink carried.

public static PamojaStatus pamoja_chirpstack_uplink_data(nint uplink, out nint outData)

Parameters

uplink nint
outData nint

Returns

PamojaStatus

Releases an uplink event handle. Passing null is a no-op.

public static extern void pamoja_chirpstack_uplink_free(nint uplink)

Parameters

uplink nint

Reads an uplink event from the JSON ChirpStack published.

public static PamojaStatus pamoja_chirpstack_uplink_parse(ReadOnlySpan<byte> text, nuint textLen, out nint outUplink)

Parameters

text ReadOnlySpan<byte>
textLen nuint
outUplink nint

Returns

PamojaStatus

Reads one gateway that heard an uplink.

public static PamojaStatus pamoja_chirpstack_uplink_reception(nint uplink, uint index, out PamojaChirpstackReception outReception)

Parameters

uplink nint
index uint
outReception PamojaChirpstackReception

Returns

PamojaStatus

Reads the scalar fields of an uplink event.

public static PamojaStatus pamoja_chirpstack_uplink_summary(nint uplink, out PamojaChirpstackUplinkSummary outSummary)

Parameters

uplink nint
outSummary PamojaChirpstackUplinkSummary

Returns

PamojaStatus

Reads one of an uplink event's text fields.

public static extern nint pamoja_chirpstack_uplink_text(nint uplink, byte field)

Parameters

uplink nint
field byte

Returns

nint

Builds the MQTT topic an application's uplink events are published on.

public static nint pamoja_chirpstack_uplink_topic(string applicationId)

Parameters

applicationId string

Returns

nint

pamoja_coap_client_connect(nint)

Binds the local socket of a CoAP endpoint.

public static extern PamojaStatus pamoja_coap_client_connect(nint client)

Parameters

client nint

Returns

PamojaStatus

pamoja_coap_client_disconnect(nint)

Releases the socket a CoAP endpoint holds.

public static extern PamojaStatus pamoja_coap_client_disconnect(nint client)

Parameters

client nint

Returns

PamojaStatus

pamoja_coap_client_free(nint)

Releases a CoAP endpoint handle.

public static extern void pamoja_coap_client_free(nint client)

Parameters

client nint

pamoja_coap_client_is_connected(nint)

Reports whether a CoAP endpoint is bound.

public static bool pamoja_coap_client_is_connected(nint client)

Parameters

client nint

Returns

bool

pamoja_coap_client_new(ref PamojaCoapConfig)

Creates a disconnected CoAP endpoint.

public static nint pamoja_coap_client_new(ref PamojaCoapConfig config)

Parameters

config PamojaCoapConfig

Returns

nint

pamoja_coap_client_recv(nint, out nint)

Waits for the next message on an observed CoAP path.

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

Parameters

client nint
outMessage nint

Returns

PamojaStatus

pamoja_coap_client_recv_within(nint, ulong, out nint, out bool)

Waits a limited time for the next message on an observed CoAP path.

public static PamojaStatus pamoja_coap_client_recv_within(nint client, ulong timeoutMs, out nint outMessage, out bool outTimedOut)

Parameters

client nint
timeoutMs ulong
outMessage nint
outTimedOut bool

Returns

PamojaStatus

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

Sends a payload to a CoAP resource path.

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

Parameters

client nint
topic nint
payload ReadOnlySpan<byte>
payloadLen nuint

Returns

PamojaStatus

pamoja_coap_client_subscribe(nint, nint)

Observes a CoAP resource path.

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

Parameters

client nint
topic nint

Returns

PamojaStatus

pamoja_coap_server_connect(nint)

Binds a CoAP server's socket.

public static extern PamojaStatus pamoja_coap_server_connect(nint server)

Parameters

server nint

Returns

PamojaStatus

pamoja_coap_server_disconnect(nint)

Closes a CoAP server's socket.

public static extern PamojaStatus pamoja_coap_server_disconnect(nint server)

Parameters

server nint

Returns

PamojaStatus

pamoja_coap_server_free(nint)

Releases a CoAP server handle.

public static extern void pamoja_coap_server_free(nint server)

Parameters

server nint

pamoja_coap_server_is_connected(nint)

Reports whether a CoAP server holds a bound socket.

public static bool pamoja_coap_server_is_connected(nint server)

Parameters

server nint

Returns

bool

pamoja_coap_server_local_port(nint)

The port a CoAP server listens on, or 0 while it is not connected.

public static extern ushort pamoja_coap_server_local_port(nint server)

Parameters

server nint

Returns

ushort

pamoja_coap_server_new(nint)

Creates a CoAP server that will listen on a local address.

public static extern nint pamoja_coap_server_new(nint bind)

Parameters

bind nint

Returns

nint

pamoja_coap_server_observers(nint, nint)

Counts the clients observing a resource.

public static extern nuint pamoja_coap_server_observers(nint server, nint path)

Parameters

server nint
path nint

Returns

nuint

pamoja_coap_server_recv(nint, out nint)

Waits for the next reading a CoAP server takes.

public static PamojaStatus pamoja_coap_server_recv(nint server, out nint outMessage)

Parameters

server nint
outMessage nint

Returns

PamojaStatus

pamoja_coap_server_recv_within(nint, ulong, out nint, out bool)

Waits a limited time for the next reading a CoAP server takes.

public static PamojaStatus pamoja_coap_server_recv_within(nint server, ulong timeoutMs, out nint outMessage, out bool outTimedOut)

Parameters

server nint
timeoutMs ulong
outMessage nint
outTimedOut bool

Returns

PamojaStatus

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

Sets a resource's state and notifies its observers.

public static PamojaStatus pamoja_coap_server_send(nint server, nint path, ReadOnlySpan<byte> payload, nuint payloadLen)

Parameters

server nint
path nint
payload ReadOnlySpan<byte>
payloadLen nuint

Returns

PamojaStatus

pamoja_coap_server_subscribe(nint, nint)

Takes the readings sent to the paths a filter matches.

public static extern PamojaStatus pamoja_coap_server_subscribe(nint server, nint filter)

Parameters

server nint
filter nint

Returns

PamojaStatus

pamoja_cobs_decoder_discarded(nint)

Returns how many corrupt frames a COBS decoder has discarded.

public static extern ulong pamoja_cobs_decoder_discarded(nint decoder)

Parameters

decoder nint

Returns

ulong

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

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

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

Parameters

decoder nint
bytes ReadOnlySpan<byte>
bytesLen nuint
outFrames nint

Returns

PamojaStatus

pamoja_cobs_decoder_free(nint)

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

public static extern void pamoja_cobs_decoder_free(nint decoder)

Parameters

decoder nint

pamoja_cobs_decoder_new()

Creates a streaming COBS decoder.

public static extern nint pamoja_cobs_decoder_new()

Returns

nint

pamoja_cobs_decoder_reset(nint)

Discards any partly assembled COBS frame.

public static extern void pamoja_cobs_decoder_reset(nint decoder)

Parameters

decoder nint

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

Converts a CBOR document into its JSON encoding.

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

Parameters

cbor ReadOnlySpan<byte>
cborLen nuint
outBuffer nint

Returns

PamojaStatus

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

Decodes a delta-encoded buffer back into integer samples.

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

Parameters

bytes ReadOnlySpan<byte>
bytesLen nuint
outSamples nint

Returns

PamojaStatus

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

Delta-encodes a series of integer samples.

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

Parameters

samples ReadOnlySpan<long>
count nuint
outBuffer nint

Returns

PamojaStatus

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

Converts a JSON document into its CBOR encoding.

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

Parameters

json ReadOnlySpan<byte>
jsonLen nuint
outBuffer nint

Returns

PamojaStatus

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

Decodes a quantized batch back into float readings.

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

Parameters

scale float
bytes ReadOnlySpan<byte>
bytesLen nuint
outReadings nint

Returns

PamojaStatus

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

Quantizes and delta-encodes a batch of float readings.

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

Parameters

scale float
readings ReadOnlySpan<float>
count nuint
outBuffer nint

Returns

PamojaStatus

pamoja_complementary_estimate(nint)

Reads a complementary filter's estimate.

public static extern float pamoja_complementary_estimate(nint filter)

Parameters

filter nint

Returns

float

pamoja_complementary_free(nint)

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

public static extern void pamoja_complementary_free(nint filter)

Parameters

filter nint

pamoja_complementary_new(float, float)

Creates a complementary filter.

public static extern nint pamoja_complementary_new(float alpha, float initial)

Parameters

alpha float
initial float

Returns

nint

pamoja_complementary_update(nint, float, float, float)

Fuses a rate and an absolute reading over a time step.

public static extern float pamoja_complementary_update(nint filter, float rate, float absolute, float dt)

Parameters

filter nint
rate float
absolute float
dt float

Returns

float

pamoja_controller_evaluate(nint, float, out PamojaReaction)

Decides what one reading calls for.

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

Parameters

controller nint
reading float
reaction PamojaReaction

Returns

PamojaStatus

pamoja_controller_free(nint)

Releases a controller handle.

public static extern void pamoja_controller_free(nint controller)

Parameters

controller nint

pamoja_controller_level(float, uint)

Creates a controller that warns before a level reaches empty.

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

Parameters

empty float
warnWithin uint

Returns

nint

pamoja_controller_monitor()

Creates a controller that reports readings without judging them.

public static extern nint pamoja_controller_monitor()

Returns

nint

pamoja_controller_setpoint(float, float, bool, float)

Creates a controller that holds a reading near a setpoint.

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

Parameters

setpoint float
hysteresis float
cooling bool
safeBand float

Returns

nint

pamoja_controller_surge(bool, float)

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

public static nint pamoja_controller_surge(bool rising, float limit)

Parameters

rising bool
limit float

Returns

nint

pamoja_coordinate_bearing_to(PamojaCoordinate, PamojaCoordinate)

Returns the initial bearing between two coordinates, in degrees.

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

Parameters

from PamojaCoordinate
to PamojaCoordinate

Returns

double

pamoja_coordinate_distance_to(PamojaCoordinate, PamojaCoordinate)

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

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

Parameters

from PamojaCoordinate
to PamojaCoordinate

Returns

double

pamoja_debounce_free(nint)

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

public static extern void pamoja_debounce_free(nint debounce)

Parameters

debounce nint

pamoja_debounce_new(ushort, bool)

Creates a boolean debouncer.

public static nint pamoja_debounce_new(ushort samples, bool initial)

Parameters

samples ushort
initial bool

Returns

nint

pamoja_debounce_state(nint)

Reports a debouncer's settled state.

public static bool pamoja_debounce_state(nint debounce)

Parameters

debounce nint

Returns

bool

pamoja_debounce_update(nint, bool)

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

public static bool pamoja_debounce_update(nint debounce, bool raw)

Parameters

debounce nint
raw bool

Returns

bool

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

Opens a signed delegation against its anchor.

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

Parameters

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

Returns

PamojaStatus

pamoja_delegation_sign(PamojaDelegation, nint)

Signs a delegation naming a release key.

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

Parameters

delegation PamojaDelegation
anchor nint

Returns

nint

pamoja_depletion_free(nint)

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

public static extern void pamoja_depletion_free(nint depletion)

Parameters

depletion nint

pamoja_depletion_new(float)

Creates a depletion estimator.

public static extern nint pamoja_depletion_new(float threshold)

Parameters

threshold float

Returns

nint

pamoja_depletion_update(nint, float, out uint)

Records a level and estimates the samples until the threshold.

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

Parameters

depletion nint
level float
outSamples uint

Returns

bool

pamoja_device_identity_free(nint)

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

public static extern void pamoja_device_identity_free(nint identity)

Parameters

identity nint

pamoja_device_identity_new(ReadOnlySpan<byte>, nuint)

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

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

Parameters

seed ReadOnlySpan<byte>
seedLen nuint

Returns

nint

pamoja_device_identity_public_key(nint, Span<byte>)

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

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

Parameters

identity nint
outPublicKey Span<byte>

Returns

PamojaStatus

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

Signs a payload, writing the 64-byte signature.

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

Parameters

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

Returns

PamojaStatus

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

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

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

Parameters

identity nint
payload ReadOnlySpan<byte>
payloadLen nuint
outBuffer nint

Returns

PamojaStatus

pamoja_dh_transform(PamojaDhParameters)

Returns the transform one Denavit-Hartenberg joint makes.

public static extern PamojaTransform pamoja_dh_transform(PamojaDhParameters joint)

Parameters

joint PamojaDhParameters

Returns

PamojaTransform

pamoja_diff_drive_body_motion(PamojaDiffDrive, float, float)

Returns the body motion a differential drive makes from measured wheel speeds.

public static extern PamojaBodyMotion pamoja_diff_drive_body_motion(PamojaDiffDrive drive, float left, float right)

Parameters

drive PamojaDiffDrive
left float
right float

Returns

PamojaBodyMotion

pamoja_diff_drive_wheel_speeds(PamojaDiffDrive, float, float)

Returns the wheel speeds a differential drive needs for a body motion.

public static extern PamojaSideSpeeds pamoja_diff_drive_wheel_speeds(PamojaDiffDrive drive, float linear, float angular)

Parameters

drive PamojaDiffDrive
linear float
angular float

Returns

PamojaSideSpeeds

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

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

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

Parameters

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

Returns

PamojaStatus

pamoja_ds18b20_celsius(short)

Converts a raw DS18B20 temperature register to degrees Celsius.

public static extern float pamoja_ds18b20_celsius(short raw)

Parameters

raw short

Returns

float

pamoja_ds18b20_config_byte(byte, out byte)

Returns the configuration byte that selects a DS18B20 resolution.

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

Parameters

bits byte
outByte byte

Returns

PamojaStatus

pamoja_ds18b20_crc8(ReadOnlySpan<byte>, nuint)

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

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

Parameters

data ReadOnlySpan<byte>
dataLen nuint

Returns

byte

pamoja_ds18b20_discover(string?, out nint)

Lists every DS18B20 the kernel has found under a directory, or the default one.

public static PamojaStatus pamoja_ds18b20_discover(string? devices, out nint outThermometers)

Parameters

devices string
outThermometers nint

Returns

PamojaStatus

pamoja_ds18b20_max_conversion_micros(byte, out uint)

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

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

Parameters

bits byte
outMicros uint

Returns

PamojaStatus

pamoja_ds18b20_micro_celsius(short)

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

public static extern int pamoja_ds18b20_micro_celsius(short raw)

Parameters

raw short

Returns

int

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

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

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

Parameters

bytes ReadOnlySpan<byte>
bytesLen nuint
outReading PamojaDs18b20Reading

Returns

PamojaStatus

pamoja_ds18b20_parse_w1_slave(string, out PamojaDs18b20Reading)

Decodes the text the kernel serves for a DS18B20.

public static PamojaStatus pamoja_ds18b20_parse_w1_slave(string text, out PamojaDs18b20Reading outReading)

Parameters

text string
outReading PamojaDs18b20Reading

Returns

PamojaStatus

pamoja_ds18b20_resolution_bits(byte)

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

public static extern byte pamoja_ds18b20_resolution_bits(byte configByte)

Parameters

configByte byte

Returns

byte

pamoja_ds18b20_step_micro_celsius(byte, out uint)

Returns the temperature step a DS18B20 resolution resolves.

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

Parameters

bits byte
outMicroCelsius uint

Returns

PamojaStatus

pamoja_ds18b20_thermometer_at(string, out nint)

Names a DS18B20 by the path of its w1_slave file.

public static PamojaStatus pamoja_ds18b20_thermometer_at(string path, out nint outThermometer)

Parameters

path string
outThermometer nint

Returns

PamojaStatus

pamoja_ds18b20_thermometer_free(nint)

Releases a thermometer. Passing null is a no-op.

public static extern void pamoja_ds18b20_thermometer_free(nint thermometer)

Parameters

thermometer nint

pamoja_ds18b20_thermometer_new(string, out nint)

Names a DS18B20 the kernel serves by its serial.

public static PamojaStatus pamoja_ds18b20_thermometer_new(string serial, out nint outThermometer)

Parameters

serial string
outThermometer nint

Returns

PamojaStatus

pamoja_ds18b20_thermometer_path(nint)

Returns the path of the file a thermometer reads, as an owned string.

public static extern nint pamoja_ds18b20_thermometer_path(nint thermometer)

Parameters

thermometer nint

Returns

nint

pamoja_ds18b20_thermometer_read(nint, out PamojaDs18b20Reading)

Reads and decodes a thermometer's file.

public static PamojaStatus pamoja_ds18b20_thermometer_read(nint thermometer, out PamojaDs18b20Reading outReading)

Parameters

thermometer nint
outReading PamojaDs18b20Reading

Returns

PamojaStatus

pamoja_ds18b20_thermometer_serial(nint)

Returns the serial in a thermometer's directory name as an owned string, or null when the file does not sit in a DS18B20's directory.

public static extern nint pamoja_ds18b20_thermometer_serial(nint thermometer)

Parameters

thermometer nint

Returns

nint

pamoja_ds18b20_thermometers_free(nint)

Releases a list of thermometers. Passing null is a no-op.

public static extern void pamoja_ds18b20_thermometers_free(nint thermometers)

Parameters

thermometers nint

pamoja_ds18b20_thermometers_get(nint, nuint)

Copies one thermometer out of a list, or returns null.

public static extern nint pamoja_ds18b20_thermometers_get(nint thermometers, nuint index)

Parameters

thermometers nint
index nuint

Returns

nint

pamoja_ds18b20_thermometers_len(nint)

Returns how many thermometers a list holds.

public static extern nuint pamoja_ds18b20_thermometers_len(nint thermometers)

Parameters

thermometers nint

Returns

nuint

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

Renders the text the kernel serves for a DS18B20 scratchpad it read cleanly.

public static PamojaStatus pamoja_ds18b20_w1_slave_text(ReadOnlySpan<byte> bytes, nuint len, out nint outText)

Parameters

bytes ReadOnlySpan<byte>
len nuint
outText nint

Returns

PamojaStatus

pamoja_duty_cycle_fraction(PamojaDutyCycle)

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

public static extern float pamoja_duty_cycle_fraction(PamojaDutyCycle duty)

Parameters

duty PamojaDutyCycle

Returns

float

pamoja_duty_cycle_from_fraction(ulong, float)

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

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

Parameters

periodUs ulong
fraction float

Returns

PamojaDutyCycle

pamoja_duty_cycle_new(ulong, ulong)

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

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

Parameters

activeUs ulong
sleepUs ulong

Returns

PamojaDutyCycle

pamoja_duty_cycle_period_us(PamojaDutyCycle)

Returns the whole period of a duty cycle.

public static extern ulong pamoja_duty_cycle_period_us(PamojaDutyCycle duty)

Parameters

duty PamojaDutyCycle

Returns

ulong

pamoja_envelope_body(ReadOnlySpan<byte>, nuint)

Copies out the signed body of an envelope.

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

Parameters

bytes ReadOnlySpan<byte>
len nuint

Returns

nint

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

Verifies an envelope and reads the manifest inside it.

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

Parameters

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

Returns

PamojaStatus

pamoja_esc_bidirectional()

Returns the common reversible ESC.

public static extern PamojaEsc pamoja_esc_bidirectional()

Returns

PamojaEsc

pamoja_esc_pulse(PamojaEsc, float)

Returns the pulse width for a throttle.

public static extern ushort pamoja_esc_pulse(PamojaEsc esc, float throttle)

Parameters

esc PamojaEsc
throttle float

Returns

ushort

pamoja_estop_engage(nint)

Engages an e-stop.

public static extern void pamoja_estop_engage(nint estop)

Parameters

estop nint

pamoja_estop_free(nint)

Releases an e-stop handle. Passing null is a no-op.

public static extern void pamoja_estop_free(nint estop)

Parameters

estop nint

pamoja_estop_gate(nint, PamojaTwist)

Passes a command through an e-stop.

public static extern PamojaTwist pamoja_estop_gate(nint estop, PamojaTwist desired)

Parameters

estop nint
desired PamojaTwist

Returns

PamojaTwist

pamoja_estop_is_engaged(nint)

Reports whether an e-stop is engaged.

public static bool pamoja_estop_is_engaged(nint estop)

Parameters

estop nint

Returns

bool

pamoja_estop_new()

Creates an e-stop that is not engaged.

public static extern nint pamoja_estop_new()

Returns

nint

pamoja_estop_reset(nint)

Clears an e-stop.

public static extern void pamoja_estop_reset(nint estop)

Parameters

estop nint

pamoja_event_bus_free(nint)

Releases an event bus endpoint.

public static extern void pamoja_event_bus_free(nint bus)

Parameters

bus nint

pamoja_event_bus_missed(nint)

Counts the events an endpoint lost by falling behind.

public static extern ulong pamoja_event_bus_missed(nint bus)

Parameters

bus nint

Returns

ulong

pamoja_event_bus_new(nuint)

Creates an event bus.

public static extern nint pamoja_event_bus_new(nuint capacity)

Parameters

capacity nuint

Returns

nint

pamoja_event_bus_next(nint, out nint)

Waits for the next event on an endpoint.

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

Parameters

bus nint
outEvent nint

Returns

PamojaStatus

pamoja_event_bus_next_within(nint, ulong, out nint, out bool)

Waits a limited time for the next event on an endpoint.

public static PamojaStatus pamoja_event_bus_next_within(nint bus, ulong timeoutMs, out nint outEvent, out bool outTimedOut)

Parameters

bus nint
timeoutMs ulong
outEvent nint
outTimedOut bool

Returns

PamojaStatus

pamoja_event_bus_publish(nint, ReadOnlySpan<byte>, nuint)

Publishes an event to every subscriber, the endpoint included.

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

Parameters

bus nint
payload ReadOnlySpan<byte>
payloadLen nuint

Returns

PamojaStatus

pamoja_event_bus_publisher(nint)

Takes a publish-only handle on the bus an endpoint is on.

public static extern nint pamoja_event_bus_publisher(nint bus)

Parameters

bus nint

Returns

nint

pamoja_event_bus_subscribe(nint)

Takes another endpoint on an event bus.

public static extern nint pamoja_event_bus_subscribe(nint bus)

Parameters

bus nint

Returns

nint

pamoja_event_publisher_clone(nint)

Takes another publisher on the same bus.

public static extern nint pamoja_event_publisher_clone(nint publisher)

Parameters

publisher nint

Returns

nint

pamoja_event_publisher_free(nint)

Releases a publisher.

public static extern void pamoja_event_publisher_free(nint publisher)

Parameters

publisher nint

pamoja_event_publisher_new(nuint)

Creates a bus with no subscribers yet, and a publisher on it.

public static extern nint pamoja_event_publisher_new(nuint capacity)

Parameters

capacity nuint

Returns

nint

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

Hands an event to every current subscriber.

public static PamojaStatus pamoja_event_publisher_publish(nint publisher, ReadOnlySpan<byte> payload, nuint payloadLen, out nuint outReached)

Parameters

publisher nint
payload ReadOnlySpan<byte>
payloadLen nuint
outReached nuint

Returns

PamojaStatus

pamoja_event_publisher_subscribe(nint)

Subscribes to the bus a publisher publishes on.

public static extern nint pamoja_event_publisher_subscribe(nint publisher)

Parameters

publisher nint

Returns

nint

pamoja_forward_kinematics(ReadOnlySpan<PamojaDhParameters>, nuint)

Returns the transform from a serial arm's base to its tool.

public static PamojaTransform pamoja_forward_kinematics(ReadOnlySpan<PamojaDhParameters> joints, nuint len)

Parameters

joints ReadOnlySpan<PamojaDhParameters>
len nuint

Returns

PamojaTransform

pamoja_frames_count(nint)

Returns how many frames a decoder call produced.

public static extern nuint pamoja_frames_count(nint frames)

Parameters

frames nint

Returns

nuint

pamoja_frames_data(nint, nuint)

Returns a pointer to one frame's payload bytes.

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

Parameters

frames nint
index nuint

Returns

nint

pamoja_frames_free(nint)

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

public static extern void pamoja_frames_free(nint frames)

Parameters

frames nint

pamoja_frames_len(nint, nuint)

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

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

Parameters

frames nint
index nuint

Returns

nuint

pamoja_gateway_network_answer(nint, uint, PamojaGatewayNetworkSlot, byte, ReadOnlySpan<byte>, nuint, Span<byte>, nuint, out PamojaGatewayTxpk, out nuint)

Builds a downlink for a device, encrypted with its session.

public static PamojaStatus pamoja_gateway_network_answer(nint network, uint devAddr, PamojaGatewayNetworkSlot slot, byte fport, ReadOnlySpan<byte> payload, nuint payloadLen, Span<byte> buffer, nuint capacity, out PamojaGatewayTxpk outTxpk, out nuint outLen)

Parameters

network nint
devAddr uint
slot PamojaGatewayNetworkSlot
fport byte
payload ReadOnlySpan<byte>
payloadLen nuint
buffer Span<byte>
capacity nuint
outTxpk PamojaGatewayTxpk
outLen nuint

Returns

PamojaStatus

pamoja_gateway_network_command(nint, uint, PamojaGatewayNetworkSlot, ReadOnlySpan<PamojaLorawanMacCommand>, nuint, Span<byte>, nuint, out PamojaGatewayTxpk, out nuint)

Builds a downlink carrying MAC commands.

public static PamojaStatus pamoja_gateway_network_command(nint network, uint devAddr, PamojaGatewayNetworkSlot slot, ReadOnlySpan<PamojaLorawanMacCommand> commands, nuint commandsLen, Span<byte> buffer, nuint capacity, out PamojaGatewayTxpk outTxpk, out nuint outLen)

Parameters

network nint
devAddr uint
slot PamojaGatewayNetworkSlot
commands ReadOnlySpan<PamojaLorawanMacCommand>
commandsLen nuint
buffer Span<byte>
capacity nuint
outTxpk PamojaGatewayTxpk
outLen nuint

Returns

PamojaStatus

pamoja_gateway_network_free(nint)

Releases a network.

public static extern void pamoja_gateway_network_free(nint network)

Parameters

network nint

pamoja_gateway_network_notices(nint, Span<PamojaGatewayNetworkNotice>, nuint, out nuint)

Takes the devices relays reported hearing and could not verify.

public static PamojaStatus pamoja_gateway_network_notices(nint network, Span<PamojaGatewayNetworkNotice> outNotices, nuint capacity, out nuint outLen)

Parameters

network nint
outNotices Span<PamojaGatewayNetworkNotice>
capacity nuint
outLen nuint

Returns

PamojaStatus

pamoja_gateway_network_open(nint, uint, PamojaGatewayNetworkWindows, uint, out nint)

Opens the network side of a site on a channel plan.

public static PamojaStatus pamoja_gateway_network_open(nint plan, uint netId, PamojaGatewayNetworkWindows windows, uint firstDevAddr, out nint outNetwork)

Parameters

plan nint
netId uint
windows PamojaGatewayNetworkWindows
firstDevAddr uint
outNetwork nint

Returns

PamojaStatus

pamoja_gateway_network_register(nint, ReadOnlySpan<byte>, ReadOnlySpan<byte>, ReadOnlySpan<byte>, byte)

Admits a device, so a join request signed with its key is accepted.

public static PamojaStatus pamoja_gateway_network_register(nint network, ReadOnlySpan<byte> devEui, ReadOnlySpan<byte> appEui, ReadOnlySpan<byte> appKey, byte version)

Parameters

network nint
devEui ReadOnlySpan<byte>
appEui ReadOnlySpan<byte>
appKey ReadOnlySpan<byte>
version byte

Returns

PamojaStatus

pamoja_gateway_network_trust_command(nint, uint, byte, byte, byte, out PamojaLorawanMacCommand)

Builds the command that tells a relay to trust a device.

public static PamojaStatus pamoja_gateway_network_trust_command(nint network, uint devAddr, byte index, byte reloadRate, byte bucketSize, out PamojaLorawanMacCommand outCommand)

Parameters

network nint
devAddr uint
index byte
reloadRate byte
bucketSize byte
outCommand PamojaLorawanMacCommand

Returns

PamojaStatus

Reads a packet the gateway forwarded.

public static PamojaStatus pamoja_gateway_network_uplink(nint network, PamojaGatewayRxpk packet, ReadOnlySpan<byte> payload, nuint payloadLen, Span<byte> buffer, nuint capacity, out PamojaGatewayNetworkEvent outEvent)

Parameters

network nint
packet PamojaGatewayRxpk
payload ReadOnlySpan<byte>
payloadLen nuint
buffer Span<byte>
capacity nuint
outEvent PamojaGatewayNetworkEvent

Returns

PamojaStatus

pamoja_gateway_network_windows_default()

Returns the windows a network answers in by default.

public static extern PamojaGatewayNetworkWindows pamoja_gateway_network_windows_default()

Returns

PamojaGatewayNetworkWindows

pamoja_gateway_packet_acknowledgment(nint, out nint)

Builds the acknowledgment a server owes a datagram.

public static bool pamoja_gateway_packet_acknowledgment(nint packet, out nint outPacket)

Parameters

packet nint
outPacket nint

Returns

bool

pamoja_gateway_packet_free(nint)

Releases a packet.

public static extern void pamoja_gateway_packet_free(nint packet)

Parameters

packet nint

pamoja_gateway_packet_gateway(nint, Span<byte>)

Writes the gateway's identifier, for the datagrams that carry one.

public static bool pamoja_gateway_packet_gateway(nint packet, Span<byte> outGateway)

Parameters

packet nint
outGateway Span<byte>

Returns

bool

pamoja_gateway_packet_kind(nint)

Returns which kind of datagram a packet is, or 255 for a null packet.

public static extern byte pamoja_gateway_packet_kind(nint packet)

Parameters

packet nint

Returns

byte

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

Reads a datagram.

public static PamojaStatus pamoja_gateway_packet_parse(ReadOnlySpan<byte> bytes, nuint len, out nint outPacket)

Parameters

bytes ReadOnlySpan<byte>
len nuint
outPacket nint

Returns

PamojaStatus

pamoja_gateway_packet_rxpk(nint, nuint, out PamojaGatewayRxpk)

Reads one of the packets a PUSH_DATA forwards.

public static bool pamoja_gateway_packet_rxpk(nint packet, nuint index, out PamojaGatewayRxpk outRxpk)

Parameters

packet nint
index nuint
outRxpk PamojaGatewayRxpk

Returns

bool

pamoja_gateway_packet_rxpk_count(nint)

Returns how many packets a PUSH_DATA forwards.

public static extern nuint pamoja_gateway_packet_rxpk_count(nint packet)

Parameters

packet nint

Returns

nuint

pamoja_gateway_packet_rxpk_payload(nint, nuint)

Returns a pointer to one forwarded packet's payload.

public static extern nint pamoja_gateway_packet_rxpk_payload(nint packet, nuint index)

Parameters

packet nint
index nuint

Returns

nint

pamoja_gateway_packet_rxpk_payload_len(nint, nuint)

Returns the length of one forwarded packet's payload.

public static extern nuint pamoja_gateway_packet_rxpk_payload_len(nint packet, nuint index)

Parameters

packet nint
index nuint

Returns

nuint

pamoja_gateway_packet_stat(nint, out PamojaGatewayStat)

Reads the gateway's status report, when a PUSH_DATA carries one.

public static bool pamoja_gateway_packet_stat(nint packet, out PamojaGatewayStat outStat)

Parameters

packet nint
outStat PamojaGatewayStat

Returns

bool

pamoja_gateway_packet_to_buffer(nint)

Writes a packet as the datagram to send.

public static extern nint pamoja_gateway_packet_to_buffer(nint packet)

Parameters

packet nint

Returns

nint

pamoja_gateway_packet_token(nint)

Returns a packet's token.

public static extern ushort pamoja_gateway_packet_token(nint packet)

Parameters

packet nint

Returns

ushort

pamoja_gateway_packet_tx_status(nint)

Returns what a TX_ACK reports, or 255 when the packet is not one.

public static extern byte pamoja_gateway_packet_tx_status(nint packet)

Parameters

packet nint

Returns

byte

pamoja_gateway_packet_txpk(nint, out PamojaGatewayTxpk)

Reads what a PULL_RESP asks the gateway to transmit.

public static bool pamoja_gateway_packet_txpk(nint packet, out PamojaGatewayTxpk outTxpk)

Parameters

packet nint
outTxpk PamojaGatewayTxpk

Returns

bool

pamoja_gateway_packet_txpk_payload(nint)

Returns a pointer to the payload a PULL_RESP carries.

public static extern nint pamoja_gateway_packet_txpk_payload(nint packet)

Parameters

packet nint

Returns

nint

pamoja_gateway_packet_txpk_payload_len(nint)

Returns the length of the payload a PULL_RESP carries.

public static extern nuint pamoja_gateway_packet_txpk_payload_len(nint packet)

Parameters

packet nint

Returns

nuint

pamoja_gateway_pull_ack(ushort)

Builds the PULL_ACK that answers a PULL_DATA.

public static extern nint pamoja_gateway_pull_ack(ushort token)

Parameters

token ushort

Returns

nint

pamoja_gateway_pull_data(ushort, ReadOnlySpan<byte>, out nint)

Builds the PULL_DATA that holds a route open.

public static PamojaStatus pamoja_gateway_pull_data(ushort token, ReadOnlySpan<byte> gateway, out nint outPacket)

Parameters

token ushort
gateway ReadOnlySpan<byte>
outPacket nint

Returns

PamojaStatus

pamoja_gateway_pull_resp(ushort, PamojaGatewayTxpk, ReadOnlySpan<byte>, nuint, out nint)

Builds the PULL_RESP that asks a gateway to transmit.

public static PamojaStatus pamoja_gateway_pull_resp(ushort token, PamojaGatewayTxpk transmit, ReadOnlySpan<byte> payload, nuint payloadLen, out nint outPacket)

Parameters

token ushort
transmit PamojaGatewayTxpk
payload ReadOnlySpan<byte>
payloadLen nuint
outPacket nint

Returns

PamojaStatus

pamoja_gateway_push_ack(ushort)

Builds the PUSH_ACK that answers a PUSH_DATA.

public static extern nint pamoja_gateway_push_ack(ushort token)

Parameters

token ushort

Returns

nint

pamoja_gateway_push_data(ushort, ReadOnlySpan<byte>, nint, out nint)

Builds the PUSH_DATA that forwards an uplink, taking the uplink over.

public static PamojaStatus pamoja_gateway_push_data(ushort token, ReadOnlySpan<byte> gateway, nint uplink, out nint outPacket)

Parameters

token ushort
gateway ReadOnlySpan<byte>
uplink nint
outPacket nint

Returns

PamojaStatus

pamoja_gateway_station_discovery(ReadOnlySpan<byte>, out nint)

Writes the request a station sends to find its network server.

public static PamojaStatus pamoja_gateway_station_discovery(ReadOnlySpan<byte> router, out nint outText)

Parameters

router ReadOnlySpan<byte>
outText nint

Returns

PamojaStatus

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

Reads the request a station sent to find its network server.

public static PamojaStatus pamoja_gateway_station_discovery_parse(ReadOnlySpan<byte> text, nuint textLen, Span<byte> outRouter)

Parameters

text ReadOnlySpan<byte>
textLen nuint
outRouter Span<byte>

Returns

PamojaStatus

pamoja_gateway_station_eui_of(string, Span<byte>)

Reads an identifier written in any form the protocol accepts.

public static PamojaStatus pamoja_gateway_station_eui_of(string text, Span<byte> outEui)

Parameters

text string
outEui Span<byte>

Returns

PamojaStatus

pamoja_gateway_station_heard(ReadOnlySpan<byte>, nuint, byte, uint, PamojaGatewayStationLevels)

Reads a frame the radio heard into the message that reports it.

public static nint pamoja_gateway_station_heard(ReadOnlySpan<byte> frame, nuint frameLen, byte dataRate, uint frequencyHz, PamojaGatewayStationLevels levels)

Parameters

frame ReadOnlySpan<byte>
frameLen nuint
dataRate byte
frequencyHz uint
levels PamojaGatewayStationLevels

Returns

nint

pamoja_gateway_station_id6(ReadOnlySpan<byte>, out nint)

Writes an identifier in the ID6 form the protocol prefers.

public static PamojaStatus pamoja_gateway_station_id6(ReadOnlySpan<byte> eui, out nint outText)

Parameters

eui ReadOnlySpan<byte>
outText nint

Returns

PamojaStatus

pamoja_gateway_station_message_add_broadcast(nint, in PamojaGatewayStationBroadcast, ReadOnlySpan<byte>, nuint)

Adds a frame to a schedule.

public static PamojaStatus pamoja_gateway_station_message_add_broadcast(nint message, in PamojaGatewayStationBroadcast frame, ReadOnlySpan<byte> pdu, nuint pduLen)

Parameters

message nint
frame PamojaGatewayStationBroadcast
pdu ReadOnlySpan<byte>
pduLen nuint

Returns

PamojaStatus

pamoja_gateway_station_message_add_data_rate(nint, in PamojaGatewayStationDataRate)

Adds the next number of a configuration's data-rate table.

public static PamojaStatus pamoja_gateway_station_message_add_data_rate(nint message, in PamojaGatewayStationDataRate rate)

Parameters

message nint
rate PamojaGatewayStationDataRate

Returns

PamojaStatus

pamoja_gateway_station_message_add_join_range(nint, in PamojaGatewayStationJoinRange)

Adds a range of join identifiers a configuration forwards.

public static PamojaStatus pamoja_gateway_station_message_add_join_range(nint message, in PamojaGatewayStationJoinRange range)

Parameters

message nint
range PamojaGatewayStationJoinRange

Returns

PamojaStatus

pamoja_gateway_station_message_add_net_id(nint, uint)

Adds a network whose data frames a configuration forwards.

public static extern PamojaStatus pamoja_gateway_station_message_add_net_id(nint message, uint netId)

Parameters

message nint
netId uint

Returns

PamojaStatus

pamoja_gateway_station_message_broadcast(nint, nuint, out PamojaGatewayStationBroadcast, out nint)

Reads one frame of a schedule.

public static PamojaStatus pamoja_gateway_station_message_broadcast(nint message, nuint index, out PamojaGatewayStationBroadcast outFrame, out nint outPdu)

Parameters

message nint
index nuint
outFrame PamojaGatewayStationBroadcast
outPdu nint

Returns

PamojaStatus

pamoja_gateway_station_message_data_rate(nint, nuint, out PamojaGatewayStationDataRate)

Reads one number of a configuration's data-rate table.

public static PamojaStatus pamoja_gateway_station_message_data_rate(nint message, nuint index, out PamojaGatewayStationDataRate outRate)

Parameters

message nint
index nuint
outRate PamojaGatewayStationDataRate

Returns

PamojaStatus

pamoja_gateway_station_message_fields(nint, out PamojaGatewayStationFields)

Reads the fields a message carries.

public static PamojaStatus pamoja_gateway_station_message_fields(nint message, out PamojaGatewayStationFields outFields)

Parameters

message nint
outFields PamojaGatewayStationFields

Returns

PamojaStatus

pamoja_gateway_station_message_free(nint)

Releases a message.

public static extern void pamoja_gateway_station_message_free(nint message)

Parameters

message nint

pamoja_gateway_station_message_join_range(nint, nuint, out PamojaGatewayStationJoinRange)

Reads one join identifier range a configuration names.

public static PamojaStatus pamoja_gateway_station_message_join_range(nint message, nuint index, out PamojaGatewayStationJoinRange outRange)

Parameters

message nint
index nuint
outRange PamojaGatewayStationJoinRange

Returns

PamojaStatus

pamoja_gateway_station_message_json(nint, out nint)

Writes a message as the websocket carries it.

public static PamojaStatus pamoja_gateway_station_message_json(nint message, out nint outText)

Parameters

message nint
outText nint

Returns

PamojaStatus

pamoja_gateway_station_message_kind(nint)

Returns which kind a message is.

public static extern byte pamoja_gateway_station_message_kind(nint message)

Parameters

message nint

Returns

byte

pamoja_gateway_station_message_net_id(nint, nuint, out uint)

Reads one network a configuration names.

public static PamojaStatus pamoja_gateway_station_message_net_id(nint message, nuint index, out uint outNetId)

Parameters

message nint
index nuint
outNetId uint

Returns

PamojaStatus

pamoja_gateway_station_message_new(in PamojaGatewayStationFields)

Builds a message of any kind from its fixed fields.

public static nint pamoja_gateway_station_message_new(in PamojaGatewayStationFields fields)

Parameters

fields PamojaGatewayStationFields

Returns

nint

pamoja_gateway_station_message_options(nint, out nint)

Returns the frame options a data frame carries.

public static PamojaStatus pamoja_gateway_station_message_options(nint message, out nint outOptions)

Parameters

message nint
outOptions nint

Returns

PamojaStatus

pamoja_gateway_station_message_parse(ReadOnlySpan<byte>, nuint)

Reads a message that arrived over the websocket.

public static nint pamoja_gateway_station_message_parse(ReadOnlySpan<byte> text, nuint textLen)

Parameters

text ReadOnlySpan<byte>
textLen nuint

Returns

nint

pamoja_gateway_station_message_payload(nint, out nint)

Returns the bytes a message carries.

public static PamojaStatus pamoja_gateway_station_message_payload(nint message, out nint outPayload)

Parameters

message nint
outPayload nint

Returns

PamojaStatus

pamoja_gateway_station_message_set_options(nint, ReadOnlySpan<byte>, nuint)

Sets the frame options a data frame carries.

public static PamojaStatus pamoja_gateway_station_message_set_options(nint message, ReadOnlySpan<byte> bytes, nuint bytesLen)

Parameters

message nint
bytes ReadOnlySpan<byte>
bytesLen nuint

Returns

PamojaStatus

pamoja_gateway_station_message_set_payload(nint, ReadOnlySpan<byte>, nuint)

Sets the bytes a message carries.

public static PamojaStatus pamoja_gateway_station_message_set_payload(nint message, ReadOnlySpan<byte> bytes, nuint bytesLen)

Parameters

message nint
bytes ReadOnlySpan<byte>
bytesLen nuint

Returns

PamojaStatus

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

Sets a piece of text a message carries.

public static PamojaStatus pamoja_gateway_station_message_set_text(nint message, byte field, ReadOnlySpan<byte> text, nuint textLen)

Parameters

message nint
field byte
text ReadOnlySpan<byte>
textLen nuint

Returns

PamojaStatus

pamoja_gateway_station_message_text(nint, byte, out nint)

Returns a piece of text a message carries.

public static PamojaStatus pamoja_gateway_station_message_text(nint message, byte field, out nint outText)

Parameters

message nint
field byte
outText nint

Returns

PamojaStatus

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

Writes the answer that sends a station to its session's websocket.

public static PamojaStatus pamoja_gateway_station_router_accepted(ReadOnlySpan<byte> router, ReadOnlySpan<byte> muxs, ReadOnlySpan<byte> uri, nuint uriLen, out nint outText)

Parameters

router ReadOnlySpan<byte>
muxs ReadOnlySpan<byte>
uri ReadOnlySpan<byte>
uriLen nuint
outText nint

Returns

PamojaStatus

pamoja_gateway_station_router_identities(ReadOnlySpan<byte>, nuint, out PamojaGatewayStationRouterIds)

Reads the identities a discovery answer names.

public static PamojaStatus pamoja_gateway_station_router_identities(ReadOnlySpan<byte> text, nuint textLen, out PamojaGatewayStationRouterIds outIds)

Parameters

text ReadOnlySpan<byte>
textLen nuint
outIds PamojaGatewayStationRouterIds

Returns

PamojaStatus

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

Reads the answer a discovery endpoint gives.

public static PamojaStatus pamoja_gateway_station_router_parse(ReadOnlySpan<byte> text, nuint textLen, out nint outUri, out nint outError)

Parameters

text ReadOnlySpan<byte>
textLen nuint
outUri nint
outError nint

Returns

PamojaStatus

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

Writes the answer that refuses a station, saying why.

public static PamojaStatus pamoja_gateway_station_router_refused(ReadOnlySpan<byte> router, ReadOnlySpan<byte> error, nuint errorLen, out nint outText)

Parameters

router ReadOnlySpan<byte>
error ReadOnlySpan<byte>
errorLen nuint
outText nint

Returns

PamojaStatus

pamoja_gateway_station_xtime(byte, byte, ulong, out long)

Builds a station clock value from its radio unit, run, and microseconds.

public static PamojaStatus pamoja_gateway_station_xtime(byte unit, byte session, ulong micros, out long outValue)

Parameters

unit byte
session byte
micros ulong
outValue long

Returns

PamojaStatus

pamoja_gateway_station_xtime_parts(long, out PamojaGatewayStationXtime)

Takes a station clock value apart.

public static PamojaStatus pamoja_gateway_station_xtime_parts(long value, out PamojaGatewayStationXtime outParts)

Parameters

value long
outParts PamojaGatewayStationXtime

Returns

PamojaStatus

pamoja_gateway_tx_ack(ushort, ReadOnlySpan<byte>, byte, out nint)

Builds the TX_ACK that reports what became of a PULL_RESP.

public static PamojaStatus pamoja_gateway_tx_ack(ushort token, ReadOnlySpan<byte> gateway, byte status, out nint outPacket)

Parameters

token ushort
gateway ReadOnlySpan<byte>
status byte
outPacket nint

Returns

PamojaStatus

Adds a packet the gateway heard.

public static PamojaStatus pamoja_gateway_uplink_add_rxpk(nint uplink, PamojaGatewayRxpk packet, ReadOnlySpan<byte> payload, nuint payloadLen)

Parameters

uplink nint
packet PamojaGatewayRxpk
payload ReadOnlySpan<byte>
payloadLen nuint

Returns

PamojaStatus

Releases an uplink that will not be sent.

public static extern void pamoja_gateway_uplink_free(nint uplink)

Parameters

uplink nint

Creates an empty uplink for a PUSH_DATA to carry.

public static extern nint pamoja_gateway_uplink_new()

Returns

nint

Sets the gateway's status report on an uplink.

public static extern PamojaStatus pamoja_gateway_uplink_set_stat(nint uplink, PamojaGatewayStat status)

Parameters

uplink nint
status PamojaGatewayStat

Returns

PamojaStatus

pamoja_geofence_contains(nint, PamojaCoordinate)

Reports whether a fix lies inside a geofence.

public static bool pamoja_geofence_contains(nint geofence, PamojaCoordinate point)

Parameters

geofence nint
point PamojaCoordinate

Returns

bool

pamoja_geofence_free(nint)

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

public static extern void pamoja_geofence_free(nint geofence)

Parameters

geofence nint

pamoja_geofence_new(PamojaCoordinate, double)

Creates a circular geofence.

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

Parameters

center PamojaCoordinate
radiusM double

Returns

nint

pamoja_geofence_update(nint, PamojaCoordinate)

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

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

Parameters

geofence nint
point PamojaCoordinate

Returns

PamojaBoundary

pamoja_gpio_line_drive(nint, PamojaPinLevel)

Drives an output line to a level.

public static extern PamojaStatus pamoja_gpio_line_drive(nint line, PamojaPinLevel level)

Parameters

line nint
level PamojaPinLevel

Returns

PamojaStatus

pamoja_gpio_line_free(nint)

Lets a line go, handing it back to the kernel.

public static extern void pamoja_gpio_line_free(nint line)

Parameters

line nint

pamoja_gpio_line_open_input(string, uint, out nint)

Opens a line on a Linux board as an input.

public static PamojaStatus pamoja_gpio_line_open_input(string chip, uint line, out nint outLine)

Parameters

chip string
line uint
outLine nint

Returns

PamojaStatus

pamoja_gpio_line_open_output(string, uint, PamojaPinLevel, out nint)

Opens a line on a Linux board as an output, driving an initial level.

public static PamojaStatus pamoja_gpio_line_open_output(string chip, uint line, PamojaPinLevel initial, out nint outLine)

Parameters

chip string
line uint
initial PamojaPinLevel
outLine nint

Returns

PamojaStatus

pamoja_gpio_line_read(nint, out PamojaPinLevel)

Reads the level on a line now.

public static PamojaStatus pamoja_gpio_line_read(nint line, out PamojaPinLevel outLevel)

Parameters

line nint
outLevel PamojaPinLevel

Returns

PamojaStatus

pamoja_hdc1080_celsius(ushort)

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

public static extern float pamoja_hdc1080_celsius(ushort raw)

Parameters

raw ushort

Returns

float

pamoja_hdc1080_config_from_register(ushort, out PamojaHdc1080Config)

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

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

Parameters

raw ushort
outConfig PamojaHdc1080Config

Returns

PamojaStatus

pamoja_hdc1080_config_to_register(PamojaHdc1080Config, out ushort)

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

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

Parameters

config PamojaHdc1080Config
outRegister ushort

Returns

PamojaStatus

pamoja_hdc1080_configuration(nint, out PamojaHdc1080Config)

Copies the configuration an HDC1080 driver writes.

public static PamojaStatus pamoja_hdc1080_configuration(nint sensor, out PamojaHdc1080Config outConfig)

Parameters

sensor nint
outConfig PamojaHdc1080Config

Returns

PamojaStatus

pamoja_hdc1080_conversion_time_micros(PamojaHdc1080Config, out uint)

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

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

Parameters

config PamojaHdc1080Config
outMicros uint

Returns

PamojaStatus

pamoja_hdc1080_free(nint)

Releases an HDC1080 driver. Passing null is a no-op.

public static extern void pamoja_hdc1080_free(nint sensor)

Parameters

sensor nint

pamoja_hdc1080_heater(nint, bool)

Switches the HDC1080's heater on or off.

public static PamojaStatus pamoja_hdc1080_heater(nint sensor, bool on)

Parameters

sensor nint
on bool

Returns

PamojaStatus

pamoja_hdc1080_humidity_conversion_micros(byte, out uint)

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

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

Parameters

bits byte
outMicros uint

Returns

PamojaStatus

pamoja_hdc1080_humidity_register(uint)

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

public static extern ushort pamoja_hdc1080_humidity_register(uint milliPercent)

Parameters

milliPercent uint

Returns

ushort

pamoja_hdc1080_init(nint)

Identifies and configures an HDC1080.

public static extern PamojaStatus pamoja_hdc1080_init(nint sensor)

Parameters

sensor nint

Returns

PamojaStatus

pamoja_hdc1080_measure(nint, out PamojaHdc1080Measurement)

Runs one HDC1080 acquisition of both channels.

public static PamojaStatus pamoja_hdc1080_measure(nint sensor, out PamojaHdc1080Measurement outMeasurement)

Parameters

sensor nint
outMeasurement PamojaHdc1080Measurement

Returns

PamojaStatus

pamoja_hdc1080_measurement_bytes(ushort, ushort, Span<byte>)

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

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

Parameters

temperatureRaw ushort
humidityRaw ushort
outBytes Span<byte>

Returns

PamojaStatus

pamoja_hdc1080_measurement_from_physical(int, uint, out PamojaHdc1080Measurement)

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

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

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

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

Parameters

milliCelsius int
milliPercent uint
outMeasurement PamojaHdc1080Measurement

Returns

PamojaStatus

pamoja_hdc1080_milli_celsius(ushort)

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

public static extern int pamoja_hdc1080_milli_celsius(ushort raw)

Parameters

raw ushort

Returns

int

pamoja_hdc1080_milli_percent(ushort)

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

public static extern uint pamoja_hdc1080_milli_percent(ushort raw)

Parameters

raw ushort

Returns

uint

pamoja_hdc1080_new(nint, PamojaHdc1080Settings, out nint)

Creates an HDC1080 driver on a bus.

public static PamojaStatus pamoja_hdc1080_new(nint bus, PamojaHdc1080Settings settings, out nint outSensor)

Parameters

bus nint
settings PamojaHdc1080Settings
outSensor nint

Returns

PamojaStatus

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

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

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

Parameters

bytes ReadOnlySpan<byte>
bytesLen nuint
outMeasurement PamojaHdc1080Measurement

Returns

PamojaStatus

pamoja_hdc1080_relative_humidity(ushort)

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

public static extern float pamoja_hdc1080_relative_humidity(ushort raw)

Parameters

raw ushort

Returns

float

pamoja_hdc1080_serial_id(ushort, ushort, ushort)

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

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

Parameters

high ushort
mid ushort
low ushort

Returns

ulong

pamoja_hdc1080_serial_id_registers(ulong, out ushort)

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

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

Parameters

serial ulong
outRegisters ushort

Returns

PamojaStatus

pamoja_hdc1080_settings_default()

Returns the settings an HDC1080 driver starts with.

public static extern PamojaHdc1080Settings pamoja_hdc1080_settings_default()

Returns

PamojaHdc1080Settings

pamoja_hdc1080_sim_part()

Creates a simulated HDC1080 reading its default temperature and humidity.

public static extern nint pamoja_hdc1080_sim_part()

Returns

nint

pamoja_hdc1080_sim_reporting(float, float)

Creates a simulated HDC1080 that reads what it is asked to.

public static extern nint pamoja_hdc1080_sim_reporting(float celsius, float relativeHumidity)

Parameters

celsius float
relativeHumidity float

Returns

nint

pamoja_hdc1080_temperature_conversion_micros(byte, out uint)

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

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

Parameters

bits byte
outMicros uint

Returns

PamojaStatus

pamoja_hdc1080_temperature_register(int)

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

public static extern ushort pamoja_hdc1080_temperature_register(int milliCelsius)

Parameters

milliCelsius int

Returns

ushort

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

Writes the address bytes a controller puts on the bus.

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

Parameters

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

Returns

PamojaStatus

pamoja_i2c_address_frame_len(PamojaI2cAddress)

Returns how many bytes an address frame occupies.

public static extern nuint pamoja_i2c_address_frame_len(PamojaI2cAddress address)

Parameters

address PamojaI2cAddress

Returns

nuint

pamoja_i2c_address_is_general_call(PamojaI2cAddress)

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

public static bool pamoja_i2c_address_is_general_call(PamojaI2cAddress address)

Parameters

address PamojaI2cAddress

Returns

bool

pamoja_i2c_address_is_reserved(PamojaI2cAddress)

Reports whether an address falls in a reserved range.

public static bool pamoja_i2c_address_is_reserved(PamojaI2cAddress address)

Parameters

address PamojaI2cAddress

Returns

bool

pamoja_i2c_address_seven_bit(byte, out PamojaI2cAddress)

Validates a 7-bit I2C address.

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

Parameters

address byte
outAddress PamojaI2cAddress

Returns

PamojaStatus

pamoja_i2c_address_ten_bit(ushort, out PamojaI2cAddress)

Validates a 10-bit I2C address.

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

Parameters

address ushort
outAddress PamojaI2cAddress

Returns

PamojaStatus

pamoja_i2c_bus_attach(nint, nint)

Puts a copy of a part on a simulated bus.

public static extern PamojaStatus pamoja_i2c_bus_attach(nint bus, nint part)

Parameters

bus nint
part nint

Returns

PamojaStatus

pamoja_i2c_bus_free(nint)

Releases the caller's share of a bus. Passing null is a no-op.

public static extern void pamoja_i2c_bus_free(nint bus)

Parameters

bus nint

pamoja_i2c_bus_kind(nint)

Returns what answers on a bus.

public static extern byte pamoja_i2c_bus_kind(nint bus)

Parameters

bus nint

Returns

byte

pamoja_i2c_bus_open(string, out nint)

Opens the kernel's I2C adapter.

public static PamojaStatus pamoja_i2c_bus_open(string path, out nint outBus)

Parameters

path string
outBus nint

Returns

PamojaStatus

pamoja_i2c_bus_part(nint, byte)

Copies what a simulated part holds now, or returns null.

public static extern nint pamoja_i2c_bus_part(nint bus, byte address)

Parameters

bus nint
address byte

Returns

nint

pamoja_i2c_bus_read(nint, byte, Span<byte>, nuint)

Reads bytes from a part, in one transaction.

public static PamojaStatus pamoja_i2c_bus_read(nint bus, byte address, Span<byte> outBytes, nuint len)

Parameters

bus nint
address byte
outBytes Span<byte>
len nuint

Returns

PamojaStatus

pamoja_i2c_bus_remaining(nint, out nuint)

Reports how many steps a scripted bus has left.

public static bool pamoja_i2c_bus_remaining(nint bus, out nuint outRemaining)

Parameters

bus nint
outRemaining nuint

Returns

bool

pamoja_i2c_bus_scripted(nint)

Creates a bus that plays a copy of a script.

public static extern nint pamoja_i2c_bus_scripted(nint script)

Parameters

script nint

Returns

nint

pamoja_i2c_bus_simulated()

Creates a simulated bus with no parts on it yet.

public static extern nint pamoja_i2c_bus_simulated()

Returns

nint

pamoja_i2c_bus_transfers(nint)

Returns how many transfers have been made on a bus.

public static extern nuint pamoja_i2c_bus_transfers(nint bus)

Parameters

bus nint

Returns

nuint

pamoja_i2c_bus_waited_micros(nint)

Returns how long the drivers on a bus have asked to wait, in microseconds.

public static extern ulong pamoja_i2c_bus_waited_micros(nint bus)

Parameters

bus nint

Returns

ulong

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

Writes bytes to a part, in one transaction.

public static PamojaStatus pamoja_i2c_bus_write(nint bus, byte address, ReadOnlySpan<byte> bytes, nuint len)

Parameters

bus nint
address byte
bytes ReadOnlySpan<byte>
len nuint

Returns

PamojaStatus

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

Writes bytes and reads the reply in one transaction.

public static PamojaStatus pamoja_i2c_bus_write_read(nint bus, byte address, ReadOnlySpan<byte> bytes, nuint len, Span<byte> outBytes, nuint outLen)

Parameters

bus nint
address byte
bytes ReadOnlySpan<byte>
len nuint
outBytes Span<byte>
outLen nuint

Returns

PamojaStatus

pamoja_i2c_command_part_new(byte, nuint)

Creates a simulated part answering at one address that takes commands.

public static extern nint pamoja_i2c_command_part_new(byte address, nuint width)

Parameters

address byte
width nuint

Returns

nint

pamoja_i2c_part_address(nint)

Returns the address a part answers to.

public static extern byte pamoja_i2c_part_address(nint part)

Parameters

part nint

Returns

byte

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

Gives a part that takes commands the reply one command leaves.

public static PamojaStatus pamoja_i2c_part_answer(nint part, ReadOnlySpan<byte> command, nuint commandLen, ReadOnlySpan<byte> reply, nuint replyLen)

Parameters

part nint
command ReadOnlySpan<byte>
commandLen nuint
reply ReadOnlySpan<byte>
replyLen nuint

Returns

PamojaStatus

pamoja_i2c_part_free(nint)

Releases a part. Passing null is a no-op.

public static extern void pamoja_i2c_part_free(nint part)

Parameters

part nint

pamoja_i2c_part_kind(nint)

Returns which kind of part a handle holds.

public static extern byte pamoja_i2c_part_kind(nint part)

Parameters

part nint

Returns

byte

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

Puts bytes in a part, from a register on.

public static PamojaStatus pamoja_i2c_part_load(nint part, byte first, ReadOnlySpan<byte> bytes, nuint len)

Parameters

part nint
first byte
bytes ReadOnlySpan<byte>
len nuint

Returns

PamojaStatus

pamoja_i2c_part_new(byte)

Creates a simulated part answering at one address from registers a byte wide.

public static extern nint pamoja_i2c_part_new(byte address)

Parameters

address byte

Returns

nint

pamoja_i2c_part_read(nint, byte, Span<byte>, nuint)

Reads consecutive registers of a part, from one register on.

public static PamojaStatus pamoja_i2c_part_read(nint part, byte first, Span<byte> outBytes, nuint len)

Parameters

part nint
first byte
outBytes Span<byte>
len nuint

Returns

PamojaStatus

pamoja_i2c_part_read_only(nint, byte, ushort)

Marks bits of one sixteen-bit register as the part's to set.

public static extern PamojaStatus pamoja_i2c_part_read_only(nint part, byte register, ushort mask)

Parameters

part nint
register byte
mask ushort

Returns

PamojaStatus

pamoja_i2c_part_received(nint, nuint)

Copies one write a part that takes commands received, or returns null.

public static extern nint pamoja_i2c_part_received(nint part, nuint index)

Parameters

part nint
index nuint

Returns

nint

pamoja_i2c_part_received_count(nint)

Returns how many writes a part that takes commands has received.

public static extern nuint pamoja_i2c_part_received_count(nint part)

Parameters

part nint

Returns

nuint

pamoja_i2c_part_register(nint, byte)

Reads what one of a part's registers holds.

public static extern byte pamoja_i2c_part_register(nint part, byte register)

Parameters

part nint
register byte

Returns

byte

pamoja_i2c_part_set_word(nint, byte, ushort)

Puts a value in one register of a part whose registers are sixteen bits wide.

public static extern PamojaStatus pamoja_i2c_part_set_word(nint part, byte register, ushort value)

Parameters

part nint
register byte
value ushort

Returns

PamojaStatus

pamoja_i2c_part_transfers(nint)

Returns how many transfers a part has served.

public static extern nuint pamoja_i2c_part_transfers(nint part)

Parameters

part nint

Returns

nuint

pamoja_i2c_part_word(nint, byte)

Reads what one register of a part whose registers are sixteen bits wide holds.

public static extern ushort pamoja_i2c_part_word(nint part, byte register)

Parameters

part nint
register byte

Returns

ushort

pamoja_i2c_script_fault(nint, byte, byte)

Adds a step: the next transfer to the address fails.

public static extern PamojaStatus pamoja_i2c_script_fault(nint script, byte address, byte fault)

Parameters

script nint
address byte
fault byte

Returns

PamojaStatus

pamoja_i2c_script_free(nint)

Releases a script. Passing null is a no-op.

public static extern void pamoja_i2c_script_free(nint script)

Parameters

script nint

pamoja_i2c_script_len(nint)

Returns how many steps a script holds.

public static extern nuint pamoja_i2c_script_len(nint script)

Parameters

script nint

Returns

nuint

pamoja_i2c_script_new()

Creates an empty script.

public static extern nint pamoja_i2c_script_new()

Returns

nint

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

Adds a step: the driver reads from the address and receives the reply.

public static PamojaStatus pamoja_i2c_script_read(nint script, byte address, ReadOnlySpan<byte> reply, nuint len)

Parameters

script nint
address byte
reply ReadOnlySpan<byte>
len nuint

Returns

PamojaStatus

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

Adds a step: the driver writes exactly these bytes to the address.

public static PamojaStatus pamoja_i2c_script_write(nint script, byte address, ReadOnlySpan<byte> bytes, nuint len)

Parameters

script nint
address byte
bytes ReadOnlySpan<byte>
len nuint

Returns

PamojaStatus

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

Adds a step: a write and then a read in one transaction.

public static PamojaStatus pamoja_i2c_script_write_read(nint script, byte address, ReadOnlySpan<byte> bytes, nuint len, ReadOnlySpan<byte> reply, nuint replyLen)

Parameters

script nint
address byte
bytes ReadOnlySpan<byte>
len nuint
reply ReadOnlySpan<byte>
replyLen nuint

Returns

PamojaStatus

pamoja_i2c_word_part_new(byte)

Creates a simulated part answering at one address from registers sixteen bits wide.

public static extern nint pamoja_i2c_word_part_new(byte address)

Parameters

address byte

Returns

nint

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

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

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

Parameters

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

Returns

PamojaStatus

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

Settles an image against its manifest, consuming the verifier.

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

Parameters

verifier nint
outSize uint
outDigest Span<byte>

Returns

PamojaStatus

pamoja_image_verifier_free(nint)

Releases a verifier handle that will not be settled.

public static extern void pamoja_image_verifier_free(nint verifier)

Parameters

verifier nint

pamoja_image_verifier_new(PamojaManifest)

Creates a verifier that hashes an image against a manifest.

public static extern nint pamoja_image_verifier_new(PamojaManifest manifest)

Parameters

manifest PamojaManifest

Returns

nint

pamoja_image_verifier_update(nint, ReadOnlySpan<byte>, nuint)

Takes the next piece of the image.

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

Parameters

verifier nint
chunk ReadOnlySpan<byte>
len nuint

Returns

PamojaStatus

pamoja_imu_tilt_from_accel(double, double, double)

Computes roll and pitch from a three-axis accelerometer at rest.

public static extern PamojaTilt pamoja_imu_tilt_from_accel(double ax, double ay, double az)

Parameters

ax double
ay double
az double

Returns

PamojaTilt

pamoja_ina219_adc_conversion_micros(byte)

Returns how long one INA219 conversion takes at an ADC code, in microseconds.

public static extern uint pamoja_ina219_adc_conversion_micros(byte code)

Parameters

code byte

Returns

uint

pamoja_ina219_address(byte, byte, out byte)

Returns the I2C address an INA219's A1 and A0 pin codes select.

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

Parameters

a1 byte
a0 byte
outAddress byte

Returns

PamojaStatus

pamoja_ina219_bus_millivolts(ushort)

Converts a raw INA219 bus-voltage register to millivolts.

public static extern uint pamoja_ina219_bus_millivolts(ushort raw)

Parameters

raw ushort

Returns

uint

pamoja_ina219_bus_register(uint)

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

public static extern ushort pamoja_ina219_bus_register(uint millivolts)

Parameters

millivolts uint

Returns

ushort

pamoja_ina219_calibration(uint, uint)

Computes the INA219 calibration register.

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

Parameters

currentLsbMicroamps uint
shuntMilliohms uint

Returns

ushort

pamoja_ina219_calibration_word(nint)

Returns the calibration word an INA219 driver programs.

public static extern ushort pamoja_ina219_calibration_word(nint sensor)

Parameters

sensor nint

Returns

ushort

pamoja_ina219_config_bits(PamojaIna219Config)

Assembles an INA219 configuration register value.

public static extern ushort pamoja_ina219_config_bits(PamojaIna219Config config)

Parameters

config PamojaIna219Config

Returns

ushort

pamoja_ina219_config_from_bits(ushort, out PamojaIna219Config)

Parses an INA219 configuration register value.

public static PamojaStatus pamoja_ina219_config_from_bits(ushort bits, out PamojaIna219Config outConfig)

Parameters

bits ushort
outConfig PamojaIna219Config

Returns

PamojaStatus

pamoja_ina219_conversion_micros(PamojaIna219Config)

Returns how long one INA219 conversion cycle takes, in microseconds.

public static extern uint pamoja_ina219_conversion_micros(PamojaIna219Config config)

Parameters

config PamojaIna219Config

Returns

uint

pamoja_ina219_conversion_ready(ushort)

Reports whether an INA219 register says a conversion is ready.

public static bool pamoja_ina219_conversion_ready(ushort raw)

Parameters

raw ushort

Returns

bool

pamoja_ina219_current_lsb(nint)

Returns the current step an INA219 driver programs.

public static extern uint pamoja_ina219_current_lsb(nint sensor)

Parameters

sensor nint

Returns

uint

pamoja_ina219_current_microamps(short, uint)

Converts a raw INA219 current register to microamps.

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

Parameters

raw short
currentLsbMicroamps uint

Returns

int

pamoja_ina219_current_register(int, uint)

Builds the INA219 current register for a current.

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

Parameters

microamps int
currentLsbMicroamps uint

Returns

short

pamoja_ina219_free(nint)

Releases an INA219 driver. Passing null is a no-op.

public static extern void pamoja_ina219_free(nint sensor)

Parameters

sensor nint

pamoja_ina219_gain_range_millivolts(byte)

Returns the shunt-voltage range an INA219 gain code selects, in millivolts.

public static extern ushort pamoja_ina219_gain_range_millivolts(byte code)

Parameters

code byte

Returns

ushort

pamoja_ina219_init(nint)

Resets, configures, and calibrates an INA219.

public static extern PamojaStatus pamoja_ina219_init(nint sensor)

Parameters

sensor nint

Returns

PamojaStatus

pamoja_ina219_math_overflow(ushort)

Reports whether an INA219 register flags a math overflow.

public static bool pamoja_ina219_math_overflow(ushort raw)

Parameters

raw ushort

Returns

bool

pamoja_ina219_measure(nint, out PamojaIna219Reading)

Runs one INA219 conversion and reads every result.

public static PamojaStatus pamoja_ina219_measure(nint sensor, out PamojaIna219Reading outReading)

Parameters

sensor nint
outReading PamojaIna219Reading

Returns

PamojaStatus

pamoja_ina219_minimum_current_lsb_microamps(uint)

Returns the smallest current resolution covering an expected maximum.

public static extern uint pamoja_ina219_minimum_current_lsb_microamps(uint maxExpectedMicroamps)

Parameters

maxExpectedMicroamps uint

Returns

uint

pamoja_ina219_new(nint, byte, PamojaIna219Settings, out nint)

Creates an INA219 driver on a bus.

public static PamojaStatus pamoja_ina219_new(nint bus, byte address, PamojaIna219Settings settings, out nint outSensor)

Parameters

bus nint
address byte
settings PamojaIna219Settings
outSensor nint

Returns

PamojaStatus

pamoja_ina219_power_microwatts(ushort, uint)

Converts a raw INA219 power register to microwatts.

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

Parameters

raw ushort
currentLsbMicroamps uint

Returns

uint

pamoja_ina219_power_register(uint, uint)

Builds the INA219 power register for a power.

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

Parameters

microwatts uint
currentLsbMicroamps uint

Returns

ushort

pamoja_ina219_settings_default()

Returns the settings an INA219 driver starts with.

public static extern PamojaIna219Settings pamoja_ina219_settings_default()

Returns

PamojaIna219Settings

pamoja_ina219_shunt_microvolts(short)

Converts a raw INA219 shunt-voltage register to microvolts.

public static extern int pamoja_ina219_shunt_microvolts(short raw)

Parameters

raw short

Returns

int

pamoja_ina219_shunt_register(int)

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

public static extern short pamoja_ina219_shunt_register(int microvolts)

Parameters

microvolts int

Returns

short

pamoja_ina219_sim_part(byte)

Creates a simulated INA219 carrying its default load.

public static extern nint pamoja_ina219_sim_part(byte address)

Parameters

address byte

Returns

nint

pamoja_ina219_sim_reporting(byte, uint, uint, uint, int)

Creates a simulated INA219 that reads what it is asked to.

public static extern nint pamoja_ina219_sim_reporting(byte address, uint shuntMilliohms, uint maxMicroamps, uint busMillivolts, int microamps)

Parameters

address byte
shuntMilliohms uint
maxMicroamps uint
busMillivolts uint
microamps int

Returns

nint

pamoja_ina226_active_alert_function(PamojaIna226MaskEnable, out PamojaIna226AlertFunction)

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

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

Parameters

mask PamojaIna226MaskEnable
outFunction PamojaIna226AlertFunction

Returns

bool

pamoja_ina226_address(byte, byte, out byte)

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

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

Parameters

a1 byte
a0 byte
outAddress byte

Returns

PamojaStatus

pamoja_ina226_averaging_samples(byte)

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

public static extern ushort pamoja_ina226_averaging_samples(byte code)

Parameters

code byte

Returns

ushort

pamoja_ina226_bus_microvolts(ushort)

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

public static extern uint pamoja_ina226_bus_microvolts(ushort raw)

Parameters

raw ushort

Returns

uint

pamoja_ina226_bus_register(uint)

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

public static extern ushort pamoja_ina226_bus_register(uint microvolts)

Parameters

microvolts uint

Returns

ushort

pamoja_ina226_bus_volts(ushort)

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

public static extern float pamoja_ina226_bus_volts(ushort raw)

Parameters

raw ushort

Returns

float

pamoja_ina226_calibration(uint, uint)

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

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

Parameters

currentLsbMicroamps uint
shuntMilliohms uint

Returns

ushort

pamoja_ina226_calibration_word(nint)

Returns the calibration word an INA226 driver programs.

public static extern ushort pamoja_ina226_calibration_word(nint sensor)

Parameters

sensor nint

Returns

ushort

pamoja_ina226_config_from_register(ushort, out PamojaIna226Config)

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

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

Parameters

raw ushort
outConfig PamojaIna226Config

Returns

PamojaStatus

pamoja_ina226_config_to_register(PamojaIna226Config)

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

public static extern ushort pamoja_ina226_config_to_register(PamojaIna226Config config)

Parameters

config PamojaIna226Config

Returns

ushort

pamoja_ina226_conversion_micros(byte)

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

public static extern uint pamoja_ina226_conversion_micros(byte code)

Parameters

code byte

Returns

uint

pamoja_ina226_current_amps(short, uint)

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

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

Parameters

raw short
currentLsbMicroamps uint

Returns

float

pamoja_ina226_current_lsb(nint)

Returns the current step an INA226 driver programs.

public static extern uint pamoja_ina226_current_lsb(nint sensor)

Parameters

sensor nint

Returns

uint

pamoja_ina226_current_microamps(short, uint)

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

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

Parameters

raw short
currentLsbMicroamps uint

Returns

int

pamoja_ina226_current_register(int, uint)

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

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

Parameters

microamps int
currentLsbMicroamps uint

Returns

short

pamoja_ina226_current_register_from_shunt(short, ushort)

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

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

Parameters

shunt short
calibration ushort

Returns

short

pamoja_ina226_die_id(ushort, out PamojaIna226DieId)

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

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

Parameters

raw ushort
outDieId PamojaIna226DieId

Returns

PamojaStatus

pamoja_ina226_free(nint)

Releases an INA226 driver. Passing null is a no-op.

public static extern void pamoja_ina226_free(nint sensor)

Parameters

sensor nint

pamoja_ina226_identify(ushort, ushort, out PamojaIna226DieId)

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

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

Parameters

manufacturerId ushort
dieId ushort
outDieId PamojaIna226DieId

Returns

PamojaStatus

pamoja_ina226_identity(nint, out PamojaIna226DieId)

Reports the die id an INA226 driver read at initialization.

public static bool pamoja_ina226_identity(nint sensor, out PamojaIna226DieId outDieId)

Parameters

sensor nint
outDieId PamojaIna226DieId

Returns

bool

pamoja_ina226_init(nint)

Resets, identifies, configures, and calibrates an INA226.

public static extern PamojaStatus pamoja_ina226_init(nint sensor)

Parameters

sensor nint

Returns

PamojaStatus

pamoja_ina226_is_continuous(byte)

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

public static bool pamoja_ina226_is_continuous(byte code)

Parameters

code byte

Returns

bool

pamoja_ina226_mask_enable_from_register(ushort, out PamojaIna226MaskEnable)

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

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

Parameters

raw ushort
outMask PamojaIna226MaskEnable

Returns

PamojaStatus

pamoja_ina226_mask_enable_to_register(PamojaIna226MaskEnable)

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

public static extern ushort pamoja_ina226_mask_enable_to_register(PamojaIna226MaskEnable mask)

Parameters

mask PamojaIna226MaskEnable

Returns

ushort

pamoja_ina226_measure(nint, out PamojaIna226Reading)

Runs one INA226 conversion and reads every result.

public static PamojaStatus pamoja_ina226_measure(nint sensor, out PamojaIna226Reading outReading)

Parameters

sensor nint
outReading PamojaIna226Reading

Returns

PamojaStatus

pamoja_ina226_measures_bus(byte)

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

public static bool pamoja_ina226_measures_bus(byte code)

Parameters

code byte

Returns

bool

pamoja_ina226_measures_shunt(byte)

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

public static bool pamoja_ina226_measures_shunt(byte code)

Parameters

code byte

Returns

bool

pamoja_ina226_minimum_current_lsb_microamps(uint)

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

public static extern uint pamoja_ina226_minimum_current_lsb_microamps(uint maxExpectedMicroamps)

Parameters

maxExpectedMicroamps uint

Returns

uint

pamoja_ina226_new(nint, byte, PamojaIna226Settings, out nint)

Creates an INA226 driver on a bus.

public static PamojaStatus pamoja_ina226_new(nint bus, byte address, PamojaIna226Settings settings, out nint outSensor)

Parameters

bus nint
address byte
settings PamojaIna226Settings
outSensor nint

Returns

PamojaStatus

pamoja_ina226_power_microwatts(ushort, uint)

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

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

Parameters

raw ushort
currentLsbMicroamps uint

Returns

uint

pamoja_ina226_power_register(uint, uint)

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

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

Parameters

microwatts uint
currentLsbMicroamps uint

Returns

ushort

pamoja_ina226_power_register_from_current(short, ushort)

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

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

Parameters

current short
bus ushort

Returns

ushort

pamoja_ina226_power_watts(ushort, uint)

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

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

Parameters

raw ushort
currentLsbMicroamps uint

Returns

float

pamoja_ina226_set_alert(nint, PamojaIna226MaskEnable, ushort)

Programs the INA226's alert pin.

public static extern PamojaStatus pamoja_ina226_set_alert(nint sensor, PamojaIna226MaskEnable mask, ushort limit)

Parameters

sensor nint
mask PamojaIna226MaskEnable
limit ushort

Returns

PamojaStatus

pamoja_ina226_settings_default()

Returns the settings an INA226 driver starts with.

public static extern PamojaIna226Settings pamoja_ina226_settings_default()

Returns

PamojaIna226Settings

pamoja_ina226_shunt_millivolts(short)

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

public static extern float pamoja_ina226_shunt_millivolts(short raw)

Parameters

raw short

Returns

float

pamoja_ina226_shunt_nanovolts(short)

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

public static extern int pamoja_ina226_shunt_nanovolts(short raw)

Parameters

raw short

Returns

int

pamoja_ina226_shunt_register(int)

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

public static extern short pamoja_ina226_shunt_register(int nanovolts)

Parameters

nanovolts int

Returns

short

pamoja_ina226_sim_part(byte)

Creates a simulated INA226 carrying its default load.

public static extern nint pamoja_ina226_sim_part(byte address)

Parameters

address byte

Returns

nint

pamoja_ina226_sim_reporting(byte, uint, uint, uint, int)

Creates a simulated INA226 that reads what it is asked to.

public static extern nint pamoja_ina226_sim_reporting(byte address, uint shuntMilliohms, uint maxMicroamps, uint busMicrovolts, int microamps)

Parameters

address byte
shuntMilliohms uint
maxMicroamps uint
busMicrovolts uint
microamps int

Returns

nint

pamoja_ina226_update_micros(PamojaIna226Config)

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

public static extern uint pamoja_ina226_update_micros(PamojaIna226Config config)

Parameters

config PamojaIna226Config

Returns

uint

pamoja_kalman_estimate(nint)

Reads a Kalman filter's current estimate.

public static extern float pamoja_kalman_estimate(nint kalman)

Parameters

kalman nint

Returns

float

pamoja_kalman_free(nint)

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

public static extern void pamoja_kalman_free(nint kalman)

Parameters

kalman nint

pamoja_kalman_new(float, float, float)

Creates a one-dimensional Kalman filter.

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

Parameters

processNoise float
measurementNoise float
initial float

Returns

nint

pamoja_kalman_update(nint, float)

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

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

Parameters

kalman nint
reading float

Returns

float

pamoja_keyexpr_canonize(string)

Rewrites a key expression into its canonical form.

public static nint pamoja_keyexpr_canonize(string key)

Parameters

key string

Returns

nint

pamoja_keyexpr_includes(string, string)

Reports whether one key expression selects every key another selects.

public static bool pamoja_keyexpr_includes(string a, string b)

Parameters

a string
b string

Returns

bool

pamoja_keyexpr_intersects(string, string)

Reports whether two key expressions share at least one key.

public static bool pamoja_keyexpr_intersects(string a, string b)

Parameters

a string
b string

Returns

bool

pamoja_keyexpr_is_canon(string)

Reports whether a key expression is already canonical.

public static bool pamoja_keyexpr_is_canon(string key)

Parameters

key string

Returns

bool

pamoja_keyexpr_is_valid(string)

Reports whether a key expression is well formed.

public static bool pamoja_keyexpr_is_valid(string key)

Parameters

key string

Returns

bool

pamoja_keyexpr_join(string, string)

Joins two key expressions with a slash and canonizes the result.

public static nint pamoja_keyexpr_join(string prefix, string suffix)

Parameters

prefix string
suffix string

Returns

nint

pamoja_keyexpr_matches(string, string)

Reports whether a pattern selects a key.

public static bool pamoja_keyexpr_matches(string pattern, string key)

Parameters

pattern string
key string

Returns

bool

pamoja_kit_deadband(float, float, float)

Holds a reading at a center while it stays within a band either side.

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

Parameters

value float
center float
width float

Returns

float

pamoja_ladder_buffered(nint, out nuint)

Reports how many messages a ladder has buffered.

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

Parameters

ladder nint
outCount nuint

Returns

PamojaStatus

pamoja_ladder_connect(nint)

Connects every rung of a ladder.

public static extern PamojaStatus pamoja_ladder_connect(nint ladder)

Parameters

ladder nint

Returns

PamojaStatus

pamoja_ladder_flush(nint, out nuint)

Replays the buffer of a ladder over its rungs.

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

Parameters

ladder nint
outSent nuint

Returns

PamojaStatus

pamoja_ladder_free(nint)

Releases a ladder handle.

public static extern void pamoja_ladder_free(nint ladder)

Parameters

ladder nint

pamoja_ladder_new(nint)

Creates a ladder buffering into a store.

public static extern nint pamoja_ladder_new(nint store)

Parameters

store nint

Returns

nint

pamoja_ladder_recv(nint, out nint)

Waits for the next message from any listening rung of a ladder.

public static PamojaStatus pamoja_ladder_recv(nint ladder, out nint outMessage)

Parameters

ladder nint
outMessage nint

Returns

PamojaStatus

pamoja_ladder_recv_within(nint, ulong, out nint, out bool)

Waits a limited time for the next message from any listening rung of a ladder.

public static PamojaStatus pamoja_ladder_recv_within(nint ladder, ulong timeoutMs, out nint outMessage, out bool outTimedOut)

Parameters

ladder nint
timeoutMs ulong
outMessage nint
outTimedOut bool

Returns

PamojaStatus

pamoja_ladder_rung(nint, nint)

Adds a rung to a ladder.

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

Parameters

ladder nint
transport nint

Returns

PamojaStatus

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

Sends a payload through a ladder.

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

Parameters

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

Returns

PamojaStatus

pamoja_ladder_subscribe(nint, nint)

Subscribes every listening rung of a ladder to a topic.

public static extern PamojaStatus pamoja_ladder_subscribe(nint ladder, nint topic)

Parameters

ladder nint
topic nint

Returns

PamojaStatus

Adds a rung that only sends to a ladder.

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

Parameters

ladder nint
transport nint

Returns

PamojaStatus

pamoja_last_error_message()

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

public static extern nint pamoja_last_error_message()

Returns

nint

pamoja_last_error_set(nint)

Records the text attached to the status a host callback returns.

public static extern void pamoja_last_error_set(nint message)

Parameters

message nint

pamoja_limits_apply(nint, PamojaTwist, float)

Bounds a command in speed and acceleration.

public static extern PamojaTwist pamoja_limits_apply(nint limits, PamojaTwist desired, float dt)

Parameters

limits nint
desired PamojaTwist
dt float

Returns

PamojaTwist

pamoja_limits_free(nint)

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

public static extern void pamoja_limits_free(nint limits)

Parameters

limits nint

pamoja_limits_new(float, float, float, float)

Creates limits on speed and acceleration, starting from rest.

public static extern nint pamoja_limits_new(float maxLinear, float maxAngular, float maxLinearAccel, float maxAngularAccel)

Parameters

maxLinear float
maxAngular float
maxLinearAccel float
maxAngularAccel float

Returns

nint

pamoja_limits_reset(nint)

Forgets the motion limits last allowed.

public static extern void pamoja_limits_reset(nint limits)

Parameters

limits nint

Returns the level a link cost calls for.

public static extern PamojaTelemetryLevel pamoja_link_cost_threshold(PamojaLinkCost cost)

Parameters

cost PamojaLinkCost

Returns

PamojaTelemetryLevel

pamoja_loopback_broker_free(nint)

Releases a broker handle.

public static extern void pamoja_loopback_broker_free(nint broker)

Parameters

broker nint

pamoja_loopback_broker_is_reachable(nint)

Reports whether a broker is in reach.

public static bool pamoja_loopback_broker_is_reachable(nint broker)

Parameters

broker nint

Returns

bool

pamoja_loopback_broker_new()

Creates an in-process broker.

public static extern nint pamoja_loopback_broker_new()

Returns

nint

pamoja_loopback_broker_set_reachable(nint, bool)

Takes a broker out of reach, or brings it back.

public static PamojaStatus pamoja_loopback_broker_set_reachable(nint broker, bool reachable)

Parameters

broker nint
reachable bool

Returns

PamojaStatus

pamoja_loopback_transport_connect(nint)

Marks a loopback link connected.

public static extern PamojaStatus pamoja_loopback_transport_connect(nint transport)

Parameters

transport nint

Returns

PamojaStatus

pamoja_loopback_transport_disconnect(nint)

Marks a loopback link disconnected.

public static extern void pamoja_loopback_transport_disconnect(nint transport)

Parameters

transport nint

pamoja_loopback_transport_free(nint)

Releases a loopback link handle.

public static extern void pamoja_loopback_transport_free(nint transport)

Parameters

transport nint

pamoja_loopback_transport_is_connected(nint)

Reports whether a loopback link is connected.

public static bool pamoja_loopback_transport_is_connected(nint transport)

Parameters

transport nint

Returns

bool

pamoja_loopback_transport_new(nint)

Creates a link to a broker.

public static extern nint pamoja_loopback_transport_new(nint broker)

Parameters

broker nint

Returns

nint

pamoja_loopback_transport_recv(nint, out nint)

Waits for the next message on a loopback link.

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

Parameters

transport nint
outMessage nint

Returns

PamojaStatus

pamoja_loopback_transport_recv_within(nint, ulong, out nint, out bool)

Waits a limited time for the next message on a loopback link.

public static PamojaStatus pamoja_loopback_transport_recv_within(nint transport, ulong timeoutMs, out nint outMessage, out bool outTimedOut)

Parameters

transport nint
timeoutMs ulong
outMessage nint
outTimedOut bool

Returns

PamojaStatus

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

Publishes a payload on a loopback link.

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

Parameters

transport nint
topic nint
payload ReadOnlySpan<byte>
payloadLen nuint

Returns

PamojaStatus

pamoja_loopback_transport_subscribe(nint, nint)

Subscribes a loopback link to a topic.

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

Parameters

transport nint
topic nint

Returns

PamojaStatus

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

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

Parameters

link PamojaLoraLink
payloadLen nuint

Returns

ulong

pamoja_lora_demodulator_snr_centi_db(byte)

Returns the SNR the LoRa demodulator needs, in hundredths of a dB.

public static extern int pamoja_lora_demodulator_snr_centi_db(byte spreadingFactor)

Parameters

spreadingFactor byte

Returns

int

pamoja_lora_fcc_digital_max_conducted_centi_dbm(int)

Returns the 47 CFR 15.247 limit for digital modulation, in hundredths of a dBm.

public static extern int pamoja_lora_fcc_digital_max_conducted_centi_dbm(int antennaGainCentiDbi)

Parameters

antennaGainCentiDbi int

Returns

int

pamoja_lora_fcc_hopping_max_conducted_centi_dbm(ushort, int)

Returns the 47 CFR 15.247 limit for frequency hopping, in hundredths of a dBm, or MinValue for fewer than 25 channels.

public static extern int pamoja_lora_fcc_hopping_max_conducted_centi_dbm(ushort hoppingChannels, int antennaGainCentiDbi)

Parameters

hoppingChannels ushort
antennaGainCentiDbi int

Returns

int

pamoja_lora_free_space_loss_centi_db(uint, uint)

Returns the free-space basic transmission loss, in hundredths of a dB.

public static extern int pamoja_lora_free_space_loss_centi_db(uint distanceM, uint frequencyHz)

Parameters

distanceM uint
frequencyHz uint

Returns

int

pamoja_lora_fresnel_radius_mm(uint, uint, uint)

Returns the radius of the first Fresnel ellipsoid, in millimeters.

public static extern uint pamoja_lora_fresnel_radius_mm(uint nearM, uint farM, uint frequencyHz)

Parameters

nearM uint
farM uint
frequencyHz uint

Returns

uint

Returns a LoRa link budget of 0 dBm between isotropic antennas.

public static extern PamojaLoraLinkBudget pamoja_lora_link_budget_default()

Returns

PamojaLoraLinkBudget

Returns the EIRP of a link budget, in hundredths of a dBm.

public static extern int pamoja_lora_link_budget_eirp_centi_dbm(PamojaLoraLinkBudget budget)

Parameters

budget PamojaLoraLinkBudget

Returns

int

Returns the margin a path leaves, in hundredths of a dB.

public static extern int pamoja_lora_link_budget_margin_centi_db(PamojaLoraLinkBudget budget, PamojaLoraLink link, int pathLossCentiDb)

Parameters

budget PamojaLoraLinkBudget
link PamojaLoraLink
pathLossCentiDb int

Returns

int

Returns the most path loss a link survives, in hundredths of a dB.

public static extern int pamoja_lora_link_budget_max_path_loss_centi_db(PamojaLoraLinkBudget budget, PamojaLoraLink link)

Parameters

budget PamojaLoraLinkBudget
link PamojaLoraLink

Returns

int

Returns the most transmit power under an EIRP ceiling, in hundredths of a dBm.

public static extern int pamoja_lora_link_budget_max_transmit_power_centi_dbm(PamojaLoraLinkBudget budget, int eirpCeilingCentiDbm)

Parameters

budget PamojaLoraLinkBudget
eirpCeilingCentiDbm int

Returns

int

Returns the power that reaches the receiving radio, in hundredths of a dBm.

public static extern int pamoja_lora_link_budget_received_centi_dbm(PamojaLoraLinkBudget budget, int pathLossCentiDb)

Parameters

budget PamojaLoraLinkBudget
pathLossCentiDb int

Returns

int

Returns the sensitivity of a budget on a link, in hundredths of a dBm.

public static extern int pamoja_lora_link_budget_sensitivity_centi_dbm(PamojaLoraLinkBudget budget, PamojaLoraLink link)

Parameters

budget PamojaLoraLinkBudget
link PamojaLoraLink

Returns

int

Returns LoRa link settings with the LoRa defaults filled in.

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

Parameters

spreadingFactor byte
bandwidthHz uint

Returns

PamojaLoraLink

Reports whether a link uses low data rate optimization.

public static bool pamoja_lora_low_data_rate_optimization(PamojaLoraLink link)

Parameters

link PamojaLoraLink

Returns

bool

Returns how many transmissions of a payload fit in an hour under a limit.

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

Parameters

link PamojaLoraLink
payloadLen nuint
dutyCyclePermille uint

Returns

ulong

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

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

Parameters

link PamojaLoraLink
payloadLen nuint
dutyCyclePermille uint

Returns

ulong

pamoja_lora_noise_floor_centi_dbm(uint)

Returns the thermal noise power in a channel, in hundredths of a dBm.

public static extern int pamoja_lora_noise_floor_centi_dbm(uint bandwidthHz)

Parameters

bandwidthHz uint

Returns

int

pamoja_lora_plan_builder_add_relay_channel(nint, in PamojaLoraRelayChannel)

Appends the next default relay channel to a plan.

public static PamojaStatus pamoja_lora_plan_builder_add_relay_channel(nint builder, in PamojaLoraRelayChannel channel)

Parameters

builder nint
channel PamojaLoraRelayChannel

Returns

PamojaStatus

pamoja_lora_plan_builder_build(nint, out nint)

Finishes a plan, consuming the builder.

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

Parameters

builder nint
outPlan nint

Returns

PamojaStatus

pamoja_lora_plan_builder_free(nint)

Releases a plan builder that will not be built.

public static extern void pamoja_lora_plan_builder_free(nint builder)

Parameters

builder nint

pamoja_lora_plan_builder_new(string, out nint)

Creates an empty plan builder.

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

Parameters

name string
outBuilder nint

Returns

PamojaStatus

pamoja_lora_plan_builder_push_backoff(nint, byte, byte)

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

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

Parameters

builder nint
hasLower byte
dataRate byte

Returns

PamojaStatus

pamoja_lora_plan_builder_push_channel_block(nint, uint, in PamojaLoraChannelBlock)

Appends a run of evenly spaced channels to the plan.

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

Parameters

builder nint
which uint
block PamojaLoraChannelBlock

Returns

PamojaStatus

pamoja_lora_plan_builder_push_data_rate(nint, uint, in PamojaLoraDataRate)

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

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

Parameters

builder nint
direction uint
rate PamojaLoraDataRate

Returns

PamojaStatus

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

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

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

Parameters

builder nint
table uint
present byte
macPayload ushort
application ushort

Returns

PamojaStatus

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

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

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

Parameters

builder nint
dwellLimited byte
offsets ReadOnlySpan<byte>
offsetsLen nuint

Returns

PamojaStatus

pamoja_lora_plan_builder_push_sub_band(nint, in PamojaLoraSubBand)

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

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

Parameters

builder nint
band PamojaLoraSubBand

Returns

PamojaStatus

pamoja_lora_plan_builder_set_beacon(nint, in PamojaLoraBeacon, byte)

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

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

Parameters

builder nint
beacon PamojaLoraBeacon
hasDwellTimeLimit byte

Returns

PamojaStatus

pamoja_lora_plan_builder_set_join_sequence(nint, byte)

Sets the order a device tries the join channels in.

public static extern PamojaStatus pamoja_lora_plan_builder_set_join_sequence(nint builder, byte sequence)

Parameters

builder nint
sequence byte

Returns

PamojaStatus

pamoja_lora_plan_builder_set_kind(nint, byte, byte)

Sets whether the plan's network creates channels, and its channel list numbering.

public static extern PamojaStatus pamoja_lora_plan_builder_set_kind(nint builder, byte kind, byte channelList)

Parameters

builder nint
kind byte
channelList byte

Returns

PamojaStatus

pamoja_lora_plan_builder_set_mask_controls(nint, ReadOnlySpan<PamojaLoraMaskControl>, nuint)

Sets what each ChMaskCntl value does.

public static PamojaStatus pamoja_lora_plan_builder_set_mask_controls(nint builder, ReadOnlySpan<PamojaLoraMaskControl> controls, nuint len)

Parameters

builder nint
controls ReadOnlySpan<PamojaLoraMaskControl>
len nuint

Returns

PamojaStatus

pamoja_lora_plan_builder_set_power(nint, sbyte, byte, byte)

Sets the plan's transmit-power ladder.

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

Parameters

builder nint
defaultMaxEirpDbm sbyte
txPowerStepDb byte
maxTxPowerIndex byte

Returns

PamojaStatus

pamoja_lora_plan_builder_set_power_reference(nint, byte, byte)

Sets what the plan's transmit power indexes count down from.

public static extern PamojaStatus pamoja_lora_plan_builder_set_power_reference(nint builder, byte reference, byte gainAllowanceDb)

Parameters

builder nint
reference byte
gainAllowanceDb byte

Returns

PamojaStatus

pamoja_lora_plan_builder_set_rx(nint, uint, byte, byte)

Sets the plan's receive windows.

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

Parameters

builder nint
rx2FrequencyHz uint
rx2DataRate byte
maxRx1DataRateOffset byte

Returns

PamojaStatus

pamoja_lora_plan_builder_set_tx_param_setup(nint, byte)

Sets whether devices on the plan answer TXParamSetupReq.

public static extern PamojaStatus pamoja_lora_plan_builder_set_tx_param_setup(nint builder, byte answered)

Parameters

builder nint
answered byte

Returns

PamojaStatus

pamoja_lora_plan_channel_block(nint, uint, ushort, out PamojaLoraChannelBlock)

Returns one of the plan's channel blocks.

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

Parameters

plan nint
which uint
index ushort
outBlock PamojaLoraChannelBlock

Returns

PamojaStatus

pamoja_lora_plan_channel_frequency_hz(nint, ushort, out uint)

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

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

Parameters

plan nint
channel ushort
outFrequencyHz uint

Returns

PamojaStatus

pamoja_lora_plan_data_rate(nint, uint, byte, out PamojaLoraDataRate)

Returns the data rate a number selects.

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

Parameters

plan nint
direction uint
dataRate byte
outRate PamojaLoraDataRate

Returns

PamojaStatus

Returns the frequency of one of the plan's numbered downlink channels.

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

Parameters

plan nint
channel ushort
outFrequencyHz uint

Returns

PamojaStatus

pamoja_lora_plan_duty_cycle_permille(nint, uint, out uint)

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

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

Parameters

plan nint
frequencyHz uint
outPermille uint

Returns

PamojaStatus

pamoja_lora_plan_for_cn470(uint, out nint)

Returns one of the CN470-510 channel plans.

public static PamojaStatus pamoja_lora_plan_for_cn470(uint which, out nint outPlan)

Parameters

which uint
outPlan nint

Returns

PamojaStatus

pamoja_lora_plan_for_region(uint, out nint)

Returns the published channel plan for a region.

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

Parameters

region uint
outPlan nint

Returns

PamojaStatus

pamoja_lora_plan_free(nint)

Releases a channel plan.

public static extern void pamoja_lora_plan_free(nint plan)

Parameters

plan nint

pamoja_lora_plan_info(nint, out PamojaLoraPlanInfo)

Reads the scalar facts of a plan in one call.

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

Parameters

plan nint
outInfo PamojaLoraPlanInfo

Returns

PamojaStatus

pamoja_lora_plan_join_plan(nint, ushort, out PamojaLoraJoinPlan)

Returns one run of join channels that selects a plan.

public static PamojaStatus pamoja_lora_plan_join_plan(nint plan, ushort index, out PamojaLoraJoinPlan outJoinPlan)

Parameters

plan nint
index ushort
outJoinPlan PamojaLoraJoinPlan

Returns

PamojaStatus

pamoja_lora_plan_join_plan_for_channel(nint, ushort, out ushort, out ushort)

Finds the run of join channels a join channel belongs to.

public static PamojaStatus pamoja_lora_plan_join_plan_for_channel(nint plan, ushort joinChannel, out ushort outIndex, out ushort outOffset)

Parameters

plan nint
joinChannel ushort
outIndex ushort
outOffset ushort

Returns

PamojaStatus

Returns the radio settings an uplink data rate selects.

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

Parameters

plan nint
dataRate byte
outLink PamojaLoraLink

Returns

PamojaStatus

pamoja_lora_plan_mask_control(nint, byte, out PamojaLoraMaskControl)

Reads what one ChMaskCntl value does on a plan.

public static PamojaStatus pamoja_lora_plan_mask_control(nint plan, byte value, out PamojaLoraMaskControl outControl)

Parameters

plan nint
value byte
outControl PamojaLoraMaskControl

Returns

PamojaStatus

pamoja_lora_plan_max_eirp_dbm(nint, uint, out sbyte)

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

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

Parameters

plan nint
frequencyHz uint
outDbm sbyte

Returns

PamojaStatus

pamoja_lora_plan_max_payload(nint, uint, byte, out PamojaLoraMaxPayload)

Returns what a data rate may carry in one frame.

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

Parameters

plan nint
table uint
dataRate byte
outPayload PamojaLoraMaxPayload

Returns

PamojaStatus

pamoja_lora_plan_name(nint)

Returns the plan's name as an owned string.

public static extern nint pamoja_lora_plan_name(nint plan)

Parameters

plan nint

Returns

nint

pamoja_lora_plan_next_backoff_data_rate(nint, byte, out byte)

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

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

Parameters

plan nint
dataRate byte
outDataRate byte

Returns

PamojaStatus

pamoja_lora_plan_relay_channel(nint, byte, out PamojaLoraRelayChannel)

Returns one of a plan's default relay channels.

public static PamojaStatus pamoja_lora_plan_relay_channel(nint plan, byte index, out PamojaLoraRelayChannel outChannel)

Parameters

plan nint
index byte
outChannel PamojaLoraRelayChannel

Returns

PamojaStatus

pamoja_lora_plan_relay_channel_count(nint, out byte)

Counts a plan's default relay channels.

public static PamojaStatus pamoja_lora_plan_relay_channel_count(nint plan, out byte outCount)

Parameters

plan nint
outCount byte

Returns

PamojaStatus

pamoja_lora_plan_rules(nint, out PamojaLoraPlanRules)

Reads how a plan defines and uses its channels.

public static PamojaStatus pamoja_lora_plan_rules(nint plan, out PamojaLoraPlanRules outRules)

Parameters

plan nint
outRules PamojaLoraPlanRules

Returns

PamojaStatus

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

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

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

Parameters

plan nint
uplinkDataRate byte
offset byte
dwellLimited byte
outDataRate byte

Returns

PamojaStatus

pamoja_lora_plan_rx1_frequency_hz(nint, ushort, uint, out uint)

Returns where the first receive window listens after an uplink.

public static PamojaStatus pamoja_lora_plan_rx1_frequency_hz(nint plan, ushort uplinkChannel, uint uplinkHz, out uint outFrequencyHz)

Parameters

plan nint
uplinkChannel ushort
uplinkHz uint
outFrequencyHz uint

Returns

PamojaStatus

pamoja_lora_plan_sub_band(nint, ushort, out PamojaLoraSubBand)

Returns one of the plan's sub-bands.

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

Parameters

plan nint
index ushort
outBand PamojaLoraSubBand

Returns

PamojaStatus

pamoja_lora_plan_tx_power_dbm(nint, byte, sbyte, out sbyte)

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

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

Parameters

plan nint
index byte
maxEirpDbm sbyte
outDbm sbyte

Returns

PamojaStatus

Returns a configuration with a private sync word and standard IQ both ways.

public static extern PamojaLoraRadioConfig pamoja_lora_radio_config_default(uint frequencyHz, PamojaLoraLink link, sbyte outputDbm)

Parameters

frequencyHz uint
link PamojaLoraLink
outputDbm sbyte

Returns

PamojaLoraRadioConfig

pamoja_lora_radio_configure(nint, PamojaLoraRadioConfig)

Tunes a radio to a configuration.

public static extern PamojaStatus pamoja_lora_radio_configure(nint radio, PamojaLoraRadioConfig config)

Parameters

radio nint
config PamojaLoraRadioConfig

Returns

PamojaStatus

pamoja_lora_radio_detect(nint, byte, out bool)

Listens a few symbols for a LoRa preamble, as a relay's scan does.

public static PamojaStatus pamoja_lora_radio_detect(nint radio, byte symbols, out bool outDetected)

Parameters

radio nint
symbols byte
outDetected bool

Returns

PamojaStatus

pamoja_lora_radio_family(nint)

Returns the family of a radio's chip, or 255 for a null radio.

public static extern byte pamoja_lora_radio_family(nint radio)

Parameters

radio nint

Returns

byte

pamoja_lora_radio_free(nint)

Closes a radio's device files and releases it.

public static extern void pamoja_lora_radio_free(nint radio)

Parameters

radio nint

pamoja_lora_radio_listen(nint)

Starts listening, frame after frame, until another call changes the mode.

public static extern PamojaStatus pamoja_lora_radio_listen(nint radio)

Parameters

radio nint

Returns

PamojaStatus

pamoja_lora_radio_open_sx126x(string, uint, string, uint, uint, PamojaSx126xBoard, out nint)

Opens an SX1261, SX1262, SX1268, or LLCC68 module and resets it.

public static PamojaStatus pamoja_lora_radio_open_sx126x(string spi, uint spiHz, string gpioChip, uint busyLine, uint resetLine, PamojaSx126xBoard board, out nint outRadio)

Parameters

spi string
spiHz uint
gpioChip string
busyLine uint
resetLine uint
board PamojaSx126xBoard
outRadio nint

Returns

PamojaStatus

pamoja_lora_radio_open_sx127x(string, uint, string, uint, bool, bool, out nint)

Opens an SX1276, SX1277, SX1278, or SX1279 module and resets it into LoRa mode.

public static PamojaStatus pamoja_lora_radio_open_sx127x(string spi, uint spiHz, string gpioChip, uint resetLine, bool paBoost, bool tcxo, out nint outRadio)

Parameters

spi string
spiHz uint
gpioChip string
resetLine uint
paBoost bool
tcxo bool
outRadio nint

Returns

PamojaStatus

pamoja_lora_radio_random(nint, out uint)

Draws a random number from the noise a radio's receiver hears.

public static PamojaStatus pamoja_lora_radio_random(nint radio, out uint outValue)

Parameters

radio nint
outValue uint

Returns

PamojaStatus

pamoja_lora_radio_read_register(nint, ushort, out byte)

Reads one register of a radio's chip.

public static PamojaStatus pamoja_lora_radio_read_register(nint radio, ushort address, out byte outValue)

Parameters

radio nint
address ushort
outValue byte

Returns

PamojaStatus

pamoja_lora_radio_receive(nint, Span<byte>, nuint, ulong, out PamojaLoraRadioReception)

Listens for one frame for up to a timeout in microseconds.

public static PamojaStatus pamoja_lora_radio_receive(nint radio, Span<byte> buffer, nuint capacity, ulong timeoutUs, out PamojaLoraRadioReception outReception)

Parameters

radio nint
buffer Span<byte>
capacity nuint
timeoutUs ulong
outReception PamojaLoraRadioReception

Returns

PamojaStatus

pamoja_lora_radio_sleep(nint)

Puts a radio to sleep until the next call wakes it.

public static extern PamojaStatus pamoja_lora_radio_sleep(nint radio)

Parameters

radio nint

Returns

PamojaStatus

pamoja_lora_radio_standby(nint)

Puts a radio in standby, which stops a transmission or a reception.

public static extern PamojaStatus pamoja_lora_radio_standby(nint radio)

Parameters

radio nint

Returns

PamojaStatus

pamoja_lora_radio_take_frame(nint, Span<byte>, nuint, out PamojaLoraRadioReception)

Takes the frame a listening radio has received, if one has arrived.

public static PamojaStatus pamoja_lora_radio_take_frame(nint radio, Span<byte> buffer, nuint capacity, out PamojaLoraRadioReception outReception)

Parameters

radio nint
buffer Span<byte>
capacity nuint
outReception PamojaLoraRadioReception

Returns

PamojaStatus

pamoja_lora_radio_transmit(nint, ReadOnlySpan<byte>, nuint, out ulong)

Sends one frame and waits for it to leave.

public static PamojaStatus pamoja_lora_radio_transmit(nint radio, ReadOnlySpan<byte> payload, nuint len, out ulong outAirtimeUs)

Parameters

radio nint
payload ReadOnlySpan<byte>
len nuint
outAirtimeUs ulong

Returns

PamojaStatus

pamoja_lora_radio_write_register(nint, ushort, byte)

Writes one register of a radio's chip.

public static extern PamojaStatus pamoja_lora_radio_write_register(nint radio, ushort address, byte value)

Parameters

radio nint
address ushort
value byte

Returns

PamojaStatus

pamoja_lora_region_is_available(uint)

Reports whether a region is compiled into this build.

public static extern byte pamoja_lora_region_is_available(uint region)

Parameters

region uint

Returns

byte

pamoja_lora_sim_chip_family(nint)

Returns the family of a simulated chip, or 255 for a null chip.

public static extern byte pamoja_lora_sim_chip_family(nint chip)

Parameters

chip nint

Returns

byte

pamoja_lora_sim_chip_free(nint)

Releases a simulated chip.

public static extern void pamoja_lora_sim_chip_free(nint chip)

Parameters

chip nint

pamoja_lora_sim_chip_hear(nint, ReadOnlySpan<byte>, nuint, int, int)

Puts a frame on the air for a simulated chip to receive.

public static PamojaStatus pamoja_lora_sim_chip_hear(nint chip, ReadOnlySpan<byte> payload, nuint len, int rssiCentiDbm, int snrCentiDb)

Parameters

chip nint
payload ReadOnlySpan<byte>
len nuint
rssiCentiDbm int
snrCentiDb int

Returns

PamojaStatus

pamoja_lora_sim_chip_hear_corrupt(nint, int, int)

Puts a frame on the air whose CRC fails.

public static extern PamojaStatus pamoja_lora_sim_chip_hear_corrupt(nint chip, int rssiCentiDbm, int snrCentiDb)

Parameters

chip nint
rssiCentiDbm int
snrCentiDb int

Returns

PamojaStatus

pamoja_lora_sim_chip_radio(nint, out nint)

Wires a radio to a simulated chip and resets it, as opening a module does.

public static PamojaStatus pamoja_lora_sim_chip_radio(nint chip, out nint outRadio)

Parameters

chip nint
outRadio nint

Returns

PamojaStatus

pamoja_lora_sim_chip_sent_count(nint)

Returns how many frames a simulated chip has put on the air.

public static extern nuint pamoja_lora_sim_chip_sent_count(nint chip)

Parameters

chip nint

Returns

nuint

pamoja_lora_sim_chip_sent_payload(nint, nuint)

Copies the payload of a frame a simulated chip sent, or null past the last.

public static extern nint pamoja_lora_sim_chip_sent_payload(nint chip, nuint index)

Parameters

chip nint
index nuint

Returns

nint

pamoja_lora_sim_chip_sent_tuning(nint, nuint, out PamojaLoraTuning)

Reads what a simulated chip was tuned to when it sent a frame.

public static PamojaStatus pamoja_lora_sim_chip_sent_tuning(nint chip, nuint index, out PamojaLoraTuning outTuning)

Parameters

chip nint
index nuint
outTuning PamojaLoraTuning

Returns

PamojaStatus

pamoja_lora_sim_chip_sx126x(PamojaSx126xBoard, out nint)

Creates a simulated SX1261, SX1262, SX1268, or LLCC68, out of reset.

public static PamojaStatus pamoja_lora_sim_chip_sx126x(PamojaSx126xBoard board, out nint outChip)

Parameters

board PamojaSx126xBoard
outChip nint

Returns

PamojaStatus

pamoja_lora_sim_chip_sx127x(bool, bool, out nint)

Creates a simulated SX1276, SX1277, SX1278, or SX1279, out of reset.

public static PamojaStatus pamoja_lora_sim_chip_sx127x(bool paBoost, bool tcxo, out nint outChip)

Parameters

paBoost bool
tcxo bool
outChip nint

Returns

PamojaStatus

pamoja_lora_sim_chip_tuning(nint, out PamojaLoraTuning)

Reads what a simulated chip is tuned to now.

public static PamojaStatus pamoja_lora_sim_chip_tuning(nint chip, out PamojaLoraTuning outTuning)

Parameters

chip nint
outTuning PamojaLoraTuning

Returns

PamojaStatus

pamoja_lora_sim_chip_waiting(nint)

Returns how many frames wait on the air for a simulated chip to receive.

public static extern nuint pamoja_lora_sim_chip_waiting(nint chip)

Parameters

chip nint

Returns

nuint

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

public static extern ulong pamoja_lora_symbol_time_us(PamojaLoraLink link)

Parameters

link PamojaLoraLink

Returns

ulong

pamoja_lorawan_backoff_counter(nint)

Returns how many uplinks have gone unanswered.

public static extern uint pamoja_lorawan_backoff_counter(nint backoff)

Parameters

backoff nint

Returns

uint

Counts a Class A downlink, which resets the count.

public static extern PamojaStatus pamoja_lorawan_backoff_downlink(nint backoff)

Parameters

backoff nint

Returns

PamojaStatus

pamoja_lorawan_backoff_free(nint)

Releases a back-off handle. Passing null is a no-op.

public static extern void pamoja_lorawan_backoff_free(nint backoff)

Parameters

backoff nint

pamoja_lorawan_backoff_new(byte, uint, uint, out nint)

Starts a back-off count from zero.

public static PamojaStatus pamoja_lorawan_backoff_new(byte version, uint limit, uint delay, out nint outBackoff)

Parameters

version byte
limit uint
delay uint
outBackoff nint

Returns

PamojaStatus

Counts one new uplink, and says what to do before sending it.

public static PamojaStatus pamoja_lorawan_backoff_uplink(nint backoff, byte defaultDataRate, out PamojaLorawanBackoffStep outStep)

Parameters

backoff nint
defaultDataRate byte
outStep PamojaLorawanBackoffStep

Returns

PamojaStatus

pamoja_lorawan_backoff_version(nint)

Returns the revision whose steps a count follows.

public static extern byte pamoja_lorawan_backoff_version(nint backoff)

Parameters

backoff nint

Returns

byte

pamoja_lorawan_block_mic_finish(nint, Span<byte>)

Finishes the code, writing the four bytes a session setup carries.

public static PamojaStatus pamoja_lorawan_block_mic_finish(nint mic, Span<byte> outMic)

Parameters

mic nint
outMic Span<byte>

Returns

PamojaStatus

pamoja_lorawan_block_mic_free(nint)

Releases a code that was never finished.

public static extern void pamoja_lorawan_block_mic_free(nint mic)

Parameters

mic nint

pamoja_lorawan_block_mic_start(ReadOnlySpan<byte>, ushort, byte, ReadOnlySpan<byte>, uint, out nint)

Starts a code over one session's block.

public static PamojaStatus pamoja_lorawan_block_mic_start(ReadOnlySpan<byte> dataBlockIntKey, ushort sessionCnt, byte fragIndex, ReadOnlySpan<byte> descriptor, uint blockLen, out nint outMic)

Parameters

dataBlockIntKey ReadOnlySpan<byte>
sessionCnt ushort
fragIndex byte
descriptor ReadOnlySpan<byte>
blockLen uint
outMic nint

Returns

PamojaStatus

pamoja_lorawan_block_mic_update(nint, ReadOnlySpan<byte>, nuint)

Adds a piece of the block, in order, without any padding.

public static PamojaStatus pamoja_lorawan_block_mic_update(nint mic, ReadOnlySpan<byte> data, nuint dataLen)

Parameters

mic nint
data ReadOnlySpan<byte>
dataLen nuint

Returns

PamojaStatus

pamoja_lorawan_cflist_channel_masks(ReadOnlySpan<byte>, nuint, Span<ushort>, nuint)

Reads the mask groups out of a type 1 channel list.

public static PamojaStatus pamoja_lorawan_cflist_channel_masks(ReadOnlySpan<byte> cflist, nuint cflistLen, Span<ushort> outMasks, nuint len)

Parameters

cflist ReadOnlySpan<byte>
cflistLen nuint
outMasks Span<ushort>
len nuint

Returns

PamojaStatus

pamoja_lorawan_cflist_enables(ReadOnlySpan<byte>, nuint, byte, out byte)

Reports whether a type 1 channel list enables a channel.

public static PamojaStatus pamoja_lorawan_cflist_enables(ReadOnlySpan<byte> cflist, nuint cflistLen, byte channel, out byte outEnabled)

Parameters

cflist ReadOnlySpan<byte>
cflistLen nuint
channel byte
outEnabled byte

Returns

PamojaStatus

pamoja_lorawan_cflist_frequencies(ReadOnlySpan<byte>, nuint, Span<uint>, nuint)

Reads the frequencies out of a type 0 channel list.

public static PamojaStatus pamoja_lorawan_cflist_frequencies(ReadOnlySpan<byte> cflist, nuint cflistLen, Span<uint> outFrequenciesHz, nuint len)

Parameters

cflist ReadOnlySpan<byte>
cflistLen nuint
outFrequenciesHz Span<uint>
len nuint

Returns

PamojaStatus

pamoja_lorawan_cflist_from_channel_masks(ReadOnlySpan<ushort>, nuint, Span<byte>)

Builds a type 1 channel list from channel mask groups.

public static PamojaStatus pamoja_lorawan_cflist_from_channel_masks(ReadOnlySpan<ushort> masks, nuint len, Span<byte> outCflist)

Parameters

masks ReadOnlySpan<ushort>
len nuint
outCflist Span<byte>

Returns

PamojaStatus

pamoja_lorawan_cflist_from_frequencies(ReadOnlySpan<uint>, nuint, Span<byte>)

Builds a type 0 channel list from frequencies.

public static PamojaStatus pamoja_lorawan_cflist_from_frequencies(ReadOnlySpan<uint> frequenciesHz, nuint len, Span<byte> outCflist)

Parameters

frequenciesHz ReadOnlySpan<uint>
len nuint
outCflist Span<byte>

Returns

PamojaStatus

pamoja_lorawan_cflist_type(ReadOnlySpan<byte>, nuint, out byte)

Reads which form a channel list takes.

public static PamojaStatus pamoja_lorawan_cflist_type(ReadOnlySpan<byte> cflist, nuint cflistLen, out byte outType)

Parameters

cflist ReadOnlySpan<byte>
cflistLen nuint
outType byte

Returns

PamojaStatus

pamoja_lorawan_clock_sync_answer(nint, uint, Span<byte>, nuint, out nuint)

Writes the answer the device owes, if it owes one.

public static PamojaStatus pamoja_lorawan_clock_sync_answer(nint sync, uint deviceTime, Span<byte> outCommand, nuint capacity, out nuint outLen)

Parameters

sync nint
deviceTime uint
outCommand Span<byte>
capacity nuint
outLen nuint

Returns

PamojaStatus

pamoja_lorawan_clock_sync_free(nint)

Releases a clock synchronization package.

public static extern void pamoja_lorawan_clock_sync_free(nint sync)

Parameters

sync nint

pamoja_lorawan_clock_sync_heard(nint, ReadOnlySpan<byte>, nuint, out int, out byte, out byte, out byte, out byte)

Reads a downlink on the clock port and acts on it.

public static PamojaStatus pamoja_lorawan_clock_sync_heard(nint sync, ReadOnlySpan<byte> payload, nuint payloadLen, out int outCorrection, out byte outHasCorrection, out byte outMore, out byte outResync, out byte outAnswerDue)

Parameters

sync nint
payload ReadOnlySpan<byte>
payloadLen nuint
outCorrection int
outHasCorrection byte
outMore byte
outResync byte
outAnswerDue byte

Returns

PamojaStatus

pamoja_lorawan_clock_sync_new(byte, out nint)

Starts the clock synchronization package on a device.

public static PamojaStatus pamoja_lorawan_clock_sync_new(byte selfManaged, out nint outSync)

Parameters

selfManaged byte
outSync nint

Returns

PamojaStatus

pamoja_lorawan_clock_sync_request(nint, uint, byte, Span<byte>, nuint, out nuint)

Builds the request that asks a server for a correction.

public static PamojaStatus pamoja_lorawan_clock_sync_request(nint sync, uint deviceTime, byte ansRequired, Span<byte> outCommand, nuint capacity, out nuint outLen)

Parameters

sync nint
deviceTime uint
ansRequired byte
outCommand Span<byte>
capacity nuint
outLen nuint

Returns

PamojaStatus

pamoja_lorawan_clock_sync_status(nint, out byte, out uint, out byte)

Reports the token, the period, and whether an answer is owed.

public static PamojaStatus pamoja_lorawan_clock_sync_status(nint sync, out byte outToken, out uint outPeriodS, out byte outAnswerDue)

Parameters

sync nint
outToken byte
outPeriodS uint
outAnswerDue byte

Returns

PamojaStatus

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

Derives the key that signs a data block.

public static PamojaStatus pamoja_lorawan_data_block_int_key(ReadOnlySpan<byte> rootKey, Span<byte> outKey)

Parameters

rootKey ReadOnlySpan<byte>
outKey Span<byte>

Returns

PamojaStatus

pamoja_lorawan_defrag_block(nint, Span<byte>, nuint, out nuint)

Copies out the block as far as it has been put back together.

public static PamojaStatus pamoja_lorawan_defrag_block(nint session, Span<byte> outBlock, nuint capacity, out nuint outLen)

Parameters

session nint
outBlock Span<byte>
capacity nuint
outLen nuint

Returns

PamojaStatus

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

Takes one fragment of a session, counting from one.

public static PamojaStatus pamoja_lorawan_defrag_fragment(nint session, ushort n, ReadOnlySpan<byte> fragment, nuint fragmentLen, out byte outDone)

Parameters

session nint
n ushort
fragment ReadOnlySpan<byte>
fragmentLen nuint
outDone byte

Returns

PamojaStatus

pamoja_lorawan_defrag_free(nint)

Releases a session.

public static extern void pamoja_lorawan_defrag_free(nint session)

Parameters

session nint

pamoja_lorawan_defrag_matrix_len(ushort, ushort)

The working memory a session of this shape takes, in bytes.

public static extern nuint pamoja_lorawan_defrag_matrix_len(ushort nbFrag, ushort maxLost)

Parameters

nbFrag ushort
maxLost ushort

Returns

nuint

pamoja_lorawan_defrag_new(ushort, byte, ushort, out nint)

Opens a session for a block being put back together.

public static PamojaStatus pamoja_lorawan_defrag_new(ushort nbFrag, byte fragSize, ushort maxLost, out nint outSession)

Parameters

nbFrag ushort
fragSize byte
maxLost ushort
outSession nint

Returns

PamojaStatus

pamoja_lorawan_defrag_status(nint, out ushort, out ushort, out byte)

Says how far along a session is.

public static PamojaStatus pamoja_lorawan_defrag_status(nint session, out ushort outReceived, out ushort outMissing, out byte outDone)

Parameters

session nint
outReceived ushort
outMissing ushort
outDone byte

Returns

PamojaStatus

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

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

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

Parameters

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

Returns

PamojaStatus

pamoja_lorawan_device_dev_eui(nint, Span<byte>)

Copies the device EUI a device was created with.

public static bool pamoja_lorawan_device_dev_eui(nint device, Span<byte> outDevEui)

Parameters

device nint
outDevEui Span<byte>

Returns

bool

pamoja_lorawan_device_free(nint)

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

public static extern void pamoja_lorawan_device_free(nint device)

Parameters

device nint

pamoja_lorawan_device_join_request(nint, ushort, out nint)

Builds the join request a device broadcasts to activate.

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

Parameters

device nint
devNonce ushort
outFrame nint

Returns

PamojaStatus

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

Creates a device from the root credentials activation uses.

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

Parameters

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

Returns

PamojaStatus

pamoja_lorawan_device_settings(sbyte, sbyte, out PamojaLorawanDeviceSettings)

Fills in the settings of a typical node with a radio's output power range.

public static PamojaStatus pamoja_lorawan_device_settings(sbyte minOutputDbm, sbyte maxOutputDbm, out PamojaLorawanDeviceSettings outSettings)

Parameters

minOutputDbm sbyte
maxOutputDbm sbyte
outSettings PamojaLorawanDeviceSettings

Returns

PamojaStatus

pamoja_lorawan_end_device_channel(nint, ushort, out ushort, out PamojaLorawanChannel)

Reads one of the channels a device may send on.

public static PamojaStatus pamoja_lorawan_end_device_channel(nint device, ushort position, out ushort outIndex, out PamojaLorawanChannel outChannel)

Parameters

device nint
position ushort
outIndex ushort
outChannel PamojaLorawanChannel

Returns

PamojaStatus

pamoja_lorawan_end_device_error(nint, out PamojaLorawanDeviceError)

Reads why a device's last call failed.

public static PamojaStatus pamoja_lorawan_end_device_error(nint device, out PamojaLorawanDeviceError outError)

Parameters

device nint
outError PamojaLorawanDeviceError

Returns

PamojaStatus

pamoja_lorawan_end_device_free(nint)

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

public static extern void pamoja_lorawan_end_device_free(nint device)

Parameters

device nint

pamoja_lorawan_end_device_heard(nint, ReadOnlySpan<byte>, nuint, sbyte, out PamojaLorawanHeard, out nint)

Reads a frame heard in a receive window.

public static PamojaStatus pamoja_lorawan_end_device_heard(nint device, ReadOnlySpan<byte> frame, nuint frameLen, sbyte snrDb, out PamojaLorawanHeard outHeard, out nint outPayload)

Parameters

device nint
frame ReadOnlySpan<byte>
frameLen nuint
snrDb sbyte
outHeard PamojaLorawanHeard
outPayload nint

Returns

PamojaStatus

pamoja_lorawan_end_device_heard_in(nint, byte, ReadOnlySpan<byte>, nuint, sbyte, out PamojaLorawanHeard, out nint)

Reads a frame heard in a given receive window.

public static PamojaStatus pamoja_lorawan_end_device_heard_in(nint device, byte window, ReadOnlySpan<byte> frame, nuint frameLen, sbyte snrDb, out PamojaLorawanHeard outHeard, out nint outPayload)

Parameters

device nint
window byte
frame ReadOnlySpan<byte>
frameLen nuint
snrDb sbyte
outHeard PamojaLorawanHeard
outPayload nint

Returns

PamojaStatus

pamoja_lorawan_end_device_heard_wor_ack(nint, ReadOnlySpan<byte>, nuint, out PamojaLorawanRelayStatus)

Reads the acknowledgment a relay answered the last WOR frame with.

public static PamojaStatus pamoja_lorawan_end_device_heard_wor_ack(nint device, ReadOnlySpan<byte> frame, nuint frameLen, out PamojaLorawanRelayStatus outStatus)

Parameters

device nint
frame ReadOnlySpan<byte>
frameLen nuint
outStatus PamojaLorawanRelayStatus

Returns

PamojaStatus

pamoja_lorawan_end_device_join(nint, ushort, ulong, out nint, out PamojaLorawanTransmission)

Builds a join request.

public static PamojaStatus pamoja_lorawan_end_device_join(nint device, ushort devNonce, ulong nowUs, out nint outFrame, out PamojaLorawanTransmission outTransmission)

Parameters

device nint
devNonce ushort
nowUs ulong
outFrame nint
outTransmission PamojaLorawanTransmission

Returns

PamojaStatus

pamoja_lorawan_end_device_new(nint, nint, in PamojaLorawanDeviceSettings, uint, byte, uint, out nint)

Makes a device that joins over the air.

public static PamojaStatus pamoja_lorawan_end_device_new(nint plan, nint credentials, in PamojaLorawanDeviceSettings settings, uint fcntUp, byte hasFcntDown, uint fcntDown, out nint outDevice)

Parameters

plan nint
credentials nint
settings PamojaLorawanDeviceSettings
fcntUp uint
hasFcntDown byte
fcntDown uint
outDevice nint

Returns

PamojaStatus

pamoja_lorawan_end_device_no_wor_ack(nint, ulong, out byte, out PamojaLorawanRelayExchange)

Says what to do once the acknowledgment window closed empty.

public static PamojaStatus pamoja_lorawan_end_device_no_wor_ack(nint device, ulong nowUs, out byte outNext, out PamojaLorawanRelayExchange outExchange)

Parameters

device nint
nowUs ulong
outNext byte
outExchange PamojaLorawanRelayExchange

Returns

PamojaStatus

pamoja_lorawan_end_device_nothing_heard(nint, ulong, out PamojaLorawanNext)

Says what comes next once both receive windows closed empty.

public static PamojaStatus pamoja_lorawan_end_device_nothing_heard(nint device, ulong nowUs, out PamojaLorawanNext outNext)

Parameters

device nint
nowUs ulong
outNext PamojaLorawanNext

Returns

PamojaStatus

pamoja_lorawan_end_device_personalized(nint, nint, in PamojaLorawanDeviceSettings, uint, byte, uint, out nint)

Makes a device activated by personalization.

public static PamojaStatus pamoja_lorawan_end_device_personalized(nint plan, nint session, in PamojaLorawanDeviceSettings settings, uint fcntUp, byte hasFcntDown, uint fcntDown, out nint outDevice)

Parameters

plan nint
session nint
settings PamojaLorawanDeviceSettings
fcntUp uint
hasFcntDown byte
fcntDown uint
outDevice nint

Returns

PamojaStatus

pamoja_lorawan_end_device_relay_mode(nint, out byte, out byte, out byte, out uint)

Reports how a device uses a relay.

public static PamojaStatus pamoja_lorawan_end_device_relay_mode(nint device, out byte outRelaying, out byte outActivation, out byte outSync, out uint outWorCounter)

Parameters

device nint
outRelaying byte
outActivation byte
outSync byte
outWorCounter uint

Returns

PamojaStatus

pamoja_lorawan_end_device_relay_status(nint, out PamojaLorawanRelayStatus)

Returns what the relay's last acknowledgment said about itself.

public static PamojaStatus pamoja_lorawan_end_device_relay_status(nint device, out PamojaLorawanRelayStatus outStatus)

Parameters

device nint
outStatus PamojaLorawanRelayStatus

Returns

PamojaStatus

pamoja_lorawan_end_device_repeat(nint, ulong, out nint, out PamojaLorawanTransmission)

Sends the last uplink again.

public static PamojaStatus pamoja_lorawan_end_device_repeat(nint device, ulong nowUs, out nint outFrame, out PamojaLorawanTransmission outTransmission)

Parameters

device nint
nowUs ulong
outFrame nint
outTransmission PamojaLorawanTransmission

Returns

PamojaStatus

pamoja_lorawan_end_device_request_device_time(nint)

Asks the network, with the next uplink, for the time.

public static extern PamojaStatus pamoja_lorawan_end_device_request_device_time(nint device)

Parameters

device nint

Returns

PamojaStatus

Asks the network, with the next uplink, how well it hears the device.

public static extern PamojaStatus pamoja_lorawan_end_device_request_link_check(nint device)

Parameters

device nint

Returns

PamojaStatus

pamoja_lorawan_end_device_resume(nint, ReadOnlySpan<byte>, nuint, ulong)

Puts a saved state back on a device.

public static PamojaStatus pamoja_lorawan_end_device_resume(nint device, ReadOnlySpan<byte> saved, nuint savedLen, ulong nowUs)

Parameters

device nint
saved ReadOnlySpan<byte>
savedLen nuint
nowUs ulong

Returns

PamojaStatus

pamoja_lorawan_end_device_save(nint, ulong, Span<byte>, nuint)

Saves a joined device's state.

public static PamojaStatus pamoja_lorawan_end_device_save(nint device, ulong nowUs, Span<byte> outSaved, nuint len)

Parameters

device nint
nowUs ulong
outSaved Span<byte>
len nuint

Returns

PamojaStatus

pamoja_lorawan_end_device_send(nint, byte, ReadOnlySpan<byte>, nuint, byte, ulong, out nint, out PamojaLorawanTransmission)

Builds an uplink carrying a payload.

public static PamojaStatus pamoja_lorawan_end_device_send(nint device, byte port, ReadOnlySpan<byte> payload, nuint payloadLen, byte confirmed, ulong nowUs, out nint outFrame, out PamojaLorawanTransmission outTransmission)

Parameters

device nint
port byte
payload ReadOnlySpan<byte>
payloadLen nuint
confirmed byte
nowUs ulong
outFrame nint
outTransmission PamojaLorawanTransmission

Returns

PamojaStatus

pamoja_lorawan_end_device_send_empty(nint, ulong, out nint, out PamojaLorawanTransmission)

Builds an uplink with no payload.

public static PamojaStatus pamoja_lorawan_end_device_send_empty(nint device, ulong nowUs, out nint outFrame, out PamojaLorawanTransmission outTransmission)

Parameters

device nint
nowUs ulong
outFrame nint
outTransmission PamojaLorawanTransmission

Returns

PamojaStatus

pamoja_lorawan_end_device_set_battery(nint, byte, byte)

Sets what the device reports its battery as.

public static extern PamojaStatus pamoja_lorawan_end_device_set_battery(nint device, byte kind, byte level)

Parameters

device nint
kind byte
level byte

Returns

PamojaStatus

pamoja_lorawan_end_device_status(nint, out PamojaLorawanEndDeviceStatus)

Reads where a device stands.

public static PamojaStatus pamoja_lorawan_end_device_status(nint device, out PamojaLorawanEndDeviceStatus outStatus)

Parameters

device nint
outStatus PamojaLorawanEndDeviceStatus

Returns

PamojaStatus

pamoja_lorawan_end_device_use_relay(nint, byte, out byte)

Turns an end device's relay mode on or off.

public static PamojaStatus pamoja_lorawan_end_device_use_relay(nint device, byte on, out byte outTaken)

Parameters

device nint
on byte
outTaken byte

Returns

PamojaStatus

pamoja_lorawan_firmware_free(nint)

Releases a firmware manager.

public static extern void pamoja_lorawan_firmware_free(nint manager)

Parameters

manager nint

pamoja_lorawan_firmware_heard(nint, ReadOnlySpan<byte>, nuint, uint, byte, Span<byte>, nuint, out nuint)

Reads a downlink on the firmware port and writes the answers.

public static PamojaStatus pamoja_lorawan_firmware_heard(nint manager, ReadOnlySpan<byte> payload, nuint payloadLen, uint nowS, byte hasNow, Span<byte> outAnswers, nuint capacity, out nuint outLen)

Parameters

manager nint
payload ReadOnlySpan<byte>
payloadLen nuint
nowS uint
hasNow byte
outAnswers Span<byte>
capacity nuint
outLen nuint

Returns

PamojaStatus

pamoja_lorawan_firmware_image(nint, out byte, out uint, out byte)

Reads back what the device is holding.

public static PamojaStatus pamoja_lorawan_firmware_image(nint manager, out byte outStatus, out uint outNextVersion, out byte outHasNextVersion)

Parameters

manager nint
outStatus byte
outNextVersion uint
outHasNextVersion byte

Returns

PamojaStatus

pamoja_lorawan_firmware_new(uint, uint, out nint)

Starts the firmware management package on a device.

public static PamojaStatus pamoja_lorawan_firmware_new(uint firmware, uint hardware, out nint outManager)

Parameters

firmware uint
hardware uint
outManager nint

Returns

PamojaStatus

pamoja_lorawan_firmware_reboot(nint, out uint, out byte, out uint, out byte, out byte)

Reports the one reboot the device keeps.

public static PamojaStatus pamoja_lorawan_firmware_reboot(nint manager, out uint outAtS, out byte outHasAt, out uint outInS, out byte outHasIn, out byte outNow)

Parameters

manager nint
outAtS uint
outHasAt byte
outInS uint
outHasIn byte
outNow byte

Returns

PamojaStatus

pamoja_lorawan_firmware_rebooted(nint)

Forgets the programmed reboot, for a device that carried it out.

public static extern PamojaStatus pamoja_lorawan_firmware_rebooted(nint manager)

Parameters

manager nint

Returns

PamojaStatus

pamoja_lorawan_firmware_set_image(nint, byte, uint)

Says what firmware upgrade image the device is holding.

public static extern PamojaStatus pamoja_lorawan_firmware_set_image(nint manager, byte status, uint version)

Parameters

manager nint
status byte
version uint

Returns

PamojaStatus

pamoja_lorawan_frag_fragment(ReadOnlySpan<byte>, nuint, byte, ushort, Span<byte>, nuint)

Builds one fragment of a session out of a block held whole.

public static PamojaStatus pamoja_lorawan_frag_fragment(ReadOnlySpan<byte> block, nuint blockLen, byte fragSize, ushort n, Span<byte> outFragment, nuint outLen)

Parameters

block ReadOnlySpan<byte>
blockLen nuint
fragSize byte
n ushort
outFragment Span<byte>
outLen nuint

Returns

PamojaStatus

pamoja_lorawan_frag_parity_line(ushort, ushort, Span<byte>, nuint, out nuint)

Writes the bitmap of the fragments one coded fragment is made of.

public static PamojaStatus pamoja_lorawan_frag_parity_line(ushort coded, ushort nbFrag, Span<byte> outLine, nuint lineLen, out nuint outOnes)

Parameters

coded ushort
nbFrag ushort
outLine Span<byte>
lineLen nuint
outOnes nuint

Returns

PamojaStatus

pamoja_lorawan_frag_prbs23(uint)

Steps the pseudo-random sequence the parity matrix is drawn from.

public static extern uint pamoja_lorawan_frag_prbs23(uint x)

Parameters

x uint

Returns

uint

pamoja_lorawan_frag_session(nuint, byte, out ushort, out byte)

Says how many fragments a block takes and how much padding it needs.

public static PamojaStatus pamoja_lorawan_frag_session(nuint blockLen, byte fragSize, out ushort outNbFrag, out byte outPadding)

Parameters

blockLen nuint
fragSize byte
outNbFrag ushort
outPadding byte

Returns

PamojaStatus

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

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

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

Parameters

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

Returns

PamojaStatus

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

Derives the session a grant activates.

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

Parameters

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

Returns

PamojaStatus

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

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

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

Parameters

bytes ReadOnlySpan<byte>
bytesLen nuint
outHeader PamojaLorawanHeader

Returns

PamojaStatus

pamoja_lorawan_join_accept_cflist(nint, Span<byte>)

Copies the channel list a join accept carried.

public static bool pamoja_lorawan_join_accept_cflist(nint accept, Span<byte> outCflist)

Parameters

accept nint
outCflist Span<byte>

Returns

bool

pamoja_lorawan_join_accept_dev_addr(nint)

Returns the device address a join grants.

public static extern uint pamoja_lorawan_join_accept_dev_addr(nint accept)

Parameters

accept nint

Returns

uint

pamoja_lorawan_join_accept_dl_settings(nint)

Returns the downlink settings byte a join grants.

public static extern byte pamoja_lorawan_join_accept_dl_settings(nint accept)

Parameters

accept nint

Returns

byte

pamoja_lorawan_join_accept_free(nint)

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

public static extern void pamoja_lorawan_join_accept_free(nint accept)

Parameters

accept nint

pamoja_lorawan_join_accept_net_id(nint)

Returns the identifier of the network that accepted a join.

public static extern uint pamoja_lorawan_join_accept_net_id(nint accept)

Parameters

accept nint

Returns

uint

pamoja_lorawan_join_accept_receive_delay_us(nint)

Returns the delay to the first receive window, in microseconds.

public static extern uint pamoja_lorawan_join_accept_receive_delay_us(nint accept)

Parameters

accept nint

Returns

uint

pamoja_lorawan_join_accept_rx1_dr_offset(nint)

Returns how far below the uplink's data rate the first window listens.

public static extern byte pamoja_lorawan_join_accept_rx1_dr_offset(nint accept)

Parameters

accept nint

Returns

byte

pamoja_lorawan_join_accept_rx2_data_rate(nint)

Returns the data rate the second receive window listens at.

public static extern byte pamoja_lorawan_join_accept_rx2_data_rate(nint accept)

Parameters

accept nint

Returns

byte

pamoja_lorawan_join_accept_rx_delay(nint)

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

public static extern byte pamoja_lorawan_join_accept_rx_delay(nint accept)

Parameters

accept nint

Returns

byte

pamoja_lorawan_join_accept_session(nint, out nint)

Takes the activated session a join grants.

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

Parameters

accept nint
outSession nint

Returns

PamojaStatus

pamoja_lorawan_join_request_app_eui(nint, Span<byte>)

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

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

Parameters

request nint
outAppEui Span<byte>

Returns

bool

pamoja_lorawan_join_request_dev_eui(nint, Span<byte>)

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

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

Parameters

request nint
outDevEui Span<byte>

Returns

bool

pamoja_lorawan_join_request_dev_nonce(nint)

Returns the nonce a verified join-request carried.

public static extern ushort pamoja_lorawan_join_request_dev_nonce(nint request)

Parameters

request nint

Returns

ushort

pamoja_lorawan_join_request_free(nint)

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

public static extern void pamoja_lorawan_join_request_free(nint request)

Parameters

request nint

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

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

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

Parameters

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

Returns

PamojaStatus

pamoja_lorawan_mac_at(PamojaLorawanDirection, ReadOnlySpan<byte>, nuint, nuint, out PamojaLorawanMacCommand)

Reads one of the commands packed into a frame options field.

public static PamojaStatus pamoja_lorawan_mac_at(PamojaLorawanDirection direction, ReadOnlySpan<byte> bytes, nuint len, nuint index, out PamojaLorawanMacCommand outCommand)

Parameters

direction PamojaLorawanDirection
bytes ReadOnlySpan<byte>
len nuint
index nuint
outCommand PamojaLorawanMacCommand

Returns

PamojaStatus

pamoja_lorawan_mac_count(PamojaLorawanDirection, ReadOnlySpan<byte>, nuint, out nuint)

Counts the commands packed into a frame options field.

public static PamojaStatus pamoja_lorawan_mac_count(PamojaLorawanDirection direction, ReadOnlySpan<byte> bytes, nuint len, out nuint outCount)

Parameters

direction PamojaLorawanDirection
bytes ReadOnlySpan<byte>
len nuint
outCount nuint

Returns

PamojaStatus

pamoja_lorawan_mac_encode(ref PamojaLorawanMacCommand, Span<byte>, nuint, out nuint)

Writes one command out.

public static PamojaStatus pamoja_lorawan_mac_encode(ref PamojaLorawanMacCommand command, Span<byte> outBytes, nuint capacity, out nuint outWritten)

Parameters

command PamojaLorawanMacCommand
outBytes Span<byte>
capacity nuint
outWritten nuint

Returns

PamojaStatus

pamoja_lorawan_mc_app_s_key(ReadOnlySpan<byte>, uint, Span<byte>)

Derives the key that reads a multicast group's payloads.

public static PamojaStatus pamoja_lorawan_mc_app_s_key(ReadOnlySpan<byte> mcKey, uint mcAddr, Span<byte> outKey)

Parameters

mcKey ReadOnlySpan<byte>
mcAddr uint
outKey Span<byte>

Returns

PamojaStatus

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

Derives the key a multicast group's key travels under.

public static PamojaStatus pamoja_lorawan_mc_ke_key(ReadOnlySpan<byte> mcRootKey, Span<byte> outKey)

Parameters

mcRootKey ReadOnlySpan<byte>
outKey Span<byte>

Returns

PamojaStatus

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

Unwraps the group key a setup command carried.

public static PamojaStatus pamoja_lorawan_mc_key(ReadOnlySpan<byte> mcKeKey, ReadOnlySpan<byte> wrapped, Span<byte> outKey)

Parameters

mcKeKey ReadOnlySpan<byte>
wrapped ReadOnlySpan<byte>
outKey Span<byte>

Returns

PamojaStatus

pamoja_lorawan_mc_nwk_s_key(ReadOnlySpan<byte>, uint, Span<byte>)

Derives the key that verifies a multicast group's frames.

public static PamojaStatus pamoja_lorawan_mc_nwk_s_key(ReadOnlySpan<byte> mcKey, uint mcAddr, Span<byte> outKey)

Parameters

mcKey ReadOnlySpan<byte>
mcAddr uint
outKey Span<byte>

Returns

PamojaStatus

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

Derives a device's multicast root key.

public static PamojaStatus pamoja_lorawan_mc_root_key(ReadOnlySpan<byte> rootKey, byte lorawan11, Span<byte> outKey)

Parameters

rootKey ReadOnlySpan<byte>
lorawan11 byte
outKey Span<byte>

Returns

PamojaStatus

pamoja_lorawan_package_encode(in PamojaLorawanPackageCommand, ReadOnlySpan<byte>, nuint, Span<byte>, nuint, out nuint)

Writes one command of an application layer package.

public static PamojaStatus pamoja_lorawan_package_encode(in PamojaLorawanPackageCommand command, ReadOnlySpan<byte> data, nuint dataLen, Span<byte> outPayload, nuint capacity, out nuint outLen)

Parameters

command PamojaLorawanPackageCommand
data ReadOnlySpan<byte>
dataLen nuint
outPayload Span<byte>
capacity nuint
outLen nuint

Returns

PamojaStatus

pamoja_lorawan_package_parse(byte, byte, ReadOnlySpan<byte>, nuint, out PamojaLorawanPackageCommand, out nuint)

Reads one command of an application layer package.

public static PamojaStatus pamoja_lorawan_package_parse(byte port, byte uplink, ReadOnlySpan<byte> payload, nuint payloadLen, out PamojaLorawanPackageCommand outCommand, out nuint outTaken)

Parameters

port byte
uplink byte
payload ReadOnlySpan<byte>
payloadLen nuint
outCommand PamojaLorawanPackageCommand
outTaken nuint

Returns

PamojaStatus

pamoja_lorawan_package_status_item(ReadOnlySpan<byte>, nuint, out PamojaLorawanPackageCommand)

Reads one group record of a multicast status answer.

public static PamojaStatus pamoja_lorawan_package_status_item(ReadOnlySpan<byte> payload, nuint payloadLen, out PamojaLorawanPackageCommand outCommand)

Parameters

payload ReadOnlySpan<byte>
payloadLen nuint
outCommand PamojaLorawanPackageCommand

Returns

PamojaStatus

pamoja_lorawan_relay_error(nint)

Returns why the last relay call failed, or null.

public static extern nint pamoja_lorawan_relay_error(nint relay)

Parameters

relay nint

Returns

nint

pamoja_lorawan_relay_forward(nint, ulong, out nint, out PamojaLorawanTransmission)

Sends the uplink the relay is holding, in one of its own.

public static PamojaStatus pamoja_lorawan_relay_forward(nint relay, ulong nowUs, out nint outFrame, out PamojaLorawanTransmission outTransmission)

Parameters

relay nint
nowUs ulong
outFrame nint
outTransmission PamojaLorawanTransmission

Returns

PamojaStatus

pamoja_lorawan_relay_forward_due(nint, out ulong)

Reports when the forwarded uplink waiting to go out is due.

public static byte pamoja_lorawan_relay_forward_due(nint relay, out ulong outDueUs)

Parameters

relay nint
outDueUs ulong

Returns

byte

pamoja_lorawan_relay_forward_encode(in PamojaLorawanUplinkMetadata, uint, ReadOnlySpan<byte>, nuint, out nint)

Writes an uplink a relay forwards.

public static PamojaStatus pamoja_lorawan_relay_forward_encode(in PamojaLorawanUplinkMetadata metadata, uint frequencyHz, ReadOnlySpan<byte> phyPayload, nuint phyPayloadLen, out nint outPayload)

Parameters

metadata PamojaLorawanUplinkMetadata
frequencyHz uint
phyPayload ReadOnlySpan<byte>
phyPayloadLen nuint
outPayload nint

Returns

PamojaStatus

pamoja_lorawan_relay_forward_parse(ReadOnlySpan<byte>, nuint, out PamojaLorawanUplinkMetadata, out uint, out nint)

Reads an uplink a relay forwarded.

public static PamojaStatus pamoja_lorawan_relay_forward_parse(ReadOnlySpan<byte> payload, nuint payloadLen, out PamojaLorawanUplinkMetadata outMetadata, out uint outFrequencyHz, out nint outPhyPayload)

Parameters

payload ReadOnlySpan<byte>
payloadLen nuint
outMetadata PamojaLorawanUplinkMetadata
outFrequencyHz uint
outPhyPayload nint

Returns

PamojaStatus

pamoja_lorawan_relay_free(nint)

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

public static extern void pamoja_lorawan_relay_free(nint relay)

Parameters

relay nint

pamoja_lorawan_relay_heard_in(nint, byte, ReadOnlySpan<byte>, nuint, sbyte, out byte, out PamojaLorawanHeard, out nint, out nint, out PamojaLorawanRxr)

Reads a frame the relay's own device heard.

public static PamojaStatus pamoja_lorawan_relay_heard_in(nint relay, byte window, ReadOnlySpan<byte> frame, nuint frameLen, sbyte snrDb, out byte outKind, out PamojaLorawanHeard outHeard, out nint outPayload, out nint outFrame, out PamojaLorawanRxr outDownlink)

Parameters

relay nint
window byte
frame ReadOnlySpan<byte>
frameLen nuint
snrDb sbyte
outKind byte
outHeard PamojaLorawanHeard
outPayload nint
outFrame nint
outDownlink PamojaLorawanRxr

Returns

PamojaStatus

Reads the uplink a wake-on-radio frame announced.

public static PamojaStatus pamoja_lorawan_relay_heard_uplink(nint relay, ReadOnlySpan<byte> frame, nuint frameLen, short rssiDbm, sbyte snrDb, ulong endedUs, out ulong outDueUs)

Parameters

relay nint
frame ReadOnlySpan<byte>
frameLen nuint
rssiDbm short
snrDb sbyte
endedUs ulong
outDueUs ulong

Returns

PamojaStatus

pamoja_lorawan_relay_heard_wor(nint, in PamojaLorawanScan, ReadOnlySpan<byte>, nuint, short, sbyte, ulong, out PamojaLorawanWake)

Reads a wake-on-radio frame a scan heard.

public static PamojaStatus pamoja_lorawan_relay_heard_wor(nint relay, in PamojaLorawanScan scan, ReadOnlySpan<byte> frame, nuint frameLen, short rssiDbm, sbyte snrDb, ulong endedUs, out PamojaLorawanWake outWake)

Parameters

relay nint
scan PamojaLorawanScan
frame ReadOnlySpan<byte>
frameLen nuint
rssiDbm short
snrDb sbyte
endedUs ulong
outWake PamojaLorawanWake

Returns

PamojaStatus

pamoja_lorawan_relay_join(nint, ushort, ulong, out nint, out PamojaLorawanTransmission)

Makes the relay's own join request.

public static PamojaStatus pamoja_lorawan_relay_join(nint relay, ushort devNonce, ulong nowUs, out nint outFrame, out PamojaLorawanTransmission outTransmission)

Parameters

relay nint
devNonce ushort
nowUs ulong
outFrame nint
outTransmission PamojaLorawanTransmission

Returns

PamojaStatus

pamoja_lorawan_relay_new(nint, nint, in PamojaLorawanDeviceSettings, byte, byte, out nint)

Makes a relay whose own device joins over the air.

public static PamojaStatus pamoja_lorawan_relay_new(nint plan, nint credentials, in PamojaLorawanDeviceSettings settings, byte xtalAccuracy, byte cadToRx, out nint outRelay)

Parameters

plan nint
credentials nint
settings PamojaLorawanDeviceSettings
xtalAccuracy byte
cadToRx byte
outRelay nint

Returns

PamojaStatus

pamoja_lorawan_relay_next_scan(nint, ulong, out PamojaLorawanScan)

Says when and where to scan next.

public static PamojaStatus pamoja_lorawan_relay_next_scan(nint relay, ulong nowUs, out PamojaLorawanScan outScan)

Parameters

relay nint
nowUs ulong
outScan PamojaLorawanScan

Returns

PamojaStatus

pamoja_lorawan_relay_next_wor(in PamojaLorawanSynchronization, ulong, uint, ulong, byte, out PamojaLorawanWorSlot, out byte)

Picks the relay scan a synchronized end device aims its next WOR frame at.

public static PamojaStatus pamoja_lorawan_relay_next_wor(in PamojaLorawanSynchronization synchronization, ulong nowUs, uint deviceXtalPpm, ulong symbolUs, byte otherChannel, out PamojaLorawanWorSlot outSlot, out byte outSynchronized)

Parameters

synchronization PamojaLorawanSynchronization
nowUs ulong
deviceXtalPpm uint
symbolUs ulong
otherChannel byte
outSlot PamojaLorawanWorSlot
outSynchronized byte

Returns

PamojaStatus

pamoja_lorawan_relay_nothing_heard(nint, ulong, out byte, out ulong)

Says what comes next once the relay's own windows closed empty.

public static PamojaStatus pamoja_lorawan_relay_nothing_heard(nint relay, ulong nowUs, out byte outNext, out ulong outNotBeforeUs)

Parameters

relay nint
nowUs ulong
outNext byte
outNotBeforeUs ulong

Returns

PamojaStatus

pamoja_lorawan_relay_personalized(nint, nint, in PamojaLorawanDeviceSettings, byte, byte, out nint)

Makes a relay whose own device is activated by personalization.

public static PamojaStatus pamoja_lorawan_relay_personalized(nint plan, nint session, in PamojaLorawanDeviceSettings settings, byte xtalAccuracy, byte cadToRx, out nint outRelay)

Parameters

plan nint
session nint
settings PamojaLorawanDeviceSettings
xtalAccuracy byte
cadToRx byte
outRelay nint

Returns

PamojaStatus

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

Derives a root relay session key from a network session key.

public static PamojaStatus pamoja_lorawan_relay_root_wor_s_key(ReadOnlySpan<byte> networkKey, nuint networkKeyLen, Span<byte> outKey)

Parameters

networkKey ReadOnlySpan<byte>
networkKeyLen nuint
outKey Span<byte>

Returns

PamojaStatus

pamoja_lorawan_relay_running(nint)

Reports whether the relay is scanning.

public static extern byte pamoja_lorawan_relay_running(nint relay)

Parameters

relay nint

Returns

byte

pamoja_lorawan_relay_second_channel(byte, byte, byte, uint, out PamojaLoraRelayChannel)

Reads the second channel a relay or end device configuration describes.

public static PamojaStatus pamoja_lorawan_relay_second_channel(byte secondChannelIndex, byte dataRate, byte ackOffset, uint frequencyHz, out PamojaLoraRelayChannel outChannel)

Parameters

secondChannelIndex byte
dataRate byte
ackOffset byte
frequencyHz uint
outChannel PamojaLoraRelayChannel

Returns

PamojaStatus

pamoja_lorawan_relay_send(nint, byte, ReadOnlySpan<byte>, nuint, byte, ulong, out nint, out PamojaLorawanTransmission)

Sends one of the relay's own uplinks.

public static PamojaStatus pamoja_lorawan_relay_send(nint relay, byte port, ReadOnlySpan<byte> payload, nuint payloadLen, byte confirmed, ulong nowUs, out nint outFrame, out PamojaLorawanTransmission outTransmission)

Parameters

relay nint
port byte
payload ReadOnlySpan<byte>
payloadLen nuint
confirmed byte
nowUs ulong
outFrame nint
outTransmission PamojaLorawanTransmission

Returns

PamojaStatus

pamoja_lorawan_relay_start(nint, byte, byte, byte, uint, uint, byte)

Starts scanning, or changes what a running relay scans.

public static extern PamojaStatus pamoja_lorawan_relay_start(nint relay, byte cadPeriodicity, byte defaultChannelIndex, byte hasSecondChannel, uint secondWorFrequencyHz, uint secondAckFrequencyHz, byte secondDataRate)

Parameters

relay nint
cadPeriodicity byte
defaultChannelIndex byte
hasSecondChannel byte
secondWorFrequencyHz uint
secondAckFrequencyHz uint
secondDataRate byte

Returns

PamojaStatus

pamoja_lorawan_relay_status(nint, out PamojaLorawanEndDeviceStatus)

Reads where the relay's own device stands.

public static PamojaStatus pamoja_lorawan_relay_status(nint relay, out PamojaLorawanEndDeviceStatus outStatus)

Parameters

relay nint
outStatus PamojaLorawanEndDeviceStatus

Returns

PamojaStatus

pamoja_lorawan_relay_stop(nint)

Stops scanning.

public static extern void pamoja_lorawan_relay_stop(nint relay)

Parameters

relay nint

pamoja_lorawan_relay_synchronization(ulong, ushort, ulong, in PamojaLorawanStateSync, out PamojaLorawanSynchronization)

Works out when a relay scanned from the WOR ACK that answered a frame.

public static PamojaStatus pamoja_lorawan_relay_synchronization(ulong worStartUs, ushort preambleSymbols, ulong symbolUs, in PamojaLorawanStateSync state, out PamojaLorawanSynchronization outSynchronization)

Parameters

worStartUs ulong
preambleSymbols ushort
symbolUs ulong
state PamojaLorawanStateSync
outSynchronization PamojaLorawanSynchronization

Returns

PamojaStatus

pamoja_lorawan_relay_t_offset_ms(ulong, ulong, out ushort)

Works out the offset a relay reports in a WOR ACK.

public static PamojaStatus pamoja_lorawan_relay_t_offset_ms(ulong scanStartUs, ulong preambleEndUs, out ushort outOffsetMs)

Parameters

scanStartUs ulong
preambleEndUs ulong
outOffsetMs ushort

Returns

PamojaStatus

pamoja_lorawan_relay_trust(nint, byte, uint, ReadOnlySpan<byte>, uint, byte, byte)

Trusts an end device, as an UpdateUplinkListReq does.

public static PamojaStatus pamoja_lorawan_relay_trust(nint relay, byte index, uint devAddr, ReadOnlySpan<byte> rootWorSKey, uint nextWfcnt, byte reloadRate, byte bucketSize)

Parameters

relay nint
index byte
devAddr uint
rootWorSKey ReadOnlySpan<byte>
nextWfcnt uint
reloadRate byte
bucketSize byte

Returns

PamojaStatus

pamoja_lorawan_relay_unsynchronized_preamble(byte, ulong, byte, out ushort)

Works out an unsynchronized WOR preamble.

public static PamojaStatus pamoja_lorawan_relay_unsynchronized_preamble(byte cadPeriodicity, ulong symbolUs, byte cadToRx, out ushort outSymbols)

Parameters

cadPeriodicity byte
symbolUs ulong
cadToRx byte
outSymbols ushort

Returns

PamojaStatus

Clears the uplink a wake-on-radio frame announced.

public static extern void pamoja_lorawan_relay_uplink_missed(nint relay)

Parameters

relay nint

pamoja_lorawan_relay_wor_ack(in PamojaLorawanWorKeys, uint, uint, in PamojaLorawanCarrier, in PamojaLorawanCarrier, in PamojaLorawanStateSync, Span<byte>)

Builds a relay's WOR ACK.

public static PamojaStatus pamoja_lorawan_relay_wor_ack(in PamojaLorawanWorKeys keys, uint devAddr, uint wfcnt, in PamojaLorawanCarrier ack, in PamojaLorawanCarrier uplink, in PamojaLorawanStateSync state, Span<byte> outFrame)

Parameters

keys PamojaLorawanWorKeys
devAddr uint
wfcnt uint
ack PamojaLorawanCarrier
uplink PamojaLorawanCarrier
state PamojaLorawanStateSync
outFrame Span<byte>

Returns

PamojaStatus

pamoja_lorawan_relay_wor_ack_open(ReadOnlySpan<byte>, nuint, in PamojaLorawanWorKeys, uint, uint, in PamojaLorawanCarrier, in PamojaLorawanCarrier, out PamojaLorawanStateSync)

Checks and reads a WOR ACK.

public static PamojaStatus pamoja_lorawan_relay_wor_ack_open(ReadOnlySpan<byte> frame, nuint frameLen, in PamojaLorawanWorKeys keys, uint devAddr, uint wfcnt, in PamojaLorawanCarrier ack, in PamojaLorawanCarrier uplink, out PamojaLorawanStateSync outState)

Parameters

frame ReadOnlySpan<byte>
frameLen nuint
keys PamojaLorawanWorKeys
devAddr uint
wfcnt uint
ack PamojaLorawanCarrier
uplink PamojaLorawanCarrier
outState PamojaLorawanStateSync

Returns

PamojaStatus

pamoja_lorawan_relay_wor_join_request(in PamojaLorawanCarrier, Span<byte>)

Builds the WOR frame ahead of a join request.

public static PamojaStatus pamoja_lorawan_relay_wor_join_request(in PamojaLorawanCarrier uplink, Span<byte> outFrame)

Parameters

uplink PamojaLorawanCarrier
outFrame Span<byte>

Returns

PamojaStatus

pamoja_lorawan_relay_wor_keys(ReadOnlySpan<byte>, nuint, uint, out PamojaLorawanWorKeys)

Derives an end device's wake-on-radio keys from its root key.

public static PamojaStatus pamoja_lorawan_relay_wor_keys(ReadOnlySpan<byte> rootKey, nuint rootKeyLen, uint devAddr, out PamojaLorawanWorKeys outKeys)

Parameters

rootKey ReadOnlySpan<byte>
rootKeyLen nuint
devAddr uint
outKeys PamojaLorawanWorKeys

Returns

PamojaStatus

pamoja_lorawan_relay_wor_open(ReadOnlySpan<byte>, nuint, in PamojaLorawanWorKeys, uint, in PamojaLorawanCarrier, out PamojaLorawanCarrier)

Checks a WOR frame ahead of a Class A uplink and reads its carrier.

public static PamojaStatus pamoja_lorawan_relay_wor_open(ReadOnlySpan<byte> frame, nuint frameLen, in PamojaLorawanWorKeys keys, uint wfcnt, in PamojaLorawanCarrier wor, out PamojaLorawanCarrier outUplink)

Parameters

frame ReadOnlySpan<byte>
frameLen nuint
keys PamojaLorawanWorKeys
wfcnt uint
wor PamojaLorawanCarrier
outUplink PamojaLorawanCarrier

Returns

PamojaStatus

pamoja_lorawan_relay_wor_parse(ReadOnlySpan<byte>, nuint, out PamojaLorawanWor)

Reads a WOR frame.

public static PamojaStatus pamoja_lorawan_relay_wor_parse(ReadOnlySpan<byte> frame, nuint frameLen, out PamojaLorawanWor outWor)

Parameters

frame ReadOnlySpan<byte>
frameLen nuint
outWor PamojaLorawanWor

Returns

PamojaStatus

Builds the WOR frame ahead of a Class A uplink.

public static PamojaStatus pamoja_lorawan_relay_wor_uplink(in PamojaLorawanWorKeys keys, uint devAddr, uint wfcnt, in PamojaLorawanCarrier uplink, in PamojaLorawanCarrier wor, Span<byte> outFrame)

Parameters

keys PamojaLorawanWorKeys
devAddr uint
wfcnt uint
uplink PamojaLorawanCarrier
wor PamojaLorawanCarrier
outFrame Span<byte>

Returns

PamojaStatus

pamoja_lorawan_rx_ack(nint)

Reports whether a decoded frame acknowledges the last confirmed one.

public static bool pamoja_lorawan_rx_ack(nint rx)

Parameters

rx nint

Returns

bool

pamoja_lorawan_rx_adr(nint)

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

public static bool pamoja_lorawan_rx_adr(nint rx)

Parameters

rx nint

Returns

bool

pamoja_lorawan_rx_adr_ack_req(nint)

Reports whether a decoded uplink asks the network to answer.

public static bool pamoja_lorawan_rx_adr_ack_req(nint rx)

Parameters

rx nint

Returns

bool

pamoja_lorawan_rx_class_b(nint)

Reports whether a decoded uplink came from a device running Class B.

public static bool pamoja_lorawan_rx_class_b(nint rx)

Parameters

rx nint

Returns

bool

pamoja_lorawan_rx_confirmed(nint)

Reports whether a decoded frame asks to be acknowledged.

public static bool pamoja_lorawan_rx_confirmed(nint rx)

Parameters

rx nint

Returns

bool

pamoja_lorawan_rx_dev_addr(nint)

Returns the device address a decoded frame carries.

public static extern uint pamoja_lorawan_rx_dev_addr(nint rx)

Parameters

rx nint

Returns

uint

pamoja_lorawan_rx_direction(nint)

Returns the direction a decoded frame traveled.

public static extern PamojaLorawanDirection pamoja_lorawan_rx_direction(nint rx)

Parameters

rx nint

Returns

PamojaLorawanDirection

pamoja_lorawan_rx_fcnt(nint)

Returns the low 16 bits of the frame counter.

public static extern ushort pamoja_lorawan_rx_fcnt(nint rx)

Parameters

rx nint

Returns

ushort

pamoja_lorawan_rx_fopts(nint)

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

public static extern nint pamoja_lorawan_rx_fopts(nint rx)

Parameters

rx nint

Returns

nint

pamoja_lorawan_rx_fopts_len(nint)

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

public static extern nuint pamoja_lorawan_rx_fopts_len(nint rx)

Parameters

rx nint

Returns

nuint

pamoja_lorawan_rx_fpending(nint)

Reports whether the network has more downlink data waiting.

public static bool pamoja_lorawan_rx_fpending(nint rx)

Parameters

rx nint

Returns

bool

pamoja_lorawan_rx_fport(nint, out byte)

Returns the port a decoded frame was sent on.

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

Parameters

rx nint
outFport byte

Returns

bool

pamoja_lorawan_rx_free(nint)

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

public static extern void pamoja_lorawan_rx_free(nint rx)

Parameters

rx nint

pamoja_lorawan_rx_payload(nint)

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

public static extern nint pamoja_lorawan_rx_payload(nint rx)

Parameters

rx nint

Returns

nint

pamoja_lorawan_rx_payload_len(nint)

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

public static extern nuint pamoja_lorawan_rx_payload_len(nint rx)

Parameters

rx nint

Returns

nuint

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

Verifies a received frame, then decrypts it.

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

Parameters

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

Returns

PamojaStatus

pamoja_lorawan_session_dev_addr(nint)

Returns the device address a session is bound to.

public static extern uint pamoja_lorawan_session_dev_addr(nint session)

Parameters

session nint

Returns

uint

Encodes a downlink data frame.

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

Parameters

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

Returns

PamojaStatus

Encodes an uplink data frame.

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

Parameters

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

Returns

PamojaStatus

pamoja_lorawan_session_free(nint)

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

public static extern void pamoja_lorawan_session_free(nint session)

Parameters

session nint

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

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

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

Parameters

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

Returns

PamojaStatus

pamoja_lorawan_session_root_wor_s_key(nint, Span<byte>)

Returns the root relay session key of a session's device.

public static PamojaStatus pamoja_lorawan_session_root_wor_s_key(nint session, Span<byte> outKey)

Parameters

session nint
outKey Span<byte>

Returns

PamojaStatus

pamoja_lorawan_session_wor_keys(nint, out PamojaLorawanWorKeys)

Returns the wake-on-radio keys of a session's device.

public static PamojaStatus pamoja_lorawan_session_wor_keys(nint session, out PamojaLorawanWorKeys outKeys)

Parameters

session nint
outKeys PamojaLorawanWorKeys

Returns

PamojaStatus

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

Wraps a group key for a device, which is what a server does.

public static PamojaStatus pamoja_lorawan_wrap_mc_key(ReadOnlySpan<byte> mcKeKey, ReadOnlySpan<byte> mcKey, Span<byte> outWrapped)

Parameters

mcKeKey ReadOnlySpan<byte>
mcKey ReadOnlySpan<byte>
outWrapped Span<byte>

Returns

PamojaStatus

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

Reads a manifest body back from its bytes.

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

Parameters

bytes ReadOnlySpan<byte>
len nuint
outManifest PamojaManifest

Returns

PamojaStatus

pamoja_manifest_encode(PamojaManifest)

Encodes the body of a manifest.

public static extern nint pamoja_manifest_encode(PamojaManifest manifest)

Parameters

manifest PamojaManifest

Returns

nint

pamoja_manifest_sign(PamojaManifest, nint)

Signs a manifest into the envelope offered to a device.

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

Parameters

manifest PamojaManifest
author nint

Returns

nint

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

public static extern byte pamoja_mavlink_command_confirmation(nint command)

Parameters

command nint

Returns

byte

Releases a command tracker.

public static extern void pamoja_mavlink_command_free(nint command)

Parameters

command nint

Returns the command id being tracked.

public static extern ushort pamoja_mavlink_command_id(nint command)

Parameters

command nint

Returns

ushort

Starts tracking a command.

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

Parameters

command ushort
maxRetries byte

Returns

nint

Classifies an incoming frame against the command in flight.

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

Parameters

command nint
frame nint
outKind uint
outValue byte

Returns

PamojaStatus

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

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

Parameters

command nint
outConfirmation byte

Returns

byte

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

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

Parameters

bytes ReadOnlySpan<byte>
bytesLen nuint

Returns

ushort

Adds or replaces the seed for a message id.

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

Parameters

dialect nint
msgid uint
crcExtra byte

Returns

PamojaStatus

Adds a schema's message to a dialect table.

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

Parameters

dialect nint
schema nint

Returns

PamojaStatus

Returns the seed a dialect resolves a message id to.

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

Parameters

dialect nint
msgid uint
outCrcExtra byte

Returns

PamojaStatus

Releases a dialect table.

public static extern void pamoja_mavlink_dialect_free(nint dialect)

Parameters

dialect nint

Creates an empty dialect table.

public static extern nint pamoja_mavlink_dialect_new()

Returns

nint

Returns the name of the enumeration at a position in the table.

public static PamojaStatus pamoja_mavlink_enum_at(nuint index, out nint outName)

Parameters

index nuint
outName nint

Returns

PamojaStatus

Returns how many enumerations the dialect table holds.

public static extern nuint pamoja_mavlink_enum_count()

Returns

nuint

pamoja_mavlink_enum_entry(string, ulong, out nint)

Names the entry of an enumeration that stands for a value, or null.

public static PamojaStatus pamoja_mavlink_enum_entry(string enumeration, ulong value, out nint outName)

Parameters

enumeration string
value ulong
outName nint

Returns

PamojaStatus

pamoja_mavlink_enum_entry_at(string, nuint, out nint, out ulong)

Returns an enumeration's entry at a position, with its value.

public static PamojaStatus pamoja_mavlink_enum_entry_at(string enumeration, nuint index, out nint outName, out ulong outValue)

Parameters

enumeration string
index nuint
outName nint
outValue ulong

Returns

PamojaStatus

Reports whether an enumeration's values combine as bits.

public static PamojaStatus pamoja_mavlink_enum_is_bitmask(string enumeration, out bool outBitmask)

Parameters

enumeration string
outBitmask bool

Returns

PamojaStatus

Returns how many entries an enumeration names.

public static PamojaStatus pamoja_mavlink_enum_len(string enumeration, out nuint outLen)

Parameters

enumeration string
outLen nuint

Returns

PamojaStatus

Names the entries a value is made of, joined by a vertical bar.

public static PamojaStatus pamoja_mavlink_enum_names(string enumeration, ulong value, out nint outNames)

Parameters

enumeration string
value ulong
outNames nint

Returns

PamojaStatus

Looks up the value a dialect entry name stands for.

public static PamojaStatus pamoja_mavlink_enum_value(string entry, out ulong outValue)

Parameters

entry string
outValue ulong

Returns

PamojaStatus

Returns a pointer to a frame's bytes.

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

Parameters

frame nint
outLen nuint

Returns

nint

Assembles a frame carrying a message.

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

Parameters

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

Returns

PamojaStatus

Releases a frame.

public static extern void pamoja_mavlink_frame_free(nint frame)

Parameters

frame nint

Returns the addressing fields a frame carries.

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

Parameters

frame nint
outHeader PamojaMavlinkHeader

Returns

PamojaStatus

Returns the incompatibility flags a v2 frame declares.

public static extern byte pamoja_mavlink_frame_incompat_flags(nint frame)

Parameters

frame nint

Returns

byte

Reports whether a frame carries a signature.

public static extern byte pamoja_mavlink_frame_is_signed(nint frame)

Parameters

frame nint

Returns

byte

Returns the id of the message a frame carries.

public static extern uint pamoja_mavlink_frame_message_id(nint frame)

Parameters

frame nint

Returns

uint

Parses one frame against a known CRC_EXTRA.

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

Parameters

bytes ReadOnlySpan<byte>
bytesLen nuint
crcExtra byte
outFrame nint

Returns

PamojaStatus

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

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

Parameters

bytes ReadOnlySpan<byte>
bytesLen nuint
dialect nint
outFrame nint

Returns

PamojaStatus

Returns a pointer to a frame's payload.

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

Parameters

frame nint
outLen nuint

Returns

nint

Copies a frame's signature block out.

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

Parameters

frame nint
outSignature Span<byte>

Returns

PamojaStatus

Returns the wire format a frame uses.

public static extern byte pamoja_mavlink_frame_version(nint frame)

Parameters

frame nint

Returns

byte

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

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

Parameters

msgid uint
outCrcExtra byte

Returns

PamojaStatus

Derives the CRC_EXTRA seed of a message from its definition.

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

Parameters

name string
fields ReadOnlySpan<PamojaMavlinkField>
fieldCount nuint
outCrcExtra byte

Returns

PamojaStatus

Reads a message out of a frame payload.

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

Parameters

schema nint
payload ReadOnlySpan<byte>
payloadLen nuint
outMessage nint

Returns

PamojaStatus

Releases a message.

public static extern void pamoja_mavlink_message_free(nint message)

Parameters

message nint

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

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

Parameters

message nint
field string
outBytes Span<byte>
outBytesLen nuint

Returns

PamojaStatus

Reads a floating-point field.

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

Parameters

message nint
field string
index nuint
outValue double

Returns

PamojaStatus

Reads a field as a signed integer.

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

Parameters

message nint
field string
index nuint
outValue long

Returns

PamojaStatus

Reads a field as a double, whatever its type.

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

Parameters

message nint
field string
index nuint
outValue double

Returns

PamojaStatus

Reads a field as an unsigned integer.

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

Parameters

message nint
field string
index nuint
outValue ulong

Returns

PamojaStatus

Creates a message with every field zero.

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

Parameters

schema nint
outMessage nint

Returns

PamojaStatus

Returns a pointer to a message's payload bytes.

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

Parameters

message nint
outLen nuint

Returns

nint

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

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

Parameters

message nint
field string
bytes ReadOnlySpan<byte>
bytesLen nuint

Returns

PamojaStatus

Writes a floating-point field.

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

Parameters

message nint
field string
index nuint
value double

Returns

PamojaStatus

Writes a signed integer into a field.

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

Parameters

message nint
field string
index nuint
value long

Returns

PamojaStatus

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

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

Parameters

message nint
field string
index nuint
value double

Returns

PamojaStatus

Writes an unsigned integer into a field.

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

Parameters

message nint
field string
index nuint
value ulong

Returns

PamojaStatus

Builds a v2 frame carrying a message.

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

Parameters

message nint
header PamojaMavlinkHeader
outFrame nint

Returns

PamojaStatus

Returns the next sequence number the receiver expects.

public static extern ushort pamoja_mavlink_mission_receiver_expected(nint receiver)

Parameters

receiver nint

Returns

ushort

Releases a receiver.

public static extern void pamoja_mavlink_mission_receiver_free(nint receiver)

Parameters

receiver nint

Reports whether the transfer has finished.

public static extern byte pamoja_mavlink_mission_receiver_is_complete(nint receiver)

Parameters

receiver nint

Returns

byte

Creates a receiver for a plan from a target vehicle.

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

Parameters

targetSystem byte
targetComponent byte
missionType byte

Returns

nint

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

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

Parameters

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

Returns

PamojaStatus

Builds the frame that starts a download.

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

Parameters

receiver nint
header PamojaMavlinkHeader
outFrame nint

Returns

PamojaStatus

Appends an item to the plan.

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

Parameters

sender nint
payload ReadOnlySpan<byte>
payloadLen nuint

Returns

PamojaStatus

Builds the frame that opens an upload.

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

Parameters

sender nint
header PamojaMavlinkHeader
outFrame nint

Returns

PamojaStatus

Releases a sender.

public static extern void pamoja_mavlink_mission_sender_free(nint sender)

Parameters

sender nint

Returns the number of items in the plan.

public static extern ushort pamoja_mavlink_mission_sender_len(nint sender)

Parameters

sender nint

Returns

ushort

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

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

Parameters

targetSystem byte
targetComponent byte
missionType byte

Returns

nint

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

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

Parameters

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

Returns

PamojaStatus

Builds a global-frame position setpoint frame.

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

Parameters

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

Returns

PamojaStatus

Builds a local-frame position setpoint frame.

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

Parameters

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

Returns

PamojaStatus

Builds a local-frame velocity setpoint frame.

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

Parameters

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

Returns

PamojaStatus

Builds a setpoint type_mask from the fields to use.

public static extern ushort pamoja_mavlink_offboard_type_mask(uint flags)

Parameters

flags uint

Returns

ushort

Releases a parser.

public static extern void pamoja_mavlink_parser_free(nint parser)

Parameters

parser nint

Creates a parser with an empty buffer.

public static extern nint pamoja_mavlink_parser_new()

Returns

nint

Takes the next completed frame out of the parser.

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

Parameters

parser nint
outFrame nint

Returns

PamojaStatus

Returns how many completed frames are waiting.

public static extern nuint pamoja_mavlink_parser_pending(nint parser)

Parameters

parser nint

Returns

nuint

Feeds bytes off a link into the parser.

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

Parameters

parser nint
bytes ReadOnlySpan<byte>
bytesLen nuint
dialect nint

Returns

PamojaStatus

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

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

Parameters

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

Returns

PamojaStatus

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

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

Parameters

index nuint
outSchema nint

Returns

PamojaStatus

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

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

Parameters

builder nint
outSchema nint

Returns

PamojaStatus

Adds a MAVLink 2 extension field, in declared order.

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

Parameters

builder nint
name string
fieldType uint
arrayLen byte

Returns

PamojaStatus

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

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

Parameters

builder nint
name string
fieldType uint
arrayLen byte

Returns

PamojaStatus

Releases a builder that was never built.

public static extern void pamoja_mavlink_schema_builder_free(nint builder)

Parameters

builder nint

Starts describing a message.

public static nint pamoja_mavlink_schema_builder_new(uint msgid, string name)

Parameters

msgid uint
name string

Returns

nint

Returns how many messages this build types.

public static extern nuint pamoja_mavlink_schema_count()

Returns

nuint

Returns the CRC_EXTRA seed a schema implies.

public static extern byte pamoja_mavlink_schema_crc_extra(nint schema)

Parameters

schema nint

Returns

byte

Describes one field of a message.

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

Parameters

schema nint
index nuint
outField PamojaMavlinkFieldInfo

Returns

PamojaStatus

Returns how many fields a message has.

public static extern nuint pamoja_mavlink_schema_field_count(nint schema)

Parameters

schema nint

Returns

nuint

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

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

Parameters

msgid uint
outSchema nint

Returns

PamojaStatus

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

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

Parameters

name string
outSchema nint

Returns

PamojaStatus

Releases a schema.

public static extern void pamoja_mavlink_schema_free(nint schema)

Parameters

schema nint

Returns the id of the message a schema describes.

public static extern uint pamoja_mavlink_schema_id(nint schema)

Parameters

schema nint

Returns

uint

Returns the name of the message a schema describes.

public static extern nint pamoja_mavlink_schema_name(nint schema)

Parameters

schema nint

Returns

nint

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

public static extern nuint pamoja_mavlink_schema_wire_len(nint schema)

Parameters

schema nint

Returns

nuint

Releases a signer.

public static extern void pamoja_mavlink_signer_free(nint signer)

Parameters

signer nint

Returns the link a signer signs on.

public static extern byte pamoja_mavlink_signer_link_id(nint signer)

Parameters

signer nint

Returns

byte

Creates a signer.

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

Parameters

key ReadOnlySpan<byte>
linkId byte
timestamp ulong
outSigner nint

Returns

PamojaStatus

Signs a message into a v2 frame.

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

Parameters

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

Returns

PamojaStatus

Converts Unix time into the timestamp MAVLink signing counts in.

public static extern ulong pamoja_mavlink_timestamp_from_unix_micros(ulong unixMicros)

Parameters

unixMicros ulong

Returns

ulong

Releases a verifier.

public static extern void pamoja_mavlink_verifier_free(nint verifier)

Parameters

verifier nint

Creates a verifier.

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

Parameters

key ReadOnlySpan<byte>
outVerifier nint

Returns

PamojaStatus

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

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

Parameters

verifier nint
window ulong

Returns

PamojaStatus

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

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

Parameters

verifier nint
frame nint

Returns

PamojaStatus

pamoja_mecanum_body_motion(PamojaMecanum, PamojaWheelSpeeds)

Returns the body twist a mecanum base makes from measured wheel speeds.

public static extern PamojaTwist pamoja_mecanum_body_motion(PamojaMecanum mecanum, PamojaWheelSpeeds wheels)

Parameters

mecanum PamojaMecanum
wheels PamojaWheelSpeeds

Returns

PamojaTwist

pamoja_mecanum_wheel_speeds(PamojaMecanum, PamojaTwist)

Returns the four wheel speeds a mecanum base needs for a body twist.

public static extern PamojaWheelSpeeds pamoja_mecanum_wheel_speeds(PamojaMecanum mecanum, PamojaTwist twist)

Parameters

mecanum PamojaMecanum
twist PamojaTwist

Returns

PamojaWheelSpeeds

pamoja_median_capacity(nint)

Returns how many readings a median filter keeps.

public static extern nuint pamoja_median_capacity(nint median)

Parameters

median nint

Returns

nuint

pamoja_median_free(nint)

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

public static extern void pamoja_median_free(nint median)

Parameters

median nint

pamoja_median_new()

Creates an empty median filter.

public static extern nint pamoja_median_new()

Returns

nint

pamoja_median_update(nint, float)

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

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

Parameters

median nint
reading float

Returns

float

pamoja_median_value(nint, out float)

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

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

Parameters

median nint
outValue float

Returns

bool

pamoja_median_with_capacity(nuint)

Creates an empty median filter keeping up to a capacity, or null for one out of range.

public static extern nint pamoja_median_with_capacity(nuint capacity)

Parameters

capacity nuint

Returns

nint

pamoja_mesh_crc16(ReadOnlySpan<byte>, nuint)

Computes the CRC-16 a mesh frame carries.

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

Parameters

data ReadOnlySpan<byte>
dataLen nuint

Returns

ushort

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

Builds a mesh frame addressed to every node.

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

Parameters

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

Returns

PamojaStatus

pamoja_mesh_frame_bytes(nint)

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

public static extern nint pamoja_mesh_frame_bytes(nint frame)

Parameters

frame nint

Returns

nint

pamoja_mesh_frame_bytes_len(nint)

Returns the length of the whole frame.

public static extern nuint pamoja_mesh_frame_bytes_len(nint frame)

Parameters

frame nint

Returns

nuint

pamoja_mesh_frame_dst(nint)

Returns the address a frame is addressed to.

public static extern uint pamoja_mesh_frame_dst(nint frame)

Parameters

frame nint

Returns

uint

pamoja_mesh_frame_free(nint)

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

public static extern void pamoja_mesh_frame_free(nint frame)

Parameters

frame nint

pamoja_mesh_frame_hop_limit(nint)

Returns how many further relays a frame may take.

public static extern byte pamoja_mesh_frame_hop_limit(nint frame)

Parameters

frame nint

Returns

byte

pamoja_mesh_frame_id(nint)

Returns the sequence number a frame carries.

public static extern ushort pamoja_mesh_frame_id(nint frame)

Parameters

frame nint

Returns

ushort

pamoja_mesh_frame_is_broadcast(nint)

Reports whether a frame is addressed to every node.

public static bool pamoja_mesh_frame_is_broadcast(nint frame)

Parameters

frame nint

Returns

bool

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

Builds a mesh frame addressed to one node.

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

Parameters

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

Returns

PamojaStatus

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

Parses a mesh frame received off a radio.

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

Parameters

bytes ReadOnlySpan<byte>
bytesLen nuint
outFrame nint

Returns

PamojaStatus

pamoja_mesh_frame_payload(nint)

Returns a pointer to the payload a frame carries.

public static extern nint pamoja_mesh_frame_payload(nint frame)

Parameters

frame nint

Returns

nint

pamoja_mesh_frame_payload_len(nint)

Returns the length of the payload a frame carries.

public static extern nuint pamoja_mesh_frame_payload_len(nint frame)

Parameters

frame nint

Returns

nuint

pamoja_mesh_frame_relayed(nint, out nint)

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

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

Parameters

frame nint
outFrame nint

Returns

bool

pamoja_mesh_frame_set_hop_limit(nint, byte)

Sets the number of relays a frame may still take.

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

Parameters

frame nint
hopLimit byte

pamoja_mesh_frame_src(nint)

Returns the address of the node a frame came from.

public static extern uint pamoja_mesh_frame_src(nint frame)

Parameters

frame nint

Returns

uint

pamoja_mesh_frame_version(nint)

Returns the protocol version a frame declares.

public static extern byte pamoja_mesh_frame_version(nint frame)

Parameters

frame nint

Returns

byte

pamoja_mesh_seen_capacity(nint)

Returns how many packets a duplicate cache remembers.

public static extern nuint pamoja_mesh_seen_capacity(nint cache)

Parameters

cache nint

Returns

nuint

pamoja_mesh_seen_contains(nint, uint, ushort)

Reports whether a packet is remembered, without recording it.

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

Parameters

cache nint
src uint
id ushort

Returns

bool

pamoja_mesh_seen_free(nint)

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

public static extern void pamoja_mesh_seen_free(nint cache)

Parameters

cache nint

pamoja_mesh_seen_new(nuint)

Creates an empty duplicate cache of the size given.

public static extern nint pamoja_mesh_seen_new(nuint capacity)

Parameters

capacity nuint

Returns

nint

pamoja_mesh_seen_record(nint, uint, ushort)

Records a packet and reports whether it was new.

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

Parameters

cache nint
src uint
id ushort

Returns

bool

pamoja_message_free(nint)

Releases a message handle.

public static extern void pamoja_message_free(nint message)

Parameters

message nint

pamoja_message_new(nint, ReadOnlySpan<byte>, nuint)

Builds a message for a host to deliver.

public static nint pamoja_message_new(nint topic, ReadOnlySpan<byte> payload, nuint payloadLen)

Parameters

topic nint
payload ReadOnlySpan<byte>
payloadLen nuint

Returns

nint

pamoja_message_payload(nint)

Returns a pointer to a message payload.

public static extern nint pamoja_message_payload(nint message)

Parameters

message nint

Returns

nint

pamoja_message_payload_len(nint)

Returns the length in bytes of a message payload.

public static extern nuint pamoja_message_payload_len(nint message)

Parameters

message nint

Returns

nuint

pamoja_message_topic(nint)

Returns the topic a message arrived on.

public static extern nint pamoja_message_topic(nint message)

Parameters

message nint

Returns

nint

pamoja_modbus_client_free(nint)

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

public static extern void pamoja_modbus_client_free(nint client)

Parameters

client nint

pamoja_modbus_client_new(nint, out nint)

Makes a client on a port.

public static PamojaStatus pamoja_modbus_client_new(nint port, out nint outClient)

Parameters

port nint
outClient nint

Returns

PamojaStatus

pamoja_modbus_client_read_coils(nint, byte, ushort, ushort, Span<byte>, out PamojaModbusClientError)

Reads coils, one byte per coil.

public static PamojaStatus pamoja_modbus_client_read_coils(nint client, byte unit, ushort start, ushort quantity, Span<byte> outValues, out PamojaModbusClientError outError)

Parameters

client nint
unit byte
start ushort
quantity ushort
outValues Span<byte>
outError PamojaModbusClientError

Returns

PamojaStatus

pamoja_modbus_client_read_discrete_inputs(nint, byte, ushort, ushort, Span<byte>, out PamojaModbusClientError)

Reads discrete inputs, one byte per input.

public static PamojaStatus pamoja_modbus_client_read_discrete_inputs(nint client, byte unit, ushort start, ushort quantity, Span<byte> outValues, out PamojaModbusClientError outError)

Parameters

client nint
unit byte
start ushort
quantity ushort
outValues Span<byte>
outError PamojaModbusClientError

Returns

PamojaStatus

pamoja_modbus_client_read_holding_registers(nint, byte, ushort, ushort, Span<ushort>, out PamojaModbusClientError)

Reads holding registers.

public static PamojaStatus pamoja_modbus_client_read_holding_registers(nint client, byte unit, ushort start, ushort quantity, Span<ushort> outValues, out PamojaModbusClientError outError)

Parameters

client nint
unit byte
start ushort
quantity ushort
outValues Span<ushort>
outError PamojaModbusClientError

Returns

PamojaStatus

pamoja_modbus_client_read_input_registers(nint, byte, ushort, ushort, Span<ushort>, out PamojaModbusClientError)

Reads input registers.

public static PamojaStatus pamoja_modbus_client_read_input_registers(nint client, byte unit, ushort start, ushort quantity, Span<ushort> outValues, out PamojaModbusClientError outError)

Parameters

client nint
unit byte
start ushort
quantity ushort
outValues Span<ushort>
outError PamojaModbusClientError

Returns

PamojaStatus

pamoja_modbus_client_response_timeout_micros(nint)

Returns a client's response timeout, in microseconds.

public static extern ulong pamoja_modbus_client_response_timeout_micros(nint client)

Parameters

client nint

Returns

ulong

pamoja_modbus_client_set_response_timeout(nint, ulong)

Sets how long a client waits for a whole reply, in microseconds.

public static extern void pamoja_modbus_client_set_response_timeout(nint client, ulong micros)

Parameters

client nint
micros ulong

pamoja_modbus_client_set_turnaround(nint, ulong)

Sets how long a client leaves the line quiet after a broadcast, in microseconds.

public static extern void pamoja_modbus_client_set_turnaround(nint client, ulong micros)

Parameters

client nint
micros ulong

pamoja_modbus_client_turnaround_micros(nint)

Returns a client's turnaround delay, in microseconds.

public static extern ulong pamoja_modbus_client_turnaround_micros(nint client)

Parameters

client nint

Returns

ulong

pamoja_modbus_client_write_multiple_coils(nint, byte, ushort, ReadOnlySpan<byte>, nuint, out PamojaModbusClientError)

Writes a run of coils, one byte per coil.

public static PamojaStatus pamoja_modbus_client_write_multiple_coils(nint client, byte unit, ushort start, ReadOnlySpan<byte> values, nuint len, out PamojaModbusClientError outError)

Parameters

client nint
unit byte
start ushort
values ReadOnlySpan<byte>
len nuint
outError PamojaModbusClientError

Returns

PamojaStatus

pamoja_modbus_client_write_multiple_registers(nint, byte, ushort, ReadOnlySpan<ushort>, nuint, out PamojaModbusClientError)

Writes a run of holding registers.

public static PamojaStatus pamoja_modbus_client_write_multiple_registers(nint client, byte unit, ushort start, ReadOnlySpan<ushort> values, nuint len, out PamojaModbusClientError outError)

Parameters

client nint
unit byte
start ushort
values ReadOnlySpan<ushort>
len nuint
outError PamojaModbusClientError

Returns

PamojaStatus

pamoja_modbus_client_write_single_coil(nint, byte, ushort, bool, out PamojaModbusClientError)

Writes one coil.

public static PamojaStatus pamoja_modbus_client_write_single_coil(nint client, byte unit, ushort address, bool on, out PamojaModbusClientError outError)

Parameters

client nint
unit byte
address ushort
on bool
outError PamojaModbusClientError

Returns

PamojaStatus

pamoja_modbus_client_write_single_register(nint, byte, ushort, ushort, out PamojaModbusClientError)

Writes one holding register.

public static PamojaStatus pamoja_modbus_client_write_single_register(nint client, byte unit, ushort address, ushort value, out PamojaModbusClientError outError)

Parameters

client nint
unit byte
address ushort
value ushort
outError PamojaModbusClientError

Returns

PamojaStatus

pamoja_modbus_crc16(ReadOnlySpan<byte>, nuint)

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

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

Parameters

bytes ReadOnlySpan<byte>
bytesLen nuint

Returns

ushort

pamoja_modbus_frame_address(nint)

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

public static extern byte pamoja_modbus_frame_address(nint frame)

Parameters

frame nint

Returns

byte

pamoja_modbus_frame_coils(nint, ushort, out nint)

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

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

Parameters

frame nint
count ushort
outBuffer nint

Returns

PamojaStatus

pamoja_modbus_frame_exception(nint)

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

public static extern byte pamoja_modbus_frame_exception(nint frame)

Parameters

frame nint

Returns

byte

pamoja_modbus_frame_free(nint)

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

public static extern void pamoja_modbus_frame_free(nint frame)

Parameters

frame nint

pamoja_modbus_frame_function(nint)

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

public static extern byte pamoja_modbus_frame_function(nint frame)

Parameters

frame nint

Returns

byte

pamoja_modbus_frame_gap_nanos(PamojaSerialSettings, out ulong)

Returns the silence that separates two frames, in nanoseconds.

public static PamojaStatus pamoja_modbus_frame_gap_nanos(PamojaSerialSettings settings, out ulong outNanos)

Parameters

settings PamojaSerialSettings
outNanos ulong

Returns

PamojaStatus

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

Parses a received RTU frame, verifying its CRC.

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

Parameters

bytes ReadOnlySpan<byte>
bytesLen nuint
outFrame nint

Returns

PamojaStatus

pamoja_modbus_frame_pdu(nint)

Returns a pointer to a frame's PDU.

public static extern nint pamoja_modbus_frame_pdu(nint frame)

Parameters

frame nint

Returns

nint

pamoja_modbus_frame_pdu_len(nint)

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

public static extern nuint pamoja_modbus_frame_pdu_len(nint frame)

Parameters

frame nint

Returns

nuint

pamoja_modbus_frame_registers(nint, out nint)

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

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

Parameters

frame nint
outRegisters nint

Returns

PamojaStatus

pamoja_modbus_line_attach(nint, nint)

Puts a device on a line, which shares it.

public static extern PamojaStatus pamoja_modbus_line_attach(nint line, nint server)

Parameters

line nint
server nint

Returns

PamojaStatus

pamoja_modbus_line_free(nint)

Releases the caller's handle to a line. Passing null is a no-op.

public static extern void pamoja_modbus_line_free(nint line)

Parameters

line nint

pamoja_modbus_line_len(nint)

Returns how many devices are on a line.

public static extern nuint pamoja_modbus_line_len(nint line)

Parameters

line nint

Returns

nuint

pamoja_modbus_line_new()

Makes a line with no devices on it.

public static extern nint pamoja_modbus_line_new()

Returns

nint

pamoja_modbus_line_port(nint, PamojaSerialSettings, out nint)

Makes a serial port with a line on its far end.

public static PamojaStatus pamoja_modbus_line_port(nint line, PamojaSerialSettings settings, out nint outPort)

Parameters

line nint
settings PamojaSerialSettings
outPort nint

Returns

PamojaStatus

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

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

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

Parameters

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

Returns

PamojaStatus

pamoja_modbus_read_coils(byte, ushort, ushort, out nint)

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

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

Parameters

address byte
start ushort
count ushort
outBuffer nint

Returns

PamojaStatus

pamoja_modbus_read_discrete_inputs(byte, ushort, ushort, out nint)

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

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

Parameters

address byte
start ushort
count ushort
outBuffer nint

Returns

PamojaStatus

pamoja_modbus_read_holding_registers(byte, ushort, ushort, out nint)

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

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

Parameters

address byte
start ushort
count ushort
outBuffer nint

Returns

PamojaStatus

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

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

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

Parameters

address byte
values ReadOnlySpan<ushort>
valuesLen nuint
outBuffer nint

Returns

PamojaStatus

pamoja_modbus_read_input_registers(byte, ushort, ushort, out nint)

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

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

Parameters

address byte
start ushort
count ushort
outBuffer nint

Returns

PamojaStatus

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

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

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

Parameters

address byte
values ReadOnlySpan<ushort>
valuesLen nuint
outBuffer nint

Returns

PamojaStatus

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

Answers one RTU frame, leaving the buffer null when the device stays silent.

public static PamojaStatus pamoja_modbus_server_answer(nint server, ReadOnlySpan<byte> frame, nuint len, out nint outBuffer)

Parameters

server nint
frame ReadOnlySpan<byte>
len nuint
outBuffer nint

Returns

PamojaStatus

pamoja_modbus_server_coil(nint, ushort, out bool)

Reads a coil, reporting whether the device has it.

public static bool pamoja_modbus_server_coil(nint server, ushort address, out bool outOn)

Parameters

server nint
address ushort
outOn bool

Returns

bool

pamoja_modbus_server_discrete_input(nint, ushort, out bool)

Reads a discrete input, reporting whether the device has it.

public static bool pamoja_modbus_server_discrete_input(nint server, ushort address, out bool outOn)

Parameters

server nint
address ushort
outOn bool

Returns

bool

pamoja_modbus_server_free(nint)

Releases the caller's handle to a device. Passing null is a no-op.

public static extern void pamoja_modbus_server_free(nint server)

Parameters

server nint

pamoja_modbus_server_holding_register(nint, ushort, out ushort)

Reads a holding register, reporting whether the device has it.

public static bool pamoja_modbus_server_holding_register(nint server, ushort address, out ushort outValue)

Parameters

server nint
address ushort
outValue ushort

Returns

bool

pamoja_modbus_server_input_register(nint, ushort, out ushort)

Reads an input register, reporting whether the device has it.

public static bool pamoja_modbus_server_input_register(nint server, ushort address, out ushort outValue)

Parameters

server nint
address ushort
outValue ushort

Returns

bool

pamoja_modbus_server_new(byte, out nint)

Makes a device at a unit address, with every table empty.

public static PamojaStatus pamoja_modbus_server_new(byte unit, out nint outServer)

Parameters

unit byte
outServer nint

Returns

PamojaStatus

pamoja_modbus_server_served(nint)

Returns how many requests a device has carried out.

public static extern nuint pamoja_modbus_server_served(nint server)

Parameters

server nint

Returns

nuint

pamoja_modbus_server_set_coils(nint, ushort, ReadOnlySpan<byte>, nuint)

Sets coils from an address on, one byte per coil.

public static PamojaStatus pamoja_modbus_server_set_coils(nint server, ushort start, ReadOnlySpan<byte> values, nuint len)

Parameters

server nint
start ushort
values ReadOnlySpan<byte>
len nuint

Returns

PamojaStatus

pamoja_modbus_server_set_discrete_inputs(nint, ushort, ReadOnlySpan<byte>, nuint)

Sets discrete inputs from an address on, one byte per input.

public static PamojaStatus pamoja_modbus_server_set_discrete_inputs(nint server, ushort start, ReadOnlySpan<byte> values, nuint len)

Parameters

server nint
start ushort
values ReadOnlySpan<byte>
len nuint

Returns

PamojaStatus

pamoja_modbus_server_set_holding_registers(nint, ushort, ReadOnlySpan<ushort>, nuint)

Sets holding registers from an address on.

public static PamojaStatus pamoja_modbus_server_set_holding_registers(nint server, ushort start, ReadOnlySpan<ushort> values, nuint len)

Parameters

server nint
start ushort
values ReadOnlySpan<ushort>
len nuint

Returns

PamojaStatus

pamoja_modbus_server_set_input_registers(nint, ushort, ReadOnlySpan<ushort>, nuint)

Sets input registers from an address on.

public static PamojaStatus pamoja_modbus_server_set_input_registers(nint server, ushort start, ReadOnlySpan<ushort> values, nuint len)

Parameters

server nint
start ushort
values ReadOnlySpan<ushort>
len nuint

Returns

PamojaStatus

pamoja_modbus_server_unit(nint)

Returns a device's unit address.

public static extern byte pamoja_modbus_server_unit(nint server)

Parameters

server nint

Returns

byte

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

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

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

Parameters

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

Returns

PamojaStatus

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

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

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

Parameters

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

Returns

PamojaStatus

pamoja_modbus_write_single_coil(byte, ushort, bool, out nint)

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

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

Parameters

address byte
coil ushort
on bool
outBuffer nint

Returns

PamojaStatus

pamoja_modbus_write_single_register(byte, ushort, ushort, out nint)

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

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

Parameters

address byte
register ushort
value ushort
outBuffer nint

Returns

PamojaStatus

pamoja_mqtt_client_connect(nint)

Connects to the broker and starts the background event loop.

public static extern PamojaStatus pamoja_mqtt_client_connect(nint client)

Parameters

client nint

Returns

PamojaStatus

pamoja_mqtt_client_disconnect(nint)

Closes the connection and stops the background event loop.

public static extern PamojaStatus pamoja_mqtt_client_disconnect(nint client)

Parameters

client nint

Returns

PamojaStatus

pamoja_mqtt_client_free(nint)

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

public static extern void pamoja_mqtt_client_free(nint client)

Parameters

client nint

pamoja_mqtt_client_is_connected(nint)

Reports whether the client currently holds an active connection.

public static bool pamoja_mqtt_client_is_connected(nint client)

Parameters

client nint

Returns

bool

pamoja_mqtt_client_new(ref PamojaMqttConfig)

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

public static nint pamoja_mqtt_client_new(ref PamojaMqttConfig config)

Parameters

config PamojaMqttConfig

Returns

nint

pamoja_mqtt_client_publish(nint, nint, nint, nuint)

Publishes a payload to a topic.

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

Parameters

client nint
topic nint
payload nint
payloadLen nuint

Returns

PamojaStatus

pamoja_mqtt_client_publish_with(nint, nint, nint, nuint, PamojaQos, bool, bool)

Publishes with a quality of service and retain flag of its own, waiting for the broker's acknowledgment when confirmed is set.

public static PamojaStatus pamoja_mqtt_client_publish_with(nint client, nint topic, nint payload, nuint payloadLen, PamojaQos qos, bool retain, bool confirmed)

Parameters

client nint
topic nint
payload nint
payloadLen nuint
qos PamojaQos
retain bool
confirmed bool

Returns

PamojaStatus

pamoja_mqtt_client_recv(nint, out nint)

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

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

Parameters

client nint
outMessage nint

Returns

PamojaStatus

pamoja_mqtt_client_recv_within(nint, ulong, out nint, out bool)

Waits a limited time for the next message; outTimedOut says whether the time ran out.

public static PamojaStatus pamoja_mqtt_client_recv_within(nint client, ulong timeoutMs, out nint outMessage, out bool outTimedOut)

Parameters

client nint
timeoutMs ulong
outMessage nint
outTimedOut bool

Returns

PamojaStatus

pamoja_mqtt_client_subscribe(nint, nint)

Subscribes to a topic filter.

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

Parameters

client nint
topic nint

Returns

PamojaStatus

pamoja_mqtt_message_free(nint)

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

public static extern void pamoja_mqtt_message_free(nint message)

Parameters

message nint

pamoja_mqtt_message_payload(nint)

Returns a pointer to a message's payload bytes.

public static extern nint pamoja_mqtt_message_payload(nint message)

Parameters

message nint

Returns

nint

pamoja_mqtt_message_payload_len(nint)

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

public static extern nuint pamoja_mqtt_message_payload_len(nint message)

Parameters

message nint

Returns

nuint

pamoja_mqtt_message_topic(nint)

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

public static extern nint pamoja_mqtt_message_topic(nint message)

Parameters

message nint

Returns

nint

pamoja_obstacle_stop(PamojaTwist, float, float)

Cuts forward and sideways motion when an obstacle is within the stopping distance.

public static extern PamojaTwist pamoja_obstacle_stop(PamojaTwist twist, float rangeM, float stopDistanceM)

Parameters

twist PamojaTwist
rangeM float
stopDistanceM float

Returns

PamojaTwist

pamoja_odometry_free(nint)

Releases an odometry handle. Passing null is a no-op.

public static extern void pamoja_odometry_free(nint odometry)

Parameters

odometry nint

pamoja_odometry_fuse_heading(nint, float, float)

Nudges an odometry estimate's heading toward an absolute measurement.

public static extern void pamoja_odometry_fuse_heading(nint odometry, float measured, float weight)

Parameters

odometry nint
measured float
weight float

pamoja_odometry_integrate(nint, float, float, float)

Integrates a body motion over a time step onto an odometry estimate.

public static extern PamojaPose pamoja_odometry_integrate(nint odometry, float linear, float angular, float dt)

Parameters

odometry nint
linear float
angular float
dt float

Returns

PamojaPose

pamoja_odometry_integrate_wheels(nint, float, float, PamojaDiffDrive)

Integrates the distances two wheels rolled onto an odometry estimate.

public static extern PamojaPose pamoja_odometry_integrate_wheels(nint odometry, float left, float right, PamojaDiffDrive drive)

Parameters

odometry nint
left float
right float
drive PamojaDiffDrive

Returns

PamojaPose

pamoja_odometry_new(PamojaPose)

Creates an odometry estimate starting from a known pose.

public static extern nint pamoja_odometry_new(PamojaPose start)

Parameters

start PamojaPose

Returns

nint

pamoja_odometry_pose(nint)

Reads an odometry estimate's pose.

public static extern PamojaPose pamoja_odometry_pose(nint odometry)

Parameters

odometry nint

Returns

PamojaPose

pamoja_odometry_reset(nint, PamojaPose)

Sets an odometry estimate to a known pose.

public static extern void pamoja_odometry_reset(nint odometry, PamojaPose pose)

Parameters

odometry nint
pose PamojaPose

pamoja_opt3001_config_bits(PamojaOpt3001Config)

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

public static extern ushort pamoja_opt3001_config_bits(PamojaOpt3001Config config)

Parameters

config PamojaOpt3001Config

Returns

ushort

pamoja_opt3001_config_from_bits(ushort, out PamojaOpt3001Config)

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

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

Parameters

bits ushort
outConfig PamojaOpt3001Config

Returns

PamojaStatus

pamoja_opt3001_configuration(nint, out PamojaOpt3001Config)

Copies the configuration an OPT3001 driver writes.

public static PamojaStatus pamoja_opt3001_configuration(nint sensor, out PamojaOpt3001Config outConfig)

Parameters

sensor nint
outConfig PamojaOpt3001Config

Returns

PamojaStatus

pamoja_opt3001_conversion_millis(bool)

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

public static ushort pamoja_opt3001_conversion_millis(bool longConversion)

Parameters

longConversion bool

Returns

ushort

pamoja_opt3001_fault_count(byte)

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

public static extern byte pamoja_opt3001_fault_count(byte code)

Parameters

code byte

Returns

byte

pamoja_opt3001_free(nint)

Releases an OPT3001 driver. Passing null is a no-op.

public static extern void pamoja_opt3001_free(nint sensor)

Parameters

sensor nint

pamoja_opt3001_full_scale_milli_lux(byte, out uint)

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

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

Parameters

rangeNumber byte
outMilliLux uint

Returns

bool

pamoja_opt3001_init(nint)

Identifies and configures an OPT3001.

public static extern PamojaStatus pamoja_opt3001_init(nint sensor)

Parameters

sensor nint

Returns

PamojaStatus

pamoja_opt3001_is_automatic_range(byte)

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

public static bool pamoja_opt3001_is_automatic_range(byte rangeNumber)

Parameters

rangeNumber byte

Returns

bool

pamoja_opt3001_lsb_milli_lux(byte, out uint)

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

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

Parameters

exponent byte
outMilliLux uint

Returns

bool

pamoja_opt3001_lux(ushort)

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

public static extern float pamoja_opt3001_lux(ushort raw)

Parameters

raw ushort

Returns

float

pamoja_opt3001_measure(nint, out PamojaOpt3001Reading)

Runs one OPT3001 conversion and reads the illuminance.

public static PamojaStatus pamoja_opt3001_measure(nint sensor, out PamojaOpt3001Reading outReading)

Parameters

sensor nint
outReading PamojaOpt3001Reading

Returns

PamojaStatus

pamoja_opt3001_milli_lux(ushort)

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

public static extern uint pamoja_opt3001_milli_lux(ushort raw)

Parameters

raw ushort

Returns

uint

pamoja_opt3001_new(nint, byte, PamojaOpt3001Settings, out nint)

Creates an OPT3001 driver on a bus.

public static PamojaStatus pamoja_opt3001_new(nint bus, byte address, PamojaOpt3001Settings settings, out nint outSensor)

Parameters

bus nint
address byte
settings PamojaOpt3001Settings
outSensor nint

Returns

PamojaStatus

pamoja_opt3001_raw_from_milli_lux(uint)

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

public static extern ushort pamoja_opt3001_raw_from_milli_lux(uint milliLux)

Parameters

milliLux uint

Returns

ushort

pamoja_opt3001_set_limits(nint, uint, uint)

Writes the OPT3001's low and high limits, in millilux.

public static extern PamojaStatus pamoja_opt3001_set_limits(nint sensor, uint lowMilliLux, uint highMilliLux)

Parameters

sensor nint
lowMilliLux uint
highMilliLux uint

Returns

PamojaStatus

pamoja_opt3001_settings_default()

Returns the settings an OPT3001 driver starts with.

public static extern PamojaOpt3001Settings pamoja_opt3001_settings_default()

Returns

PamojaOpt3001Settings

pamoja_opt3001_sim_part(byte)

Creates a simulated OPT3001 reading its default illuminance.

public static extern nint pamoja_opt3001_sim_part(byte address)

Parameters

address byte

Returns

nint

pamoja_opt3001_sim_reporting(byte, float)

Creates a simulated OPT3001 that reads what it is asked to.

public static extern nint pamoja_opt3001_sim_reporting(byte address, float lux)

Parameters

address byte
lux float

Returns

nint

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

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

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

Parameters

bytes ReadOnlySpan<byte>
bytesLen nuint
outWord ushort

Returns

PamojaStatus

pamoja_opt3001_word_to_bytes(ushort, Span<byte>)

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

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

Parameters

word ushort
outBytes Span<byte>

Returns

PamojaStatus

pamoja_pca9685_channel(nint, byte, out PamojaPwm)

Reads one channel's four register bytes back from the part.

public static PamojaStatus pamoja_pca9685_channel(nint driver, byte channel, out PamojaPwm pwm)

Parameters

driver nint
channel byte
pwm PamojaPwm

Returns

PamojaStatus

pamoja_pca9685_channel_register(byte, out byte)

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

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

Parameters

channel byte
outRegister byte

Returns

PamojaStatus

pamoja_pca9685_free(nint)

Releases a driver and its share of the bus.

public static extern void pamoja_pca9685_free(nint driver)

Parameters

driver nint

pamoja_pca9685_frequency(nint)

Returns the frequency the part runs at after the prescaler rounds.

public static extern float pamoja_pca9685_frequency(nint driver)

Parameters

driver nint

Returns

float

pamoja_pca9685_frequency_for_prescale(byte, uint)

Returns the update rate a PCA9685 prescale value produces.

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

Parameters

prescale byte
oscHz uint

Returns

float

pamoja_pca9685_init(nint)

Programs the prescale and the output wiring, and wakes the oscillator.

public static extern PamojaStatus pamoja_pca9685_init(nint driver)

Parameters

driver nint

Returns

PamojaStatus

pamoja_pca9685_new(nint, byte, PamojaPca9685Settings, out nint)

Creates a PCA9685 driver on a bus.

public static PamojaStatus pamoja_pca9685_new(nint bus, byte address, PamojaPca9685Settings settings, out nint outDriver)

Parameters

bus nint
address byte
settings PamojaPca9685Settings
outDriver nint

Returns

PamojaStatus

pamoja_pca9685_prescale(nint)

Returns the prescale value the driver writes.

public static extern byte pamoja_pca9685_prescale(nint driver)

Parameters

driver nint

Returns

byte

pamoja_pca9685_prescale_for_frequency(uint, uint)

Returns the prescale value that sets a PCA9685 update rate.

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

Parameters

updateRateHz uint
oscHz uint

Returns

byte

pamoja_pca9685_set_all(nint, PamojaPwm)

Loads every channel with the same four bytes.

public static extern PamojaStatus pamoja_pca9685_set_all(nint driver, PamojaPwm pwm)

Parameters

driver nint
pwm PamojaPwm

Returns

PamojaStatus

pamoja_pca9685_set_channel(nint, byte, PamojaPwm)

Loads one channel's four register bytes.

public static extern PamojaStatus pamoja_pca9685_set_channel(nint driver, byte channel, PamojaPwm pwm)

Parameters

driver nint
channel byte
pwm PamojaPwm

Returns

PamojaStatus

pamoja_pca9685_settings_default()

Returns the settings a PCA9685 driver takes when given none.

public static extern PamojaPca9685Settings pamoja_pca9685_settings_default()

Returns

PamojaPca9685Settings

pamoja_pca9685_sim_part(byte)

Creates a simulated PCA9685 as it powers up.

public static extern nint pamoja_pca9685_sim_part(byte address)

Parameters

address byte

Returns

nint

pamoja_pca9685_sleep(nint)

Stops the oscillator.

public static extern PamojaStatus pamoja_pca9685_sleep(nint driver)

Parameters

driver nint

Returns

PamojaStatus

pamoja_pca9685_software_reset(nint)

Sends the general-call software reset.

public static extern PamojaStatus pamoja_pca9685_software_reset(nint driver)

Parameters

driver nint

Returns

PamojaStatus

pamoja_pca9685_wake(nint)

Wakes the oscillator and restarts the channels.

public static extern PamojaStatus pamoja_pca9685_wake(nint driver)

Parameters

driver nint

Returns

PamojaStatus

pamoja_pid_free(nint)

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

public static extern void pamoja_pid_free(nint pid)

Parameters

pid nint

pamoja_pid_new(float, float, float)

Creates a PID controller with no output limits.

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

Parameters

kp float
ki float
kd float

Returns

nint

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

Creates a PID controller clamped to the given output range.

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

Parameters

kp float
ki float
kd float
min float
max float

Returns

nint

pamoja_pid_reset(nint)

Clears a PID controller's integral, last error, and last output.

public static extern void pamoja_pid_reset(nint pid)

Parameters

pid nint

pamoja_pid_update(nint, float, float, float)

Advances a PID controller by one step.

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

Parameters

pid nint
setpoint float
measurement float
dt float

Returns

float

pamoja_pin_edge_triggered_by(PamojaPinEdge, PamojaPinLevel, PamojaPinLevel)

Reports whether a transition fires an interrupt trigger.

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

Parameters

edge PamojaPinEdge
from PamojaPinLevel
to PamojaPinLevel

Returns

bool

pamoja_pin_level_from_bool(bool)

Returns the level a boolean names.

public static PamojaPinLevel pamoja_pin_level_from_bool(bool high)

Parameters

high bool

Returns

PamojaPinLevel

pamoja_pin_level_inverted(PamojaPinLevel)

Returns the opposite level.

public static extern PamojaPinLevel pamoja_pin_level_inverted(PamojaPinLevel level)

Parameters

level PamojaPinLevel

Returns

PamojaPinLevel

pamoja_pin_polarity_is_asserted(PamojaPinPolarity, PamojaPinLevel)

Reports whether a physical level means the signal is asserted.

public static bool pamoja_pin_polarity_is_asserted(PamojaPinPolarity polarity, PamojaPinLevel level)

Parameters

polarity PamojaPinPolarity
level PamojaPinLevel

Returns

bool

pamoja_pin_polarity_level(PamojaPinPolarity, bool)

Returns the physical level representing a logical state.

public static PamojaPinLevel pamoja_pin_polarity_level(PamojaPinPolarity polarity, bool asserted)

Parameters

polarity PamojaPinPolarity
asserted bool

Returns

PamojaPinLevel

pamoja_power_plan_interval_for_us(PamojaPowerPlan, PamojaPowerMode)

Returns the work interval a plan uses in a mode.

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

Parameters

plan PamojaPowerPlan
mode PamojaPowerMode

Returns

ulong

pamoja_power_plan_interval_us(PamojaPowerPlan, float)

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

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

Parameters

plan PamojaPowerPlan
soc float

Returns

ulong

pamoja_power_plan_mode(PamojaPowerPlan, float)

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

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

Parameters

plan PamojaPowerPlan
soc float

Returns

PamojaPowerMode

pamoja_power_plan_mode_while_charging(PamojaPowerPlan, float, byte)

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

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

Parameters

plan PamojaPowerPlan
soc float
charging byte

Returns

PamojaPowerMode

pamoja_power_plan_new(ulong, ulong, ulong)

Creates a power plan with the default thresholds.

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

Parameters

activeUs ulong
saverUs ulong
criticalUs ulong

Returns

PamojaPowerPlan

pamoja_power_plan_next_mode(PamojaPowerPlan, PamojaPowerMode, float)

Returns the mode a node in a given mode moves to at a new state of charge.

public static extern PamojaPowerMode pamoja_power_plan_next_mode(PamojaPowerPlan plan, PamojaPowerMode current, float soc)

Parameters

plan PamojaPowerPlan
current PamojaPowerMode
soc float

Returns

PamojaPowerMode

pamoja_power_plan_next_mode_while_charging(PamojaPowerPlan, PamojaPowerMode, float, byte)

Returns the mode a node in a given mode moves to, eased one step while charging.

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

Parameters

plan PamojaPowerPlan
current PamojaPowerMode
soc float
charging byte

Returns

PamojaPowerMode

pamoja_power_plan_with_hysteresis(PamojaPowerPlan, float)

Returns a plan with the hysteresis margin moved.

public static extern PamojaPowerPlan pamoja_power_plan_with_hysteresis(PamojaPowerPlan plan, float margin)

Parameters

plan PamojaPowerPlan
margin float

Returns

PamojaPowerPlan

pamoja_power_plan_with_thresholds(PamojaPowerPlan, float, float)

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

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

Parameters

plan PamojaPowerPlan
saverBelow float
criticalBelow float

Returns

PamojaPowerPlan

pamoja_profile_control(nint, out PamojaControlSpec)

Returns the control policy a profile applies.

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

Parameters

profile nint
control PamojaControlSpec

Returns

PamojaStatus

pamoja_profile_control_kind(nint)

Returns the control kind a profile names, as its manifest writes it.

public static extern nint pamoja_profile_control_kind(nint profile)

Parameters

profile nint

Returns

nint

pamoja_profile_control_params_json(nint)

Returns a custom kind's parameters as JSON, or null for a built-in kind.

public static extern nint pamoja_profile_control_params_json(nint profile)

Parameters

profile nint

Returns

nint

pamoja_profile_controller(nint)

Builds the decision logic a profile describes.

public static extern nint pamoja_profile_controller(nint profile)

Parameters

profile nint

Returns

nint

pamoja_profile_description(nint)

Returns what a profile is for, or null when its manifest says nothing.

public static extern nint pamoja_profile_description(nint profile)

Parameters

profile nint

Returns

nint

pamoja_profile_flood_sensor()

Creates a flood sensor.

public static extern nint pamoja_profile_flood_sensor()

Returns

nint

pamoja_profile_free(nint)

Releases a profile handle.

public static extern void pamoja_profile_free(nint profile)

Parameters

profile nint

pamoja_profile_from_json(string)

Loads a profile from its JSON manifest.

public static nint pamoja_profile_from_json(string manifest)

Parameters

manifest string

Returns

nint

pamoja_profile_irrigation_node()

Creates an irrigation node.

public static extern nint pamoja_profile_irrigation_node()

Returns

nint

pamoja_profile_name(nint)

Returns a profile's stable name.

public static extern nint pamoja_profile_name(nint profile)

Parameters

profile nint

Returns

nint

pamoja_profile_new(string, string, in PamojaControlSpec, in PamojaPowerSchedule)

Creates a profile of the caller's own from its parts.

public static nint pamoja_profile_new(string name, string topic, in PamojaControlSpec control, in PamojaPowerSchedule power)

Parameters

name string
topic string
control PamojaControlSpec
power PamojaPowerSchedule

Returns

nint

pamoja_profile_new_custom(string, string, string, string, in PamojaPowerSchedule)

Creates a profile whose control is a custom kind, its parameters a JSON object.

public static nint pamoja_profile_new_custom(string name, string topic, string kind, string parameters, in PamojaPowerSchedule power)

Parameters

name string
topic string
kind string
parameters string
power PamojaPowerSchedule

Returns

nint

pamoja_profile_power(nint, out PamojaPowerSchedule)

Returns the sampling schedule a profile keeps.

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

Parameters

profile nint
schedule PamojaPowerSchedule

Returns

PamojaStatus

pamoja_profile_power_plan(nint, out PamojaPowerPlan)

Assembles a profile's schedule into a power governor.

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

Parameters

profile nint
plan PamojaPowerPlan

Returns

PamojaStatus

pamoja_profile_presentation_json(nint)

Returns a profile's dashboard presentation as JSON, or null when it declares none.

public static extern nint pamoja_profile_presentation_json(nint profile)

Parameters

profile nint

Returns

nint

pamoja_profile_reads_quantity(nint)

Returns the quantity a profile reads, or null when its manifest does not say.

public static extern nint pamoja_profile_reads_quantity(nint profile)

Parameters

profile nint

Returns

nint

pamoja_profile_reads_unit(nint)

Returns the unit a profile's numbers are in, or null when its manifest does not say.

public static extern nint pamoja_profile_reads_unit(nint profile)

Parameters

profile nint

Returns

nint

pamoja_profile_to_json(nint)

Serializes a profile to its JSON manifest.

public static extern nint pamoja_profile_to_json(nint profile)

Parameters

profile nint

Returns

nint

pamoja_profile_topic(nint)

Returns the topic a profile publishes each reading to.

public static extern nint pamoja_profile_topic(nint profile)

Parameters

profile nint

Returns

nint

pamoja_profile_vaccine_fridge_monitor()

Creates a cold-chain fridge monitor.

public static extern nint pamoja_profile_vaccine_fridge_monitor()

Returns

nint

pamoja_profile_well_level()

Creates a well-level monitor.

public static extern nint pamoja_profile_well_level()

Returns

nint

pamoja_profile_with_description(nint, string)

Returns a copy of a profile carrying a description.

public static nint pamoja_profile_with_description(nint profile, string description)

Parameters

profile nint
description string

Returns

nint

pamoja_profile_with_presentation_json(nint, string)

Returns a copy of a profile carrying the presentation the JSON describes.

public static nint pamoja_profile_with_presentation_json(nint profile, string presentation)

Parameters

profile nint
presentation string

Returns

nint

pamoja_profile_with_reads(nint, string, string)

Returns a copy of a profile that says what it reads.

public static nint pamoja_profile_with_reads(nint profile, string quantity, string unit)

Parameters

profile nint
quantity string
unit string

Returns

nint

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

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

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

Parameters

publicKey ReadOnlySpan<byte>
outFingerprint Span<byte>

Returns

PamojaStatus

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

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

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

Parameters

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

Returns

PamojaStatus

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

Verifies a signed message, returning the payload it carries.

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

Parameters

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

Returns

PamojaStatus

pamoja_pwm_counts(PamojaPwm, out ushort, out ushort)

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

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

Parameters

pwm PamojaPwm
outOn ushort
outOff ushort

Returns

PamojaStatus

pamoja_pwm_duty(ushort)

Builds a PWM setting with no phase delay.

public static extern PamojaPwm pamoja_pwm_duty(ushort off)

Parameters

off ushort

Returns

PamojaPwm

pamoja_pwm_from_counts(ushort, ushort)

Builds a PWM setting from explicit on and off counts.

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

Parameters

on ushort
off ushort

Returns

PamojaPwm

pamoja_pwm_full_off()

The setting that holds a channel continuously low.

public static extern PamojaPwm pamoja_pwm_full_off()

Returns

PamojaPwm

pamoja_pwm_full_on()

The setting that holds a channel continuously high.

public static extern PamojaPwm pamoja_pwm_full_on()

Returns

PamojaPwm

pamoja_pwm_servo(uint, uint)

Builds the PWM setting for a servo pulse width.

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

Parameters

pulseMicros uint
updateRateHz uint

Returns

PamojaPwm

pamoja_quadrature_count(nint)

Reads a quadrature decoder's signed count of steps.

public static extern long pamoja_quadrature_count(nint quadrature)

Parameters

quadrature nint

Returns

long

pamoja_quadrature_free(nint)

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

public static extern void pamoja_quadrature_free(nint quadrature)

Parameters

quadrature nint

pamoja_quadrature_new(bool, bool)

Creates a quadrature decoder seeded with the encoder's current channel levels.

public static nint pamoja_quadrature_new(bool a, bool b)

Parameters

a bool
b bool

Returns

nint

pamoja_quadrature_reset(nint)

Sets a quadrature decoder's count back to 0.

public static extern void pamoja_quadrature_reset(nint quadrature)

Parameters

quadrature nint

pamoja_quadrature_scale_distance(PamojaQuadratureScale, long)

Returns the distance a wheel rolled for a step count.

public static extern float pamoja_quadrature_scale_distance(PamojaQuadratureScale scale, long count)

Parameters

scale PamojaQuadratureScale
count long

Returns

float

pamoja_quadrature_scale_velocity(PamojaQuadratureScale, long, float)

Returns a wheel's speed from the steps counted over a time step.

public static extern float pamoja_quadrature_scale_velocity(PamojaQuadratureScale scale, long deltaCount, float dt)

Parameters

scale PamojaQuadratureScale
deltaCount long
dt float

Returns

float

pamoja_quadrature_update(nint, bool, bool)

Feeds a quadrature decoder the channel levels it reads now.

public static sbyte pamoja_quadrature_update(nint quadrature, bool a, bool b)

Parameters

quadrature nint
a bool
b bool

Returns

sbyte

pamoja_radio_duty_cycle_earliest_us(nint)

Returns the earliest start for the next transmission, or the maximum when transmitting is forbidden.

public static extern ulong pamoja_radio_duty_cycle_earliest_us(nint guard)

Parameters

guard nint

Returns

ulong

pamoja_radio_duty_cycle_free(nint)

Releases a duty-cycle guard handle. Passing null is a no-op.

public static extern void pamoja_radio_duty_cycle_free(nint guard)

Parameters

guard nint

pamoja_radio_duty_cycle_new(uint)

Creates a duty-cycle guard, ready to transmit at once.

public static extern nint pamoja_radio_duty_cycle_new(uint permille)

Parameters

permille uint

Returns

nint

pamoja_radio_duty_cycle_ready(nint, ulong)

Reports whether a transmission may start now.

public static bool pamoja_radio_duty_cycle_ready(nint guard, ulong nowUs)

Parameters

guard nint
nowUs ulong

Returns

bool

Records a transmission and returns its time on air in microseconds.

public static extern ulong pamoja_radio_duty_cycle_transmitted(nint guard, ulong startedUs, PamojaLoraLink link, nuint payloadLen)

Parameters

guard nint
startedUs ulong
link PamojaLoraLink
payloadLen nuint

Returns

ulong

pamoja_radio_duty_cycle_wait_us(nint, ulong)

Returns the silence still owed in microseconds, or the maximum when transmitting is forbidden.

public static extern ulong pamoja_radio_duty_cycle_wait_us(nint guard, ulong nowUs)

Parameters

guard nint
nowUs ulong

Returns

ulong

pamoja_ramp_free(nint)

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

public static extern void pamoja_ramp_free(nint ramp)

Parameters

ramp nint

pamoja_ramp_new(float, float)

Creates a rate limiter.

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

Parameters

start float
maxStep float

Returns

nint

pamoja_ramp_set(nint, float)

Forces a ramp to a value without rate limiting.

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

Parameters

ramp nint
value float

pamoja_ramp_update(nint, float)

Moves a ramp one step toward a target.

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

Parameters

ramp nint
target float

Returns

float

pamoja_ramp_value(nint)

Reads a ramp's current value.

public static extern float pamoja_ramp_value(nint ramp)

Parameters

ramp nint

Returns

float

pamoja_readings_data(nint)

Returns a pointer to a decoded float reading series.

public static extern nint pamoja_readings_data(nint readings)

Parameters

readings nint

Returns

nint

pamoja_readings_free(nint)

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

public static extern void pamoja_readings_free(nint readings)

Parameters

readings nint

pamoja_readings_len(nint)

Returns the number of float readings in a decoded series.

public static extern nuint pamoja_readings_len(nint readings)

Parameters

readings nint

Returns

nuint

pamoja_recording_actuator_apply(nint, float)

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

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

Parameters

actuator nint
command float

Returns

PamojaStatus

pamoja_recording_actuator_commands(nint, Span<float>, nuint)

Copies out the commands an actuator recorded.

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

Parameters

actuator nint
outCommands Span<float>
capacity nuint

Returns

nuint

pamoja_recording_actuator_free(nint)

Releases a recording actuator handle.

public static extern void pamoja_recording_actuator_free(nint actuator)

Parameters

actuator nint

pamoja_recording_actuator_len(nint)

Reports how many commands an actuator has been given.

public static extern nuint pamoja_recording_actuator_len(nint actuator)

Parameters

actuator nint

Returns

nuint

pamoja_recording_actuator_new()

Creates an actuator that records every command.

public static extern nint pamoja_recording_actuator_new()

Returns

nint

pamoja_registers_data(nint)

Returns a pointer to the registers a device returned.

public static extern nint pamoja_registers_data(nint registers)

Parameters

registers nint

Returns

nint

pamoja_registers_free(nint)

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

public static extern void pamoja_registers_free(nint registers)

Parameters

registers nint

pamoja_registers_len(nint)

Returns how many registers a device returned.

public static extern nuint pamoja_registers_len(nint registers)

Parameters

registers nint

Returns

nuint

pamoja_replay_free(nint)

Releases a replay handle.

public static extern void pamoja_replay_free(nint replay)

Parameters

replay nint

pamoja_replay_new(ReadOnlySpan<float>, nuint, bool)

Creates a sensor that reads back a recorded series.

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

Parameters

readings ReadOnlySpan<float>
count nuint
repeating bool

Returns

nint

pamoja_replay_read(nint, out float)

Takes the next reading from a replay.

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

Parameters

replay nint
outReading float

Returns

PamojaStatus

pamoja_reporter_adapt_to(nint, PamojaLinkCost)

Moves the threshold to match what the link now costs.

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

Parameters

reporter nint
cost PamojaLinkCost

pamoja_reporter_count(nint, PamojaTelemetryLevel)

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

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

Parameters

reporter nint
level PamojaTelemetryLevel

Returns

uint

pamoja_reporter_dropped(nint)

Returns how many events the threshold dropped.

public static extern uint pamoja_reporter_dropped(nint reporter)

Parameters

reporter nint

Returns

uint

pamoja_reporter_emitted(nint)

Returns how many events passed the threshold and were shipped.

public static extern uint pamoja_reporter_emitted(nint reporter)

Parameters

reporter nint

Returns

uint

pamoja_reporter_free(nint)

Releases a reporter handle.

public static extern void pamoja_reporter_free(nint reporter)

Parameters

reporter nint

pamoja_reporter_new(PamojaTelemetryLevel)

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

public static extern nint pamoja_reporter_new(PamojaTelemetryLevel threshold)

Parameters

threshold PamojaTelemetryLevel

Returns

nint

pamoja_reporter_record(nint, PamojaTelemetryLevel)

Records an event and reports whether it is worth shipping.

public static bool pamoja_reporter_record(nint reporter, PamojaTelemetryLevel level)

Parameters

reporter nint
level PamojaTelemetryLevel

Returns

bool

pamoja_reporter_set_threshold(nint, PamojaTelemetryLevel)

Moves the level a reporter ships from.

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

Parameters

reporter nint
threshold PamojaTelemetryLevel

pamoja_reporter_snapshot(nint)

Takes a snapshot of a reporter's counters.

public static extern PamojaTelemetrySnapshot pamoja_reporter_snapshot(nint reporter)

Parameters

reporter nint

Returns

PamojaTelemetrySnapshot

pamoja_reporter_threshold(nint)

Returns the level a reporter is currently shipping from.

public static extern PamojaTelemetryLevel pamoja_reporter_threshold(nint reporter)

Parameters

reporter nint

Returns

PamojaTelemetryLevel

pamoja_reporter_total(nint)

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

public static extern uint pamoja_reporter_total(nint reporter)

Parameters

reporter nint

Returns

uint

pamoja_ros2_dds_topic(string, PamojaEntityKind)

Returns the DDS topic a fully qualified name maps onto.

public static nint pamoja_ros2_dds_topic(string fqn, PamojaEntityKind kind)

Parameters

fqn string
kind PamojaEntityKind

Returns

nint

pamoja_ros2_dds_type_name(string)

Returns the DDS type name an interface type maps onto.

public static nint pamoja_ros2_dds_type_name(string rosType)

Parameters

rosType string

Returns

nint

pamoja_ros2_entity_key(uint, string, string, PamojaTypeHash)

Builds the Zenoh key an entity is published on.

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

Parameters

domainId uint
fqn string
rosType string
hash PamojaTypeHash

Returns

nint

pamoja_ros2_entity_kind_prefix(PamojaEntityKind)

Returns the DDS topic prefix a subsystem uses.

public static extern nint pamoja_ros2_entity_kind_prefix(PamojaEntityKind kind)

Parameters

kind PamojaEntityKind

Returns

nint

pamoja_ros2_entity_kind_suffix(PamojaEntityKind)

Returns what the middleware appends to a name for a subsystem.

public static extern nint pamoja_ros2_entity_kind_suffix(PamojaEntityKind kind)

Parameters

kind PamojaEntityKind

Returns

nint

pamoja_ros2_name_is_fully_qualified(string)

Reports whether a name is fully qualified.

public static bool pamoja_ros2_name_is_fully_qualified(string name)

Parameters

name string

Returns

bool

pamoja_ros2_name_is_valid(string)

Reports whether a string is a valid ROS 2 name.

public static bool pamoja_ros2_name_is_valid(string name)

Parameters

name string

Returns

bool

pamoja_ros2_percent_mangle(string)

Percent-mangles a name as rmw_zenoh writes it in a liveliness token.

public static nint pamoja_ros2_percent_mangle(string name)

Parameters

name string

Returns

nint

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

Decodes a twist from its CDR representation.

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

Parameters

data ReadOnlySpan<byte>
dataLen nuint
twist PamojaRos2Twist

Returns

PamojaStatus

pamoja_ros2_twist_to_cdr(PamojaRos2Twist)

Encodes a twist into its CDR representation.

public static extern nint pamoja_ros2_twist_to_cdr(PamojaRos2Twist twist)

Parameters

twist PamojaRos2Twist

Returns

nint

pamoja_ros2_type_hash_parse(string, out PamojaTypeHash)

Parses a RIHS01 type hash string.

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

Parameters

text string
hash PamojaTypeHash

Returns

PamojaStatus

pamoja_ros2_type_hash_to_string(PamojaTypeHash)

Renders a type hash back to its RIHS01 string.

public static extern nint pamoja_ros2_type_hash_to_string(PamojaTypeHash hash)

Parameters

hash PamojaTypeHash

Returns

nint

pamoja_router_address(nint)

Returns the address a router answers for.

public static extern uint pamoja_router_address(nint router)

Parameters

router nint

Returns

uint

pamoja_router_capacity(nint)

Returns how many routes a table can hold.

public static extern nuint pamoja_router_capacity(nint router)

Parameters

router nint

Returns

nuint

pamoja_router_cost(nint, uint, out ushort)

Returns what the known route to a node costs.

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

Parameters

router nint
dst uint
outCost ushort

Returns

bool

pamoja_router_forget(nint, uint)

Forgets the route to a node.

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

Parameters

router nint
dst uint

pamoja_router_forward(nint, uint, out uint)

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

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

Parameters

router nint
dst uint
outNextHop uint

Returns

PamojaForward

pamoja_router_free(nint)

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

public static extern void pamoja_router_free(nint router)

Parameters

router nint

pamoja_router_len(nint)

Returns how many routes a table currently holds.

public static extern nuint pamoja_router_len(nint router)

Parameters

router nint

Returns

nuint

pamoja_router_new(uint, nuint)

Creates an empty routing table of the size given.

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

Parameters

address uint
capacity nuint

Returns

nint

pamoja_router_next_hop(nint, uint, out uint)

Returns the neighbor on the way to a node.

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

Parameters

router nint
dst uint
outNextHop uint

Returns

bool

pamoja_router_observe(nint, uint, uint, ushort)

Learns a route from a packet that arrived.

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

Parameters

router nint
origin uint
via uint
cost ushort

Returns

bool

pamoja_router_route(nint, uint, out PamojaRoute)

Returns the whole route to a node.

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

Parameters

router nint
dst uint
outRoute PamojaRoute

Returns

bool

pamoja_router_route_at(nint, nuint, out PamojaRoute)

Returns one of the routes a table holds, by its position among them.

public static bool pamoja_router_route_at(nint router, nuint index, out PamojaRoute outRoute)

Parameters

router nint
index nuint
outRoute PamojaRoute

Returns

bool

pamoja_rule_evaluator_actuators_json(nint)

Lists the actuators the rules drive, as a JSON array.

public static extern nint pamoja_rule_evaluator_actuators_json(nint rules)

Parameters

rules nint

Returns

nint

pamoja_rule_evaluator_evaluate(nint, string, float)

Judges one reading from one topic, returning what fired as JSON.

public static nint pamoja_rule_evaluator_evaluate(nint rules, string topic, float reading)

Parameters

rules nint
topic string
reading float

Returns

nint

pamoja_rule_evaluator_free(nint)

Releases a rule evaluator.

public static extern void pamoja_rule_evaluator_free(nint rules)

Parameters

rules nint

pamoja_rule_evaluator_from_json(string)

Loads a rule file and arms its rules.

public static nint pamoja_rule_evaluator_from_json(string text)

Parameters

text string

Returns

nint

pamoja_rule_evaluator_is_set(nint, string, out bool)

Reports whether a rule's condition currently holds.

public static PamojaStatus pamoja_rule_evaluator_is_set(nint rules, string rule, out bool outSet)

Parameters

rules nint
rule string
outSet bool

Returns

PamojaStatus

pamoja_rule_evaluator_to_json(nint)

Writes the rules back out as a rule file.

public static extern nint pamoja_rule_evaluator_to_json(nint rules)

Parameters

rules nint

Returns

nint

pamoja_rule_evaluator_topics_json(nint)

Lists the topics the rules watch, as a JSON array.

public static extern nint pamoja_rule_evaluator_topics_json(nint rules)

Parameters

rules nint

Returns

nint

pamoja_rule_evaluator_watches(nint, string)

Reports whether any rule watches a topic.

public static bool pamoja_rule_evaluator_watches(nint rules, string topic)

Parameters

rules nint
topic string

Returns

bool

pamoja_safety_gate_command(nint, PamojaTwist, float)

Returns the command that is safe to drive for a desired one over a time step.

public static extern PamojaTwist pamoja_safety_gate_command(nint gate, PamojaTwist desired, float dt)

Parameters

gate nint
desired PamojaTwist
dt float

Returns

PamojaTwist

pamoja_safety_gate_engage_estop(nint)

Engages a safety gate's e-stop.

public static extern void pamoja_safety_gate_engage_estop(nint gate)

Parameters

gate nint

pamoja_safety_gate_feed(nint)

Feeds a safety gate's watchdog.

public static extern void pamoja_safety_gate_feed(nint gate)

Parameters

gate nint

pamoja_safety_gate_free(nint)

Releases a safety gate handle. Passing null is a no-op.

public static extern void pamoja_safety_gate_free(nint gate)

Parameters

gate nint

pamoja_safety_gate_is_stopped(nint)

Reports whether a safety gate is forcing a stop.

public static bool pamoja_safety_gate_is_stopped(nint gate)

Parameters

gate nint

Returns

bool

pamoja_safety_gate_new(nint, float)

Creates a safety gate from limits and a watchdog timeout, or null for null limits.

public static extern nint pamoja_safety_gate_new(nint limits, float watchdogTimeout)

Parameters

limits nint
watchdogTimeout float

Returns

nint

pamoja_safety_gate_reset_estop(nint)

Clears a safety gate's e-stop.

public static extern void pamoja_safety_gate_reset_estop(nint gate)

Parameters

gate nint

pamoja_samples_data(nint)

Returns a pointer to a decoded integer sample series.

public static extern nint pamoja_samples_data(nint samples)

Parameters

samples nint

Returns

nint

pamoja_samples_free(nint)

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

public static extern void pamoja_samples_free(nint samples)

Parameters

samples nint

pamoja_samples_len(nint)

Returns the number of integer samples in a decoded series.

public static extern nuint pamoja_samples_len(nint samples)

Parameters

samples nint

Returns

nuint

pamoja_scd4x_allowed_during_measurement(ushort)

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

public static bool pamoja_scd4x_allowed_during_measurement(ushort command)

Parameters

command ushort

Returns

bool

pamoja_scd4x_ambient_pressure_pascals(ushort)

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

public static extern uint pamoja_scd4x_ambient_pressure_pascals(ushort word)

Parameters

word ushort

Returns

uint

pamoja_scd4x_ambient_pressure_word(uint)

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

public static extern ushort pamoja_scd4x_ambient_pressure_word(uint pascals)

Parameters

pascals uint

Returns

ushort

pamoja_scd4x_automatic_self_calibration_enabled(ushort)

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

public static bool pamoja_scd4x_automatic_self_calibration_enabled(ushort word)

Parameters

word ushort

Returns

bool

pamoja_scd4x_automatic_self_calibration_word(bool)

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

public static ushort pamoja_scd4x_automatic_self_calibration_word(bool enabled)

Parameters

enabled bool

Returns

ushort

pamoja_scd4x_celsius(ushort)

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

public static extern float pamoja_scd4x_celsius(ushort raw)

Parameters

raw ushort

Returns

float

pamoja_scd4x_command_frame(ushort, Span<byte>)

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

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

Parameters

command ushort
outBytes Span<byte>

Returns

PamojaStatus

pamoja_scd4x_crc(ReadOnlySpan<byte>, nuint)

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

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

Parameters

data ReadOnlySpan<byte>
dataLen nuint

Returns

byte

pamoja_scd4x_data_ready(ushort)

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

public static bool pamoja_scd4x_data_ready(ushort word)

Parameters

word ushort

Returns

bool

pamoja_scd4x_forced_recalibration_correction_ppm(ushort, out int)

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

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

Parameters

word ushort
outPpm int

Returns

bool

pamoja_scd4x_forced_recalibration_word(bool, int)

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

public static ushort pamoja_scd4x_forced_recalibration_word(bool succeeded, int correctionPpm)

Parameters

succeeded bool
correctionPpm int

Returns

ushort

pamoja_scd4x_free(nint)

Releases an SCD4x driver. Passing null is a no-op.

public static extern void pamoja_scd4x_free(nint sensor)

Parameters

sensor nint

pamoja_scd4x_humidity_milli_percent(ushort)

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

public static extern uint pamoja_scd4x_humidity_milli_percent(ushort raw)

Parameters

raw ushort

Returns

uint

pamoja_scd4x_humidity_raw(uint)

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

public static extern ushort pamoja_scd4x_humidity_raw(uint milliPercent)

Parameters

milliPercent uint

Returns

ushort

pamoja_scd4x_init(nint)

Reads the SCD4x serial number and starts periodic measurement.

public static extern PamojaStatus pamoja_scd4x_init(nint sensor)

Parameters

sensor nint

Returns

PamojaStatus

pamoja_scd4x_max_duration_ms(ushort, out ushort)

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

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

Parameters

command ushort
outMillis ushort

Returns

bool

pamoja_scd4x_measure(nint, out PamojaScd4xMeasurement)

Waits for the next SCD4x periodic result and reads it.

public static PamojaStatus pamoja_scd4x_measure(nint sensor, out PamojaScd4xMeasurement outMeasurement)

Parameters

sensor nint
outMeasurement PamojaScd4xMeasurement

Returns

PamojaStatus

pamoja_scd4x_measure_single_shot(nint, out PamojaScd4xMeasurement)

Runs one on-demand SCD41 measurement.

public static PamojaStatus pamoja_scd4x_measure_single_shot(nint sensor, out PamojaScd4xMeasurement outMeasurement)

Parameters

sensor nint
outMeasurement PamojaScd4xMeasurement

Returns

PamojaStatus

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

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

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

Parameters

co2Ppm ushort
temperatureRaw ushort
humidityRaw ushort
outBytes Span<byte>

Returns

PamojaStatus

pamoja_scd4x_measurement_from_physical(ushort, int, uint, out PamojaScd4xMeasurement)

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

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

Parameters

co2Ppm ushort
milliCelsius int
humidityMilliPercent uint
outMeasurement PamojaScd4xMeasurement

Returns

PamojaStatus

pamoja_scd4x_milli_celsius(ushort)

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

public static extern int pamoja_scd4x_milli_celsius(ushort raw)

Parameters

raw ushort

Returns

int

pamoja_scd4x_new(nint, out nint)

Creates an SCD4x driver on a bus.

public static PamojaStatus pamoja_scd4x_new(nint bus, out nint outSensor)

Parameters

bus nint
outSensor nint

Returns

PamojaStatus

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

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

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

Parameters

frame ReadOnlySpan<byte>
frameLen nuint
outMeasurement PamojaScd4xMeasurement

Returns

PamojaStatus

pamoja_scd4x_poll_ready(nint, out bool)

Asks an SCD4x whether a periodic result is waiting.

public static PamojaStatus pamoja_scd4x_poll_ready(nint sensor, out bool outReady)

Parameters

sensor nint
outReady bool

Returns

PamojaStatus

pamoja_scd4x_relative_humidity_percent(ushort)

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

public static extern float pamoja_scd4x_relative_humidity_percent(ushort raw)

Parameters

raw ushort

Returns

float

pamoja_scd4x_self_test_passed(ushort)

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

public static bool pamoja_scd4x_self_test_passed(ushort word)

Parameters

word ushort

Returns

bool

pamoja_scd4x_serial(nint, out ulong)

Reports the serial number an SCD4x driver read at initialization.

public static bool pamoja_scd4x_serial(nint sensor, out ulong outSerial)

Parameters

sensor nint
outSerial ulong

Returns

bool

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

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

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

Parameters

frame ReadOnlySpan<byte>
frameLen nuint
outSerial ulong

Returns

PamojaStatus

pamoja_scd4x_serial_number_frame(ulong, Span<byte>)

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

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

Parameters

serial ulong
outBytes Span<byte>

Returns

PamojaStatus

pamoja_scd4x_set_sensor_altitude(nint, ushort)

Sets the altitude an SCD4x corrects for, in meters.

public static extern PamojaStatus pamoja_scd4x_set_sensor_altitude(nint sensor, ushort meters)

Parameters

sensor nint
meters ushort

Returns

PamojaStatus

pamoja_scd4x_set_temperature_offset(nint, uint)

Sets the SCD4x temperature offset, in millidegrees.

public static extern PamojaStatus pamoja_scd4x_set_temperature_offset(nint sensor, uint milliCelsius)

Parameters

sensor nint
milliCelsius uint

Returns

PamojaStatus

pamoja_scd4x_sim_part()

Creates a simulated SCD4x reading its default air.

public static extern nint pamoja_scd4x_sim_part()

Returns

nint

pamoja_scd4x_sim_reporting(ushort, float, float)

Creates a simulated SCD4x that reads what it is asked to.

public static extern nint pamoja_scd4x_sim_reporting(ushort co2Ppm, float celsius, float relativeHumidity)

Parameters

co2Ppm ushort
celsius float
relativeHumidity float

Returns

nint

pamoja_scd4x_start(nint)

Starts SCD4x periodic measurement.

public static extern PamojaStatus pamoja_scd4x_start(nint sensor)

Parameters

sensor nint

Returns

PamojaStatus

pamoja_scd4x_stop(nint)

Stops SCD4x periodic measurement.

public static extern PamojaStatus pamoja_scd4x_stop(nint sensor)

Parameters

sensor nint

Returns

PamojaStatus

pamoja_scd4x_temperature_offset_milli_celsius(ushort)

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

public static extern uint pamoja_scd4x_temperature_offset_milli_celsius(ushort word)

Parameters

word ushort

Returns

uint

pamoja_scd4x_temperature_offset_word(uint)

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

public static extern ushort pamoja_scd4x_temperature_offset_word(uint milliCelsius)

Parameters

milliCelsius uint

Returns

ushort

pamoja_scd4x_temperature_raw(int)

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

public static extern ushort pamoja_scd4x_temperature_raw(int milliCelsius)

Parameters

milliCelsius int

Returns

ushort

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

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

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

Parameters

frame ReadOnlySpan<byte>
frameLen nuint
outWord ushort

Returns

PamojaStatus

pamoja_scd4x_word_frame(ushort, Span<byte>)

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

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

Parameters

value ushort
outBytes Span<byte>

Returns

PamojaStatus

pamoja_scd4x_write_frame(ushort, ushort, Span<byte>)

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

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

Parameters

command ushort
value ushort
outBytes Span<byte>

Returns

PamojaStatus

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

Reads the payload back out of a COBS frame.

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

Parameters

frame ReadOnlySpan<byte>
frameLen nuint
outBuffer nint

Returns

PamojaStatus

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

Frames a payload as a COBS packet.

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

Parameters

payload ReadOnlySpan<byte>
payloadLen nuint
outBuffer nint

Returns

PamojaStatus

pamoja_serial_cobs_max_encoded_len(nuint)

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

public static extern nuint pamoja_serial_cobs_max_encoded_len(nuint payloadLen)

Parameters

payloadLen nuint

Returns

nuint

pamoja_serial_port_clone(nint)

Gives another holder the same port.

public static extern nint pamoja_serial_port_clone(nint port)

Parameters

port nint

Returns

nint

pamoja_serial_port_discard_input(nint)

Drops whatever has arrived and not been read.

public static extern PamojaStatus pamoja_serial_port_discard_input(nint port)

Parameters

port nint

Returns

PamojaStatus

pamoja_serial_port_free(nint)

Releases a holder's share of a port. Passing null is a no-op.

public static extern void pamoja_serial_port_free(nint port)

Parameters

port nint

pamoja_serial_port_kind(nint)

Returns what is on the other end of a port.

public static extern byte pamoja_serial_port_kind(nint port)

Parameters

port nint

Returns

byte

pamoja_serial_port_looped(PamojaSerialSettings)

Creates a line looped back on itself.

public static extern nint pamoja_serial_port_looped(PamojaSerialSettings settings)

Parameters

settings PamojaSerialSettings

Returns

nint

pamoja_serial_port_open(string, PamojaSerialSettings, out nint)

Opens the kernel's serial device raw.

public static PamojaStatus pamoja_serial_port_open(string path, PamojaSerialSettings settings, out nint outPort)

Parameters

path string
settings PamojaSerialSettings
outPort nint

Returns

PamojaStatus

pamoja_serial_port_pair(PamojaSerialSettings, out nint, out nint)

Creates the two ends of a null-modem pair.

public static PamojaStatus pamoja_serial_port_pair(PamojaSerialSettings settings, out nint outOne, out nint outOther)

Parameters

settings PamojaSerialSettings
outOne nint
outOther nint

Returns

PamojaStatus

pamoja_serial_port_read(nint, Span<byte>, nuint, ulong, out nuint)

Reads what has arrived, waiting up to a timeout for the first byte.

public static PamojaStatus pamoja_serial_port_read(nint port, Span<byte> outBytes, nuint capacity, ulong timeoutMicros, out nuint outLen)

Parameters

port nint
outBytes Span<byte>
capacity nuint
timeoutMicros ulong
outLen nuint

Returns

PamojaStatus

pamoja_serial_port_received(nint)

Returns how many bytes have been read through a port.

public static extern nuint pamoja_serial_port_received(nint port)

Parameters

port nint

Returns

nuint

pamoja_serial_port_remaining(nint, out nuint)

Reports how many steps a scripted port has left.

public static bool pamoja_serial_port_remaining(nint port, out nuint outRemaining)

Parameters

port nint
outRemaining nuint

Returns

bool

pamoja_serial_port_scripted(PamojaSerialSettings, nint)

Creates a port that plays a copy of a script.

public static extern nint pamoja_serial_port_scripted(PamojaSerialSettings settings, nint script)

Parameters

settings PamojaSerialSettings
script nint

Returns

nint

pamoja_serial_port_settings(nint)

Returns the speed and format a port runs at.

public static extern PamojaSerialSettings pamoja_serial_port_settings(nint port)

Parameters

port nint

Returns

PamojaSerialSettings

pamoja_serial_port_wait(nint, ulong)

Waits, really on a device and anywhere else only counted.

public static extern void pamoja_serial_port_wait(nint port, ulong micros)

Parameters

port nint
micros ulong

pamoja_serial_port_waited_micros(nint)

Returns how long a port's reads and waits have waited, in microseconds.

public static extern ulong pamoja_serial_port_waited_micros(nint port)

Parameters

port nint

Returns

ulong

pamoja_serial_port_write(nint, ReadOnlySpan<byte>, nuint)

Writes bytes, waiting until they have left the UART on a real device.

public static PamojaStatus pamoja_serial_port_write(nint port, ReadOnlySpan<byte> bytes, nuint len)

Parameters

port nint
bytes ReadOnlySpan<byte>
len nuint

Returns

PamojaStatus

pamoja_serial_port_written(nint)

Returns how many bytes have been written through a port.

public static extern nuint pamoja_serial_port_written(nint port)

Parameters

port nint

Returns

nuint

pamoja_serial_script_free(nint)

Releases a script. Passing null is a no-op.

public static extern void pamoja_serial_script_free(nint script)

Parameters

script nint

pamoja_serial_script_len(nint)

Returns how many steps a script holds.

public static extern nuint pamoja_serial_script_len(nint script)

Parameters

script nint

Returns

nuint

pamoja_serial_script_new()

Creates an empty script.

public static extern nint pamoja_serial_script_new()

Returns

nint

pamoja_serial_script_read(nint, ReadOnlySpan<byte>, nuint)

Adds bytes the far end sends.

public static PamojaStatus pamoja_serial_script_read(nint script, ReadOnlySpan<byte> bytes, nuint len)

Parameters

script nint
bytes ReadOnlySpan<byte>
len nuint

Returns

PamojaStatus

pamoja_serial_script_write(nint, ReadOnlySpan<byte>, nuint)

Adds a write the program is expected to make.

public static PamojaStatus pamoja_serial_script_write(nint script, ReadOnlySpan<byte> bytes, nuint len)

Parameters

script nint
bytes ReadOnlySpan<byte>
len nuint

Returns

PamojaStatus

pamoja_serial_settings(uint)

Returns eight data bits, no parity, and one stop bit at a speed.

public static extern PamojaSerialSettings pamoja_serial_settings(uint baud)

Parameters

baud uint

Returns

PamojaSerialSettings

pamoja_serial_settings_bits_per_character(PamojaSerialSettings)

Returns the bits one character takes on the wire.

public static extern uint pamoja_serial_settings_bits_per_character(PamojaSerialSettings settings)

Parameters

settings PamojaSerialSettings

Returns

uint

pamoja_serial_settings_character_nanos(PamojaSerialSettings)

Returns how long one character takes on the wire, in nanoseconds.

public static extern ulong pamoja_serial_settings_character_nanos(PamojaSerialSettings settings)

Parameters

settings PamojaSerialSettings

Returns

ulong

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

Reads the payload back out of a SLIP frame.

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

Parameters

frame ReadOnlySpan<byte>
frameLen nuint
outBuffer nint

Returns

PamojaStatus

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

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

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

Parameters

payload ReadOnlySpan<byte>
payloadLen nuint
outBuffer nint

Returns

PamojaStatus

pamoja_serial_slip_max_encoded_len(nuint)

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

public static extern nuint pamoja_serial_slip_max_encoded_len(nuint payloadLen)

Parameters

payloadLen nuint

Returns

nuint

pamoja_servo_map_angle(PamojaServoMap, ushort)

Returns the angle a servo pulse width sets.

public static extern float pamoja_servo_map_angle(PamojaServoMap servo, ushort pulseUs)

Parameters

servo PamojaServoMap
pulseUs ushort

Returns

float

pamoja_servo_map_pulse(PamojaServoMap, float)

Returns the pulse width that sets a servo to an angle.

public static extern ushort pamoja_servo_map_pulse(PamojaServoMap servo, float angleDeg)

Parameters

servo PamojaServoMap
angleDeg float

Returns

ushort

pamoja_servo_map_standard()

Returns the standard hobby servo.

public static extern PamojaServoMap pamoja_servo_map_standard()

Returns

PamojaServoMap

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

Establishes a session with a peer.

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

Parameters

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

Returns

nint

pamoja_session_free(nint)

Releases a session handle.

public static extern void pamoja_session_free(nint session)

Parameters

session nint

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

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

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

Parameters

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

Returns

PamojaStatus

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

Computes a keyed hash over a message.

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

Parameters

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

Returns

PamojaStatus

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

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

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

Parameters

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

Returns

PamojaStatus

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

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

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

Parameters

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

Returns

PamojaStatus

pamoja_sht3x_celsius(ushort)

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

public static extern float pamoja_sht3x_celsius(ushort raw)

Parameters

raw ushort

Returns

float

pamoja_sht3x_crc(ReadOnlySpan<byte>, nuint)

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

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

Parameters

data ReadOnlySpan<byte>
dataLen nuint

Returns

byte

pamoja_sht3x_fahrenheit(ushort)

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

public static extern float pamoja_sht3x_fahrenheit(ushort raw)

Parameters

raw ushort

Returns

float

pamoja_sht3x_free(nint)

Releases an SHT3x driver. Passing null is a no-op.

public static extern void pamoja_sht3x_free(nint sensor)

Parameters

sensor nint

pamoja_sht3x_heater_off(nint)

Switches the SHT3x heater off.

public static extern PamojaStatus pamoja_sht3x_heater_off(nint sensor)

Parameters

sensor nint

Returns

PamojaStatus

pamoja_sht3x_heater_on(nint)

Switches the SHT3x heater on.

public static extern PamojaStatus pamoja_sht3x_heater_on(nint sensor)

Parameters

sensor nint

Returns

PamojaStatus

pamoja_sht3x_humidity_raw_from_milli_percent(uint)

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

public static extern ushort pamoja_sht3x_humidity_raw_from_milli_percent(uint milliPercent)

Parameters

milliPercent uint

Returns

ushort

pamoja_sht3x_humidity_raw_from_relative_humidity(float)

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

public static extern ushort pamoja_sht3x_humidity_raw_from_relative_humidity(float percent)

Parameters

percent float

Returns

ushort

pamoja_sht3x_init(nint)

Resets an SHT3x and reads its status.

public static extern PamojaStatus pamoja_sht3x_init(nint sensor)

Parameters

sensor nint

Returns

PamojaStatus

pamoja_sht3x_interval_micros(byte, out uint)

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

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

Parameters

rate byte
outMicros uint

Returns

PamojaStatus

pamoja_sht3x_last_status(nint, out PamojaSht3xStatus)

Reports the status an SHT3x driver last read.

public static bool pamoja_sht3x_last_status(nint sensor, out PamojaSht3xStatus outStatus)

Parameters

sensor nint
outStatus PamojaSht3xStatus

Returns

bool

pamoja_sht3x_max_measurement_micros(byte, out uint)

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

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

Parameters

repeatability byte
outMicros uint

Returns

PamojaStatus

pamoja_sht3x_measure(nint, out PamojaSht3xMeasurement)

Runs one SHT3x single-shot measurement.

public static PamojaStatus pamoja_sht3x_measure(nint sensor, out PamojaSht3xMeasurement outMeasurement)

Parameters

sensor nint
outMeasurement PamojaSht3xMeasurement

Returns

PamojaStatus

pamoja_sht3x_measurement_bytes(ushort, ushort, Span<byte>)

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

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

Parameters

temperatureRaw ushort
humidityRaw ushort
outBytes Span<byte>

Returns

PamojaStatus

pamoja_sht3x_milli_celsius(ushort)

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

public static extern int pamoja_sht3x_milli_celsius(ushort raw)

Parameters

raw ushort

Returns

int

pamoja_sht3x_milli_fahrenheit(ushort)

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

public static extern int pamoja_sht3x_milli_fahrenheit(ushort raw)

Parameters

raw ushort

Returns

int

pamoja_sht3x_milli_percent(ushort)

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

public static extern uint pamoja_sht3x_milli_percent(ushort raw)

Parameters

raw ushort

Returns

uint

pamoja_sht3x_new(nint, byte, byte, out nint)

Creates an SHT3x driver on a bus.

public static PamojaStatus pamoja_sht3x_new(nint bus, byte address, byte repeatability, out nint outSensor)

Parameters

bus nint
address byte
repeatability byte
outSensor nint

Returns

PamojaStatus

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

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

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

Parameters

frame ReadOnlySpan<byte>
frameLen nuint
outMeasurement PamojaSht3xMeasurement

Returns

PamojaStatus

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

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

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

Parameters

frame ReadOnlySpan<byte>
frameLen nuint
outStatus PamojaSht3xStatus

Returns

PamojaStatus

pamoja_sht3x_periodic(byte, byte, out ushort)

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

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

Parameters

repeatability byte
rate byte
outCommand ushort

Returns

PamojaStatus

pamoja_sht3x_read_status(nint, out PamojaSht3xStatus)

Reads the SHT3x status register.

public static PamojaStatus pamoja_sht3x_read_status(nint sensor, out PamojaSht3xStatus outStatus)

Parameters

sensor nint
outStatus PamojaSht3xStatus

Returns

PamojaStatus

pamoja_sht3x_relative_humidity(ushort)

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

public static extern float pamoja_sht3x_relative_humidity(ushort raw)

Parameters

raw ushort

Returns

float

pamoja_sht3x_sim_part(byte)

Creates a simulated SHT3x reading its default temperature and humidity.

public static extern nint pamoja_sht3x_sim_part(byte address)

Parameters

address byte

Returns

nint

pamoja_sht3x_sim_reporting(byte, float, float)

Creates a simulated SHT3x that reads what it is asked to.

public static extern nint pamoja_sht3x_sim_reporting(byte address, float celsius, float relativeHumidity)

Parameters

address byte
celsius float
relativeHumidity float

Returns

nint

pamoja_sht3x_single_shot(byte, bool, out ushort)

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

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

Parameters

repeatability byte
clockStretching bool
outCommand ushort

Returns

PamojaStatus

pamoja_sht3x_status_bytes(ushort, Span<byte>)

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

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

Parameters

bits ushort
outBytes Span<byte>

Returns

PamojaStatus

pamoja_sht3x_status_from_bits(ushort, out PamojaSht3xStatus)

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

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

Parameters

bits ushort
outStatus PamojaSht3xStatus

Returns

PamojaStatus

pamoja_sht3x_temperature_raw_from_celsius(float)

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

public static extern ushort pamoja_sht3x_temperature_raw_from_celsius(float celsius)

Parameters

celsius float

Returns

ushort

pamoja_sht3x_temperature_raw_from_milli_celsius(int)

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

public static extern ushort pamoja_sht3x_temperature_raw_from_milli_celsius(int milliCelsius)

Parameters

milliCelsius int

Returns

ushort

pamoja_sht3x_temperature_raw_from_milli_fahrenheit(int)

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

public static extern ushort pamoja_sht3x_temperature_raw_from_milli_fahrenheit(int milliFahrenheit)

Parameters

milliFahrenheit int

Returns

ushort

pamoja_sht3x_typical_measurement_micros(byte, out uint)

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

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

Parameters

repeatability byte
outMicros uint

Returns

PamojaStatus

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

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

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

Parameters

frame ReadOnlySpan<byte>
frameLen nuint
outWord ushort

Returns

PamojaStatus

pamoja_sht3x_word_bytes(ushort, Span<byte>)

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

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

Parameters

value ushort
outBytes Span<byte>

Returns

PamojaStatus

pamoja_sim_robot_apply(nint, PamojaTwist)

Drives a simulated robot for one time step.

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

Parameters

robot nint
command PamojaTwist

Returns

PamojaStatus

pamoja_sim_robot_free(nint)

Releases a simulated robot handle.

public static extern void pamoja_sim_robot_free(nint robot)

Parameters

robot nint

pamoja_sim_robot_new(PamojaPose, float)

Creates a robot that moves only in arithmetic.

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

Parameters

start PamojaPose
dt float

Returns

nint

pamoja_sim_robot_pose(nint)

Reads where a simulated robot has got to.

public static extern PamojaPose pamoja_sim_robot_pose(nint robot)

Parameters

robot nint

Returns

PamojaPose

pamoja_sim_sensor_free(nint)

Releases a simulated sensor handle.

public static extern void pamoja_sim_sensor_free(nint sensor)

Parameters

sensor nint

pamoja_sim_sensor_new(float, float, float, uint)

Creates a sensor that reads around a baseline.

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

Parameters

baseline float
driftPerRead float
noise float
seed uint

Returns

nint

pamoja_sim_sensor_read(nint, out float)

Takes the next reading from a simulated sensor.

public static PamojaStatus pamoja_sim_sensor_read(nint sensor, out float outReading)

Parameters

sensor nint
outReading float

Returns

PamojaStatus

pamoja_skid_steer_body_motion(PamojaSkidSteer, float, float)

Returns the body motion a skid-steer drive makes from measured side speeds.

public static extern PamojaBodyMotion pamoja_skid_steer_body_motion(PamojaSkidSteer drive, float left, float right)

Parameters

drive PamojaSkidSteer
left float
right float

Returns

PamojaBodyMotion

pamoja_skid_steer_wheel_speeds(PamojaSkidSteer, float, float)

Returns the side speeds a skid-steer drive needs for a body motion.

public static extern PamojaSideSpeeds pamoja_skid_steer_wheel_speeds(PamojaSkidSteer drive, float linear, float angular)

Parameters

drive PamojaSkidSteer
linear float
angular float

Returns

PamojaSideSpeeds

pamoja_slip_decoder_discarded(nint)

Returns how many corrupt frames a SLIP decoder has discarded.

public static extern ulong pamoja_slip_decoder_discarded(nint decoder)

Parameters

decoder nint

Returns

ulong

pamoja_slip_decoder_feed(nint, ReadOnlySpan<byte>, nuint, out nint)

Feeds a chunk of the byte stream to a SLIP decoder.

public static PamojaStatus pamoja_slip_decoder_feed(nint decoder, ReadOnlySpan<byte> bytes, nuint bytesLen, out nint outFrames)

Parameters

decoder nint
bytes ReadOnlySpan<byte>
bytesLen nuint
outFrames nint

Returns

PamojaStatus

pamoja_slip_decoder_free(nint)

Releases a SLIP decoder handle. Passing null is a no-op.

public static extern void pamoja_slip_decoder_free(nint decoder)

Parameters

decoder nint

pamoja_slip_decoder_new()

Creates a streaming SLIP decoder.

public static extern nint pamoja_slip_decoder_new()

Returns

nint

pamoja_slip_decoder_reset(nint)

Discards any partly assembled SLIP frame.

public static extern void pamoja_slip_decoder_reset(nint decoder)

Parameters

decoder nint

pamoja_smoother_free(nint)

Releases a smoother handle. Passing null is a no-op.

public static extern void pamoja_smoother_free(nint smoother)

Parameters

smoother nint

pamoja_smoother_new(float)

Creates an exponential smoother.

public static extern nint pamoja_smoother_new(float weight)

Parameters

weight float

Returns

nint

pamoja_smoother_reset(nint)

Clears a smoother back to its initial state.

public static extern void pamoja_smoother_reset(nint smoother)

Parameters

smoother nint

pamoja_smoother_update(nint, float)

Folds a sample into a smoother and returns the smoothed value.

public static extern float pamoja_smoother_update(nint smoother, float sample)

Parameters

smoother nint
sample float

Returns

float

pamoja_smoother_value(nint, out float)

Reads a smoother's current value, if it has one.

public static bool pamoja_smoother_value(nint smoother, out float outValue)

Parameters

smoother nint
outValue float

Returns

bool

pamoja_spi_mode_cpol_cpha(byte, out bool, out bool)

Returns the clock polarity and phase an SPI mode number names.

public static PamojaStatus pamoja_spi_mode_cpol_cpha(byte mode, out bool outCpol, out bool outCpha)

Parameters

mode byte
outCpol bool
outCpha bool

Returns

PamojaStatus

pamoja_spi_mode_from_cpol_cpha(bool, bool)

Returns the SPI mode number a clock polarity and phase name.

public static byte pamoja_spi_mode_from_cpol_cpha(bool cpol, bool cpha)

Parameters

cpol bool
cpha bool

Returns

byte

pamoja_stepper_coils(nint)

Returns the coil pattern a stepper holds, without advancing.

public static extern byte pamoja_stepper_coils(nint stepper)

Parameters

stepper nint

Returns

byte

pamoja_stepper_free(nint)

Releases a stepper handle. Passing null is a no-op.

public static extern void pamoja_stepper_free(nint stepper)

Parameters

stepper nint

pamoja_stepper_new(PamojaStepDrive)

Creates a stepper at the start of a drive pattern.

public static extern nint pamoja_stepper_new(PamojaStepDrive drive)

Parameters

drive PamojaStepDrive

Returns

nint

pamoja_stepper_step(nint, PamojaStepDirection)

Advances a stepper and returns the coil pattern to apply.

public static extern byte pamoja_stepper_step(nint stepper, PamojaStepDirection direction)

Parameters

stepper nint
direction PamojaStepDirection

Returns

byte

pamoja_stepper_step_count(PamojaStepDrive)

Returns how many steps one electrical cycle of a drive takes.

public static extern nuint pamoja_stepper_step_count(PamojaStepDrive drive)

Parameters

drive PamojaStepDrive

Returns

nuint

pamoja_stepper_steps(nint)

Returns how many steps a stepper has taken, signed by direction.

public static extern int pamoja_stepper_steps(nint stepper)

Parameters

stepper nint

Returns

int

pamoja_stepper_steps_for_degrees(float, uint)

Returns how many steps a rotation of an angle takes.

public static extern int pamoja_stepper_steps_for_degrees(float degrees, uint stepsPerRevolution)

Parameters

degrees float
stepsPerRevolution uint

Returns

int

pamoja_store_append(nint, ReadOnlySpan<byte>, nuint)

Adds a record to the end of a buffer.

public static PamojaStatus pamoja_store_append(nint store, ReadOnlySpan<byte> record, nuint recordLen)

Parameters

store nint
record ReadOnlySpan<byte>
recordLen nuint

Returns

PamojaStatus

pamoja_store_drain_to(nint, nint, nint, out nuint)

Sends every held record over a transport.

public static PamojaStatus pamoja_store_drain_to(nint store, nint transport, nint topic, out nuint outSent)

Parameters

store nint
transport nint
topic nint
outSent nuint

Returns

PamojaStatus

pamoja_store_file(nint, nuint)

Opens a buffer backed by a directory.

public static extern nint pamoja_store_file(nint dir, nuint capacity)

Parameters

dir nint
capacity nuint

Returns

nint

pamoja_store_free(nint)

Releases a store handle.

public static extern void pamoja_store_free(nint store)

Parameters

store nint

pamoja_store_len(nint, out nuint)

Reports how many records a buffer holds.

public static PamojaStatus pamoja_store_len(nint store, out nuint outLen)

Parameters

store nint
outLen nuint

Returns

PamojaStatus

pamoja_store_memory(nuint)

Creates a buffer held in memory.

public static extern nint pamoja_store_memory(nuint capacity)

Parameters

capacity nuint

Returns

nint

pamoja_store_peek(nint, out nint)

Reads the oldest record without removing it.

public static PamojaStatus pamoja_store_peek(nint store, out nint outRecord)

Parameters

store nint
outRecord nint

Returns

PamojaStatus

pamoja_store_pop(nint, out nint)

Removes and returns the oldest record.

public static PamojaStatus pamoja_store_pop(nint store, out nint outRecord)

Parameters

store nint
outRecord nint

Returns

PamojaStatus

pamoja_string_data(nint)

Returns a pointer to an owned string's bytes.

public static extern nint pamoja_string_data(nint text)

Parameters

text nint

Returns

nint

pamoja_string_free(nint)

Releases an owned string.

public static extern void pamoja_string_free(nint text)

Parameters

text nint

pamoja_string_len(nint)

Returns the length in bytes of an owned string.

public static extern nuint pamoja_string_len(nint text)

Parameters

text nint

Returns

nuint

pamoja_surge_falling(float)

Creates a detector for falls of more than the given size.

public static extern nint pamoja_surge_falling(float limit)

Parameters

limit float

Returns

nint

pamoja_surge_free(nint)

Releases a surge handle. Passing null is a no-op.

public static extern void pamoja_surge_free(nint surge)

Parameters

surge nint

pamoja_surge_rising(float)

Creates a detector for rises of more than the given size.

public static extern nint pamoja_surge_rising(float limit)

Parameters

limit float

Returns

nint

pamoja_surge_update(nint, float, out float)

Feeds a value to a surge detector, reporting a step past the limit.

public static bool pamoja_surge_update(nint surge, float value, out float outDelta)

Parameters

surge nint
value float
outDelta float

Returns

bool

pamoja_sx126x_calibrate_image(uint, uint)

Builds CalibrateImage for a band.

public static extern PamojaSx126xCommand pamoja_sx126x_calibrate_image(uint lowHz, uint highHz)

Parameters

lowHz uint
highHz uint

Returns

PamojaSx126xCommand

pamoja_sx126x_clear_irq_status(ushort)

Builds ClearIrqStatus for a set of interrupts.

public static extern PamojaSx126xCommand pamoja_sx126x_clear_irq_status(ushort irq)

Parameters

irq ushort

Returns

PamojaSx126xCommand

pamoja_sx126x_device_errors_from_bytes(byte, byte)

Decodes a GetDeviceErrors answer into its error bits.

public static extern ushort pamoja_sx126x_device_errors_from_bytes(byte high, byte low)

Parameters

high byte
low byte

Returns

ushort

pamoja_sx126x_frequency_word(uint)

Returns the RF frequency word for a frequency in hertz.

public static extern uint pamoja_sx126x_frequency_word(uint frequencyHz)

Parameters

frequencyHz uint

Returns

uint

pamoja_sx126x_get_device_errors()

Builds GetDeviceErrors.

public static extern PamojaSx126xQuery pamoja_sx126x_get_device_errors()

Returns

PamojaSx126xQuery

pamoja_sx126x_get_irq_status()

Builds GetIrqStatus.

public static extern PamojaSx126xQuery pamoja_sx126x_get_irq_status()

Returns

PamojaSx126xQuery

pamoja_sx126x_get_packet_status()

Builds GetPacketStatus.

public static extern PamojaSx126xQuery pamoja_sx126x_get_packet_status()

Returns

PamojaSx126xQuery

pamoja_sx126x_get_rssi_inst()

Builds GetRssiInst.

public static extern PamojaSx126xQuery pamoja_sx126x_get_rssi_inst()

Returns

PamojaSx126xQuery

pamoja_sx126x_get_rx_buffer_status()

Builds GetRxBufferStatus.

public static extern PamojaSx126xQuery pamoja_sx126x_get_rx_buffer_status()

Returns

PamojaSx126xQuery

pamoja_sx126x_get_status()

Builds GetStatus.

public static extern PamojaSx126xQuery pamoja_sx126x_get_status()

Returns

PamojaSx126xQuery

pamoja_sx126x_image_calibration(uint, uint)

Returns the two CalibrateImage codes for a band, high byte first.

public static extern ushort pamoja_sx126x_image_calibration(uint lowHz, uint highHz)

Parameters

lowHz uint
highHz uint

Returns

ushort

pamoja_sx126x_irq_from_bytes(byte, byte)

Decodes a GetIrqStatus answer into its interrupt bits.

public static extern ushort pamoja_sx126x_irq_from_bytes(byte high, byte low)

Parameters

high byte
low byte

Returns

ushort

Reports whether an LLCC68 supports a link's spreading factor at its bandwidth.

public static bool pamoja_sx126x_llcc68_supports(PamojaLoraLink link)

Parameters

link PamojaLoraLink

Returns

bool

pamoja_sx126x_packet_status_from_bytes(byte, byte, byte)

Decodes a GetPacketStatus answer.

public static extern PamojaSx126xPacketStatus pamoja_sx126x_packet_status_from_bytes(byte rssiPkt, byte snrPkt, byte signalRssiPkt)

Parameters

rssiPkt byte
snrPkt byte
signalRssiPkt byte

Returns

PamojaSx126xPacketStatus

pamoja_sx126x_ramp_time_us(uint)

Returns the shortest ramp time the chip offers at least as long as the one given.

public static extern uint pamoja_sx126x_ramp_time_us(uint atLeastUs)

Parameters

atLeastUs uint

Returns

uint

pamoja_sx126x_read_buffer(byte, byte)

Builds ReadBuffer for a run of buffer bytes.

public static extern PamojaSx126xQuery pamoja_sx126x_read_buffer(byte offset, byte len)

Parameters

offset byte
len byte

Returns

PamojaSx126xQuery

pamoja_sx126x_read_register(ushort, byte)

Builds ReadRegister for a run of registers.

public static extern PamojaSx126xQuery pamoja_sx126x_read_register(ushort address, byte len)

Parameters

address ushort
len byte

Returns

PamojaSx126xQuery

pamoja_sx126x_rssi_inst_centi_dbm(byte)

Decodes a GetRssiInst answer, in hundredths of a dBm.

public static extern int pamoja_sx126x_rssi_inst_centi_dbm(byte value)

Parameters

value byte

Returns

int

pamoja_sx126x_rx_buffer_status_from_bytes(byte, byte)

Decodes a GetRxBufferStatus answer.

public static extern PamojaSx126xRxBufferStatus pamoja_sx126x_rx_buffer_status_from_bytes(byte payloadLen, byte start)

Parameters

payloadLen byte
start byte

Returns

PamojaSx126xRxBufferStatus

pamoja_sx126x_set_dio_irq_params(ushort, ushort, ushort, ushort)

Builds SetDioIrqParams from an interrupt mask and the mask each DIO line raises.

public static extern PamojaSx126xCommand pamoja_sx126x_set_dio_irq_params(ushort irq, ushort dio1, ushort dio2, ushort dio3)

Parameters

irq ushort
dio1 ushort
dio2 ushort
dio3 ushort

Returns

PamojaSx126xCommand

Builds SetModulationParams for a LoRa link.

public static PamojaStatus pamoja_sx126x_set_lora_modulation_params(PamojaLoraLink link, out PamojaSx126xCommand outCommand)

Parameters

link PamojaLoraLink
outCommand PamojaSx126xCommand

Returns

PamojaStatus

Builds SetPacketParams for a LoRa link and a payload length.

public static PamojaSx126xCommand pamoja_sx126x_set_lora_packet_params(PamojaLoraLink link, byte payloadLen, bool invertIq)

Parameters

link PamojaLoraLink
payloadLen byte
invertIq bool

Returns

PamojaSx126xCommand

pamoja_sx126x_set_pa_config(PamojaSx126xTxPower)

Builds SetPaConfig for an amplifier setting.

public static extern PamojaSx126xCommand pamoja_sx126x_set_pa_config(PamojaSx126xTxPower power)

Parameters

power PamojaSx126xTxPower

Returns

PamojaSx126xCommand

pamoja_sx126x_set_packet_type_lora()

Builds SetPacketType for LoRa.

public static extern PamojaSx126xCommand pamoja_sx126x_set_packet_type_lora()

Returns

PamojaSx126xCommand

pamoja_sx126x_set_rf_frequency(uint)

Builds SetRfFrequency for a frequency in hertz.

public static extern PamojaSx126xCommand pamoja_sx126x_set_rf_frequency(uint frequencyHz)

Parameters

frequencyHz uint

Returns

PamojaSx126xCommand

pamoja_sx126x_set_rx(ulong)

Builds SetRx with a timeout in microseconds.

public static extern PamojaSx126xCommand pamoja_sx126x_set_rx(ulong timeoutUs)

Parameters

timeoutUs ulong

Returns

PamojaSx126xCommand

pamoja_sx126x_set_rx_continuous()

Builds SetRx that listens until told otherwise.

public static extern PamojaSx126xCommand pamoja_sx126x_set_rx_continuous()

Returns

PamojaSx126xCommand

pamoja_sx126x_set_sleep(bool)

Builds SetSleep, keeping the configuration for a warm start or not.

public static PamojaSx126xCommand pamoja_sx126x_set_sleep(bool warmStart)

Parameters

warmStart bool

Returns

PamojaSx126xCommand

pamoja_sx126x_set_standby()

Builds SetStandby into the RC oscillator standby.

public static extern PamojaSx126xCommand pamoja_sx126x_set_standby()

Returns

PamojaSx126xCommand

pamoja_sx126x_set_tx(ulong)

Builds SetTx with a timeout in microseconds.

public static extern PamojaSx126xCommand pamoja_sx126x_set_tx(ulong timeoutUs)

Parameters

timeoutUs ulong

Returns

PamojaSx126xCommand

pamoja_sx126x_set_tx_params(PamojaSx126xTxPower, uint)

Builds SetTxParams for an amplifier setting and a ramp time.

public static extern PamojaSx126xCommand pamoja_sx126x_set_tx_params(PamojaSx126xTxPower power, uint rampUs)

Parameters

power PamojaSx126xTxPower
rampUs uint

Returns

PamojaSx126xCommand

pamoja_sx126x_status_from_byte(byte)

Decodes a status byte.

public static extern PamojaSx126xStatus pamoja_sx126x_status_from_byte(byte value)

Parameters

value byte

Returns

PamojaSx126xStatus

pamoja_sx126x_timeout_steps(ulong)

Returns a timeout in microseconds as the chip's 15.625 microsecond steps.

public static extern uint pamoja_sx126x_timeout_steps(ulong timeoutUs)

Parameters

timeoutUs ulong

Returns

uint

pamoja_sx126x_tx_power_for_output(bool, sbyte)

Returns the amplifier setting that delivers an output power.

public static PamojaSx126xTxPower pamoja_sx126x_tx_power_for_output(bool highPower, sbyte outputDbm)

Parameters

highPower bool
outputDbm sbyte

Returns

PamojaSx126xTxPower

pamoja_sx126x_tx_power_under_ceiling(bool, PamojaLoraLinkBudget, int)

Returns the strongest amplifier setting that keeps a link under an EIRP ceiling.

public static PamojaSx126xTxPower pamoja_sx126x_tx_power_under_ceiling(bool highPower, PamojaLoraLinkBudget budget, int eirpCeilingCentiDbm)

Parameters

highPower bool
budget PamojaLoraLinkBudget
eirpCeilingCentiDbm int

Returns

PamojaSx126xTxPower

pamoja_sx126x_write_buffer_header(byte)

Builds the WriteBuffer header the payload follows.

public static extern PamojaSx126xCommand pamoja_sx126x_write_buffer_header(byte offset)

Parameters

offset byte

Returns

PamojaSx126xCommand

pamoja_sx126x_write_register_header(ushort)

Builds the WriteRegister header the values follow.

public static extern PamojaSx126xCommand pamoja_sx126x_write_register_header(ushort address)

Parameters

address ushort

Returns

PamojaSx126xCommand

pamoja_sx127x_automatic_if(byte, bool)

Returns RegDetectOptimize with AutomaticIFOn set or clear.

public static byte pamoja_sx127x_automatic_if(byte current, bool automaticIf)

Parameters

current byte
automaticIf bool

Returns

byte

pamoja_sx127x_frequency_from_word(uint)

Returns the frequency an SX127x RegFrf word selects.

public static extern uint pamoja_sx127x_frequency_from_word(uint word)

Parameters

word uint

Returns

uint

pamoja_sx127x_frequency_word(uint)

Returns the 24-bit RegFrf word an SX127x takes for a frequency.

public static extern uint pamoja_sx127x_frequency_word(uint frequencyHz)

Parameters

frequencyHz uint

Returns

uint

pamoja_sx127x_fsk_op_mode(byte)

Returns the RegOpMode value for an FSK operating mode code.

public static extern byte pamoja_sx127x_fsk_op_mode(byte mode)

Parameters

mode byte

Returns

byte

Returns the writes of the 500 kHz sensitivity erratum.

public static PamojaStatus pamoja_sx127x_high_bw_optimize(PamojaLoraLink link, uint frequencyHz, out PamojaSx127xHighBwOptimize outOptimize)

Parameters

link PamojaLoraLink
frequencyHz uint
outOptimize PamojaSx127xHighBwOptimize

Returns

PamojaStatus

pamoja_sx127x_image_cal_start(byte)

Returns RegImageCal to start a calibration.

public static extern byte pamoja_sx127x_image_cal_start(byte current)

Parameters

current byte

Returns

byte

pamoja_sx127x_invert_iq(bool, bool)

Returns RegInvertIQ for the IQ polarity of each path.

public static byte pamoja_sx127x_invert_iq(bool receive, bool transmit)

Parameters

receive bool
transmit bool

Returns

byte

pamoja_sx127x_invert_iq_2(bool)

Returns RegInvertIQ2 for the path in use.

public static byte pamoja_sx127x_invert_iq_2(bool inverted)

Parameters

inverted bool

Returns

byte

pamoja_sx127x_lora_op_mode(byte)

Returns the RegOpMode value for a LoRa operating mode code.

public static extern byte pamoja_sx127x_lora_op_mode(byte mode)

Parameters

mode byte

Returns

byte

pamoja_sx127x_mode_from_op_mode(byte)

Returns the operating mode code a RegOpMode value holds.

public static extern byte pamoja_sx127x_mode_from_op_mode(byte opMode)

Parameters

opMode byte

Returns

byte

Returns the LoRa modem registers for a link at a carrier.

public static PamojaStatus pamoja_sx127x_modem(PamojaLoraLink link, uint frequencyHz, ushort symbolTimeout, out PamojaSx127xModem outModem)

Parameters

link PamojaLoraLink
frequencyHz uint
symbolTimeout ushort
outModem PamojaSx127xModem

Returns

PamojaStatus

pamoja_sx127x_modem_status_from_byte(byte)

Decodes RegModemStat.

public static extern PamojaSx127xModemStatus pamoja_sx127x_modem_status_from_byte(byte value)

Parameters

value byte

Returns

PamojaSx127xModemStatus

pamoja_sx127x_ocp_register(ushort)

Returns RegOcp for a current limit.

public static extern byte pamoja_sx127x_ocp_register(ushort milliamps)

Parameters

milliamps ushort

Returns

byte

pamoja_sx127x_packet_status_from_bytes(byte, byte, uint)

Decodes RegPktSnrValue and RegPktRssiValue for a carrier.

public static extern PamojaSx127xPacketStatus pamoja_sx127x_packet_status_from_bytes(byte pktSnr, byte pktRssi, uint frequencyHz)

Parameters

pktSnr byte
pktRssi byte
frequencyHz uint

Returns

PamojaSx127xPacketStatus

pamoja_sx127x_read_address(byte)

Returns the SX127x address byte that reads a register.

public static extern byte pamoja_sx127x_read_address(byte address)

Parameters

address byte

Returns

byte

pamoja_sx127x_rssi_centi_dbm(byte, uint)

Decodes RegRssiValue for a carrier, in hundredths of a dBm.

public static extern int pamoja_sx127x_rssi_centi_dbm(byte value, uint frequencyHz)

Parameters

value byte
frequencyHz uint

Returns

int

Returns the receive settings of the spurious reception erratum.

public static PamojaStatus pamoja_sx127x_spurious_reception(PamojaLoraLink link, out PamojaSx127xSpuriousReception outErratum)

Parameters

link PamojaLoraLink
outErratum PamojaSx127xSpuriousReception

Returns

PamojaStatus

Returns a single reception timeout in a link's symbols.

public static extern ushort pamoja_sx127x_symbol_timeout(PamojaLoraLink link, ulong timeoutUs)

Parameters

link PamojaLoraLink
timeoutUs ulong

Returns

ushort

pamoja_sx127x_tx_power_for_output(bool, sbyte)

Returns the SX127x amplifier settings for an output power.

public static PamojaSx127xTxPower pamoja_sx127x_tx_power_for_output(bool paBoost, sbyte outputDbm)

Parameters

paBoost bool
outputDbm sbyte

Returns

PamojaSx127xTxPower

pamoja_sx127x_tx_power_under_ceiling(bool, PamojaLoraLinkBudget, int)

Returns the SX127x amplifier settings that keep a link under an EIRP ceiling.

public static PamojaSx127xTxPower pamoja_sx127x_tx_power_under_ceiling(bool paBoost, PamojaLoraLinkBudget budget, int eirpCeilingCentiDbm)

Parameters

paBoost bool
budget PamojaLoraLinkBudget
eirpCeilingCentiDbm int

Returns

PamojaSx127xTxPower

pamoja_sx127x_write_address(byte)

Returns the SX127x address byte that writes a register.

public static extern byte pamoja_sx127x_write_address(byte address)

Parameters

address byte

Returns

byte

pamoja_thermostat_cooling(float, float)

Creates a cooling thermostat.

public static extern nint pamoja_thermostat_cooling(float setpoint, float hysteresis)

Parameters

setpoint float
hysteresis float

Returns

nint

pamoja_thermostat_free(nint)

Releases a thermostat handle. Passing null is a no-op.

public static extern void pamoja_thermostat_free(nint thermostat)

Parameters

thermostat nint

pamoja_thermostat_heating(float, float)

Creates a heating thermostat.

public static extern nint pamoja_thermostat_heating(float setpoint, float hysteresis)

Parameters

setpoint float
hysteresis float

Returns

nint

pamoja_thermostat_is_on(nint)

Reports a thermostat's current load state.

public static bool pamoja_thermostat_is_on(nint thermostat)

Parameters

thermostat nint

Returns

bool

pamoja_thermostat_update(nint, float)

Feeds a reading to a thermostat and returns the load state.

public static bool pamoja_thermostat_update(nint thermostat, float reading)

Parameters

thermostat nint
reading float

Returns

bool

pamoja_tmp117_alerts(nint, out PamojaTmp117Alerts)

Reads the TMP117's alert flags.

public static PamojaStatus pamoja_tmp117_alerts(nint sensor, out PamojaTmp117Alerts outAlerts)

Parameters

sensor nint
outAlerts PamojaTmp117Alerts

Returns

PamojaStatus

pamoja_tmp117_averaging_conversions(byte)

Returns how many conversions a TMP117 averaging code folds into one result. # Returns The conversion count: 1, 8, 32, or 64.

public static extern byte pamoja_tmp117_averaging_conversions(byte code)

Parameters

code byte

Returns

byte

pamoja_tmp117_averaging_micros(byte)

Returns how long a TMP117 averaging code takes to convert. # Returns The conversion time in microseconds.

public static extern uint pamoja_tmp117_averaging_micros(byte code)

Parameters

code byte

Returns

uint

pamoja_tmp117_celsius(short)

Converts a raw TMP117 temperature register to degrees Celsius. # Returns The temperature.

public static extern float pamoja_tmp117_celsius(short raw)

Parameters

raw short

Returns

float

pamoja_tmp117_config_bits(PamojaTmp117Config)

Assembles the 16-bit TMP117 configuration register value. # Returns The register value to write.

public static extern ushort pamoja_tmp117_config_bits(PamojaTmp117Config config)

Parameters

config PamojaTmp117Config

Returns

ushort

pamoja_tmp117_config_from_bits(ushort, out PamojaTmp117Config)

Parses a 16-bit TMP117 configuration register value. # Returns [PamojaStatus::Ok], with *out_config filled in. Every register value decodes, so this fails only on a null pointer. # Safety out_config must point to a writable PamojaTmp117Config.

public static PamojaStatus pamoja_tmp117_config_from_bits(ushort bits, out PamojaTmp117Config outConfig)

Parameters

bits ushort
outConfig PamojaTmp117Config

Returns

PamojaStatus

pamoja_tmp117_cycle_micros(byte, byte)

Returns how often a TMP117 updates its result for a cycle and averaging code. # Returns The longer of the nominal cycle and the time the averaging takes.

public static extern uint pamoja_tmp117_cycle_micros(byte cycle, byte averaging)

Parameters

cycle byte
averaging byte

Returns

uint

pamoja_tmp117_cycle_nominal_micros(byte)

Returns the nominal cycle a TMP117 conversion-cycle code selects. # Returns The cycle in microseconds, before the averaging setting extends it.

public static extern uint pamoja_tmp117_cycle_nominal_micros(byte code)

Parameters

code byte

Returns

uint

pamoja_tmp117_data_ready(ushort)

Reports whether a TMP117 configuration register says a result is ready. # Returns true when a conversion completed since the register was last read.

public static bool pamoja_tmp117_data_ready(ushort config)

Parameters

config ushort

Returns

bool

pamoja_tmp117_device_id(ushort)

Reads the device identifier out of a TMP117 device-ID register. # Returns The low twelve bits, which are 0x117 for a TMP117.

public static extern ushort pamoja_tmp117_device_id(ushort raw)

Parameters

raw ushort

Returns

ushort

pamoja_tmp117_eeprom_busy(ushort)

Reports whether a TMP117 configuration register says an EEPROM write is running. # Returns true while the write is in progress.

public static bool pamoja_tmp117_eeprom_busy(ushort config)

Parameters

config ushort

Returns

bool

pamoja_tmp117_eeprom_unlock_busy(ushort)

Reports whether a TMP117 EEPROM unlock register says a write is running. # Returns true while the write is in progress.

public static bool pamoja_tmp117_eeprom_unlock_busy(ushort unlock)

Parameters

unlock ushort

Returns

bool

pamoja_tmp117_free(nint)

Releases a TMP117 driver. Passing null is a no-op.

public static extern void pamoja_tmp117_free(nint sensor)

Parameters

sensor nint

pamoja_tmp117_high_alert(ushort)

Reports whether a TMP117 configuration register flags a high alert. # Returns true when a result went above the high limit.

public static bool pamoja_tmp117_high_alert(ushort config)

Parameters

config ushort

Returns

bool

pamoja_tmp117_init(nint)

Identifies and configures a TMP117.

public static extern PamojaStatus pamoja_tmp117_init(nint sensor)

Parameters

sensor nint

Returns

PamojaStatus

pamoja_tmp117_low_alert(ushort)

Reports whether a TMP117 configuration register flags a low alert. # Returns true when a result went below the low limit.

public static bool pamoja_tmp117_low_alert(ushort config)

Parameters

config ushort

Returns

bool

pamoja_tmp117_measure(nint, out PamojaTmp117Reading)

Runs one TMP117 conversion and reads the temperature.

public static PamojaStatus pamoja_tmp117_measure(nint sensor, out PamojaTmp117Reading outReading)

Parameters

sensor nint
outReading PamojaTmp117Reading

Returns

PamojaStatus

pamoja_tmp117_micro_celsius(short)

Converts a raw TMP117 temperature register to micro-degrees Celsius. # Returns The temperature, truncated toward zero at the last digit.

public static extern int pamoja_tmp117_micro_celsius(short raw)

Parameters

raw short

Returns

int

pamoja_tmp117_nano_celsius(short)

Converts a raw TMP117 temperature register to nano-degrees Celsius. # Returns The temperature, exact in integer arithmetic at the part's 7.8125 m°C step.

public static extern long pamoja_tmp117_nano_celsius(short raw)

Parameters

raw short

Returns

long

pamoja_tmp117_new(nint, byte, byte, out nint)

Creates a TMP117 driver on a bus.

public static PamojaStatus pamoja_tmp117_new(nint bus, byte address, byte averaging, out nint outSensor)

Parameters

bus nint
address byte
averaging byte
outSensor nint

Returns

PamojaStatus

pamoja_tmp117_raw_from_celsius(float)

Builds the TMP117 temperature register that decodes to a temperature in Celsius. # Returns The nearest register value, saturating at the ends of the part's range.

public static extern short pamoja_tmp117_raw_from_celsius(float celsius)

Parameters

celsius float

Returns

short

pamoja_tmp117_raw_from_micro_celsius(int)

Builds the TMP117 temperature register that decodes to a temperature. # Returns The nearest register value, saturating at the ends of the part's range.

public static extern short pamoja_tmp117_raw_from_micro_celsius(int microCelsius)

Parameters

microCelsius int

Returns

short

pamoja_tmp117_revision(ushort)

Reads the die revision out of a TMP117 device-ID register. # Returns The high four bits.

public static extern byte pamoja_tmp117_revision(ushort raw)

Parameters

raw ushort

Returns

byte

pamoja_tmp117_set_alert_limits(nint, float, float)

Writes the TMP117's high and low limits.

public static extern PamojaStatus pamoja_tmp117_set_alert_limits(nint sensor, float highCelsius, float lowCelsius)

Parameters

sensor nint
highCelsius float
lowCelsius float

Returns

PamojaStatus

pamoja_tmp117_silicon_revision(nint, out byte)

Reports the silicon revision a TMP117 driver read at initialization.

public static bool pamoja_tmp117_silicon_revision(nint sensor, out byte outRevision)

Parameters

sensor nint
outRevision byte

Returns

bool

pamoja_tmp117_sim_part(byte)

Creates a simulated TMP117 reading its default temperature.

public static extern nint pamoja_tmp117_sim_part(byte address)

Parameters

address byte

Returns

nint

pamoja_tmp117_sim_reporting(byte, float)

Creates a simulated TMP117 that reads what it is asked to.

public static extern nint pamoja_tmp117_sim_reporting(byte address, float celsius)

Parameters

address byte
celsius float

Returns

nint

pamoja_tmp117_temperature_bytes(short, Span<byte>)

Builds the two bytes a TMP117 sends for a temperature register. # Returns [PamojaStatus::Ok] on success, with the two bytes written to out_bytes, or [PamojaStatus::InvalidArgument] if out_bytes is null. # Safety out_bytes must point to at least two writable bytes.

public static PamojaStatus pamoja_tmp117_temperature_bytes(short raw, Span<byte> outBytes)

Parameters

raw short
outBytes Span<byte>

Returns

PamojaStatus

pamoja_tmp117_temperature_from_bytes(ReadOnlySpan<byte>, nuint, out short)

Reads the two bytes a TMP117 sends for a temperature register. # Returns [PamojaStatus::Ok] on success, with *out_raw set, or [PamojaStatus::InvalidArgument] if the buffer is not two bytes. # Safety bytes must point to at least bytes_len readable bytes, and out_raw must point to a writable int16_t.

public static PamojaStatus pamoja_tmp117_temperature_from_bytes(ReadOnlySpan<byte> bytes, nuint bytesLen, out short outRaw)

Parameters

bytes ReadOnlySpan<byte>
bytesLen nuint
outRaw short

Returns

PamojaStatus

pamoja_transform_identity()

Returns the identity transform.

public static extern PamojaTransform pamoja_transform_identity()

Returns

PamojaTransform

pamoja_transform_multiply(PamojaTransform, PamojaTransform)

Returns the product of two transforms.

public static extern PamojaTransform pamoja_transform_multiply(PamojaTransform first, PamojaTransform second)

Parameters

first PamojaTransform
second PamojaTransform

Returns

PamojaTransform

pamoja_transport_coap(ref PamojaCoapConfig)

Creates a CoAP transport for composing.

public static nint pamoja_transport_coap(ref PamojaCoapConfig config)

Parameters

config PamojaCoapConfig

Returns

nint

pamoja_transport_connect(nint)

Connects a transport.

public static extern PamojaStatus pamoja_transport_connect(nint transport)

Parameters

transport nint

Returns

PamojaStatus

pamoja_transport_degraded(nint, uint, uint, uint)

Wraps a transport in a link that loses packets and goes down.

public static extern nint pamoja_transport_degraded(nint transport, uint dropEvery, uint up, uint down)

Parameters

transport nint
dropEvery uint
up uint
down uint

Returns

nint

pamoja_transport_faulty(nint, nuint)

Wraps a transport so a set number of its next sends fail.

public static extern nint pamoja_transport_faulty(nint transport, nuint failures)

Parameters

transport nint
failures nuint

Returns

nint

pamoja_transport_free(nint)

Releases a transport handle.

public static extern void pamoja_transport_free(nint transport)

Parameters

transport nint

pamoja_transport_from_callbacks(ref PamojaTransportCallbacks, nint)

Wraps host callbacks in a transport.

public static nint pamoja_transport_from_callbacks(ref PamojaTransportCallbacks callbacks, nint userData)

Parameters

callbacks PamojaTransportCallbacks
userData nint

Returns

nint

pamoja_transport_loopback(nint)

Creates a loopback transport for composing.

public static extern nint pamoja_transport_loopback(nint broker)

Parameters

broker nint

Returns

nint

pamoja_transport_mqtt(ref PamojaMqttConfig)

Creates an MQTT transport for composing.

public static nint pamoja_transport_mqtt(ref PamojaMqttConfig config)

Parameters

config PamojaMqttConfig

Returns

nint

pamoja_transport_recv(nint, out nint)

Waits for the next message a transport delivers.

public static PamojaStatus pamoja_transport_recv(nint transport, out nint outMessage)

Parameters

transport nint
outMessage nint

Returns

PamojaStatus

pamoja_transport_recv_within(nint, ulong, out nint, out bool)

Waits a limited time for the next message a transport delivers.

public static PamojaStatus pamoja_transport_recv_within(nint transport, ulong timeoutMs, out nint outMessage, out bool outTimedOut)

Parameters

transport nint
timeoutMs ulong
outMessage nint
outTimedOut bool

Returns

PamojaStatus

pamoja_transport_send(nint, nint, ReadOnlySpan<byte>, nuint)

Sends a payload over a transport.

public static PamojaStatus pamoja_transport_send(nint transport, nint topic, ReadOnlySpan<byte> payload, nuint payloadLen)

Parameters

transport nint
topic nint
payload ReadOnlySpan<byte>
payloadLen nuint

Returns

PamojaStatus

pamoja_transport_subscribe(nint, nint)

Subscribes a transport to a topic.

public static extern PamojaStatus pamoja_transport_subscribe(nint transport, nint topic)

Parameters

transport nint
topic nint

Returns

PamojaStatus

pamoja_trend_capacity(nint)

Returns how many readings a trend estimator keeps.

public static extern nuint pamoja_trend_capacity(nint trend)

Parameters

trend nint

Returns

nuint

pamoja_trend_free(nint)

Releases a trend estimator handle. Passing null is a no-op.

public static extern void pamoja_trend_free(nint trend)

Parameters

trend nint

pamoja_trend_new()

Creates an empty trend estimator.

public static extern nint pamoja_trend_new()

Returns

nint

pamoja_trend_push(nint, float)

Adds a reading to a trend estimator.

public static extern void pamoja_trend_push(nint trend, float reading)

Parameters

trend nint
reading float

pamoja_trend_slope(nint, out float)

Reads the slope a trend estimator has fitted, if it has enough readings.

public static bool pamoja_trend_slope(nint trend, out float outValue)

Parameters

trend nint
outValue float

Returns

bool

pamoja_trend_with_capacity(nuint)

Creates an empty trend estimator keeping up to a capacity, or null for one out of range.

public static extern nint pamoja_trend_with_capacity(nuint capacity)

Parameters

capacity nuint

Returns

nint

pamoja_trigger_above(float, float)

Creates a trigger that fires when a reading rises above a line.

public static extern nint pamoja_trigger_above(float threshold, float hysteresis)

Parameters

threshold float
hysteresis float

Returns

nint

pamoja_trigger_below(float, float)

Creates a trigger that fires when a reading falls below a line.

public static extern nint pamoja_trigger_below(float threshold, float hysteresis)

Parameters

threshold float
hysteresis float

Returns

nint

pamoja_trigger_free(nint)

Releases a trigger handle. Passing null is a no-op.

public static extern void pamoja_trigger_free(nint trigger)

Parameters

trigger nint

pamoja_trigger_hysteresis(nint)

Reads the release band on the far side of a trigger's line.

public static extern float pamoja_trigger_hysteresis(nint trigger)

Parameters

trigger nint

Returns

float

pamoja_trigger_is_set(nint)

Reports whether a trigger's condition currently holds.

public static bool pamoja_trigger_is_set(nint trigger)

Parameters

trigger nint

Returns

bool

pamoja_trigger_threshold(nint)

Reads the line a trigger watches.

public static extern float pamoja_trigger_threshold(nint trigger)

Parameters

trigger nint

Returns

float

pamoja_trigger_update(nint, float)

Feeds a reading to a trigger and returns the edge it caused.

public static extern PamojaEdge pamoja_trigger_update(nint trigger, float reading)

Parameters

trigger nint
reading float

Returns

PamojaEdge

pamoja_trigger_watches_above(nint)

Reports whether a trigger watches a rising reading.

public static bool pamoja_trigger_watches_above(nint trigger)

Parameters

trigger nint

Returns

bool

Finds the joint angles that put a two-link arm's hand at a point.

public static bool pamoja_two_link_arm_joints_for(PamojaTwoLinkArm arm, float x, float y, PamojaElbow elbow, out PamojaJoints outJoints)

Parameters

arm PamojaTwoLinkArm
x float
y float
elbow PamojaElbow
outJoints PamojaJoints

Returns

bool

Returns how close and how far a two-link arm reaches.

public static extern PamojaReach pamoja_two_link_arm_reach(PamojaTwoLinkArm arm)

Parameters

arm PamojaTwoLinkArm

Returns

PamojaReach

Returns where a two-link arm's hand is for its joint angles.

public static extern PamojaPoint pamoja_two_link_arm_tip(PamojaTwoLinkArm arm, float shoulder, float elbow)

Parameters

arm PamojaTwoLinkArm
shoulder float
elbow float

Returns

PamojaPoint

pamoja_units_celsius_to_fahrenheit(float)

Converts degrees Celsius to degrees Fahrenheit.

public static extern float pamoja_units_celsius_to_fahrenheit(float celsius)

Parameters

celsius float

Returns

float

pamoja_units_celsius_to_kelvin(float)

Converts degrees Celsius to kelvin.

public static extern float pamoja_units_celsius_to_kelvin(float celsius)

Parameters

celsius float

Returns

float

pamoja_units_fahrenheit_to_celsius(float)

Converts degrees Fahrenheit to degrees Celsius.

public static extern float pamoja_units_fahrenheit_to_celsius(float fahrenheit)

Parameters

fahrenheit float

Returns

float

pamoja_units_hectopascals_to_pascals(float)

Converts hectopascals to pascals.

public static extern float pamoja_units_hectopascals_to_pascals(float hectopascals)

Parameters

hectopascals float

Returns

float

pamoja_units_kelvin_to_celsius(float)

Converts kelvin to degrees Celsius.

public static extern float pamoja_units_kelvin_to_celsius(float kelvin)

Parameters

kelvin float

Returns

float

pamoja_units_kilopascals_to_pascals(float)

Converts kilopascals to pascals.

public static extern float pamoja_units_kilopascals_to_pascals(float kilopascals)

Parameters

kilopascals float

Returns

float

pamoja_units_pascals_to_hectopascals(float)

Converts pascals to hectopascals.

public static extern float pamoja_units_pascals_to_hectopascals(float pascals)

Parameters

pascals float

Returns

float

pamoja_units_pascals_to_kilopascals(float)

Converts pascals to kilopascals.

public static extern float pamoja_units_pascals_to_kilopascals(float pascals)

Parameters

pascals float

Returns

float

pamoja_units_pascals_to_psi(float)

Converts pascals to pounds per square inch.

public static extern float pamoja_units_pascals_to_psi(float pascals)

Parameters

pascals float

Returns

float

pamoja_units_percent_to_ratio(float)

Converts a percentage to a ratio from 0 to 1.

public static extern float pamoja_units_percent_to_ratio(float percent)

Parameters

percent float

Returns

float

pamoja_units_psi_to_pascals(float)

Converts pounds per square inch to pascals.

public static extern float pamoja_units_psi_to_pascals(float psi)

Parameters

psi float

Returns

float

pamoja_units_ratio_to_percent(float)

Converts a ratio from 0 to 1 to a percentage.

public static extern float pamoja_units_ratio_to_percent(float ratio)

Parameters

ratio float

Returns

float

pamoja_update_block_frame(ReadOnlySpan<byte>, nuint, ReadOnlySpan<byte>, nuint, Span<byte>, nuint, out nuint)

Writes a signed update into one block, for a transport that moves blocks.

public static PamojaStatus pamoja_update_block_frame(ReadOnlySpan<byte> envelope, nuint envelopeLen, ReadOnlySpan<byte> image, nuint imageLen, Span<byte> outBlock, nuint capacity, out nuint outLen)

Parameters

envelope ReadOnlySpan<byte>
envelopeLen nuint
image ReadOnlySpan<byte>
imageLen nuint
outBlock Span<byte>
capacity nuint
outLen nuint

Returns

PamojaStatus

pamoja_update_block_split(ReadOnlySpan<byte>, nuint, out nuint, out nuint, out nuint, out nuint)

Reads a block back into the signed manifest and the image.

public static PamojaStatus pamoja_update_block_split(ReadOnlySpan<byte> block, nuint blockLen, out nuint outEnvelopeAt, out nuint outEnvelopeLen, out nuint outImageAt, out nuint outImageLen)

Parameters

block ReadOnlySpan<byte>
blockLen nuint
outEnvelopeAt nuint
outEnvelopeLen nuint
outImageAt nuint
outImageLen nuint

Returns

PamojaStatus

pamoja_updater_adopt(nint, ReadOnlySpan<byte>, nuint, bool, ulong, out PamojaDelegation)

Adopts a delegation naming a release key.

public static PamojaStatus pamoja_updater_adopt(nint updater, ReadOnlySpan<byte> bytes, nuint len, bool hasNow, ulong now, out PamojaDelegation outDelegation)

Parameters

updater nint
bytes ReadOnlySpan<byte>
len nuint
hasNow bool
now ulong
outDelegation PamojaDelegation

Returns

PamojaStatus

pamoja_updater_begin(nint, ReadOnlySpan<byte>, nuint, bool, ulong, out byte)

Checks a manifest and opens its slot for a transfer in pieces.

public static PamojaStatus pamoja_updater_begin(nint updater, ReadOnlySpan<byte> envelope, nuint envelopeLen, bool hasNow, ulong now, out byte outSlot)

Parameters

updater nint
envelope ReadOnlySpan<byte>
envelopeLen nuint
hasNow bool
now ulong
outSlot byte

Returns

PamojaStatus

pamoja_updater_confirm(nint, out byte)

Confirms the pending image.

public static PamojaStatus pamoja_updater_confirm(nint updater, out byte outSlot)

Parameters

updater nint
outSlot byte

Returns

PamojaStatus

pamoja_updater_delegation(nint, out PamojaDelegation)

Reads the delegation an updater currently honors.

public static bool pamoja_updater_delegation(nint updater, out PamojaDelegation outDelegation)

Parameters

updater nint
outDelegation PamojaDelegation

Returns

bool

pamoja_updater_finish(nint, out byte)

Finishes an opened image and marks the slot bootable if it matched.

public static PamojaStatus pamoja_updater_finish(nint updater, out byte outSlot)

Parameters

updater nint
outSlot byte

Returns

PamojaStatus

pamoja_updater_free(nint)

Releases an updater handle.

public static extern void pamoja_updater_free(nint updater)

Parameters

updater nint

pamoja_updater_installed_sequence(nint, out ulong)

Reads the highest sequence number the device already holds.

public static PamojaStatus pamoja_updater_installed_sequence(nint updater, out ulong outSequence)

Parameters

updater nint
outSequence ulong

Returns

PamojaStatus

pamoja_updater_new(PamojaDevice, byte, uint)

Creates an updater over a device's slots.

public static extern nint pamoja_updater_new(PamojaDevice device, byte slotCount, uint slotCapacity)

Parameters

device PamojaDevice
slotCount byte
slotCapacity uint

Returns

nint

pamoja_updater_on_boot(nint, out PamojaBoot)

Decides what to run, recording the decision before returning it.

public static PamojaStatus pamoja_updater_on_boot(nint updater, out PamojaBoot outBoot)

Parameters

updater nint
outBoot PamojaBoot

Returns

PamojaStatus

pamoja_updater_progress(nint, out uint, out uint)

Reports how much of an opened image has arrived.

public static PamojaStatus pamoja_updater_progress(nint updater, out uint outWritten, out uint outTotal)

Parameters

updater nint
outWritten uint
outTotal uint

Returns

PamojaStatus

pamoja_updater_provision(nint, byte, ulong)

Records that a slot holds a confirmed image at a sequence number.

public static extern PamojaStatus pamoja_updater_provision(nint updater, byte slot, ulong sequence)

Parameters

updater nint
slot byte
sequence ulong

Returns

PamojaStatus

pamoja_updater_revert(nint, out byte)

Fails the pending image and goes back to the confirmed one.

public static PamojaStatus pamoja_updater_revert(nint updater, out byte outSlot)

Parameters

updater nint
outSlot byte

Returns

PamojaStatus

pamoja_updater_slot_count(nint)

Returns how many slots a device has.

public static extern byte pamoja_updater_slot_count(nint updater)

Parameters

updater nint

Returns

byte

pamoja_updater_slot_record(nint, byte, out PamojaSlotRecord)

Reads what a device believes about one slot.

public static PamojaStatus pamoja_updater_slot_record(nint updater, byte slot, out PamojaSlotRecord outRecord)

Parameters

updater nint
slot byte
outRecord PamojaSlotRecord

Returns

PamojaStatus

pamoja_updater_stage(nint, ReadOnlySpan<byte>, nuint, ReadOnlySpan<byte>, nuint, bool, ulong, out byte)

Checks a manifest and stages an image held whole.

public static PamojaStatus pamoja_updater_stage(nint updater, ReadOnlySpan<byte> envelope, nuint envelopeLen, ReadOnlySpan<byte> image, nuint imageLen, bool hasNow, ulong now, out byte outSlot)

Parameters

updater nint
envelope ReadOnlySpan<byte>
envelopeLen nuint
image ReadOnlySpan<byte>
imageLen nuint
hasNow bool
now ulong
outSlot byte

Returns

PamojaStatus

pamoja_updater_write(nint, ReadOnlySpan<byte>, nuint)

Takes the next piece of an opened image.

public static PamojaStatus pamoja_updater_write(nint updater, ReadOnlySpan<byte> chunk, nuint len)

Parameters

updater nint
chunk ReadOnlySpan<byte>
len nuint

Returns

PamojaStatus

pamoja_version()

Returns the version string of the native pamoja library.

public static extern nint pamoja_version()

Returns

nint

pamoja_watchdog_feed(nint)

Feeds a watchdog.

public static extern void pamoja_watchdog_feed(nint watchdog)

Parameters

watchdog nint

pamoja_watchdog_free(nint)

Releases a watchdog handle. Passing null is a no-op.

public static extern void pamoja_watchdog_free(nint watchdog)

Parameters

watchdog nint

pamoja_watchdog_is_expired(nint)

Reports whether a watchdog has expired.

public static bool pamoja_watchdog_is_expired(nint watchdog)

Parameters

watchdog nint

Returns

bool

pamoja_watchdog_new(float)

Creates a watchdog that expires after a timeout without being fed.

public static extern nint pamoja_watchdog_new(float timeout)

Parameters

timeout float

Returns

nint

pamoja_watchdog_update(nint, float)

Advances a watchdog's timer and reports whether it has expired.

public static bool pamoja_watchdog_update(nint watchdog, float dt)

Parameters

watchdog nint
dt float

Returns

bool

pamoja_waypoint_follower_guide(PamojaWaypointFollower, PamojaCoordinate, float, PamojaCoordinate)

Produces the command from a robot's position and heading toward a target.

public static extern PamojaGuidance pamoja_waypoint_follower_guide(PamojaWaypointFollower follower, PamojaCoordinate here, float headingDeg, PamojaCoordinate target)

Parameters

follower PamojaWaypointFollower
here PamojaCoordinate
headingDeg float
target PamojaCoordinate

Returns

PamojaGuidance

pamoja_weather_dew_point(double, double)

Computes the dew point from the air temperature and relative humidity.

public static extern double pamoja_weather_dew_point(double celsius, double humidityPercent)

Parameters

celsius double
humidityPercent double

Returns

double

pamoja_window_capacity(nint)

Returns how many readings a window holds before dropping.

public static extern nuint pamoja_window_capacity(nint window)

Parameters

window nint

Returns

nuint

pamoja_window_free(nint)

Releases a rolling window handle. Passing null is a no-op.

public static extern void pamoja_window_free(nint window)

Parameters

window nint

pamoja_window_is_full(nint)

Reports whether a window holds as many readings as it keeps.

public static bool pamoja_window_is_full(nint window)

Parameters

window nint

Returns

bool

pamoja_window_latest(nint, out float)

Reads the most recent reading in a window, if it has any.

public static bool pamoja_window_latest(nint window, out float outValue)

Parameters

window nint
outValue float

Returns

bool

pamoja_window_len(nint)

Returns how many readings a window holds.

public static extern nuint pamoja_window_len(nint window)

Parameters

window nint

Returns

nuint

pamoja_window_max(nint, out float)

Reads the largest reading in a window, if it has any.

public static bool pamoja_window_max(nint window, out float outValue)

Parameters

window nint
outValue float

Returns

bool

pamoja_window_mean(nint, out float)

Reads the mean of a window's readings, if it has any.

public static bool pamoja_window_mean(nint window, out float outValue)

Parameters

window nint
outValue float

Returns

bool

pamoja_window_min(nint, out float)

Reads the smallest reading in a window, if it has any.

public static bool pamoja_window_min(nint window, out float outValue)

Parameters

window nint
outValue float

Returns

bool

pamoja_window_new()

Creates an empty rolling window.

public static extern nint pamoja_window_new()

Returns

nint

pamoja_window_oldest(nint, out float)

Reads the oldest reading a window still holds, if it has any.

public static bool pamoja_window_oldest(nint window, out float outValue)

Parameters

window nint
outValue float

Returns

bool

pamoja_window_push(nint, float)

Adds a reading to a window, dropping the oldest once full.

public static extern void pamoja_window_push(nint window, float reading)

Parameters

window nint
reading float

pamoja_window_range(nint, out float)

Reads the spread across a window's readings, if it has any.

public static bool pamoja_window_range(nint window, out float outValue)

Parameters

window nint
outValue float

Returns

bool

pamoja_window_variance(nint, out float)

Reads the population variance of a window's readings, if it has any.

public static bool pamoja_window_variance(nint window, out float outValue)

Parameters

window nint
outValue float

Returns

bool

pamoja_window_with_capacity(nuint)

Creates an empty rolling window keeping up to a capacity, or null for one out of range.

public static extern nint pamoja_window_with_capacity(nuint capacity)

Parameters

capacity nuint

Returns

nint