Class LorawanClockSync
The clock synchronization package running on a device, TS003-2.0.0.
public sealed class LorawanClockSync : IDisposable
- Inheritance
-
LorawanClockSync
- Implements
- Inherited Members
Remarks
A device that has no clock of its own still needs the time: a multicast window and a scheduled reboot both depend on it. The device says what time it believes it is, the server answers with the difference, and a four-bit token keeps a late answer from pulling a corrected clock back.
Constructors
LorawanClockSync(bool)
Starts the package.
public LorawanClockSync(bool selfManaged = false)
Parameters
selfManagedboolWhether the device keeps its own periodicity and answers a server that tries to set one with the not-supported bit.
Properties
AnswerDue
Whether the device owes its server an answer.
public bool AnswerDue { get; }
Property Value
PeriodS
The seconds between requests, as the server last set them.
public uint PeriodS { get; }
Property Value
Token
The token the next request will carry.
public byte Token { get; }
Property Value
Methods
Answer(uint)
Writes the answer the device owes, or nothing when it owes none.
public byte[] Answer(uint deviceTime)
Parameters
deviceTimeuintWhat the device believes the time is.
Returns
- byte[]
The payload to send, which is empty when nothing is owed.
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Heard(ReadOnlySpan<byte>)
Reads a downlink on the clock port and acts on it.
public LorawanClockHeard Heard(ReadOnlySpan<byte> payload)
Parameters
payloadReadOnlySpan<byte>What arrived.
Returns
- LorawanClockHeard
What it asked of the device.
Exceptions
- PamojaException
The payload is not a clock synchronization command.
Request(uint, bool)
Builds the request that asks a server for a correction.
public byte[] Request(uint deviceTime, bool ansRequired = false)
Parameters
deviceTimeuintWhat the device believes the time is.
ansRequiredboolWhether the server must answer even when the clock is right.