lorawan: github.com/brocaar/lorawan Index | Examples | Files | Directories

package lorawan

import "github.com/brocaar/lorawan"

Package lorawan provides structures and tools to read and write LoraWAN messages 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
* JoinAccept
* UnconfirmedDataUp
* UnconfirmedDataDown
* ConfirmedDataUp
* ConfirmedDataDown
* Proprietary

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

* LinkCheckReq
* LinkCheckAns
* LinkADRReq
* LinkADRAns
* DutyCycleReq
* DutyCycleAns
* RXParamSetupReq
* RXParamSetupAns
* DevStatusReq
* DevStatusAns
* NewChannelReq
* NewChannelAns
* RXTimingSetupReq
* RXTimingSetupAns
* Proprietary commands (0x80 - 0xFF) can be registered with RegisterProprietaryMACCommand

Support for calculating and setting the MIC is done by calling SetMIC():

err := phyPayload.SetMIC(key)

Validating the MIC is done by calling ValidateMIC():

valid, err := phyPayload.ValidateMIC(key)

Encryption and decryption of the MACPayload (for join-accept) is done by calling EncryptJoinAcceptPayload() and DecryptJoinAcceptPayload(). Note that you need to call SetMIC BEFORE encryption.

err := phyPayload.EncryptJoinAcceptPayload(key)
err := phyPayload.DecryptJoinAcceptPayload(key)

Encryption and decryption of the FRMPayload is done by calling EncryptFRMPayload() and DecryptFRMPayload(). After encryption (and thus before decryption), the bytes are stored in the DataPayload struct.

err := phyPayload.EncryptFRMPayload(key)
err := phyPayload.DecryptFRMPayload(key)

All payloads implement the Payload interface. Based on the MIC value, you should be able to know to which type to cast the Payload value, so you will be able to access its fields.

See the examples section of the documentation for concrete usage examples of this package.

When using this package, knowledge about the LoRaWAN specification is needed. You can download the LoRaWAN specification here: https://www.lora-alliance.org/For-Developers/LoRaWANDevelopers

Index

Examples

Package Files

cid_string.go doc.go fhdr.go jointype_string.go mac_commands.go macpayload.go major_string.go mtype_string.go netid.go payload.go phypayload.go

func EncryptFOpts Uses

func EncryptFOpts(nwkSEncKey AES128Key, aFCntDown, uplink bool, devAddr DevAddr, fCnt uint32, data []byte) ([]byte, error)

EncryptFOpts encrypts the FOpts mac-commands. For uplink:

Set the aFCntDown to false and use the FCntUp

For downlink if FPort is not set or equals to 0:

Set the aFCntDown to false and use the NFCntDown

For downlink if FPort > 0:

Set the aFCntDown to true and use the AFCntDown

func EncryptFRMPayload Uses

func EncryptFRMPayload(key AES128Key, uplink bool, devAddr DevAddr, fCnt uint32, data []byte) ([]byte, error)

EncryptFRMPayload encrypts the FRMPayload (slice of bytes). Note that EncryptFRMPayload is used for both encryption and decryption.

func RegisterProprietaryMACCommand Uses

func RegisterProprietaryMACCommand(uplink bool, cid CID, payloadSize int) error

RegisterProprietaryMACCommand registers a proprietary MAC command. Note that there is no need to call this when the size of the payload is > 0 bytes.

type ADRParam Uses

type ADRParam struct {
    LimitExp uint8 `json:"limitExp"`
    DelayExp uint8 `json:"delayExp"`
}

ADRParam defines the ADRParam field.

func (ADRParam) MarshalBinary Uses

func (p ADRParam) MarshalBinary() ([]byte, error)

MarshalBinary encodes the object into bytes.

func (*ADRParam) UnmarshalBinary Uses

func (p *ADRParam) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the object from bytes.

type ADRParamSetupReqPayload Uses

type ADRParamSetupReqPayload struct {
    ADRParam ADRParam `josn:"adrParam"`
}

ADRParamSetupReqPayload represents the ADRParamReq payload.

func (ADRParamSetupReqPayload) MarshalBinary Uses

func (p ADRParamSetupReqPayload) MarshalBinary() ([]byte, error)

MarshalBinary encodes the object into bytes.

func (*ADRParamSetupReqPayload) UnmarshalBinary Uses

func (p *ADRParamSetupReqPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the object from bytes.

type AES128Key Uses

type AES128Key [16]byte

AES128Key represents a 128 bit AES key.

func (AES128Key) MarshalText Uses

func (k AES128Key) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*AES128Key) Scan Uses

func (k *AES128Key) Scan(src interface{}) error

Scan implements sql.Scanner.

func (AES128Key) String Uses

func (k AES128Key) String() string

String implements fmt.Stringer.

func (*AES128Key) UnmarshalText Uses

func (k *AES128Key) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (AES128Key) Value Uses

func (k AES128Key) Value() (driver.Value, error)

Value implements driver.Valuer.

type BeaconFreqAnsPayload Uses

type BeaconFreqAnsPayload struct {
    BeaconFrequencyOK bool `json:"beaconFrequencyOK"`
}

BeaconFreqAnsPayload represents the BeaconFreqAns payload.

func (BeaconFreqAnsPayload) MarshalBinary Uses

func (p BeaconFreqAnsPayload) MarshalBinary() ([]byte, error)

MarshalBinary encodes the object into bytes.

func (*BeaconFreqAnsPayload) UnmarshalBinary Uses

