lora

package
v0.0.0-...-bd752d1 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2022 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FPort distinguishes the data format.
	FPort uint8 = 5
	// FCnt counts number of frames.
	FCnt = 10
	// Battery level of device.
	Battery = 115
	// Margin is a link margin of device.
	Margin = 7
	// Channel for communication (Gateway).
	Channel = 1
	// CRCStatus of packet (Gateway).
	CRCStatus = 1
	// Bandwidth of communication (Gateway).
	Bandwidth = 125
	// SpreadFactor of communication (Gateway).
	SpreadFactor = 7
	// Frequency of communication (Gateway).
	Frequency = 868300000
	// LoRaSNR indicates Signal to noise ratio (Gateway).
	LoRaSNR = 7
	// RFChain of communication (Gateway).
	RFChain = 1
	// Size of packet (Gateway).
	Size = 23
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	MAC     string `json:"mac"`
	Keys    `json:"keys"`
	Devices []Device `json:"devices"`
}

type Device

type Device struct {
	Addr   string `json:"addr"`
	DevEUI string `json:"dev_eui"` // nolint: tagliatelle
}

type Gateway

type Gateway struct {
	Config
}

Gateway simulate data based on LoRaWAN protocol from an ABP device and one gateway. It encrypts data and you will need a lora server to decode it.

func New

func New(cfg Config) Gateway

create new gateway simulation based on given configuration.

func (Gateway) Generate

func (g Gateway) Generate(message interface{}, index int) ([]byte, error)

Generate generates lora message by converting input into cbor and encrypts it. nolint: funlen

func (Gateway) Topic

func (g Gateway) Topic() string

Topic returns lora gateway mqtt topic.

type Keys

type Keys struct {
	NetworkSKey     string `json:"network_skey"`     // nolint: tagliatelle
	ApplicationSKey string `json:"application_skey"` // nolint: tagliatelle
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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