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

Public Member Functions | List of all members
CayenneLPP Class Reference

A simple Cayenne LPP message builder class. More...

`#include <Cayenne/CayenneLPP.h>`

## Public Member Functions
| CayenneLPP (uint8_t *buf, uint8_t size)
| Constructor of a simple Cayenne LPP wrapper. More...
| ~CayenneLPP ()
| Destructor.
void | reset (void)
| reset all internal data. Should by called prior building a new message
uint8_t | getSize (void)
| get the current size of the build message in bytes More...
uint8_t * | getBuffer (void)
| get a pointer to the internal data buffer More...
uint8_t | copy (uint8_t *buffer)
| copy the build up message to an external buffer More...
uint8_t | addDigitalInput (uint8_t channel, uint8_t value)
| intert value of type "digital input" into the message More...
uint8_t | addDigitalOutput (uint8_t channel, uint8_t value)
| intert value of type "digital output" into the message More...
uint8_t | addAnalogInput (uint8_t channel, float value)
| intert value of type "analog input" into the message More...
uint8_t | addAnalogOutput (uint8_t channel, float value)
| intert value of type "digital output" into the message More...
uint8_t | addLuminosity (uint8_t channel, uint16_t lux)
| intert value of type "Luminosity" into the message More...
uint8_t | addPresence (uint8_t channel, uint8_t value)
| intert value of type "presence" into the message More...
uint8_t | addTemperature (uint8_t channel, float celsius)
| intert value of type "temperature" into the message More...
uint8_t | addRelativeHumidity (uint8_t channel, float rh)
| intert value of type "relative humidity" into the message More...
uint8_t | addAccelerometer (uint8_t channel, float x, float y, float z)
| intert value of type "accelerometer" into the message More...
uint8_t | addBarometricPressure (uint8_t channel, float hpa)
| intert value of type "barometric pressure" into the message More...
uint8_t | addGyrometer (uint8_t channel, float x, float y, float z)
| intert value of type "gyrometer" into the message More...
uint8_t | addGPS (uint8_t channel, float latitude, float longitude, float meters)
| intert value of type "GPS" into the message More...
uint8_t | addCustomValue (uint8_t channel, uint8_t type, uint8_t valueSize, uint8_t *value)
| function to add a generic value More...

## Detailed Description

A simple Cayenne LPP message builder class.

See also
  Mydevices documentation

## Constructor & Destructor Documentation

## ◆ CayenneLPP()

CayenneLPP::CayenneLPP | ( | uint8_t * | buf,
|  | uint8_t | size
| ) |  |

Constructor of a simple Cayenne LPP wrapper.

Parameters

  buf | Pointer to a buffer where to build up cayenne compliant messages
  size | (max) size of the buffer in bytes

#include <Cayenne/CayenneLPP.h>
#define BUF_SIZE_CAYENNE 80
// buffer for cayenne
uint8_t bufCayenne[80];
// cayenne translation object
CayenneLPP cayenne(bufCayenne, BUF_SIZE_CAYENNE);
...
}

Orginal code: Mydevices documentation

## Member Function Documentation

## ◆ addAccelerometer()

uint8_t CayenneLPP::addAccelerometer | ( | uint8_t | channel,
|  | float | x,
|  | float | y,
|  | float | z
| ) |  |

intert value of type "accelerometer" into the message

Parameters

  channel | the number of the channel to use
  x | the value of the x-axis
  y | the value of the y-axis
  z | the value of the z-axis

Returns
  the number of bytes currently used by the inserted values / size of the total message

## ◆ addAnalogInput()

uint8_t CayenneLPP::addAnalogInput | ( | uint8_t | channel,
|  | float | value
| ) |  |

intert value of type "analog input" into the message

Parameters

  channel | the number of the channel to use
  value | the value of the analog input

Returns
  the number of bytes currently used by the inserted values / size of the total message

## ◆ addAnalogOutput()

uint8_t CayenneLPP::addAnalogOutput | ( | uint8_t | channel,
|  | float | value
| ) |  |

intert value of type "digital output" into the message

Parameters

  channel | the number of the channel to use
  value | the value of the digital output

Returns
  the number of bytes currently used by the inserted values / size of the total message

## ◆ addBarometricPressure()

uint8_t CayenneLPP::addBarometricPressure | ( | uint8_t | channel,
|  | float | hpa
| ) |  |

intert value of type "barometric pressure" into the message

Parameters

  channel | the number of the channel to use
  hpa | the value of the presure

