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 ErrInvalidChannelType = errors.New("cayennelpp: unknown type")
ErrInvalidChannelType indicates that the channel type is invalid.
Functions ¶
This section is empty.
Types ¶
type Decoder ¶
type Decoder interface { DecodeUplink(target UplinkTarget) error DecodeDownlink(target DownlinkTarget) error }
Decoder decodes CayenneLPP encoded values.
func NewDecoder ¶
NewDecoder instantiates a CayenneLPP decoder.
type DownlinkTarget ¶
DownlinkTarget represents a target that processes decoded downlink values.
type Encoder ¶
type Encoder interface { Grow(n int) Bytes() []byte Reset() WriteTo(w io.Writer) (int64, error) AddPort(channel uint8, value float64) AddDigitalInput(channel, value uint8) AddDigitalOutput(channel, value uint8) AddAnalogInput(channel uint8, value float64) AddAnalogOutput(channel uint8, value float64) AddLuminosity(channel uint8, value uint16) AddPresence(channel, value uint8) AddTemperature(channel uint8, celcius float64) AddRelativeHumidity(channel uint8, rh float64) AddAccelerometer(channel uint8, x, y, z float64) AddBarometricPressure(channel uint8, hpa float64) AddGyrometer(channel uint8, x, y, z float64) AddGPS(channel uint8, latitude, longitude, meters float64) }
Encoder encodes values to CayenneLPP.
type UplinkTarget ¶
type UplinkTarget interface { DigitalInput(channel, value uint8) DigitalOutput(channel, value uint8) AnalogInput(channel uint8, value float64) AnalogOutput(channel uint8, value float64) Luminosity(channel uint8, value uint16) Presence(channel, value uint8) Temperature(channel uint8, celcius float64) RelativeHumidity(channel uint8, rh float64) Accelerometer(channel uint8, x, y, z float64) BarometricPressure(channel uint8, hpa float64) Gyrometer(channel uint8, x, y, z float64) GPS(channel uint8, latitude, longitude, altitude float64) }
UplinkTarget represents a target that processes decoded uplink values.
Click to show internal directories.
Click to hide internal directories.