Class RadioDutyCycle
Holds a radio silent for the off time a duty-cycle limit owes after each frame.
public sealed class RadioDutyCycle : IDisposable
- Inheritance
-
RadioDutyCycle
- Implements
- Inherited Members
Remarks
A regional plan limits the share of time a transmitter may hold a sub-band, so every frame buys a stretch of silence in proportion to its airtime. The guard keeps its times on the caller's clock, in microseconds, so it runs the same on a gateway and in a test that steps time by hand.
Constructors
RadioDutyCycle(uint)
Creates a guard, ready to transmit at once.
public RadioDutyCycle(uint permille)
Parameters
permilleuintThe limit in parts per thousand, so
10is 1%;0forbids transmitting and1000or more imposes no silence.
Exceptions
- PamojaException
The native guard could not be created.
Properties
EarliestMicros
The earliest time the next transmission may start, in microseconds on the caller's
clock, or null when the limit forbids transmitting.
public ulong? EarliestMicros { get; }
Property Value
Permille
The limit in parts per thousand.
public uint Permille { get; }
Property Value
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Ready(ulong)
Reports whether a transmission may start now.
public bool Ready(ulong nowMicros)
Parameters
nowMicrosulongThe current time on the caller's clock.
Returns
- bool
trueonce the silence the last transmission owed has passed.
Transmitted(ulong, LoraLink, int)
Records a transmission and the silence it owes.
public ulong Transmitted(ulong startedMicros, LoraLink link, int payloadLength)
Parameters
startedMicrosulongWhen the transmission started, on the caller's clock.
linkLoraLinkThe settings the frame was sent with.
payloadLengthintThe payload length in bytes.
Returns
- ulong
The frame's time on air, in microseconds.
Exceptions
- ArgumentOutOfRangeException
payloadLengthis negative.
WaitMicros(ulong)
Returns how long the radio must still stay silent.
public ulong? WaitMicros(ulong nowMicros)
Parameters
nowMicrosulongThe current time on the caller's clock.
Returns
- ulong?
The remaining silence in microseconds, zero when a transmission may start, or
nullwhen the limit forbids transmitting.