Class LorawanMacCommand
One of the commands a network and a device configure each other with.
public sealed class LorawanMacCommand
- Inheritance
-
LorawanMacCommand
- Inherited Members
Remarks
A frame carries these either in its options field, at most fifteen bytes of them, or as a whole payload on port 0.
Cid names the command and Direction says which way it travels; together they decide which of the other properties carry anything. The same identifier means a different command in each direction, so the direction is always given and never guessed.
Fields
MaxLength
The longest command, in bytes: a relay's UpdateUplinkListReq.
public const int MaxLength = 27
Field Value
Properties
Action
What a join filter rule does, or whether a trusted end device is read or removed.
public byte Action { get; init; }
Property Value
ActionAck
Whether its action was valid.
public bool ActionAck { get; init; }
Property Value
BackOff
How many WOR frames without an acknowledgment before an uplink goes anyway.
public byte BackOff { get; init; }
Property Value
Battery
A device battery level: 0 on external power, 255 when it cannot tell.
public byte Battery { get; init; }
Property Value
BucketSize
Its bucket size multiplier, as TS011-1.0.1 table 55 codes it.
public byte BucketSize { get; init; }
Property Value
CadPeriodicity
How often a relay scans, as TS011-1.0.1 table 18 codes it.
public byte CadPeriodicity { get; init; }
Property Value
CadPeriodicityAck
Whether the scan period was valid.
public bool CadPeriodicityAck { get; init; }
Property Value
ChannelAck
Whether the frequency was usable.
public bool ChannelAck { get; init; }
Property Value
ChannelMask
Which channels may carry an uplink.
public ushort ChannelMask { get; init; }
Property Value
ChannelMaskAck
Whether the channel mask was usable.
public bool ChannelMaskAck { get; init; }
Property Value
Cid
The identifier this command travels under.
public required byte Cid { get; init; }
Property Value
CombinedRulesAck
Whether a join filter rule was one to create, change or remove.
public bool CombinedRulesAck { get; init; }
Property Value
DataRate
The data rate a network asks a device to use.
public byte DataRate { get; init; }
Property Value
DataRateAck
Whether the data rate was set.
public bool DataRateAck { get; init; }
Property Value
DataRateRangeOk
Whether the device can run that range of rates.
public bool DataRateRangeOk { get; init; }
Property Value
DefaultChannelIndex
Which of the region's relay channels is a relay's default one.
public byte DefaultChannelIndex { get; init; }
Property Value
DefaultChannelIndexAck
Whether the default channel was valid.
public bool DefaultChannelIndexAck { get; init; }
Property Value
Delay
How long a device waits before its first receive window, as coded.
public byte Delay { get; init; }
Property Value
DevAddr
An end device address a relay command names.
public uint DevAddr { get; init; }
Property Value
Direction
Which way it travels.
public required LorawanDirection Direction { get; init; }
Property Value
DownlinkDwell
Whether a downlink is.
public bool DownlinkDwell { get; init; }
Property Value
Enabled
Whether a relay runs.
public bool Enabled { get; init; }
Property Value
Eui
Those bytes, most significant first, with the rest zero.
public byte[] Eui { get; init; }
Property Value
- byte[]
EuiLen
How many leading bytes of JoinEUI and DevEUI a join filter rule matches.
public byte EuiLen { get; init; }
Property Value
EuiLenAck
Whether its length was valid.
public bool EuiLenAck { get; init; }
Property Value
Fraction
The fraction of that second, in steps of one part in 256.
public byte Fraction { get; init; }
Property Value
FrequencyHz
A frequency in hertz, for the windows and the channel commands.
public uint FrequencyHz { get; init; }
Property Value
FrequencyOk
Whether its radio can reach that frequency.
public bool FrequencyOk { get; init; }
Property Value
Gateways
How many gateways heard it.
public byte Gateways { get; init; }
Property Value
GlobalUplinkBucketSize
The global uplink bucket size multiplier.
public byte GlobalUplinkBucketSize { get; init; }
Property Value
GlobalUplinkReloadRate
Uplinks a relay forwards an hour across every trusted end device.
public byte GlobalUplinkReloadRate { get; init; }
Property Value
Index
Which channel a channel command names.
public byte Index { get; init; }
Property Value
IndexAck
Whether a trusted list entry was in use.
public bool IndexAck { get; init; }
Property Value
JoinRequestBucketSize
The join request bucket size multiplier.
public byte JoinRequestBucketSize { get; init; }
Property Value
JoinRequestReloadRate
Join requests a relay forwards an hour, 127 for no limit.
public byte JoinRequestReloadRate { get; init; }
Property Value
Margin
How far above the floor a link check arrived, in dB.
public byte Margin { get; init; }
Property Value
MaskControl
Which block of sixteen channels that mask applies to.
public byte MaskControl { get; init; }
Property Value
MaxDataRate
The fastest rate allowed on it.
public byte MaxDataRate { get; init; }
Property Value
MaxDutyCycle
The share of the air a device is held to, as one over two to this.
public byte MaxDutyCycle { get; init; }
Property Value
MaxEirp
The coded transmit power ceiling a region imposes.
public byte MaxEirp { get; init; }
Property Value
MinDataRate
The slowest rate allowed on it.
public byte MinDataRate { get; init; }
Property Value
NotifyBucketSize
The notification bucket size multiplier.
public byte NotifyBucketSize { get; init; }
Property Value
NotifyReloadRate
New end device notifications a relay sends an hour.
public byte NotifyReloadRate { get; init; }
Property Value
OverallBucketSize
The overall bucket size multiplier.
public byte OverallBucketSize { get; init; }
Property Value
OverallReloadRate
Every message a relay sends an hour.
public byte OverallReloadRate { get; init; }
Property Value
PowerAck
Whether the power was set.
public bool PowerAck { get; init; }
Property Value
RelayMode
How an end device uses a relay, as TS011-1.0.1 table 40 codes it.
public byte RelayMode { get; init; }
Property Value
ReloadRate
Tokens a trusted end device earns an hour, 63 for no limit.
public byte ReloadRate { get; init; }
Property Value
ResetLimitCounters
What a forwarding limit command does to a relay's token counters, as table 63 codes it.
public byte ResetLimitCounters { get; init; }
Property Value
RootWorSKey
An end device's root relay session key.
public byte[] RootWorSKey { get; init; }
Property Value
- byte[]
RssiDbm
The signal strength of a WOR frame a relay could not verify, in dBm.
public short RssiDbm { get; init; }
Property Value
Rx1Offset
How far the first receive window sits below the uplink rate.
public byte Rx1Offset { get; init; }
Property Value
Rx1OffsetAck
Whether the window offset was in range.
public bool Rx1OffsetAck { get; init; }
Property Value
Rx2DataRate
The rate of the second receive window.
public byte Rx2DataRate { get; init; }
Property Value
Rx2DataRateAck
Whether the window rate was known.
public bool Rx2DataRateAck { get; init; }
Property Value
SecondChannelAckOffset
How far above its frequency the second channel is acknowledged, as table 35 codes it.
public byte SecondChannelAckOffset { get; init; }
Property Value
SecondChannelAckOffsetAck
Whether its acknowledgment offset was valid.
public bool SecondChannelAckOffsetAck { get; init; }
Property Value
SecondChannelDataRate
The second channel's data rate; its frequency is the frequency field.
public byte SecondChannelDataRate { get; init; }
Property Value
SecondChannelDataRateAck
Whether the second channel's data rate was valid.
public bool SecondChannelDataRateAck { get; init; }
Property Value
SecondChannelFrequencyAck
Whether its frequency was valid.
public bool SecondChannelFrequencyAck { get; init; }
Property Value
SecondChannelIndex
Whether a relay configuration sets a second channel, 1 for yes.
public byte SecondChannelIndex { get; init; }
Property Value
SecondChannelIndexAck
Whether the second channel index was valid.
public bool SecondChannelIndexAck { get; init; }
Property Value
Seconds
Seconds since the GPS epoch.
public uint Seconds { get; init; }
Property Value
SmartEnableLevel
How many unanswered uplinks turn relaying on, as table 41 codes it.
public byte SmartEnableLevel { get; init; }
Property Value
SnrDb
Its signal-to-noise ratio, in dB.
public sbyte SnrDb { get; init; }
Property Value
SnrMargin
The signal-to-noise ratio of the last request, in dB.
public sbyte SnrMargin { get; init; }
Property Value
Transmissions
How many times to send an unconfirmed uplink.
public byte Transmissions { get; init; }
Property Value
TxPower
The transmit power it may use, as a ceiling.
public byte TxPower { get; init; }
Property Value
UplinkDwell
Whether an uplink is held to 400 ms of air time.
public bool UplinkDwell { get; init; }
Property Value
UplinkFrequencyExists
Whether the channel already had an uplink frequency to pair with.
public bool UplinkFrequencyExists { get; init; }
Property Value
Wfcnt
A wake-on-radio frame counter.
public uint Wfcnt { get; init; }
Property Value
Methods
Encode()
Writes this command out.
public byte[] Encode()
Returns
- byte[]
The bytes it goes out as.
Exceptions
- PamojaException
If the identifier and direction name no command, or a field will not fit what carries it.
From(PamojaLorawanMacCommand)
Reads a command out of the record the C ABI hands back.
public static LorawanMacCommand From(PamojaLorawanMacCommand flat)
Parameters
flatPamojaLorawanMacCommandThe record.
Returns
- LorawanMacCommand
The command.
Parse(LorawanDirection, ReadOnlySpan<byte>)
Reads the commands packed into a field.
public static IReadOnlyList<LorawanMacCommand> Parse(LorawanDirection direction, ReadOnlySpan<byte> bytes)
Parameters
directionLorawanDirectionWhich way the frame carrying them travels.
bytesReadOnlySpan<byte>The options field, or a payload sent on port 0.
Returns
- IReadOnlyList<LorawanMacCommand>
The commands that were readable, in order.
Remarks
A command does not carry its own length, so one this build does not know cannot be stepped over. Reading stops there and returns what came before it.
Exceptions
- PamojaException
If the field cannot be read at all.
- ArgumentOutOfRangeException
directionis not one of the LorawanDirection values.
ToNative()
Renders this command as the record the C ABI takes.
public PamojaLorawanMacCommand ToNative()
Returns
- PamojaLorawanMacCommand
The record.
Exceptions
- ArgumentOutOfRangeException
Direction is not one of the LorawanDirection values.