The SensorGroup class builds the syntactic template for its specific command that results from the sensor group definition and parses incoming sensor group data. More...
#include <sensorgroup.h>
Public Member Functions | |
| void | createSensorGroupCommand (Command &cmd, std::string &command) const |
| Get the generated sensor group command, that can be used to register this sensor group on the serial device. More... | |
| template<typename T > | |
| const bool | getChannelValue (const std::string &name, T &value) const |
| Get a received value from a certain channel. More... | |
| const bool | getChannelValueConverted (const std::string &name, double &value) const |
| Get a received converted value from a certain channel. More... | |
| const std::string & | getName () const |
| Get the name of this sensor group. More... | |
| void | processResponse (const std::string &response) |
| Parses an incoming sensor group message, extracts contained values and calls the registered sensor group callback. More... | |
| void | registerErrorCallback (valueErrorCallbackPtr valueError) |
| Register a value error function pointer to handle value errors during communication. More... | |
| SensorGroup () | |
| SensorGroup default constructor. More... | |
| SensorGroup (const SensorGroupParameter &sensorParams, std::shared_ptr< Syntax > syntax) | |
| SensorGroup constructor. More... | |
| void | setResponseCallback (responseCallback callbackFunction) |
| Register a sensor group callback. More... | |
| const bool | verifyResponseOnComand (Command &cmd, const std::string &response) const |
| Verfy the response on a constructed set sensor group command. More... | |
Static Public Attributes | |
| static const std::string | ENCODING_ASCII = "ASCII" |
| static const std::string | ENCODING_B64 = "B64" |
| static const std::string | ENCODING_HEX = "HEX" |
Private Member Functions | |
| void | parseResponse (const std::string &response) |
| Parse a received sensor channel message and extract channel values, i.e. convert encoded data to "proper" data types. More... | |
Private Attributes | |
| responseCallback | callbackFunction |
| bool | callbackRegistered |
| std::vector< std::shared_ptr< Channel > > | channelList |
| std::unordered_map< std::string, std::shared_ptr< Channel > > | channelMap |
| Parameter::ParameterMap | channelValues |
| Parameter::ParameterMap | cmdInputParams |
| std::string | grpName |
| unsigned char | grpNumber |
| std::vector< std::string > | optionsList |
| Parameter::ParameterMap | optionValues |
| std::vector< std::string > | optionVariableList |
| std::string | responseEncoding |
| std::shared_ptr< Syntax > | syntax |
| valueErrorCallbackPtr | valueError |
| bool | valueErrorCBSet |
The SensorGroup class builds the syntactic template for its specific command that results from the sensor group definition and parses incoming sensor group data.
A SensorGroup object builds its command message given the required channels and channel options. It can also parse incoming sensor group data and call a registered function which decides what to do with the received data.
Definition at line 82 of file sensorgroup.h.
| SensorGroup::SensorGroup | ( | ) |
SensorGroup default constructor.
Definition at line 13 of file sensorgroup.cpp.
| SensorGroup::SensorGroup | ( | const SensorGroupParameter & | sensorParams, |
| std::shared_ptr< Syntax > | syntax | ||
| ) |
SensorGroup constructor.
| [in] | sensorParams | serves as a data struct to configure SensorGroup a object. |
| [in] | syntax | Syntax object used to detect escape sequences and other important symbols. |
Definition at line 15 of file sensorgroup.cpp.
| void SensorGroup::createSensorGroupCommand | ( | Command & | cmd, |
| std::string & | command | ||
| ) | const |
Get the generated sensor group command, that can be used to register this sensor group on the serial device.
| [in] | cmd | Command object containing a set sensor group command |
| [out] | command | constructed set sensor group command |
Definition at line 208 of file sensorgroup.cpp.
|
inline |
Get a received value from a certain channel.
| [in] | name | sensor channel name |
| [out] | returned | (unconverted) value |
| std::exception |
Definition at line 143 of file sensorgroup.h.
| const bool SensorGroup::getChannelValueConverted | ( | const std::string & | name, |
| double & | value | ||
| ) | const |
Get a received converted value from a certain channel.
| [in] | name | sensor channel name |
| [out] | returned | converted value |
| std::exception |
Definition at line 223 of file sensorgroup.cpp.
| const std::string & SensorGroup::getName | ( | ) | const |
Get the name of this sensor group.
Definition at line 206 of file sensorgroup.cpp.
|
private |
Parse a received sensor channel message and extract channel values, i.e. convert encoded data to "proper" data types.
| [in] | response | posted sensor group message |
| std::exception |
Definition at line 116 of file sensorgroup.cpp.
| void SensorGroup::processResponse | ( | const std::string & | response | ) |
Parses an incoming sensor group message, extracts contained values and calls the registered sensor group callback.
| [in] | response | input sensor group message |
Definition at line 109 of file sensorgroup.cpp.
| void SensorGroup::registerErrorCallback | ( | valueErrorCallbackPtr | valueError | ) |
Register a value error function pointer to handle value errors during communication.
| [in] | valueError | this function decides what to do with the contents of a value error message |
Definition at line 200 of file sensorgroup.cpp.
| void SensorGroup::setResponseCallback | ( | responseCallback | callbackFunction | ) |
Register a sensor group callback.
| std::exception |
| [in] | callbackFunction | pointer to the function that gets call whenever this sensor group object receives a message. |
Definition at line 194 of file sensorgroup.cpp.
| const bool SensorGroup::verifyResponseOnComand | ( | Command & | cmd, |
| const std::string & | response | ||
| ) | const |
Verfy the response on a constructed set sensor group command.
| [in] | cmd | Command object containing a set sensor group command |
| [in] | response | response from the serial device |
| std::exception |
Definition at line 215 of file sensorgroup.cpp.
|
private |
Sensor group message callback pointer
Definition at line 173 of file sensorgroup.h.
|
private |
Has a group callback been registered?
Definition at line 174 of file sensorgroup.h.
|
private |
List of all channels in a sensor group.
Definition at line 168 of file sensorgroup.h.
|
private |
Map of Channel objects in this group (first: name, second Channel)
Definition at line 169 of file sensorgroup.h.
|
private |
Parameter map of received channel values
Definition at line 170 of file sensorgroup.h.
|
private |
Set group command input parameter map
Definition at line 175 of file sensorgroup.h.
|
static |
Constant Ascii encoding indicator
Definition at line 160 of file sensorgroup.h.
|
static |
Constant b64 encoding indicator
Definition at line 161 of file sensorgroup.h.
|
static |
Constant hex encoding indicator
Definition at line 162 of file sensorgroup.h.
|
private |
Optional semanitc descriptor of a group
Definition at line 166 of file sensorgroup.h.
|
private |
The unique identifier of a group
Definition at line 165 of file sensorgroup.h.
|
private |
List of enabled options for a group
Definition at line 176 of file sensorgroup.h.
|
private |
Parameter map of given option values
Definition at line 172 of file sensorgroup.h.
|
private |
List of parameter names for given options
Definition at line 171 of file sensorgroup.h.
|
private |
Encoding standard of a sensor group message
Definition at line 167 of file sensorgroup.h.
|
private |
Pointer to a Syntax object
Definition at line 177 of file sensorgroup.h.
|
private |
Pointer to the value error handling function
Definition at line 178 of file sensorgroup.h.
|
private |
Has a value error callback been registered?
Definition at line 179 of file sensorgroup.h.