Categorygithub.com/liuhw0/lorawan
modulepackage
0.0.0-20221122014549-f7b7a7987b0a
Repository: https://github.com/liuhw0/lorawan.git
Documentation: pkg.go.dev

# README

LoRaWAN (Go)

Tests GoDoc

Package lorawan provides structures and tools to read and write LoRaWAN 1.0 and 1.1 frames from and to a slice of bytes.

The following structures are implemented (+ fields):

PHYPayload    (MHDR | MACPayload | MIC)
MACPayload    (FHDR | FPort | FRMPayload)
FHDR          (DevAddr | FCtrl | FCnt | FOpts)

The Following message types (MType) are implemented:

  • JoinRequest
  • RejoinRequest
  • JoinAccept
  • UnconfirmedDataUp
  • UnconfirmedDataDown
  • ConfirmedDataUp
  • ConfirmedDataDown
  • Proprietary

The following MAC commands (and their optional payloads) are implemented:

  • ResetInd
  • ResetConf
  • LinkCheckReq
  • LinkCheckAns
  • LinkADRReq
  • LinkADRAns
  • DutyCycleReq
  • DutyCycleAns
  • RXParamSetupReq
  • RXParamSetupAns
  • DevStatusReq
  • DevStatusAns
  • NewChannelReq
  • NewChannelAns
  • RXTimingSetupReq
  • RXTimingSetupAns
  • TXParamSetupReq
  • TXParamSetupAns
  • DLChannelReq
  • DLChannelAns
  • RekeyInd
  • RekeyConf
  • ADRParamSetupReq
  • ADRParamSetupAns
  • DeviceTimeReq
  • DeviceTimeAns
  • ForceRejoinReq
  • RejoinParamSetupReq
  • RejoinParamSetupAns
  • PingSlotInfoReq
  • PingSlotInfoAns
  • PingSlotChannelReq
  • PingSlotChannelAns
  • BeaconFreqReq
  • BeaconFreqAns
  • DeviceModeInd
  • DeviceModeConf
  • Proprietary commands (0x80 - 0xFF) can be registered with RegisterProprietaryMACCommand

Sub-packages

  • airtime functions for calculating TX time-on-air
  • band ISM band configuration from the LoRaWAN Regional Parameters specification
  • backend Structs matching the LoRaWAN Backend Interface specification object
  • backend/joinserver LoRaWAN Backend Interface join-server interface implementation (http.Handler)
  • applayer/clocksync Application Layer Clock Synchronization over LoRaWAN
  • applayer/multicastsetup Application Layer Remote Multicast Setup over LoRaWAN
  • applayer/fragmentation Fragmented Data Block Transport over LoRaWAN
  • gps functions to handle Time <> GPS Epoch time conversion

Documentation

See https://godoc.org/github.com/brocaar/lorawan. There is also an examples section with usage examples. When using this package, knowledge about the LoRaWAN specification is needed. You can download the LoRaWAN specification here: https://lora-alliance.org/lorawan-for-developers

Support

For questions, feedback or support, please refer to the ChirpStack Community Forum: https://forum.chirpstack.io.

License

