Table of Contents

Class RadioDutyCycle

Namespace
Pamoja.Radios
Assembly
Pamoja.Radios.dll

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

permille uint

The limit in parts per thousand, so 10 is 1%; 0 forbids transmitting and 1000 or 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

ulong?

Permille

The limit in parts per thousand.

public uint Permille { get; }

Property Value

uint

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

nowMicros ulong

The current time on the caller's clock.

Returns

bool

true once the silence the last transmission owed has passed.

Records a transmission and the silence it owes.

public ulong Transmitted(ulong startedMicros, LoraLink link, int payloadLength)

Parameters

startedMicros ulong

When the transmission started, on the caller's clock.

link LoraLink

The settings the frame was sent with.

payloadLength int

The payload length in bytes.

Returns

ulong

The frame's time on air, in microseconds.

Exceptions

ArgumentOutOfRangeException

payloadLength is negative.

WaitMicros(ulong)

Returns how long the radio must still stay silent.

public ulong? WaitMicros(ulong nowMicros)

Parameters

nowMicros ulong

The current time on the caller's clock.

Returns

ulong?

The remaining silence in microseconds, zero when a transmission may start, or null when the limit forbids transmitting.