| Demo HCI Implementation for WiMOD-LR Devices V2.0.3

CayenneLPP.h
Go to the documentation of this file.
1 /*
2 * CayenneLPP.h
3 *
4 * Created on: Feb 10, 2017
5 * Author: FB
6 */
7
8 //------------------------------------------------------------------------------
24 //------------------------------------------------------------------------------
25
26
27 #ifndef ARDUINO_CAYENNE_CAYENNELPP_H_
28 #define ARDUINO_CAYENNE_CAYENNELPP_H_
29
30 //------------------------------------------------------------------------------
31 //
32 // Section Includes Files
33 //
34 //------------------------------------------------------------------------------
35
36 #include <stdint.h>
37
38
39
40 // source: https://mdswp-staging.mydevices.com/cayenne/docs/#lora
41
47 class CayenneLPP {
48 public:
49 CayenneLPP(uint8_t* buf, uint8_t size);
50 ~CayenneLPP();
51
52 void reset(void);
53 uint8_t getSize(void);
54 uint8_t* getBuffer(void);
55 uint8_t copy(uint8_t* buffer);
56
57 uint8_t addDigitalInput(uint8_t channel, uint8_t value);
58 uint8_t addDigitalOutput(uint8_t channel, uint8_t value);
59
60 uint8_t addAnalogInput(uint8_t channel, float value);
61 uint8_t addAnalogOutput(uint8_t channel, float value);
62
63 uint8_t addLuminosity(uint8_t channel, uint16_t lux);
64 uint8_t addPresence(uint8_t channel, uint8_t value);
65 uint8_t addTemperature(uint8_t channel, float celsius);
66 uint8_t addRelativeHumidity(uint8_t channel, float rh);
67 uint8_t addAccelerometer(uint8_t channel, float x, float y, float z);
68 uint8_t addBarometricPressure(uint8_t channel, float hpa);
69 uint8_t addGyrometer(uint8_t channel, float x, float y, float z);
70 uint8_t addGPS(uint8_t channel, float latitude, float longitude, float meters);
71
72 uint8_t addCustomValue(uint8_t channel, uint8_t type, uint8_t valueSize, uint8_t* value);
73 private:
74 uint8_t *buffer;
75 uint8_t maxsize;
76 uint8_t cursor;
77 };
78
79 #endif /* ARDUINO_CAYENNE_CAYENNELPP_H_ */
CayenneLPP::addDigitalInput
uint8_t addDigitalInput(uint8_t channel, uint8_t value)
intert value of type "digital input" into the message
Definition: CayenneLPP.cpp:153
CayenneLPP::addPresence
uint8_t addPresence(uint8_t channel, uint8_t value)
intert value of type "presence" into the message
Definition: CayenneLPP.cpp:264
CayenneLPP
A simple Cayenne LPP message builder class.
Definition: CayenneLPP.h:47
CayenneLPP::CayenneLPP
CayenneLPP(uint8_t *buf, uint8_t size)
Constructor of a simple Cayenne LPP wrapper.
Definition: CayenneLPP.cpp:75
CayenneLPP::copy
uint8_t copy(uint8_t *buffer)
copy the build up message to an external buffer
Definition: CayenneLPP.cpp:136
CayenneLPP::getSize
uint8_t getSize(void)
get the current size of the build message in bytes
Definition: CayenneLPP.cpp:109
CayenneLPP::addGyrometer
uint8_t addGyrometer(uint8_t channel, float x, float y, float z)
intert value of type "gyrometer" into the message
Definition: CayenneLPP.cpp:387
CayenneLPP::addRelativeHumidity
uint8_t addRelativeHumidity(uint8_t channel, float rh)
intert value of type "relative humidity" into the message
Definition: CayenneLPP.cpp:308
CayenneLPP::addDigitalOutput
uint8_t addDigitalOutput(uint8_t channel, uint8_t value)
intert value of type "digital output" into the message
Definition: CayenneLPP.cpp:173
CayenneLPP::addAnalogOutput
uint8_t addAnalogOutput(uint8_t channel, float value)
intert value of type "digital output" into the message
Definition: CayenneLPP.cpp:218
CayenneLPP::addTemperature
uint8_t addTemperature(uint8_t channel, float celsius)
intert value of type "temperature" into the message
Definition: CayenneLPP.cpp:285
CayenneLPP::addLuminosity
uint8_t addLuminosity(uint8_t channel, uint16_t lux)
intert value of type "Luminosity" into the message
Definition: CayenneLPP.cpp:242
CayenneLPP_constants.h
CayenneLPP::addCustomValue
uint8_t addCustomValue(uint8_t channel, uint8_t type, uint8_t valueSize, uint8_t *value)
function to add a generic value
Definition: CayenneLPP.cpp:460
CayenneLPP::getBuffer
uint8_t * getBuffer(void)
get a pointer to the internal data buffer
Definition: CayenneLPP.cpp:121
CayenneLPP::~CayenneLPP
~CayenneLPP()
Destructor.
Definition: CayenneLPP.cpp:88
CayenneLPP::reset
void reset(void)
reset all internal data. Should by called prior building a new message
Definition: CayenneLPP.cpp:97
CayenneLPP.h
CayenneLPP::addAccelerometer
uint8_t addAccelerometer(uint8_t channel, float x, float y, float z)
intert value of type "accelerometer" into the message
Definition: CayenneLPP.cpp:331
CayenneLPP::addGPS
uint8_t addGPS(uint8_t channel, float latitude, float longitude, float meters)
intert value of type "GPS" into the message
Definition: CayenneLPP.cpp:419
CayenneLPP::addBarometricPressure
uint8_t addBarometricPressure(uint8_t channel, float hpa)
intert value of type "barometric pressure" into the message
Definition: CayenneLPP.cpp:361
CayenneLPP::addAnalogInput
uint8_t addAnalogInput(uint8_t channel, float value)
intert value of type "analog input" into the message
Definition: CayenneLPP.cpp:194