Maintainer | srk <srk@48.io> |
---|---|
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Encoding example:
import qualified Data.Cayenne as CLPP import qualified Data.ByteString.Base16.Lazy as B16L import qualified Data.ByteString.Lazy.Char8 as BSL BSL.putStrLn $ B16L.encode . CLPP.encodeMany [(7, Illum 1337), (0, Power 13.5)]
Synopsis
- data Sensor
- = DigitalIn Word8
- | DigitalOut Word8
- | AnalogIn Float
- | AnalogOut Float
- | Illum Word16
- | Presence Word8
- | Temperature Float
- | Humidity Float
- | Accelerometer Float Float Float
- | Barometer Float
- | Voltage Float
- | Current Float
- | Percentage Float
- | Pressure Float
- | Power Float
- | Energy Float
- | Direction Float
- | Gyrometer Float Float Float
- | GPS Float Float Float
- type Channel = Int
- type Reading = (Channel, Sensor)
- encode :: Reading -> ByteString
- encodeMany :: [Reading] -> ByteString
- decode :: ByteString -> Reading
- decodeMany :: ByteString -> [Reading]
- decodeMaybe :: ByteString -> Maybe Reading
Documentation
DigitalIn Word8 | Digital input (8 bits) |
DigitalOut Word8 | Digital output (8 bits) |
AnalogIn Float | Analog input |
AnalogOut Float | Analog output |
Illum Word16 | Illuminance sensor (Lux) |
Presence Word8 | Presence |
Temperature Float | Temperature (Celsius) |
Humidity Float | Humidity (%) |
Accelerometer Float Float Float | Accelerometer (G) |
Barometer Float | Barometer (hPa) |
Voltage Float | Voltage (V) |
Current Float | Current (A) |
Percentage Float | Percentage |
Pressure Float | Pressure |
Power Float | Power (W) |
Energy Float | Energy (J) |
Direction Float | Angle (Deg) |
Gyrometer Float Float Float | Gyrometer (°/s) |
GPS Float Float Float | GPS Latitude (°) ,Longitude (°), Altitude (m) |
Instances
encodeMany :: [Reading] -> ByteString Source #
Encode a list of Reading
s
decodeMany :: ByteString -> [Reading] Source #
Decode multiple Reading
s, returns empty list if nothing is decoded
decodeMaybe :: ByteString -> Maybe Reading Source #
Maybe decode a single Reading