lorawan: github.com/tkiraly/lorawan/mhdr Index | Examples | Files

package mhdr

import "github.com/tkiraly/lorawan/mhdr"

Package mhdr contains LoRaWAN MAC Header related stuff.

The MAC header specifies the message type (MType) and according to which major version (Major) of the frame format of the LoRaWAN layer specification the frame has been encoded.

Index

Examples

Package Files

majorversion_string.go mhdr.go mtype_string.go

type MHDR Uses

type MHDR interface {
    //String returns a MAC header into a string
    String() string
    //ByteArray returns a MAC header into a byte array
    ByteArray() []byte
    //MType returns message type
    MType() MType
    //Major returns major version
    Major() MajorVersion
}

MHDR is accessed returns an os.FileInfo for the FileHeader.

func New Uses

func New(mtype MType, major MajorVersion) MHDR

New returns a new MAC header.

func Parse Uses

func Parse(bb byte) MHDR

Parse a byte into a MAC header.

type MType Uses

type MType byte

MType represents the message type

const (
    JoinRequestMessageType MType = iota
    JoinAcceptMessageType
    UnconfirmedDataUpMessageType
    UnconfirmedDataDownMessageType
    ConfirmedDataUpMessageType
    ConfirmedDataDownMessageType
    RFUMessageType
    ProprietaryMessageType
)

The LoRaWAN distinguishes between six different MAC message types: join request, join accept, unconfirmed data up/down, and confirmed data up/down.

Code:

m := mhdr.New(mhdr.ConfirmedDataDownMessageType, mhdr.LoRaWANR1MajorVersion)

fmt.Printf("%s", m.MType())

Output:

ConfirmedDataDownMessageType

func (MType) String Uses

func (i MType) String() string

type MajorVersion Uses

type MajorVersion byte

MajorVersion represents the major version

const (
    LoRaWANR1MajorVersion MajorVersion = iota
)

represents the Major version

func (MajorVersion) String Uses

func (i MajorVersion) String() string

Package mhdr imports 2 packages (graph) and is imported by 4 packages. Updated 2018-09-08. Refresh now. Tools for package owners.