Table of Contents

Class LoraLink

Namespace
Pamoja.Lora
Assembly
Pamoja.Lora.dll

The radio settings of a LoRa link, and what they cost in airtime.

public sealed class LoraLink
Inheritance
LoraLink
Inherited Members

LoRa buys kilometres of range on license-free bands at tiny power, and the price is time: a transmission occupies the channel for a duration these settings fix, and the regional rules cap how much of the time a node may transmit. Values outside the ranges LoRa defines are clamped when used.

Constructors

Creates link settings with the LoRa defaults filled in.

public LoraLink(byte spreadingFactor, uint bandwidthHz)

Parameters

spreadingFactor byte

The spreading factor, clamped to 5 (fastest) to 12 (longest range).

bandwidthHz uint

The channel bandwidth in hertz, such as 125000.

Properties

The channel bandwidth in hertz.

public uint BandwidthHz { get; }

Property Value

uint

The coding-rate denominator, 5 to 8, for 4/5 to 4/8.

public byte CodingRateDenominator { get; }

Property Value

byte

Whether the frame carries a CRC.

public bool Crc { get; }

Property Value

bool

Whether the frame carries an explicit header.

public bool ExplicitHeader { get; }

Property Value

bool

The preamble length in symbols.

public ushort PreambleSymbols { get; }

Property Value

ushort

The spreading factor, 5 (fastest) to 12 (longest range).

public byte SpreadingFactor { get; }

Property Value

byte

The duration of one symbol on this link, in microseconds.

public ulong SymbolTimeMicros { get; }

Property Value

ulong

Methods

Returns the time on air of a payload, in microseconds.

public ulong AirtimeMicros(int payloadLength)

Parameters

payloadLength int

The payload length in bytes.

Returns

ulong

The channel occupancy the transmission costs, which sets both the duty-cycle budget and most of the energy it spends.

Returns how many transmissions of a payload fit in an hour.

public ulong MessagesPerHour(int payloadLength, uint dutyCyclePermille)

Parameters

payloadLength int

The payload length in bytes.

dutyCyclePermille uint

The limit in parts per thousand, so 10 is 1%.

Returns

ulong

The number of whole transmissions per hour, or 0 when the limit forbids transmitting. The airtime plus the silence it forces is what one transmission really costs, so this is the budget a deployment plans against.

Returns the silence a duty-cycle limit forces after a transmission.

public ulong? MinOffTimeMicros(int payloadLength, uint dutyCyclePermille)

Parameters

payloadLength int

The payload length in bytes.

dutyCyclePermille uint

The limit in parts per thousand, so 10 is 1%.

Returns

ulong?

The required off time in microseconds, or null when the limit is zero, which forbids transmitting at all.

Returns the same link at a different coding rate.

public LoraLink WithCodingRate(byte denominator)

Parameters

denominator byte

The denominator, clamped to 5 to 8.

Returns

LoraLink

The adjusted settings.

Returns the same link with an implicit header, saving its symbols.

public LoraLink WithImplicitHeader()

Returns

LoraLink

The adjusted settings.

Returns the same link with a different preamble length.

public LoraLink WithPreamble(ushort symbols)

Parameters

symbols ushort

The preamble length in symbols.

Returns

LoraLink

The adjusted settings.

Returns the same link with the frame CRC turned off.

public LoraLink WithoutCrc()

Returns

LoraLink

The adjusted settings.