func (p *BeaconFreqAnsPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the object from bytes.

type BeaconFreqReqPayload Uses

type BeaconFreqReqPayload struct {
    Frequency uint32 `json:"frequency"`
}

BeaconFreqReqPayload represents the BeaconFreqReq payload.

func (BeaconFreqReqPayload) MarshalBinary Uses

func (p BeaconFreqReqPayload) MarshalBinary() ([]byte, error)

MarshalBinary encodes the object into bytes.

func (*BeaconFreqReqPayload) UnmarshalBinary Uses

func (p *BeaconFreqReqPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the object from bytes.

type CFList Uses

type CFList struct {
    Payload    Payload    `json:"payload"`
    CFListType CFListType `json:"cFListType"`
}

CFList represents a list of channel frequencies or channel-masks.

func (CFList) MarshalBinary Uses

func (l CFList) MarshalBinary() ([]byte, error)

MarshalBinary marshals the object in binary form.

func (*CFList) UnmarshalBinary Uses

func (l *CFList) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the object from binary form.

type CFListChannelMaskPayload Uses

type CFListChannelMaskPayload struct {
    ChannelMasks []ChMask
}

CFListChannelMaskPayload holds a list of channel-masks.

func (CFListChannelMaskPayload) MarshalBinary Uses

func (p CFListChannelMaskPayload) MarshalBinary() ([]byte, error)

MarshalBinary marshals the object in binary form.

func (*CFListChannelMaskPayload) UnmarshalBinary Uses

func (p *CFListChannelMaskPayload) UnmarshalBinary(uplink bool, data []byte) error

UnmarshalBinary decodes the object from binary form.

type CFListChannelPayload Uses

type CFListChannelPayload struct {
    Channels [5]uint32
}

CFListChannelPayload holds a list of (up to 5) channel frequencies. Each frequency is in Hz and must be a multiple of 100.

func (CFListChannelPayload) MarshalBinary Uses

func (p CFListChannelPayload) MarshalBinary() ([]byte, error)

MarshalBinary marshals the object in binary form.

func (*CFListChannelPayload) UnmarshalBinary Uses

func (p *CFListChannelPayload) UnmarshalBinary(uplink bool, data []byte) error

UnmarshalBinary decodes the object from binary form.

type CFListType Uses

type CFListType uint8

CFListType defines the CFList payload type.

const (
    CFListChannel     CFListType = 0
    CFListChannelMask CFListType = 1
)

Possible CFList types.

type CID Uses

type CID byte

CID defines the MAC command identifier.

const (
    ResetInd            CID = 0x01
    ResetConf           CID = 0x01
    LinkCheckReq        CID = 0x02
    LinkCheckAns        CID = 0x02
    LinkADRReq          CID = 0x03
    LinkADRAns          CID = 0x03
    DutyCycleReq        CID = 0x04
    DutyCycleAns        CID = 0x04
    RXParamSetupReq     CID = 0x05
    RXParamSetupAns     CID = 0x05
    DevStatusReq        CID = 0x06
    DevStatusAns        CID = 0x06
    NewChannelReq       CID = 0x07
    NewChannelAns       CID = 0x07
    RXTimingSetupReq    CID = 0x08
    RXTimingSetupAns    CID = 0x08
    TXParamSetupReq     CID = 0x09
    TXParamSetupAns     CID = 0x09
    DLChannelReq        CID = 0x0A
    DLChannelAns        CID = 0x0A
    RekeyInd            CID = 0x0B
    RekeyConf           CID = 0x0B
    ADRParamSetupReq    CID = 0x0C
    ADRParamSetupAns    CID = 0x0C
    DeviceTimeReq       CID = 0x0D
    DeviceTimeAns       CID = 0x0D
    ForceRejoinReq      CID = 0x0E
    RejoinParamSetupReq CID = 0x0F
    RejoinParamSetupAns CID = 0x0F
    PingSlotInfoReq     CID = 0x10
    PingSlotInfoAns     CID = 0x10
    PingSlotChannelReq  CID = 0x11
    PingSlotChannelAns  CID = 0x11
    // 0x12 has been deprecated in 1.1
    BeaconFreqReq CID = 0x13
    BeaconFreqAns CID = 0x13
)

MAC commands as specified by the LoRaWAN R1.0 specs. Note that each *Req / *Ans has the same value. Based on the fact if a message is uplink or downlink you should use on or the other.

func (CID) MarshalText Uses

func (c CID) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (CID) String Uses

func (i CID) String() string

type ChMask Uses

type ChMask [16]bool

ChMask encodes the channels usable for uplink access. 0 = channel 1, 15 = channel 16.

func (ChMask) MarshalBinary Uses

func (m ChMask) MarshalBinary() ([]byte, error)

MarshalBinary marshals the object in binary form.

func (*ChMask) UnmarshalBinary Uses

func (m *ChMask) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the object from binary form.

type DLChannelAnsPayload Uses

type DLChannelAnsPayload struct {
    UplinkFrequencyExists bool `json:"uplinkFrequencyExists"`
    ChannelFrequencyOK    bool `json:"channelFrequencyOK"`
}

DLChannelAnsPayload represents the DLChannelAns payload.

func (DLChannelAnsPayload) MarshalBinary Uses

func (p DLChannelAnsPayload) MarshalBinary() ([]byte, error)

MarshalBinary encodes the object into bytes.

func (*DLChannelAnsPayload) UnmarshalBinary Uses

func (p *DLChannelAnsPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the object from bytes.

type DLChannelReqPayload Uses

type DLChannelReqPayload struct {
    ChIndex uint8  `json:"chIndex"`
    Freq    uint32 `json:"freq"`
}

DLChannelReqPayload represents the DLChannelReq payload.

func (DLChannelReqPayload) MarshalBinary Uses

func (p DLChannelReqPayload) MarshalBinary() ([]byte, error)

MarshalBinary encodes the object into bytes.

func (*DLChannelReqPayload) UnmarshalBinary Uses

func (p *DLChannelReqPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the object from bytes.

type DLSettings Uses

type DLSettings struct {
    OptNeg      bool  `json:"optNeg"`
    RX2DataRate uint8 `json:"rx2DataRate"`
    RX1DROffset uint8 `json:"rx1DROffset"`
}

DLSettings represents the DLSettings fields (downlink settings).

func (DLSettings) MarshalBinary Uses

func (s DLSettings) MarshalBinary() ([]byte, error)

MarshalBinary marshals the object in binary form.

func (DLSettings) MarshalText Uses

func (s DLSettings) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*DLSettings) UnmarshalBinary Uses

func (s *DLSettings) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the object from binary form.

func (*DLSettings) UnmarshalText Uses

func (s *DLSettings) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type DataPayload Uses

type DataPayload struct {
    Bytes []byte `json:"bytes"`
}

DataPayload represents a slice of bytes.

func (DataPayload) MarshalBinary Uses

func (p DataPayload) MarshalBinary() ([]byte, error)

MarshalBinary marshals the object in binary form.

func (*DataPayload) UnmarshalBinary Uses

func (p *DataPayload) UnmarshalBinary(uplink bool, data []byte) error

UnmarshalBinary decodes the object from binary form.

type DevAddr Uses

type DevAddr [4]byte

DevAddr represents the device address.

func (DevAddr) IsNetID Uses

func (a DevAddr) IsNetID(netID NetID) bool

IsNetID returns a bool indicating if the NwkID matches the given NetID.

func (DevAddr) MarshalBinary Uses

func (a DevAddr) MarshalBinary() ([]byte, error)

MarshalBinary marshals the object in binary form.

func (DevAddr) MarshalText Uses

func (a DevAddr) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (DevAddr) NetIDType Uses

func (a DevAddr) NetIDType() int

NetIDType returns the NetID type of the DevAddr.

func (DevAddr) NwkID Uses

func (a DevAddr) NwkID() []byte

NwkID returns the NwkID bits of the DevAddr.

func (*DevAddr) Scan Uses

func (a *DevAddr) Scan(src interface{}) error

Scan implements sql.Scanner.

func (*DevAddr) SetAddrPrefix Uses

func (a *DevAddr) SetAddrPrefix(netID NetID)

SetAddrPrefix sets the NetID based AddrPrefix.

func (DevAddr) String Uses

func (a DevAddr) String() string

String implements fmt.Stringer.

func (*DevAddr) UnmarshalBinary Uses

func (a *DevAddr) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the object from binary form.

func (*DevAddr) UnmarshalText Uses

func (a *DevAddr) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type DevNonce Uses

type DevNonce uint16

DevNonce represents the dev-nonce.

func (DevNonce) MarshalBinary Uses

func (n DevNonce) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*DevNonce) UnmarshalBinary Uses

func (n *DevNonce) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type DevStatusAnsPayload Uses

type DevStatusAnsPayload struct {
    Battery uint8 `json:"battery"`
    Margin  int8  `json:"margin"`
}

DevStatusAnsPayload represents the DevStatusAns payload.

func (DevStatusAnsPayload) MarshalBinary Uses

func (p DevStatusAnsPayload) MarshalBinary() ([]byte, error)

MarshalBinary marshals the object in binary form.

func (*DevStatusAnsPayload) UnmarshalBinary Uses

func (p *DevStatusAnsPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the object from binary form.

type DeviceTimeAnsPayload Uses

type DeviceTimeAnsPayload struct {
    TimeSinceGPSEpoch time.Duration `json:"timeSinceGPSEpoch"`
}

DeviceTimeAnsPayload represents the DeviceTimeAns payload.

func (DeviceTimeAnsPayload) MarshalBinary Uses

func (p DeviceTimeAnsPayload) MarshalBinary() ([]byte, error)

MarshalBinary encodes the object into bytes.

func (*DeviceTimeAnsPayload) UnmarshalBinary Uses

func (p *DeviceTimeAnsPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the object from bytes.

type DutyCycleReqPayload Uses

type DutyCycleReqPayload struct {
    MaxDCycle uint8 `json:"maxDCycle"`
}

DutyCycleReqPayload represents the DutyCycleReq payload.

func (DutyCycleReqPayload) MarshalBinary Uses

func (p DutyCycleReqPayload) MarshalBinary() ([]byte, error)

MarshalBinary marshals the object in binary form.

func (*DutyCycleReqPayload) UnmarshalBinary Uses

func (p *DutyCycleReqPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the object from binary form.

type DwellTime Uses

type DwellTime int

DwellTime defines the dwell time type.

const (
    DwellTimeNoLimit DwellTime = iota
    DwellTime400ms
)

Possible dwell time options.

type EUI64 Uses

type EUI64 [8]byte

EUI64 data type

func (EUI64) MarshalBinary Uses

func (e EUI64) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (EUI64) MarshalText Uses

func (e EUI64) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*EUI64) Scan Uses

func (e *EUI64) Scan(src interface{}) error

Scan implements sql.Scanner.

func (EUI64) String Uses

func (e EUI64) String() string

String implement fmt.Stringer.

func (*EUI64) UnmarshalBinary Uses

func (e *EUI64) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

func (*EUI64) UnmarshalText Uses

func (e *EUI64) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (EUI64) Value Uses

func (e EUI64) Value() (driver.Value, error)

Value implements driver.Valuer.

type FCtrl Uses

type FCtrl struct {
    ADR       bool `json:"adr"`
    ADRACKReq bool `json:"adrAckReq"`
    ACK       bool `json:"ack"`
    FPending  bool `json:"fPending"` // only used for downlink messages
    ClassB    bool `json:"classB"`   // only used for uplink messages
    // contains filtered or unexported fields
}

FCtrl represents the FCtrl (frame control) field. Please note that the FPending and ClassB are mapped to the same bit. This means that when unmarshaling from a byte-slice, both fields will contain the same value (either true or false).

func (FCtrl) MarshalBinary Uses

func (c FCtrl) MarshalBinary() ([]byte, error)

MarshalBinary marshals the object in binary form.

func (*FCtrl) UnmarshalBinary Uses

func (c *FCtrl) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the object from binary form.

type FHDR Uses

type FHDR struct {
    DevAddr DevAddr   `json:"devAddr"`
    FCtrl   FCtrl     `json:"fCtrl"`
    FCnt    uint32    `json:"fCnt"`  // only the least-significant 16 bits will be marshalled
    FOpts   []Payload `json:"fOpts"` // max. number of allowed bytes is 15
}

FHDR represents the frame header.

func (FHDR) MarshalBinary Uses

func (h FHDR) MarshalBinary() ([]byte, error)

MarshalBinary marshals the object in binary form.

func (*FHDR) UnmarshalBinary Uses

func (h *FHDR) UnmarshalBinary(uplink bool, data []byte) error

UnmarshalBinary decodes the object from binary form.

type ForceRejoinReqPayload Uses

type ForceRejoinReqPayload struct {
    Period     uint8 `json:"period"`
    MaxRetries uint8 `json:"maxRetries"`
    RejoinType uint8 `json:"rejoinType"`
    DR         uint8 `json:"dr"`
}

ForceRejoinReqPayload represents the ForceRejoinReq payload.

func (ForceRejoinReqPayload) MarshalBinary Uses

func (p ForceRejoinReqPayload) MarshalBinary() ([]byte, error)

MarshalBinary encodes the object into bytes.

func (*ForceRejoinReqPayload) UnmarshalBinary Uses

func (p *ForceRejoinReqPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the object from bytes.

type JoinAcceptPayload Uses

type JoinAcceptPayload struct {
    JoinNonce  JoinNonce  `json:"joinNonce"`
    HomeNetID  NetID      `json:"homeNetID"`
    DevAddr    DevAddr    `json:"devAddr"`
    DLSettings DLSettings `json:"dlSettings"`
    RXDelay    uint8      `json:"rxDelay"` // 0=1s, 1=1s, 2=2s, ... 15=15s
    CFList     *CFList    `json:"cFlist"`
}

JoinAcceptPayload represents the join-accept message payload.

func (JoinAcceptPayload) MarshalBinary Uses

func (p JoinAcceptPayload) MarshalBinary() ([]byte, error)

MarshalBinary marshals the object in binary form.

func (*JoinAcceptPayload) UnmarshalBinary Uses

func (p *JoinAcceptPayload) UnmarshalBinary(uplink bool, data []byte) error

UnmarshalBinary decodes the object from binary form.

type JoinNonce Uses

type JoinNonce uint32

JoinNonce represents the join-nonce. Note that the max value is 2^24 - 1 = 16777215.

func (JoinNonce) MarshalBinary Uses

func (n JoinNonce) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (*JoinNonce) UnmarshalBinary Uses

func (n *JoinNonce) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type JoinRequestPayload Uses

type JoinRequestPayload struct {
    JoinEUI  EUI64    `json:"joinEUI"`
    DevEUI   EUI64    `json:"devEUI"`
    DevNonce DevNonce `json:"devNonce"`
}

JoinRequestPayload represents the join-request message payload.

func (JoinRequestPayload) MarshalBinary Uses

func (p JoinRequestPayload) MarshalBinary() ([]byte, error)

MarshalBinary marshals the object in binary form.

func (*JoinRequestPayload) UnmarshalBinary Uses

func (p *JoinRequestPayload) UnmarshalBinary(uplink bool, data []byte) error

UnmarshalBinary decodes the object from binary form.

type JoinType Uses

type JoinType uint8

JoinType defines the join-request type.

const (
    JoinRequestType    JoinType = 0xff
    RejoinRequestType0 JoinType = 0x00
    RejoinRequestType1 JoinType = 0x01
    RejoinRequestType2 JoinType = 0x02
)

Join-request types.

func (JoinType) String Uses

func (i JoinType) String() string

type LinkADRAnsPayload Uses

type LinkADRAnsPayload struct {
    ChannelMaskACK bool `json:"channelMaskAck"`
    DataRateACK    bool `json:"dataRateAck"`
    PowerACK       bool `json:"powerAck"`
}

LinkADRAnsPayload represents the LinkADRAns payload.

func (LinkADRAnsPayload) MarshalBinary Uses

func (p LinkADRAnsPayload) MarshalBinary() ([]byte, error)

MarshalBinary marshals the object in binary form.

func (*LinkADRAnsPayload) UnmarshalBinary Uses

func (p *LinkADRAnsPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the object from binary form.

type LinkADRReqPayload Uses

type LinkADRReqPayload struct {
    DataRate   uint8      `json:"dataRate"`
    TXPower    uint8      `json:"txPower"`
    ChMask     ChMask     `json:"chMask"`
    Redundancy Redundancy `json:"redundancy"`
}

LinkADRReqPayload represents the LinkADRReq payload.

func (LinkADRReqPayload) MarshalBinary Uses

func (p LinkADRReqPayload) MarshalBinary() ([]byte, error)

MarshalBinary marshals the object in binary form.

func (*LinkADRReqPayload) UnmarshalBinary Uses

func (p *LinkADRReqPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the object from binary form.

type LinkCheckAnsPayload Uses

type LinkCheckAnsPayload struct {
    Margin uint8 `json:"margin"`
    GwCnt  uint8 `json:"gwCnt"`
}

LinkCheckAnsPayload represents the LinkCheckAns payload.

func (LinkCheckAnsPayload) MarshalBinary Uses

func (p LinkCheckAnsPayload) MarshalBinary() ([]byte, error)

MarshalBinary marshals the object in binary form.

func (*LinkCheckAnsPayload) UnmarshalBinary Uses

func (p *LinkCheckAnsPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the object from binary form.

type MACCommand Uses

type MACCommand struct {
    CID     CID               `json:"cid"`
    Payload MACCommandPayload `json:"payload"`
}

MACCommand represents a MAC command with optional payload.

func (MACCommand) MarshalBinary Uses

func (m MACCommand) MarshalBinary() ([]byte, error)

MarshalBinary marshals the object in binary form.

func (*MACCommand) UnmarshalBinary Uses

func (m *MACCommand) UnmarshalBinary(uplink bool, data []byte) error

UnmarshalBinary decodes the object from binary form.

type MACCommandPayload Uses

type MACCommandPayload interface {
    MarshalBinary() (data []byte, err error)
    UnmarshalBinary(data []byte) error
}

MACCommandPayload is the interface that every MACCommand payload must implement.

func GetMACPayloadAndSize Uses

func GetMACPayloadAndSize(uplink bool, c CID) (MACCommandPayload, int, error)

GetMACPayloadAndSize returns a new MACCommandPayload instance and it's size.

type MACPayload Uses

type MACPayload struct {
    FHDR       FHDR      `json:"fhdr"`
    FPort      *uint8    `json:"fPort"` // optional, but must be set when FRMPayload is set
    FRMPayload []Payload `json:"frmPayload"`
}

MACPayload represents the MAC payload. Use NewMACPayload for creating a new MACPayload.

func (MACPayload) MarshalBinary Uses

func (p MACPayload) MarshalBinary() ([]byte, error)

MarshalBinary marshals the object in binary form.

func (*MACPayload) UnmarshalBinary Uses

func (p *MACPayload) UnmarshalBinary(uplink bool, data []byte) error

UnmarshalBinary decodes the object from binary form.

type MACVersion Uses

type MACVersion byte

MACVersion defines the LoRaWAN MAC version.

const (
    LoRaWAN1_0 MACVersion = iota
    LoRaWAN1_1
)

Supported LoRaWAN MAC versions.

type MHDR Uses

type MHDR struct {
    MType MType `json:"mType"`
    Major Major `json:"major"`
}

MHDR represents the MAC header.

func (MHDR) MarshalBinary Uses

func (h MHDR) MarshalBinary() ([]byte, error)

MarshalBinary marshals the object in binary form.

func (*MHDR) UnmarshalBinary Uses

func (h *MHDR) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the object from binary form.

type MIC Uses

type MIC [4]byte

MIC represents the message integrity code.

func (MIC) MarshalText Uses

func (m MIC) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (MIC) String Uses

func (m MIC) String() string

String implements fmt.Stringer.

type MType Uses

type MType byte

MType represents the message type.

const (
    JoinRequest MType = iota
    JoinAccept
    UnconfirmedDataUp
    UnconfirmedDataDown
    ConfirmedDataUp
    ConfirmedDataDown
    RejoinRequest
    Proprietary
)

Supported message types (MType)

func (MType) MarshalText Uses

func (m MType) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (MType) String Uses

func (i MType) String() string

type Major Uses

type Major byte

Major defines the major version of data message.

const (
    LoRaWANR1 Major = 0
)

Supported major versions

func (Major) MarshalText Uses

func (m Major) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (Major) String Uses

func (i Major) String() string

type NetID Uses

type NetID [3]byte

NetID represents the NetID.

func (NetID) ID Uses

func (n NetID) ID() []byte

ID returns the NetID ID part.

func (NetID) MarshalBinary Uses

func (n NetID) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler.

func (NetID) MarshalText Uses

func (n NetID) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*NetID) Scan Uses

func (n *NetID) Scan(src interface{}) error

Scan implements sql.Scanner.

func (NetID) String Uses

func (n NetID) String() string

String implements fmt.Stringer.

func (NetID) Type Uses

func (n NetID) Type() int

Type returns the NetID type.

func (*NetID) UnmarshalBinary Uses

func (n *NetID) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

func (*NetID) UnmarshalText Uses

func (n *NetID) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (NetID) Value Uses

func (n NetID) Value() (driver.Value, error)

Value implements driver.Valuer.

type NewChannelAnsPayload Uses

type NewChannelAnsPayload struct {
    ChannelFrequencyOK bool `json:"channelFrequencyOK"`
    DataRateRangeOK    bool `json:"dataRateRangeOK"`
}

NewChannelAnsPayload represents the NewChannelAns payload.

func (NewChannelAnsPayload) MarshalBinary Uses

func (p NewChannelAnsPayload) MarshalBinary() ([]byte, error)

MarshalBinary marshals the object in binary form.

func (*NewChannelAnsPayload) UnmarshalBinary Uses

func (p *NewChannelAnsPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the object from binary form.

type NewChannelReqPayload Uses

type NewChannelReqPayload struct {
    ChIndex uint8  `json:"chIndex"`
    Freq    uint32 `json:"freq"`
    MaxDR   uint8  `json:"maxDR"`
    MinDR   uint8  `json:"minDR"`
}

NewChannelReqPayload represents the NewChannelReq payload.

func (NewChannelReqPayload) MarshalBinary Uses

func (p NewChannelReqPayload) MarshalBinary() ([]byte, error)

MarshalBinary marshals the object in binary form.

func (*NewChannelReqPayload) UnmarshalBinary Uses

func (p *NewChannelReqPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the object from binary form.

type PHYPayload Uses

type PHYPayload struct {
    MHDR       MHDR    `json:"mhdr"`
    MACPayload Payload `json:"macPayload"`
    MIC        MIC     `json:"mic"`
}

PHYPayload represents the physical payload.

Code:

appKey := [16]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}
joinEUI := EUI64{8, 7, 6, 5, 4, 3, 2, 1}
devNonce := DevNonce(258)

phy := PHYPayload{
    MHDR: MHDR{
        MType: JoinAccept,
        Major: LoRaWANR1,
    },
    MACPayload: &JoinAcceptPayload{
        JoinNonce:  65793,
        HomeNetID:  [3]byte{2, 2, 2},
        DevAddr:    DevAddr([4]byte{1, 2, 3, 4}),
        DLSettings: DLSettings{RX2DataRate: 0, RX1DROffset: 0},
        RXDelay:    0,
    },
}

// set the MIC before encryption
if err := phy.SetDownlinkJoinMIC(JoinRequestType, joinEUI, devNonce, appKey); err != nil {
    panic(err)
}
if err := phy.EncryptJoinAcceptPayload(appKey); err != nil {
    panic(err)
}

str, err := phy.MarshalText()
if err != nil {
    panic(err)
}

bytes, err := phy.MarshalBinary()
if err != nil {
    panic(err)
}

fmt.Println(string(str))
fmt.Println(bytes)

Output:

ICPPM1SJquMYPAvguqje5fM=
[32 35 207 51 84 137 170 227 24 60 11 224 186 168 222 229 243]

Code:

appKey := [16]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}

phy := PHYPayload{
    MHDR: MHDR{
        MType: JoinRequest,
        Major: LoRaWANR1,
    },
    MACPayload: &JoinRequestPayload{
        JoinEUI:  [8]byte{1, 1, 1, 1, 1, 1, 1, 1},
        DevEUI:   [8]byte{2, 2, 2, 2, 2, 2, 2, 2},
        DevNonce: 771,
    },
}

if err := phy.SetUplinkJoinMIC(appKey); err != nil {
    panic(err)
}

str, err := phy.MarshalText()
if err != nil {
    panic(err)
}

bytes, err := phy.MarshalBinary()
if err != nil {
    panic(err)
}

fmt.Println(string(str))
fmt.Println(bytes)

Output:

AAEBAQEBAQEBAgICAgICAgIDAwm5ezI=
[0 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 3 3 9 185 123 50]

Code:

var phy PHYPayload
if err := phy.UnmarshalText([]byte("AAQDAgEEAwIBBQQDAgUEAwItEGqZDhI=")); err != nil {
    panic(err)
}

jrPL, ok := phy.MACPayload.(*JoinRequestPayload)
if !ok {
    panic("MACPayload must be a *JoinRequestPayload")
}

fmt.Println(phy.MHDR.MType)
fmt.Println(jrPL.JoinEUI)
fmt.Println(jrPL.DevEUI)
fmt.Println(jrPL.DevNonce)

Output:

JoinRequest
0102030401020304
0203040502030405
4141

func (*PHYPayload) DecodeFOptsToMACCommands Uses

func (p *PHYPayload) DecodeFOptsToMACCommands() error

DecodeFOptsToMACCommands decodes the (decrypted) FOpts bytes into MAC commands.

func (*PHYPayload) DecodeFRMPayloadToMACCommands Uses

func (p *PHYPayload) DecodeFRMPayloadToMACCommands() error

DecodeFRMPayloadToMACCommands decodes the (decrypted) FRMPayload bytes into MAC commands. Note that after calling DecryptFRMPayload, this method is called automatically when FPort=0.

func (*PHYPayload) DecryptFOpts Uses

func (p *PHYPayload) DecryptFOpts(nwkSEncKey AES128Key) error

DecryptFOpts decrypts the FOpts payload and decodes it into mac-command structures.

func (*PHYPayload) DecryptFRMPayload Uses

func (p *PHYPayload) DecryptFRMPayload(key AES128Key) error

DecryptFRMPayload decrypts the FRMPayload with the given key.

func (*PHYPayload) DecryptJoinAcceptPayload Uses

func (p *PHYPayload) DecryptJoinAcceptPayload(key AES128Key) error

DecryptJoinAcceptPayload decrypts the join-accept payload with the given key. Note that you need to decrypte before you can validate the MIC.

Note: for encrypting a join-request response, use NwkKey

for rejoin-request 0, 1, 2 response, use JSEncKey

func (*PHYPayload) EncryptFOpts Uses

func (p *PHYPayload) EncryptFOpts(nwkSEncKey AES128Key) error

EncryptFOpts encrypts the FOpts with the given key.

func (*PHYPayload) EncryptFRMPayload Uses

func (p *PHYPayload) EncryptFRMPayload(key AES128Key) error

EncryptFRMPayload encrypts the FRMPayload with the given key.

func (*PHYPayload) EncryptJoinAcceptPayload Uses

func (p *PHYPayload) EncryptJoinAcceptPayload(key AES128Key) error

EncryptJoinAcceptPayload encrypts the join-accept payload with the given key. Note that encrypted must be performed after calling SetMIC (since the MIC is part of the encrypted payload).

Note: for encrypting a join-request response, use NwkKey

for rejoin-request 0, 1, 2 response, use JSEncKey

func (PHYPayload) MarshalBinary Uses

func (p PHYPayload) MarshalBinary() ([]byte, error)

MarshalBinary marshals the object in binary form.

func (PHYPayload) MarshalJSON Uses

func (p PHYPayload) MarshalJSON() ([]byte, error)

MarshalJSON encodes the PHYPayload into JSON.

func (PHYPayload) MarshalText Uses

func (p PHYPayload) MarshalText() ([]byte, error)

MarshalText encodes the PHYPayload into base64.

func (*PHYPayload) SetDownlinkDataMIC Uses

func (p *PHYPayload) SetDownlinkDataMIC(macVersion MACVersion, confFCnt uint32, sNwkSIntKey AES128Key) error

SetDownlinkDataMIC calculates and sets the MIC field for downlink data frames. The confirmed frame-counter and is only required for LoRaWAN 1.1 and can be left blank otherwise.

func (*PHYPayload) SetDownlinkJoinMIC Uses

func (p *PHYPayload) SetDownlinkJoinMIC(joinReqType JoinType, joinEUI EUI64, devNonce DevNonce, key AES128Key) error

SetDownlinkJoinMIC calculates and sets the MIC field for downlink join requests.

func (*PHYPayload) SetUplinkDataMIC Uses

func (p *PHYPayload) SetUplinkDataMIC(macVersion MACVersion, confFCnt uint32, txDR, txCh uint8, fNwkSIntKey, sNwkSIntKey AES128Key) error

SetUplinkDataMIC calculates and sets the MIC field for uplink data frames. The confirmed frame-counter, TX data-rate TX channel index and SNwkSIntKey are only required for LoRaWAN 1.1 and can be left blank otherwise.

func (*PHYPayload) SetUplinkJoinMIC Uses

func (p *PHYPayload) SetUplinkJoinMIC(key AES128Key) error

SetUplinkJoinMIC calculates and sets the MIC field for uplink join requests.

func (*PHYPayload) UnmarshalBinary Uses

func (p *PHYPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the object from binary form.

func (*PHYPayload) UnmarshalText Uses

func (p *PHYPayload) UnmarshalText(text []byte) error

UnmarshalText decodes the PHYPayload from base64.

func (PHYPayload) ValidateDownlinkDataMIC Uses

func (p PHYPayload) ValidateDownlinkDataMIC(macVersion MACVersion, confFCnt uint32, sNwkSIntKey AES128Key) (bool, error)

ValidateDownlinkDataMIC validates the MIC of a downlink data frame. In order to validate the MIC, the FCnt value must first be set to the full 32 bit frame-counter value, as only the 16 least-significant bits are transmitted. The confirmed frame-counter and is only required for LoRaWAN 1.1 and can be left blank otherwise.

func (PHYPayload) ValidateDownlinkJoinMIC Uses

func (p PHYPayload) ValidateDownlinkJoinMIC(joinReqType JoinType, joinEUI EUI64, devNonce DevNonce, key AES128Key) (bool, error)

ValidateDownlinkJoinMIC validates the MIC of a downlink join request.

func (PHYPayload) ValidateUplinkDataMIC Uses

func (p PHYPayload) ValidateUplinkDataMIC(macVersion MACVersion, confFCnt uint32, txDR, txCh uint8, fNwkSIntKey, sNwkSIntKey AES128Key) (bool, error)

ValidateUplinkDataMIC validates the MIC of an uplink data frame. In order to validate the MIC, the FCnt value must first be set to the full 32 bit frame-counter value, as only the 16 least-significant bits are transmitted. The confirmed frame-counter, TX data-rate TX channel index and SNwkSIntKey are only required for LoRaWAN 1.1 and can be left blank otherwise.

func (PHYPayload) ValidateUplinkJoinMIC Uses

func (p PHYPayload) ValidateUplinkJoinMIC(key AES128Key) (bool, error)

ValidateUplinkJoinMIC validates the MIC of an uplink join request.

type Payload Uses

type Payload interface {
    MarshalBinary() (data []byte, err error)
    UnmarshalBinary(uplink bool, data []byte) error
}

Payload is the interface that every payload needs to implement. Since it might be a MACPayload, an indication must be given if the direction is uplink or downlink (it has different payloads for the same CID, based on direction).

type PingSlotChannelAnsPayload Uses

type PingSlotChannelAnsPayload struct {
    DataRateOK         bool `json:"dataRateOK"`
    ChannelFrequencyOK bool `json:"channelFrequencyOK"`
}

PingSlotChannelAnsPayload represents the PingSlotChannelAns payload.

func (PingSlotChannelAnsPayload) MarshalBinary Uses

func (p PingSlotChannelAnsPayload) MarshalBinary() ([]byte, error)

MarshalBinary encodes the object into bytes.

func (*PingSlotChannelAnsPayload) UnmarshalBinary Uses

func (p *PingSlotChannelAnsPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the object from bytes.

type PingSlotChannelReqPayload Uses

type PingSlotChannelReqPayload struct {
    Frequency uint32 `json:"frequency"`
    DR        uint8  `json:"dr"`
}

PingSlotChannelReqPayload represents the PingSlotChannelReq payload.

func (PingSlotChannelReqPayload) MarshalBinary Uses

func (p PingSlotChannelReqPayload) MarshalBinary() ([]byte, error)

MarshalBinary encodes the object into bytes.

func (*PingSlotChannelReqPayload) UnmarshalBinary Uses

func (p *PingSlotChannelReqPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the object from bytes.

type PingSlotInfoReqPayload Uses

type PingSlotInfoReqPayload struct {
    Periodicity uint8 `json:"periodicity"`
}

PingSlotInfoReqPayload represents the PingSlotInfoReq payload.

func (PingSlotInfoReqPayload) MarshalBinary Uses

func (p PingSlotInfoReqPayload) MarshalBinary() ([]byte, error)

MarshalBinary encodes the object into bytes.

func (*PingSlotInfoReqPayload) UnmarshalBinary Uses

func (p *PingSlotInfoReqPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the object from bytes.

type ProprietaryMACCommandPayload Uses

type ProprietaryMACCommandPayload struct {
    Bytes []byte `json:"bytes"`
}

ProprietaryMACCommandPayload represents a proprietary payload.

func (ProprietaryMACCommandPayload) MarshalBinary Uses

func (p ProprietaryMACCommandPayload) MarshalBinary() ([]byte, error)

MarshalBinary marshals the object into a slice of bytes.

func (*ProprietaryMACCommandPayload) UnmarshalBinary Uses

func (p *ProprietaryMACCommandPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the object from a slice of bytes.

type RXParamSetupAnsPayload Uses

type RXParamSetupAnsPayload struct {
    ChannelACK     bool `json:"channelAck"`
    RX2DataRateACK bool `json:"rx2DataRateAck"`
    RX1DROffsetACK bool `json:"rx1DROffsetAck"`
}

RXParamSetupAnsPayload represents the RXParamSetupAns payload.

func (RXParamSetupAnsPayload) MarshalBinary Uses

func (p RXParamSetupAnsPayload) MarshalBinary() ([]byte, error)

MarshalBinary marshals the object in binary form.

func (*RXParamSetupAnsPayload) UnmarshalBinary Uses

func (p *RXParamSetupAnsPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the object from binary form.

type RXParamSetupReqPayload Uses

type RXParamSetupReqPayload struct {
    Frequency  uint32     `json:"frequency"`
    DLSettings DLSettings `json:"dlSettings"`
}

RXParamSetupReqPayload represents the RXParamSetupReq payload.

func (RXParamSetupReqPayload) MarshalBinary Uses

func (p RXParamSetupReqPayload) MarshalBinary() ([]byte, error)

MarshalBinary marshals the object in binary form.

func (*RXParamSetupReqPayload) UnmarshalBinary Uses

func (p *RXParamSetupReqPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the object from binary form.

type RXTimingSetupReqPayload Uses

type RXTimingSetupReqPayload struct {
    Delay uint8 `json:"delay"` // 0=1s, 1=1s, 2=2s, ... 15=15s
}

RXTimingSetupReqPayload represents the RXTimingSetupReq payload.

func (RXTimingSetupReqPayload) MarshalBinary Uses

func (p RXTimingSetupReqPayload) MarshalBinary() ([]byte, error)

MarshalBinary marshals the object in binary form.

func (*RXTimingSetupReqPayload) UnmarshalBinary Uses

func (p *RXTimingSetupReqPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the object from binary form.

type Redundancy Uses

type Redundancy struct {
    ChMaskCntl uint8 `json:"chMaskCntl"`
    NbRep      uint8 `json:"nbRep"`
}

Redundancy represents the redundancy field.

func (Redundancy) MarshalBinary Uses

func (r Redundancy) MarshalBinary() ([]byte, error)

MarshalBinary marshals the object in binary form.

func (*Redundancy) UnmarshalBinary Uses

func (r *Redundancy) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the object from binary form.

type RejoinParamSetupAnsPayload Uses

type RejoinParamSetupAnsPayload struct {
    TimeOK bool `json:"timeOK"`
}

RejoinParamSetupAnsPayload represents the RejoinParamSetupAns payload.

func (RejoinParamSetupAnsPayload) MarshalBinary Uses

func (p RejoinParamSetupAnsPayload) MarshalBinary() ([]byte, error)

MarshalBinary encodes the object into bytes.

func (*RejoinParamSetupAnsPayload) UnmarshalBinary Uses

func (p *RejoinParamSetupAnsPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the object from bytes.

type RejoinParamSetupReqPayload Uses

type RejoinParamSetupReqPayload struct {
    MaxTimeN  uint8 `json:"maxTimeN"`
    MaxCountN uint8 `json:"maxCountN"`
}

RejoinParamSetupReqPayload represents the RejoinParamSetupReq payload.

func (RejoinParamSetupReqPayload) MarshalBinary Uses

func (p RejoinParamSetupReqPayload) MarshalBinary() ([]byte, error)

MarshalBinary encodes the object into bytes.

func (*RejoinParamSetupReqPayload) UnmarshalBinary Uses

func (p *RejoinParamSetupReqPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the object from bytes.

type RejoinRequestType02Payload Uses

type RejoinRequestType02Payload struct {
    RejoinType JoinType `json:"rejoinType"`
    NetID      NetID    `json:"netID"`
    DevEUI     EUI64    `json:"devEUI"`
    RJCount0   uint16   `json:"rjCount0"`
}

RejoinRequestType02Payload represents a rejoin-request of type 0 or 2.

func (RejoinRequestType02Payload) MarshalBinary Uses

func (p RejoinRequestType02Payload) MarshalBinary() ([]byte, error)

MarshalBinary marshals the object in binary form.

func (*RejoinRequestType02Payload) UnmarshalBinary Uses

func (p *RejoinRequestType02Payload) UnmarshalBinary(uplink bool, data []byte) error

UnmarshalBinary decodes the object from binary form.

type RejoinRequestType1Payload Uses

type RejoinRequestType1Payload struct {
    RejoinType JoinType `json:"rejoinRequest"`
    JoinEUI    EUI64    `json:"joinEUI"`
    DevEUI     EUI64    `json:"devEUI"`
    RJCount1   uint16   `json:"rjCount1"`
}

RejoinRequestType1Payload represents a rejoin-request of type 1.

func (RejoinRequestType1Payload) MarshalBinary Uses

func (p RejoinRequestType1Payload) MarshalBinary() ([]byte, error)

MarshalBinary marshals the object in binary form.

func (*RejoinRequestType1Payload) UnmarshalBinary Uses

func (p *RejoinRequestType1Payload) UnmarshalBinary(uplink bool, data []byte) error

UnmarshalBinary decodes the object from binary form.

type RekeyConfPayload Uses

type RekeyConfPayload struct {
    ServLoRaWANVersion Version `json:"servLoRaWANVersion"`
}

RekeyConfPayload represents the RekeyConf payload.

func (RekeyConfPayload) MarshalBinary Uses

func (p RekeyConfPayload) MarshalBinary() ([]byte, error)

MarshalBinary encodes the object into bytes.

func (*RekeyConfPayload) UnmarshalBinary Uses

func (p *RekeyConfPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the object from bytes.

type RekeyIndPayload Uses

type RekeyIndPayload struct {
    DevLoRaWANVersion Version `json:"devLoRaWANVersion"`
}

RekeyIndPayload represents the RekeyInd payload.

func (RekeyIndPayload) MarshalBinary Uses

func (p RekeyIndPayload) MarshalBinary() ([]byte, error)

MarshalBinary encodes the object into bytes.

func (*RekeyIndPayload) UnmarshalBinary Uses

func (p *RekeyIndPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the object from bytes.

type ResetConfPayload Uses

type ResetConfPayload struct {
    ServLoRaWANVersion Version `json:"servLoRaWANVersion"`
}

ResetConfPayload represents the ResetConf payload.

func (ResetConfPayload) MarshalBinary Uses

func (p ResetConfPayload) MarshalBinary() ([]byte, error)

MarshalBinary encodes the object into bytes.

func (*ResetConfPayload) UnmarshalBinary Uses

func (p *ResetConfPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the object from bytes.

type ResetIndPayload Uses

type ResetIndPayload struct {
    DevLoRaWANVersion Version `json:"devLoRaWANVersion"`
}

ResetIndPayload represents the ResetInd payload.

func (ResetIndPayload) MarshalBinary Uses

func (p ResetIndPayload) MarshalBinary() ([]byte, error)

MarshalBinary encodes the object into bytes.

func (*ResetIndPayload) UnmarshalBinary Uses

func (p *ResetIndPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the object from bytes.

type TXParamSetupReqPayload Uses

type TXParamSetupReqPayload struct {
    DownlinkDwelltime DwellTime `json:"downlinkDwellTime"`
    UplinkDwellTime   DwellTime `json:"uplinkDwellTime"`
    MaxEIRP           uint8     `json:"maxEIRP"`
}

TXParamSetupReqPayload represents the TXParamSetupReq payload.

func (TXParamSetupReqPayload) MarshalBinary Uses

func (p TXParamSetupReqPayload) MarshalBinary() ([]byte, error)

MarshalBinary encodes the object into a bytes.

func (*TXParamSetupReqPayload) UnmarshalBinary Uses

func (p *TXParamSetupReqPayload) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the object from bytes.

type Version Uses

type Version struct {
    Minor uint8 `json:"minor"`
}

Version defines LoRaWAN version field.

func (Version) MarshalBinary Uses

func (v Version) MarshalBinary() ([]byte, error)

MarshalBinary encodes the object into bytes.

func (*Version) UnmarshalBinary Uses

func (v *Version) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes the object from bytes.

Directories

PathSynopsis
airtimePackage airtime provides a function for calculating the time on air.
backendPackage backend provides the LoRaWAN backend interfaces structs.
bandPackage band provides band specific defaults and configuration for downlink communication with end-devices.

Package lorawan imports 13 packages (graph) and is imported by 85 packages. Updated 2018-07-19. Refresh now. Tools for package owners.