Class LorawanPackageCommand
One command of an application layer package, whichever package it belongs to.
public sealed class LorawanPackageCommand
- Inheritance
-
LorawanPackageCommand
- Inherited Members
Remarks
Port says which package: clock synchronization TS003-2.0.0, fragmented data block transport TS004-2.0.0, remote multicast setup TS005-2.0.0 or firmware management TS006-1.0.0. Cid names the command within it.
The same identifier means a different command in each direction, so Uplink is always given and never guessed. Only the properties that command carries are set; the rest read as zero.
Fields
MaxLength
The longest command any of the four packages writes, in bytes.
public const int MaxLength = 64
Field Value
Properties
AckReception
Whether a device reports the block once it has it.
public bool AckReception { get; init; }
Property Value
AllParticipants
Whether every device answers a status request.
public bool AllParticipants { get; init; }
Property Value
AnsRequired
Whether a clock request must be answered.
public bool AnsRequired { get; init; }
Property Value
BlockAckDelay
The coded spread of the delay before a device answers.
public byte BlockAckDelay { get; init; }
Property Value
Cid
Which command within that package.
public required byte Cid { get; init; }
Property Value
Data
The bytes a data fragment carries.
public byte[] Data { get; init; }
Property Value
- byte[]
DataRate
The data rate it listens at.
public byte DataRate { get; init; }
Property Value
DeleteVersion
The version a delete command names.
public uint DeleteVersion { get; init; }
Property Value
Descriptor
The four bytes a server describes a block with.
public byte[] Descriptor { get; init; }
Property Value
- byte[]
DeviceTime
A device's own clock, in seconds since the GPS epoch.
public uint DeviceTime { get; init; }
Property Value
DlFrequencyHz
Where a group listens, in hertz.
public uint DlFrequencyHz { get; init; }
Property Value
DrError
Whether the data rate named is not one the device has.
public bool DrError { get; init; }
Property Value
Firmware
The firmware a device reports running.
public uint Firmware { get; init; }
Property Value
FragAlgo
Which fragmentation algorithm to run.
public byte FragAlgo { get; init; }
Property Value
FragIndex
Which fragmentation session, 0 to 3.
public byte FragIndex { get; init; }
Property Value
FragSize
How many bytes each fragment carries.
public byte FragSize { get; init; }
Property Value
FragmentN
Which fragment of a session a data fragment carries, counting from one.
public ushort FragmentN { get; init; }
Property Value
FreqError
Whether the frequency named is not one it can use.
public bool FreqError { get; init; }
Property Value
GroupMask
Which groups a status request or answer covers, a bit for each.
public byte GroupMask { get; init; }
Property Value
Hardware
The hardware it runs on.
public uint Hardware { get; init; }
Property Value
HasNextVersion
Whether a version rides with the image status.
public bool HasNextVersion { get; init; }
Property Value
HasTimeToStart
Whether a delay rides with the answer.
public bool HasTimeToStart { get; init; }
Property Value
IdError
Whether a device holds no group by the identifier named.
public bool IdError { get; init; }
Property Value
ImageStatus
What a device makes of the upgrade image it holds.
public byte ImageStatus { get; init; }
Property Value
InvalidVersion
Whether the version named is not the one held.
public bool InvalidVersion { get; init; }
Property Value
IsStatusItem
Whether this is one group record of a multicast status answer.
public byte IsStatusItem { get; init; }
Property Value
MaxMcFcnt
The last one, which ends the group's life.
public uint MaxMcFcnt { get; init; }
Property Value
McAddr
The address a group answers to.
public uint McAddr { get; init; }
Property Value
McGroupBitMask
Which multicast groups may feed it, a bit for each.
public byte McGroupBitMask { get; init; }
Property Value
McGroupId
Which multicast group, 0 to 3.
public byte McGroupId { get; init; }
Property Value
McKeyEncrypted
A group's key, wrapped under the device's key encryption key.
public byte[] McKeyEncrypted { get; init; }
Property Value
- byte[]
MemoryError
Whether a session ran out of memory to defragment with.
public bool MemoryError { get; init; }
Property Value
Mic
The code over the block a device checks once it has it all.
public byte[] Mic { get; init; }
Property Value
- byte[]
MicError
Whether the block's code did not check out.
public bool MicError { get; init; }
Property Value
MinMcFcnt
The first frame counter a device accepts from a group.
public uint MinMcFcnt { get; init; }
Property Value
Missing
How many uncoded fragments are still missing.
public byte Missing { get; init; }
Property Value
NbFrag
How many uncoded fragments a block was cut into.
public ushort NbFrag { get; init; }
Property Value
NbTotalGroups
How many groups a device holds in all.
public byte NbTotalGroups { get; init; }
Property Value
NextVersion
The version it would run once that image is installed.
public uint NextVersion { get; init; }
Property Value
NoSession
Whether the session or group named does not exist on the device.
public bool NoSession { get; init; }
Property Value
NoValidImage
Whether a device holds no valid image.
public bool NoValidImage { get; init; }
Property Value
NotSupported
Whether a device manages its own clock periodicity.
public bool NotSupported { get; init; }
Property Value
Package
The package identifier a version answer carries.
public byte Package { get; init; }
Property Value
Padding
How many bytes of padding the last fragment carries.
public byte Padding { get; init; }
Property Value
Period
The coded period between clock requests.
public byte Period { get; init; }
Property Value
Periodicity
How often a device opens a ping slot inside a Class B window.
public byte Periodicity { get; init; }
Property Value
Port
Which package this command belongs to, as its port.
public required byte Port { get; init; }
Property Value
Reboot
The moment or the delay a reboot is set for.
public uint Reboot { get; init; }
Property Value
Received
How many fragments arrived, coded, uncoded and repeated.
public ushort Received { get; init; }
Property Value
SessionCnt
The session counter, which must rise for each new block.
public ushort SessionCnt { get; init; }
Property Value
SessionReplay
Whether the session counter repeats one already used.
public bool SessionReplay { get; init; }
Property Value
SessionTime
When a multicast window opens, in seconds since the GPS epoch.
public uint SessionTime { get; init; }
Property Value
StartMissed
Whether the window was to start at a time already past.
public bool StartMissed { get; init; }
Property Value
TimeCorrection
The seconds to add to a device's clock.
public int TimeCorrection { get; init; }
Property Value
TimeOut
How long it lasts at most, coded.
public byte TimeOut { get; init; }
Property Value
TimeToStart
How many seconds until a window opens.
public uint TimeToStart { get; init; }
Property Value
Token
The token that pairs a clock answer with its request.
public byte Token { get; init; }
Property Value
Transmissions
How many requests a resynchronization command asks for.
public byte Transmissions { get; init; }
Property Value
UnsupportedAlgorithm
Whether the setup named an algorithm the device does not run.
public bool UnsupportedAlgorithm { get; init; }
Property Value
UnsupportedIndex
Whether the setup named a session index the device does not keep.
public bool UnsupportedIndex { get; init; }
Property Value
Uplink
Which way it travels.
public bool Uplink { get; init; }
Property Value
Version
The package version it implements.
public byte Version { get; init; }
Property Value
WrongDescriptor
Whether the descriptor is not one the device accepts.
public bool WrongDescriptor { get; init; }
Property Value
Methods
Encode()
Writes this command out.
public byte[] Encode()
Returns
- byte[]
The bytes it goes out as.
Exceptions
- PamojaException
The port names no package, the identifier and direction name no command, or a field will not fit what carries it.
From(PamojaLorawanPackageCommand, ReadOnlySpan<byte>)
Reads a command out of the record the C ABI hands back.
public static LorawanPackageCommand From(PamojaLorawanPackageCommand flat, ReadOnlySpan<byte> data = default)
Parameters
flatPamojaLorawanPackageCommandThe record.
dataReadOnlySpan<byte>The bytes a data fragment carried.
Returns
- LorawanPackageCommand
The command.
Parse(byte, bool, ReadOnlySpan<byte>)
Reads one command of an application layer package.
public static LorawanPackageCommand Parse(byte port, bool uplink, ReadOnlySpan<byte> bytes)
Parameters
portbyteWhich package: one of ClockPort, FragmentPort, MulticastPort or FirmwarePort.
uplinkboolWhether the frame carrying it traveled up.
bytesReadOnlySpan<byte>The message, from this command's identifier on.
Returns
- LorawanPackageCommand
The command that was read.
Remarks
A data fragment takes the whole message, as TS004-2.0.0 asks, and its bytes come back on Data.
Exceptions
- PamojaException
The port names no package, the message ends inside the command, or the identifier is not one the package defines.
ParseAll(byte, bool, ReadOnlySpan<byte>)
Reads every command in one message.
public static IReadOnlyList<LorawanPackageCommand> ParseAll(byte port, bool uplink, ReadOnlySpan<byte> bytes)
Parameters
portbyteWhich package.
uplinkboolWhether the frame carrying them traveled up.
bytesReadOnlySpan<byte>The message.
Returns
- IReadOnlyList<LorawanPackageCommand>
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
The port names no package.
StatusItem(ReadOnlySpan<byte>)
Reads one group record of a multicast status answer.
public static LorawanPackageCommand StatusItem(ReadOnlySpan<byte> bytes)
Parameters
bytesReadOnlySpan<byte>The message, from the record on.
Returns
- LorawanPackageCommand
The record.
Remarks
The answer says how many groups follow; each is five bytes and carries no identifier of its own, so they are read one at a time rather than by ParseAll(byte, bool, ReadOnlySpan<byte>).
Exceptions
- PamojaException
The message ends inside the record.
ToNative()
Renders this command as the record the C ABI takes.
public PamojaLorawanPackageCommand ToNative()
Returns
- PamojaLorawanPackageCommand
The record.