cayennelpp

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2017 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DigitalInput (1 byte)
	DigitalInput = 0
	// DigitalOutput (1 byte)
	DigitalOutput = 1
	// AnalogInput (2 bytes, 0.01 signed)
	AnalogInput = 2
	// AnalogOutput (2 bytes, 0.01 signed)
	AnalogOutput = 3
	// Luminosity (2 bytes, 1 lux unsigned)
	Luminosity = 101
	// Presence (1 byte, 1)
	Presence = 102
	// Temperature (2 bytes, 0.1°C signed)
	Temperature = 103
	// RelativeHumidity (1 byte, 0.5% unsigned )
	RelativeHumidity = 104
	// Accelerometer 2 bytes per axis, 0.001G
	Accelerometer = 113
	// BarometricPressure (2 bytes 0.1 hPa Unsigned)
	BarometricPressure = 115
	// Gyrometer (2 bytes per axis, 0.01 °/s)
	Gyrometer = 134
	// GPS (3 byte lon/lat 0.0001 °, 3 bytes alt 0.01 meter)
	GPS = 136
)

Variables

View Source
var ErrInvalidChannel = errors.New("cayennelpp: unknown type")

Functions

This section is empty.

Types

type Decoder

type Decoder interface {
	DecodeUplink(target UplinkTarget) error
	DecodeDownlink(target DownlinkTarget) error
}

func NewDecoder

func NewDecoder(r io.Reader) Decoder

type DownlinkTarget

type DownlinkTarget interface {
	Port(channel uint8, value float32)
}

type Encoder

type Encoder interface {
	Grow(n int)
	Bytes() []byte
	WriteTo(w io.Writer) (int64, error)
	AddPort(channel uint8, value float32)
	AddDigitalInput(channel, value uint8)
	AddDigitalOutput(channel, value uint8)
	AddAnalogInput(channel uint8, value float32)
	AddAnalogOutput(channel uint8, value float32)
	AddLuminosity(channel uint8, value uint16)
	AddPresence(channel, value uint8)
	AddTemperature(channel uint8, celcius float32)
	AddRelativeHumidity(channel uint8, rh float32)
	AddAccelerometer(channel uint8, x, y, z float32)
	AddBarometricPressure(channel uint8, hpa float32)
	AddGyrometer(channel uint8, x, y, z float32)
	AddGPS(channel uint8, latitude, longitude, meters float32)
}

func NewEncoder

func NewEncoder() Encoder

type UplinkTarget

type UplinkTarget interface {
	DigitalInput(channel, value uint8)
	DigitalOutput(channel, value uint8)
	AnalogInput(channel uint8, value float32)
	AnalogOutput(channel uint8, value float32)
	Luminosity(channel uint8, value uint16)
	Presence(channel, value uint8)
	Temperature(channel uint8, celcius float32)
	RelativeHumidity(channel uint8, rh float32)
	Accelerometer(channel uint8, x, y, z float32)
	BarometricPressure(channel uint8, hpa float32)
	Gyrometer(channel uint8, x, y, z float32)
	GPS(channel uint8, latitude, longitude, altitude float32)
}

Jump to

Keyboard shortcuts

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