integration

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HTTP        = "HTTP"
	InfluxDB    = "INFLUXDB"
	ThingsBoard = "THINGSBOARD"
)

Handler kinds

Variables

This section is empty.

Functions

func SetIntegration

func SetIntegration(i Integrator)

SetIntegration sets the given integration.

Types

type ACKNotification

type ACKNotification struct {
	ApplicationID   int64             `json:"applicationID,string"`
	ApplicationName string            `json:"applicationName"`
	DeviceName      string            `json:"deviceName"`
	DevEUI          lorawan.EUI64     `json:"devEUI"`
	Acknowledged    bool              `json:"acknowledged"`
	FCnt            uint32            `json:"fCnt"`
	Tags            map[string]string `json:"tags,omitempty"`
	Variables       map[string]string `json:"-"`
}

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"`
	Confirmed     bool            `json:"confirmed"`
	FPort         uint8           `json:"fPort"`
	Data          []byte          `json:"data"`
	Object        json.RawMessage `json:"object"`
}

DataDownPayload represents a data-down payload.

type DataUpPayload

type DataUpPayload struct {
	ApplicationID   int64             `json:"applicationID,string"`
	ApplicationName string            `json:"applicationName"`
	DeviceName      string            `json:"deviceName"`
	DevEUI          lorawan.EUI64     `json:"devEUI"`
	RXInfo          []RXInfo          `json:"rxInfo,omitempty"`
	TXInfo          TXInfo            `json:"txInfo"`
	ADR             bool              `json:"adr"`
	FCnt            uint32            `json:"fCnt"`
	FPort           uint8             `json:"fPort"`
	Data            []byte            `json:"data"`
	Object          interface{}       `json:"object,omitempty"`
	Tags            map[string]string `json:"tags,omitempty"`
	Variables       map[string]string `json:"-"`
}

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"`
	Tags            map[string]string `json:"tags,omitempty"`
	Variables       map[string]string `json:"-"`
}

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

type Integrator

type Integrator interface {
	SendDataUp(ctx context.Context, pl DataUpPayload) error                      // send data-up payload
	SendJoinNotification(ctx context.Context, pl JoinNotification) error         // send join notification
	SendACKNotification(ctx context.Context, pl ACKNotification) error           // send ack notification
	SendErrorNotification(ctx context.Context, pl ErrorNotification) error       // send error notification
	SendStatusNotification(ctx context.Context, pl StatusNotification) error     // send status notification
	SendLocationNotification(ctx context.Context, pl LocationNotification) error // send location notofication
	DataDownChan() chan DataDownPayload                                          // returns DataDownPayload channel
	Close() error                                                                // closes the handler
}

Integrator defines the interface that an intergration must implement.

func Integration

func Integration() Integrator

Integration returns the integration object.

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"`
	RXInfo          []RXInfo          `json:"rxInfo,omitempty"`
	TXInfo          TXInfo            `json:"txInfo"`
	Tags            map[string]string `json:"tags,omitempty"`
	Variables       map[string]string `json:"-"`
}

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

type Location

type Location struct {
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`
	Altitude  float64 `json:"altitude"`
}

Location details.

type LocationNotification

type LocationNotification struct {
	ApplicationID   int64             `json:"applicationID,string"`
	ApplicationName string            `json:"applicationName"`
	DeviceName      string            `json:"deviceName"`
	DevEUI          lorawan.EUI64     `json:"devEUI"`
	Location        Location          `json:"location"`
	Tags            map[string]string `json:"tags,omitempty"`
	Variables       map[string]string `json:"-"`
}

LocationNotification defines the payload sent to the application after the device location has been resolved by a geolocation-server.

type RXInfo

type RXInfo struct {
	GatewayID lorawan.EUI64 `json:"gatewayID"`
	UplinkID  uuid.UUID     `json:"uplinkID"`
	Name      string        `json:"name"`
	Time      *time.Time    `json:"time,omitempty"`
	RSSI      int           `json:"rssi"`
	LoRaSNR   float64       `json:"loRaSNR"`
	Location  *Location     `json:"location"`
}

RXInfo contains the RX information.

type StatusNotification

type StatusNotification struct {
	ApplicationID           int64             `json:"applicationID,string"`
	ApplicationName         string            `json:"applicationName"`
	DeviceName              string            `json:"deviceName"`
	DevEUI                  lorawan.EUI64     `json:"devEUI"`
	Battery                 int               `json:"battery"`
	Margin                  int               `json:"margin"`
	ExternalPowerSource     bool              `json:"externalPowerSource"`
	BatteryLevel            float32           `json:"batteryLevel"`
	BatteryLevelUnavailable bool              `json:"batteryLevelUnavailable"`
	Tags                    map[string]string `json:"tags,omitempty"`
	Variables               map[string]string `json:"-"`
}

StatusNotification defines the payload sent to the application on a device-status reporting.

type TXInfo

type TXInfo struct {
	Frequency int `json:"frequency"`
	DR        int `json:"dr"`
}

TXInfo contains the TX information.

Directories

Path Synopsis
Package application implements a wrapper for application integrations.
Package application implements a wrapper for application integrations.
Package awssns implements an AWS NSN integration.
Package awssns implements an AWS NSN integration.
Package azureservicebus implements an Azure Service-Bus integration.
Package azureservicebus implements an Azure Service-Bus integration.
Package http implements a HTTP integration.
Package http implements a HTTP integration.
Package influxdb implements a InfluxDB integration.
Package influxdb implements a InfluxDB integration.
Package multi implements a multi-integration handler.
Package multi implements a multi-integration handler.

Jump to

Keyboard shortcuts

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