generators

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2018 License: GPL-3.0 Imports: 6 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AtrovanGenerator

type AtrovanGenerator struct {
}

AtrovanGenerator generates data based on atrovan protocol and atrovan model.

func (AtrovanGenerator) Generate

func (g AtrovanGenerator) Generate(input interface{}) ([]byte, error)

Generate generates atrovan message by converting input into telemetries json and using generator parameters.

func (AtrovanGenerator) Topic

func (g AtrovanGenerator) Topic() string

Topic returns atrovan mqtt topic

type FancoGenerator

type FancoGenerator struct {
	ThingID string `mapstructure:"thingID"`
}

FancoGenerator generates data with allthingstalk format and sends them with pure json.

func (FancoGenerator) Generate

func (g FancoGenerator) Generate(input interface{}) ([]byte, error)

Generate generates data message (in thing state format with all of its assets) in pure json.

func (FancoGenerator) Topic

func (g FancoGenerator) Topic() string

Topic returns I1820 thing state topic. this topic sets thing state (with all of its assets) in I1820

type Generator

type Generator interface {
	Generate(input interface{}) ([]byte, error)
	Topic() string
}

Generator generates data whenever you want based on given input. input can be nil.

type ISRCGenerator

type ISRCGenerator struct {
	ApplicationID   int    `mapstructure:"applicationID"`
	ApplicationName string `mapstructure:"applicationName"`
	DeviceName      string `mapstructure:"deviceName"`
	DevEUI          string `mapstructure:"devEUI"`
	GatewayMac      string `mapstructure:"gatewayMAC"`
}

ISRCGenerator generates data based on RxMessage structure as is described above and then encode it with cbor(http://cbor.io/). for historical reasons for refer to it as ISRC protocol

func (ISRCGenerator) Generate

func (g ISRCGenerator) Generate(input interface{}) ([]byte, error)

Generate generates lora message by converting input into cbor and generator parameters.

func (ISRCGenerator) Topic

func (g ISRCGenerator) Topic() string

Topic returns lora mqtt topic

type RxInfo

type RxInfo struct {
	Mac     string
	Name    string
	Time    time.Time
	RSSI    int     `json:"rssi"`
	LoRaSNR float64 `json:"LoRaSNR"`
}

RxInfo contains reception infomation of a lara gateway that payload is received from it.

type RxMessage

type RxMessage struct {
	ApplicationID   string
	ApplicationName string
	DeviceName      string
	DevEUI          string
	FPort           int
	FCnt            int
	RxInfo          []RxInfo
	TxInfo          TxInfo
	Data            []byte
}

RxMessage contains payloads received from your nodes in loraserver.io

type TTNGenerator

type TTNGenerator struct {
	ApplicationName string `mapstructure:"applicationName"`
	ApplicationID   string `mapstructure:"applicationID"`
	DevEUI          string `mapstructure:"devEUI"`
	DeviceName      string `mapstructure:"deviceName"`
}

TTNGenerator generates data based on TheThingsNetwork format for I1820 ttn integration mdoule.

func (TTNGenerator) Generate

func (g TTNGenerator) Generate(input interface{}) ([]byte, error)

Generate generates lora message by converting input into cbor and generator parameters into ttn message format.

func (TTNGenerator) Topic

func (g TTNGenerator) Topic() string

Topic returns ttn integration http topic

type TTNRequest

type TTNRequest struct {
	AppID          string `json:"app_id"`
	DevID          string `json:"dev_id"`
	HardwareSerial string `json:"hardware_serial"`
	Port           int    `json:"port"`
	Counter        int    `json:"counter"`
	IsRetry        bool   `json:"is_retry"`
	Confirmed      bool   `json:"confirmed"`
	PayloadRaw     []byte `json:"payload_raw"`
	Metadata       struct {
		Time        time.Time `json:"time"`
		Frequency   float64   `json:"frequency"`
		Modulation  string    `json:"modulation"`
		DataRate    string    `json:"data_rate"`
		BitRate     int       `json:"bit_rate"`
		CondingRate string    `json:"conding_rate"`
		Gateways    []struct {
			GatewayID string `json:"gtw_id"`
		} `json:"gateways"`
	} `json:"metadata"`
}

TTNRequest is a request structure of TTN integration module

type TxInfo

type TxInfo struct {
	Frequency int
	Adr       bool
	CodeRate  string
}

TxInfo contains transmission information of a lora gateway that payload is received from it.

Jump to

Keyboard shortcuts

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