BeeeOn Gateway  v2020.3.1-2-g6f737dc
Platform to interconnect the IoT world
Public Member Functions | Static Public Member Functions | Data Fields
BeeeOn::JablotronReport Struct Reference

Report with data coming from a sensor. Each report comes in format [AAAAAAAA] TYPE PAYLOAD. The AAAAAAAA is an address in decadic format. The TYPE represents type of the device. The PAYLOAD contains the actual report that depends on the TYPE. More...

#include <JablotronReport.h>

Public Member Functions

 operator bool () const
 
bool operator! () const
 
bool has (const std::string &keyword, bool hasValue=false) const
 Search the payload for a keyword like BEACON, SENSOR, etc. More...
 
int get (const std::string &keyword) const
 
double temperature (const std::string &keyword) const
 Almost same logic as for JablotronReport::get(), just the value is expected in the temperature format ##.#. More...
 
unsigned int battery () const
 It calls JablotronReport::get("LB") internally and interprets the value as 1 - 5 % and 0 - 100 %. More...
 
std::string toString () const
 

Static Public Member Functions

static JablotronReport invalid ()
 

Data Fields

const uint32_t address
 Address of the source device.
 
const std::string type
 Type of device.
 
const std::string data
 Data payload.
 

Detailed Description

Report with data coming from a sensor. Each report comes in format [AAAAAAAA] TYPE PAYLOAD. The AAAAAAAA is an address in decadic format. The TYPE represents type of the device. The PAYLOAD contains the actual report that depends on the TYPE.

Member Function Documentation

unsigned int JablotronReport::battery ( ) const

It calls JablotronReport::get("LB") internally and interprets the value as 1 - 5 % and 0 - 100 %.

Returns
battery status in percents
Exceptions
Poco::NotFoundExceptionis no such keyword with value is present in the payload
int JablotronReport::get ( const std::string &  keyword) const
Returns
value associated with the given keyword
Exceptions
Poco::NotFoundExceptionis no such keyword with value is present in the payload
bool JablotronReport::has ( const std::string &  keyword,
bool  hasValue = false 
) const

Search the payload for a keyword like BEACON, SENSOR, etc.

If the argument hasValue is true then it is assumed that the keyword has a value separated by colon. In such case, data like BEACON are ignored due to a missing value. This is useful to search payload for e.g. ACT:0, ACT:1, etc.

JablotronReport JablotronReport::invalid ( )
static
Returns
an invalid report
JablotronReport::operator bool ( ) const
Returns
true if the report is valid.
bool JablotronReport::operator! ( ) const
Returns
true if the report is invalid.
double JablotronReport::temperature ( const std::string &  keyword) const

Almost same logic as for JablotronReport::get(), just the value is expected in the temperature format ##.#.

Returns
temperature value associated with the given keyword.
Exceptions
Poco::SyntaxExceptionif value is not in a valid temperature format
Poco::NotFoundExceptionis no such keyword with value is present in the payload
string JablotronReport::toString ( ) const
Returns
string representation of the report

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