codec

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: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Accelerometer

type Accelerometer struct {
	X float64 `json:"x"`
	Y float64 `json:"y"`
	Z float64 `json:"z"`
}

Accelerometer defines the accelerometer data.

type CayenneLPP

type CayenneLPP struct {
	DigitalInput      map[byte]uint8         `json:"digitalInput,omitempty" influxdb:"digital_input"`
	DigitalOutput     map[byte]uint8         `json:"digitalOutput,omitempty" influxdb:"digital_output"`
	AnalogInput       map[byte]float64       `json:"analogInput,omitempty" influxdb:"analog_input"`
	AnalogOutput      map[byte]float64       `json:"analogOutput,omitempty" influxdb:"analog_output"`
	IlluminanceSensor map[byte]uint16        `json:"illuminanceSensor,omitempty" influxdb:"illuminance_sensor"`
	PresenceSensor    map[byte]uint8         `json:"presenceSensor,omitempty" influxdb:"presence_sensor"`
	TemperatureSensor map[byte]float64       `json:"temperatureSensor,omitempty" influxdb:"temperature_sensor"`
	HumiditySensor    map[byte]float64       `json:"humiditySensor,omitempty" influxdb:"humidity_sensor"`
	Accelerometer     map[byte]Accelerometer `json:"accelerometer,omitempty" influxdb:"accelerometer"`
	Barometer         map[byte]float64       `json:"barometer,omitempty" influxdb:"barometer"`
	Gyrometer         map[byte]Gyrometer     `json:"gyrometer,omitempty" influxdb:"gyrometer"`
	GPSLocation       map[byte]GPSLocation   `json:"gpsLocation,omitempty" influxdb:"gps_location"`
}

CayenneLPP defines the Cayenne LPP data structure.

func (*CayenneLPP) DecodeBytes

func (c *CayenneLPP) DecodeBytes(data []byte) error

DecodeBytes decodes the payload from a slice of bytes.

func (CayenneLPP) EncodeToBytes

func (c CayenneLPP) EncodeToBytes() ([]byte, error)

EncodeToBytes encodes the payload to a slice of bytes.

func (CayenneLPP) Object

func (c CayenneLPP) Object() interface{}

Object returns the CayenneLPP data object.

type GPSLocation

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

GPSLocation defines the GPS location data.

type Gyrometer

type Gyrometer struct {
	X float64 `json:"x"`
	Y float64 `json:"y"`
	Z float64 `json:"z"`
}

Gyrometer defines the gyrometer data.

type Payload

type Payload interface {
	DecodeBytes(data []byte) error
	EncodeToBytes() ([]byte, error)
	Object() interface{}
}

Payload defines a codec payload.

func NewPayload

func NewPayload(t Type, fPort uint8, encodeScript, decodeScript string) Payload

NewPayload returns a new codec payload. In case of an unknown Type, nil is returned.

type Type

type Type string

Type defines the codec type.

const (
	CayenneLPPType Type = "CAYENNE_LPP"
	CustomJSType   Type = "CUSTOM_JS"
)

Available codec types.

Jump to

Keyboard shortcuts

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