This package is distributed under the MIT license which can be found in LICENSE. LoRaWAN is a trademark of the LoRa Alliance Inc. (https://www.lora-alliance.org/).

# Packages

Package airtime provides a function for calculating the time on air.
No description provided by the author
Package backend provides the LoRaWAN backend interfaces structs.
Package band provides band specific defaults and configuration for downlink communication with end-devices.
Package gps provides functions to handle Time <> GPS Epoch time conversion.
Package sensitivity provides functions for calculating the LoRa sensitivity.

# Functions

EncryptFOpts encrypts the FOpts mac-commands.
EncryptFRMPayload encrypts the FRMPayload (slice of bytes).
GetMACPayloadAndSize returns a new MACCommandPayload instance and it's size.
GetTXParamsetupEIRP returns the EIRP (dBm) for the coded value.
GetTXParamSetupEIRPIndex returns the coded value for the given EIRP (dBm).
RegisterProprietaryMACCommand registers a proprietary MAC command.

# Constants

MAC commands as specified by the LoRaWAN R1.0 specs.
MAC commands as specified by the LoRaWAN R1.0 specs.
MAC commands as specified by the LoRaWAN R1.0 specs.
0x12 has been deprecated in 1.1.
Possible CFList types.
Possible CFList types.
Supported message types (MType).
Supported message types (MType).
DeviceModeInd class options.
DeviceModeInd class options.
MAC commands as specified by the LoRaWAN R1.0 specs.
Class-C.
DeviceModeInd class options.
MAC commands as specified by the LoRaWAN R1.0 specs.
MAC commands as specified by the LoRaWAN R1.0 specs.
MAC commands as specified by the LoRaWAN R1.0 specs.
MAC commands as specified by the LoRaWAN R1.0 specs.
MAC commands as specified by the LoRaWAN R1.0 specs.
MAC commands as specified by the LoRaWAN R1.0 specs.
MAC commands as specified by the LoRaWAN R1.0 specs.
MAC commands as specified by the LoRaWAN R1.0 specs.
Possible dwell time options.
Possible dwell time options.
MAC commands as specified by the LoRaWAN R1.0 specs.
Supported message types (MType).
Supported message types (MType).
Join-request types.
MAC commands as specified by the LoRaWAN R1.0 specs.
MAC commands as specified by the LoRaWAN R1.0 specs.
MAC commands as specified by the LoRaWAN R1.0 specs.
MAC commands as specified by the LoRaWAN R1.0 specs.
Supported LoRaWAN MAC versions.
Supported LoRaWAN MAC versions.
Supported major versions.
MAC commands as specified by the LoRaWAN R1.0 specs.
MAC commands as specified by the LoRaWAN R1.0 specs.
MAC commands as specified by the LoRaWAN R1.0 specs.
MAC commands as specified by the LoRaWAN R1.0 specs.
MAC commands as specified by the LoRaWAN R1.0 specs.
Class-B.
Supported message types (MType).
MAC commands as specified by the LoRaWAN R1.0 specs.
MAC commands as specified by the LoRaWAN R1.0 specs.
Supported message types (MType).
Join-request types.
Join-request types.
Join-request types.
MAC commands as specified by the LoRaWAN R1.0 specs.
MAC commands as specified by the LoRaWAN R1.0 specs.
MAC commands as specified by the LoRaWAN R1.0 specs.
Class-A.
MAC commands as specified by the LoRaWAN R1.0 specs.
MAC commands as specified by the LoRaWAN R1.0 specs.
MAC commands as specified by the LoRaWAN R1.0 specs.
MAC commands as specified by the LoRaWAN R1.0 specs.
MAC commands as specified by the LoRaWAN R1.0 specs.
MAC commands as specified by the LoRaWAN R1.0 specs.
Supported message types (MType).
Supported message types (MType).

# Structs

ADRParam defines the ADRParam field.
ADRParamSetupReqPayload represents the ADRParamReq payload.
BeaconFreqAnsPayload represents the BeaconFreqAns payload.
BeaconFreqReqPayload represents the BeaconFreqReq payload.
CFList represents a list of channel frequencies or channel-masks.
CFListChannelMaskPayload holds a list of channel-masks.
CFListChannelPayload holds a list of (up to 5) channel frequencies.
DataPayload represents a slice of bytes.
DeviceModeConfPayload represents the DeviceModeConf payload.
DeviceModeIndPayload represents the DeviceModeInd payload.
DeviceTimeAnsPayload represents the DeviceTimeAns payload.
DevStatusAnsPayload represents the DevStatusAns payload.
DLChannelAnsPayload represents the DLChannelAns payload.
DLChannelReqPayload represents the DLChannelReq payload.
DLSettings represents the DLSettings fields (downlink settings).
DutyCycleReqPayload represents the DutyCycleReq payload.
FCtrl represents the FCtrl (frame control) field.
FHDR represents the frame header.
ForceRejoinReqPayload represents the ForceRejoinReq payload.
JoinAcceptPayload represents the join-accept message payload.
JoinRequestPayload represents the join-request message payload.
LinkADRAnsPayload represents the LinkADRAns payload.
LinkADRReqPayload represents the LinkADRReq payload.
LinkCheckAnsPayload represents the LinkCheckAns payload.
MACCommand represents a MAC command with optional payload.
MACPayload represents the MAC payload.
MHDR represents the MAC header.
NewChannelAnsPayload represents the NewChannelAns payload.
NewChannelReqPayload represents the NewChannelReq payload.
PHYPayload represents the physical payload.
PingSlotChannelAnsPayload represents the PingSlotChannelAns payload.
PingSlotChannelReqPayload represents the PingSlotChannelReq payload.
PingSlotInfoReqPayload represents the PingSlotInfoReq payload.
ProprietaryMACCommandPayload represents a proprietary payload.
Redundancy represents the redundancy field.
RejoinParamSetupAnsPayload represents the RejoinParamSetupAns payload.
RejoinParamSetupReqPayload represents the RejoinParamSetupReq payload.
RejoinRequestType02Payload represents a rejoin-request of type 0 or 2.
RejoinRequestType1Payload represents a rejoin-request of type 1.
RekeyConfPayload represents the RekeyConf payload.
RekeyIndPayload represents the RekeyInd payload.
ResetConfPayload represents the ResetConf payload.
ResetIndPayload represents the ResetInd payload.
RXParamSetupAnsPayload represents the RXParamSetupAns payload.
RXParamSetupReqPayload represents the RXParamSetupReq payload.
RXTimingSetupReqPayload represents the RXTimingSetupReq payload.
TXParamSetupReqPayload represents the TXParamSetupReq payload.
Version defines LoRaWAN version field.

# Interfaces

MACCommandPayload is the interface that every MACCommand payload must implement.
Payload is the interface that every payload needs to implement.

# Type aliases

AES128Key represents a 128 bit AES key.
CFListType defines the CFList payload type.
ChMask encodes the channels usable for uplink access.
CID defines the MAC command identifier.
DevAddr represents the device address.
DeviceModeIndClass defines the DeviceModeInd class.
DevNonce represents the dev-nonce.
DwellTime defines the dwell time type.
EUI64 data type.
JoinNonce represents the join-nonce.
JoinType defines the join-request type.
MACVersion defines the LoRaWAN MAC version.
Major defines the major version of data message.
MIC represents the message integrity code.
MType represents the message type.
NetID represents the NetID.