Class LorawanGrant
What a network grants a device that joined.
public sealed class LorawanGrant
- Inheritance
-
LorawanGrant
- Inherited Members
Remarks
Build one, then Accept(ReadOnlySpan<byte>, ushort) it into the frame to transmit and take the matching Session(ReadOnlySpan<byte>, ushort) to secure traffic with. Both sides derive the same keys from the same nonces, so neither ever sends one.
Constructors
LorawanGrant(uint, uint, uint, LorawanCfList, byte, byte)
Creates a grant of an address, the settings to answer on, and a channel list.
public LorawanGrant(uint appNonce, uint netId, uint devAddr, LorawanCfList cflist, byte dlSettings = 0, byte rxDelay = 0)
Parameters
appNonceuintA nonce this network must not reuse for the device; low 24 bits only.
netIduintThe network identifier; low 24 bits only.
devAddruintThe address to assign the device.
cflistLorawanCfListThe channel list the accept carries.
dlSettingsbyteThe downlink settings byte.
rxDelaybyteThe delay before the first receive window, in seconds.
LorawanGrant(uint, uint, uint, byte, byte, byte[]?)
Creates a grant of an address and the settings to answer on.
public LorawanGrant(uint appNonce, uint netId, uint devAddr, byte dlSettings = 0, byte rxDelay = 0, byte[]? cflist = null)
Parameters
appNonceuintA nonce this network must not reuse for the device, since the session keys are derived from it; low 24 bits only.
netIduintThe network identifier; low 24 bits only.
devAddruintThe address to assign the device.
dlSettingsbyteThe downlink settings byte.
rxDelaybyteThe delay before the first receive window, in seconds.
cflistbyte[]The optional 16-byte channel list.
Properties
DevAddr
The address this grant assigns.
public uint DevAddr { get; }
Property Value
NetId
The network identifier this grant carries.
public uint NetId { get; }
Property Value
Methods
Accept(ReadOnlySpan<byte>, ushort)
Builds the signed join-accept to transmit.
public byte[] Accept(ReadOnlySpan<byte> appKey, ushort devNonce)
Parameters
appKeyReadOnlySpan<byte>The 16-byte application root key the device shares.
devNonceushortThe nonce the matching join-request carried.
Returns
- byte[]
The join-accept, encrypted and with its MIC in place.
Exceptions
- PamojaException
The key or the channel list is the wrong length.
Session(ReadOnlySpan<byte>, ushort)
Derives the session this grant activates.
public LorawanSession Session(ReadOnlySpan<byte> appKey, ushort devNonce)
Parameters
appKeyReadOnlySpan<byte>The 16-byte application root key the device shares.
devNonceushortThe nonce the matching join-request carried.
Returns
- LorawanSession
The session to secure this device's traffic with, which is the same one the device computes without either side sending a key.
Exceptions
- PamojaException
The key or the channel list is the wrong length.