handler

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HTTPHandlerKind     = "HTTP"
	InfluxDBHandlerKind = "INFLUXDB"
)

Handler kinds

Variables

This section is empty.

Functions

This section is empty.

Types

type ACKNotification

type ACKNotification struct {
	ApplicationID   int64         `json:"applicationID,string"`
	ApplicationName string        `json:"applicationName"`
	DeviceName      string        `json:"deviceName"`
	DevEUI          lorawan.EUI64 `json:"devEUI"`
	Reference       string        `json:"reference"`
	Acknowledged    bool          `json:"acknowledged"`
	FCnt            uint32        `json:"fCnt"`
}

ACKNotification defines the payload sent to the application on an ACK event.

type DataDownPayload

type DataDownPayload struct {
	ApplicationID int64           `json:"applicationID,string"`
	DevEUI        lorawan.EUI64   `json:"devEUI"`
	Reference     string          `json:"reference"`
	Confirmed     bool            `json:"confirmed"`
	FPort         uint8           `json:"fPort"`
	Data          []byte          `json:"data"`
	Object        json.RawMessage `json:"object"`
}

DataDownPayload represents a data-down payload.

type DataRate

type DataRate struct {
	Modulation   string `json:"modulation"`
	Bandwidth    int    `json:"bandwidth"`
	SpreadFactor int    `json:"spreadFactor,omitempty"`
	Bitrate      int    `json:"bitrate,omitempty"`
}

DataRate contains the data-rate related fields.

type DataUpPayload

type DataUpPayload struct {
	ApplicationID       int64         `json:"applicationID,string"`
	ApplicationName     string        `json:"applicationName"`
	DeviceName          string        `json:"deviceName"`
	DevEUI              lorawan.EUI64 `json:"devEUI"`
	DeviceStatusBattery *int          `json:"deviceStatusBattery,omitempty"`
	DeviceStatusMargin  *int          `json:"deviceStatusMargin,omitempty"`
	RXInfo              []RXInfo      `json:"rxInfo,omitempty"`
	TXInfo              TXInfo        `json:"txInfo"`
	FCnt                uint32        `json:"fCnt"`
	FPort               uint8         `json:"fPort"`
	Data                []byte        `json:"data"`
	Object              interface{}   `json:"object,omitempty"`
}

DataUpPayload represents a data-up payload.

type ErrorNotification

type ErrorNotification struct {
	ApplicationID   int64         `json:"applicationID,string"`
	ApplicationName string        `json:"applicationName"`
	DeviceName      string        `json:"deviceName"`
	DevEUI          lorawan.EUI64 `json:"devEUI"`
	Type            string        `json:"type"`
	Error           string        `json:"error"`
	FCnt            uint32        `json:"fCnt,omitempty"`
}

ErrorNotification defines the payload sent to the application on an error event.

type Handler

type Handler interface {
	IntegrationHandler
	DataDownChan() chan DataDownPayload // returns DataDownPayload channel
}

Handler defines the interface of a handler backend.

type IntegrationHandler

type IntegrationHandler interface {
	SendDataUp(payload DataUpPayload) error                // send data-up payload
	SendJoinNotification(payload JoinNotification) error   // send join notification
	SendACKNotification(payload ACKNotification) error     // send ack notification
	SendErrorNotification(payload ErrorNotification) error // send error notification
	Close() error                                          // closes the handler
}

IntegrationHandler defines the interface of an integration handler.

type JoinNotification

type JoinNotification struct {
	ApplicationID   int64           `json:"applicationID,string"`
	ApplicationName string          `json:"applicationName"`
	DeviceName      string          `json:"deviceName"`
	DevEUI          lorawan.EUI64   `json:"devEUI"`
	DevAddr         lorawan.DevAddr `json:"devAddr"`
}

JoinNotification defines the payload sent to the application on a JoinNotificationType event.

type RXInfo

type RXInfo struct {
	MAC       lorawan.EUI64 `json:"mac"`
	Time      *time.Time    `json:"time,omitempty"`
	RSSI      int           `json:"rssi"`
	LoRaSNR   float64       `json:"loRaSNR"`
	Name      string        `json:"name"`
	Latitude  float64       `json:"latitude"`
	Longitude float64       `json:"longitude"`
	Altitude  float64       `json:"altitude"`
}

RXInfo contains the RX information.

type TXInfo

type TXInfo struct {
	Frequency int      `json:"frequency"`
	DataRate  DataRate `json:"dataRate"`
	ADR       bool     `json:"adr"`
	CodeRate  string   `json:"codeRate"`
}

TXInfo contains the TX information.

Directories

Path Synopsis
Package httphandler implements a HTTP handler
Package httphandler implements a HTTP handler
Package influxdbhandler implements a InfluxDB handler
Package influxdbhandler implements a InfluxDB handler
Package multihandler provides a multi handler.
Package multihandler provides a multi handler.

Jump to

Keyboard shortcuts

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