Returns
  the number of bytes currently used by the inserted values / size of the total message

## ◆ addCustomValue()

uint8_t CayenneLPP::addCustomValue | ( | uint8_t | channel,
|  | uint8_t | type,
|  | uint8_t | valueSize,
|  | uint8_t * | value
| ) |  |

function to add a generic value

This function can be used to add a value of a "sensor" type that is currently not pre-defines as API function. The type of sensor can be manually defined here

Parameters

  channel | the number of the channel to use
  type | the type of sensor to add
  valueSize | number of byte of the value to add
  value | pointer to the sensor value itself

Returns
  the number of bytes currently used by the inserted values / size of the total message

## ◆ addDigitalInput()

uint8_t CayenneLPP::addDigitalInput | ( | uint8_t | channel,
|  | uint8_t | value
| ) |  |

intert value of type "digital input" into the message

Parameters

  channel | the number of the channel to use
  value | the value of the digital input

Returns
  the number of bytes currently used by the inserted values / size of the total message

## ◆ addDigitalOutput()

uint8_t CayenneLPP::addDigitalOutput | ( | uint8_t | channel,
|  | uint8_t | value
| ) |  |

intert value of type "digital output" into the message

Parameters

  channel | the number of the channel to use
  value | the value of the digital output

Returns
  the number of bytes currently used by the inserted values / size of the total message

## ◆ addGPS()

uint8_t CayenneLPP::addGPS | ( | uint8_t | channel,
|  | float | latitude,
|  | float | longitude,
|  | float | meters
| ) |  |

intert value of type "GPS" into the message

Parameters

  channel | the number of the channel to use
  latitude | latitude infos
  longitude | longitude infos
  meters | hight

Returns
  the number of bytes currently used by the inserted values / size of the total message

## ◆ addGyrometer()

uint8_t CayenneLPP::addGyrometer | ( | uint8_t | channel,
|  | float | x,
|  | float | y,
|  | float | z
| ) |  |

intert value of type "gyrometer" into the message

Parameters

  channel | the number of the channel to use
  x | the value of the x-axis
  y | the value of the y-axis
  z | the value of the z-axis

Returns
  the number of bytes currently used by the inserted values / size of the total message

## ◆ addLuminosity()

uint8_t CayenneLPP::addLuminosity | ( | uint8_t | channel,
|  | uint16_t | lux
| ) |  |

intert value of type "Luminosity" into the message

Parameters

  channel | the number of the channel to use
  lux | the value of the luminosity

Returns
  the number of bytes currently used by the inserted values / size of the total message

## ◆ addPresence()

uint8_t CayenneLPP::addPresence | ( | uint8_t | channel,
|  | uint8_t | value
| ) |  |

intert value of type "presence" into the message

Parameters

  channel | the number of the channel to use
  value | the value of the presence

Returns
  the number of bytes currently used by the inserted values / size of the total message

## ◆ addRelativeHumidity()

uint8_t CayenneLPP::addRelativeHumidity | ( | uint8_t | channel,
|  | float | rh
| ) |  |

intert value of type "relative humidity" into the message

Parameters

  channel | the number of the channel to use
  rh | the value of the relative humidity

Returns
  the number of bytes currently used by the inserted values / size of the total message

## ◆ addTemperature()

uint8_t CayenneLPP::addTemperature | ( | uint8_t | channel,
|  | float | celsius
| ) |  |

intert value of type "temperature" into the message

Parameters

  channel | the number of the channel to use
  celsius | the value of the temperature

Returns
  the number of bytes currently used by the inserted values / size of the total message

## ◆ copy()

uint8_t CayenneLPP::copy | ( | uint8_t * | dst | ) |

copy the build up message to an external buffer

Parameters

  dst | destination buffer where to copy the data to. WARNING: the destination must be big enough

Returns
  number of bytes copied

## ◆ getBuffer()

uint8_t * CayenneLPP::getBuffer | ( | void |  | ) |

get a pointer to the internal data buffer

Returns
  pointer to the internal buffer

## ◆ getSize()

uint8_t CayenneLPP::getSize | ( | void |  | ) |

get the current size of the build message in bytes

Returns
  number of bytes for the build up message

The documentation for this class was generated from the following files:

- Cayenne/CayenneLPP.h
- Cayenne/CayenneLPP.cpp

CayenneLPP
A simple Cayenne LPP message builder class.
Definition: CayenneLPP.h:47
CayenneLPP.h