mhdr

package
v0.3.67 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2018 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

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

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MHDR

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

func New(mtype MType, major MajorVersion) MHDR

New returns a new MAC header.

func Parse

func Parse(bb byte) MHDR

Parse a byte into a MAC header.

type MType

type MType byte

MType represents the message type

Example
package main

import (
	"fmt"

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

func main() {
	m := mhdr.New(mhdr.ConfirmedDataDownMessageType, mhdr.LoRaWANR1MajorVersion)

	fmt.Printf("%s", m.MType())
}
Output:

ConfirmedDataDownMessageType
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.

func (MType) String

func (i MType) String() string

type MajorVersion

type MajorVersion byte

MajorVersion represents the major version

const (
	LoRaWANR1MajorVersion MajorVersion = iota
)

represents the Major version

func (MajorVersion) String

func (i MajorVersion) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL