ThingsBoard Client SDK 0.16.0
Client SDK to connect with ThingsBoard IoT Platform from IoT devices (Arduino, Espressif, etc.)
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
Telemetry Class Reference

Telemetry record class, allows to store different data using a common interface. More...

#include <Telemetry.h>

Public Member Functions

 Telemetry ()
 Creates an empty Telemetry record containg neither a key nor value. More...
 
template<typename T , typename std::enable_if< std::is_integral< T >::value >::type * = nullptr>
 Telemetry (char const *key, T const &value)
 Constructs a telemetry record from integral value. More...
 
template<typename T , typename std::enable_if< std::is_floating_point< T >::value >::type * = nullptr>
 Telemetry (char const *key, T const &value)
 Constructs a telemetry record from floating point value. More...
 
 Telemetry (char const *key, bool value)
 Constructs a telemetry record from boolean value. More...
 
 Telemetry (char const *key, char const *value)
 Constructs a telemetry record from string value. More...
 
bool IsEmpty () const
 Whether this record is empty or not. More...
 
template<typename TSource >
bool SerializeKeyValue (TSource &source) const
 Serializes a key-value pair or only a value, depending on the constructor used. More...
 

Detailed Description

Telemetry record class, allows to store different data using a common interface.

Note
Is used to allow to easily create a key-value pair of multiple different types that can then be deserialized into a json message

Constructor & Destructor Documentation

◆ Telemetry() [1/5]

Telemetry::Telemetry ( )

Creates an empty Telemetry record containg neither a key nor value.

◆ Telemetry() [2/5]

template<typename T , typename std::enable_if< std::is_integral< T >::value >::type * = nullptr>
Telemetry::Telemetry ( char const *  key,
T const &  value 
)
inline

Constructs a telemetry record from integral value.

Template Parameters
TType of the passed value, is required to be integral, to ensure this constructor isn't used instead of the float one by mistake
Parameters
keyKey of the key-value pair we want to create
valueValue of the key-value pair we want to create

◆ Telemetry() [3/5]

template<typename T , typename std::enable_if< std::is_floating_point< T >::value >::type * = nullptr>
Telemetry::Telemetry ( char const *  key,
T const &  value 
)
inline

Constructs a telemetry record from floating point value.

Template Parameters
TType of the passed value, is required to be a floating point, to ensure this constructor isn't used instead of the boolean one by mistake
Parameters
keyKey of the key-value pair we want to create
valueValue of the key-value pair we want to create

◆ Telemetry() [4/5]

Telemetry::Telemetry ( char const *  key,
bool  value 
)

Constructs a telemetry record from boolean value.

Parameters
keyKey of the key-value pair we want to create
valueValue of the key-value pair we want to create

◆ Telemetry() [5/5]

Telemetry::Telemetry ( char const *  key,
char const *  value 
)

Constructs a telemetry record from string value.

Parameters
keyKey of the key-value pair we want to create
valueValue of the key-value pair we want to create

Member Function Documentation

◆ IsEmpty()

bool Telemetry::IsEmpty ( ) const

Whether this record is empty or not.

Returns
Whether there is any data in this record or not

◆ SerializeKeyValue()

template<typename TSource >
bool Telemetry::SerializeKeyValue ( TSource &  source) const
inline

Serializes a key-value pair or only a value, depending on the constructor used.

Template Parameters
TSourceSource class that the given key-value pair or only a value, should be copied into
Parameters
sourceData source that should contain the key-value pair or a value
Returns
Whether serializing was successful or not

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