sensorgroup.h
Go to the documentation of this file.
1 
7 #ifndef SENSORGROUP_H
8 #define SENSORGROUP_H
9 
10 #include <vector>
11 #include <string>
15 #include <boost/range/algorithm/remove_if.hpp>
17 
24 struct Channel
25 {
26  std::string chName;
27  std::string dataType;
28  bool
31 };
32 
43 {
44  std::string grpName;
45  unsigned char grpNumber;
46  std::vector<std::shared_ptr<Channel>>
48  std::vector<std::pair<std::shared_ptr<CommandOptions>, std::string>>
51  std::string encoding;
52 };
53 
54 class SensorGroup;
55 
63 typedef boost::function<void(SensorGroup*)> responseCallback;
69 typedef boost::function<void(const std::string&)> valueErrorCallbackPtr;
70 
83 {
84 public:
88  SensorGroup();
96  SensorGroup(const SensorGroupParameter& sensorParams,
97  std::shared_ptr<Syntax> syntax);
102  void processResponse(const std::string& response);
108  void setResponseCallback(responseCallback callbackFunction);
113  void registerErrorCallback(valueErrorCallbackPtr valueError);
118  const std::string& getName() const;
124  void createSensorGroupCommand(Command& cmd, std::string& command) const;
132  const bool verifyResponseOnComand(Command& cmd,
133  const std::string& response) const;
134 
142  template <typename T>
143  inline const bool getChannelValue(const std::string& name, T& value) const
144  {
145  if (!channelValues.isParamInMap(name))
146  return false;
147  channelValues.getParameterValue(name, value);
148  return true;
149  }
157  const bool getChannelValueConverted(const std::string& name,
158  double& value) const;
159 
160  static const std::string ENCODING_ASCII;
161  static const std::string ENCODING_B64;
162  static const std::string ENCODING_HEX;
164 private:
165  unsigned char grpNumber;
166  std::string grpName;
167  std::string responseEncoding;
168  std::vector<std::shared_ptr<Channel>> channelList;
169  std::unordered_map<std::string, std::shared_ptr<Channel>> channelMap;
171  std::vector<std::string> optionVariableList;
176  std::vector<std::string> optionsList;
177  std::shared_ptr<Syntax> syntax;
186  void parseResponse(const std::string& response);
187 };
188 
189 #endif // SENSORGROUP_H
static const std::string ENCODING_B64
Definition: sensorgroup.h:161
std::vector< std::pair< std::shared_ptr< CommandOptions >, std::string > > options
Definition: sensorgroup.h:49
const bool getChannelValue(const std::string &name, T &value) const
Get a received value from a certain channel.
Definition: sensorgroup.h:143
std::string encoding
Definition: sensorgroup.h:51
boost::function< void(SensorGroup *)> responseCallback
Definition: sensorgroup.h:63
std::string grpName
Definition: sensorgroup.h:166
Header file for the Command class.
valueErrorCallbackPtr valueError
Definition: sensorgroup.h:178
The Channel class serves as a data struct to store sensor channel parameter.
Definition: sensorgroup.h:24
The Parameter::ParameterMap class provides a map functionality for Parameter::Parameter objects conta...
Definition: parameter.h:163
The SensorGroupParameter class serves as a data struct to configure SensorGroup objects.
Definition: sensorgroup.h:42
std::shared_ptr< Syntax > syntax
Definition: sensorgroup.h:177
The SensorGroup class builds the syntactic template for its specific command that results from the se...
Definition: sensorgroup.h:82
std::vector< std::shared_ptr< Channel > > channelList
Definition: sensorgroup.h:168
std::string grpName
Definition: sensorgroup.h:44
std::vector< std::string > optionsList
Definition: sensorgroup.h:176
responseCallback callbackFunction
Definition: sensorgroup.h:173
bool callbackRegistered
Definition: sensorgroup.h:174
std::string chName
Definition: sensorgroup.h:26
bool conversionNeeded
Definition: sensorgroup.h:29
std::unordered_map< std::string, std::shared_ptr< Channel > > channelMap
Definition: sensorgroup.h:169
static const std::string ENCODING_ASCII
Definition: sensorgroup.h:160
static const std::string ENCODING_HEX
Definition: sensorgroup.h:162
std::vector< std::shared_ptr< Channel > > channels
Definition: sensorgroup.h:47
Parameter::ParameterMap cmdInputParams
Definition: sensorgroup.h:175
Parameter::ParameterMap optionValues
Definition: sensorgroup.h:172
std::vector< std::string > optionVariableList
Definition: sensorgroup.h:171
std::string responseEncoding
Definition: sensorgroup.h:167
Parameter::ParameterMap channelValues
Definition: sensorgroup.h:170
The Command class builds the syntactic template for a specific command defined in a CommandParams str...
Definition: command.h:90
unsigned char grpNumber
Definition: sensorgroup.h:45
unsigned char grpNumber
Definition: sensorgroup.h:165
boost::function< void(const std::string &)> valueErrorCallbackPtr
Definition: sensorgroup.h:69
Header file for the Syntax struct.
std::string dataType
Definition: sensorgroup.h:27
double conversionFactor
Definition: sensorgroup.h:30
bool valueErrorCBSet
Definition: sensorgroup.h:179
Header file for the Parameter::Parameter, Parameter::GenericParameter and Parameter::ParameterMap cla...
This library provides functions to convert a base64 encoded value to 32bit signed/unsigned integer...


pses_ucbridge
Author(s): Sebastian Ehmes
autogenerated on Sat Oct 28 2017 19:16:13