Skip to content

DistRap/ivory-tower-cayenne

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ivory-tower-cayenne

Encode sensor data with Cayenne Low Power Protocol

Usage

To create a message containing Temperature and Humidity readings and pack it into string use the following example:

import Ivory.Tower.Cayenne

...

(arr :: Ref ('Stack s) ('Array len ('Stored Uint8))) <- local $ izero
len <- packCayenne arr [
    Temperature (lastSample ~> sample_th_temperature)
  , Humidity    (lastSample ~> sample_th_humidity)
  ]

(strbuf :: Ref ('Stack s) UARTBuffer) <- local $ izero
refCopy (strbuf ~> stringDataL) arr
store (strbuf ~> stringLengthL) (signCast len)

It is also possible to specify sensor channels with packCayenneChannels like this:

len <- packCayenneChannels arr [
    (0, Temperature (sample0 ~> sample_th_temperature))
    (1, Temperature (sample1 ~> sample_th_temperature))
  ]

About

Cayenne LPP packing for Ivory/Tower

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published