Class LoraLink
The radio settings of a LoRa link, and what they cost in airtime.
public sealed class LoraLink
- Inheritance
-
LoraLink
- Inherited Members
Remarks
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
LoraLink(byte, uint)
Creates link settings with the LoRa defaults filled in.
public LoraLink(byte spreadingFactor, uint bandwidthHz)
Parameters
spreadingFactorbyteThe spreading factor, clamped to 5 (fastest) to 12 (longest range).
bandwidthHzuintThe channel bandwidth in hertz, such as 125000.
Properties
BandwidthHz
The channel bandwidth in hertz.
public uint BandwidthHz { get; }
Property Value
CodingRateDenominator
The coding-rate denominator, 5 to 8, for 4/5 to 4/8.
public byte CodingRateDenominator { get; }
Property Value
Crc
Whether the frame carries a CRC.
public bool Crc { get; }
Property Value
ExplicitHeader
Whether the frame carries an explicit header.
public bool ExplicitHeader { get; }
Property Value
PreambleSymbols
The preamble length in symbols.
public ushort PreambleSymbols { get; }
Property Value
SpreadingFactor
The spreading factor, 5 (fastest) to 12 (longest range).
public byte SpreadingFactor { get; }
Property Value
SymbolTimeMicros
The duration of one symbol on this link, in microseconds.
public ulong SymbolTimeMicros { get; }
Property Value
Methods
AirtimeMicros(int)
Returns the time on air of a payload, in microseconds.
public ulong AirtimeMicros(int payloadLength)
Parameters
payloadLengthintThe 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.
MessagesPerHour(int, uint)
Returns how many transmissions of a payload fit in an hour.
public ulong MessagesPerHour(int payloadLength, uint dutyCyclePermille)
Parameters
payloadLengthintThe payload length in bytes.
dutyCyclePermilleuintThe 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.
MinOffTimeMicros(int, uint)
Returns the silence a duty-cycle limit forces after a transmission.
public ulong? MinOffTimeMicros(int payloadLength, uint dutyCyclePermille)
Parameters
payloadLengthintThe payload length in bytes.
dutyCyclePermilleuintThe limit in parts per thousand, so 10 is 1%.
Returns
- ulong?
The required off time in microseconds, or
nullwhen the limit is zero, which forbids transmitting at all.
WithCodingRate(byte)
Returns the same link at a different coding rate.
public LoraLink WithCodingRate(byte denominator)
Parameters
denominatorbyteThe denominator, clamped to 5 to 8.
Returns
- LoraLink
The adjusted settings.
WithImplicitHeader()
Returns the same link with an implicit header, saving its symbols.
public LoraLink WithImplicitHeader()
Returns
- LoraLink
The adjusted settings.
WithPreamble(ushort)
Returns the same link with a different preamble length.
public LoraLink WithPreamble(ushort symbols)
Parameters
symbolsushortThe preamble length in symbols.
Returns
- LoraLink
The adjusted settings.
WithoutCrc()
Returns the same link with the frame CRC turned off.
public LoraLink WithoutCrc()
Returns
- LoraLink
The adjusted settings.