OpenIndy-Core  0.2.0.43
sensorconfiguration.h
Go to the documentation of this file.
1 #ifndef SENSORCONFIGURATION_H
2 #define SENSORCONFIGURATION_H
3 
4 #include <QPointer>
5 #include <QtXml>
6 #include <QString>
7 #include <QMap>
8 #include <QtSerialPort/QSerialPort>
9 
10 #include "types.h"
11 #include "util.h"
12 #include "oivec.h"
13 
14 namespace oi{
15 
16 using namespace math;
17 
18 class Sensor;
19 
20 //##############
21 //helper classes
22 //##############
23 
29 public:
31 
33 
34  QString ip;
35  QString port;
36  QString comPort;
37  QSerialPort::BaudRate baudRate;
38  QSerialPort::DataBits dataBits;
39  QSerialPort::Parity parity;
40  QSerialPort::StopBits stopBits;
41  QSerialPort::FlowControl flowControl;
42 };
43 
49 public:
50  Accuracy() : sigmaXyz((OiVec(3))), sigmaAzimuth(0.0), sigmaZenith(0.0), sigmaDistance(0.0),
51  sigmaTemp(0.0), sigmaAngleXZ(0.0), sigmaAngleYZ(0.0){}
52 
53  double sigmaAzimuth;
54  double sigmaZenith;
55  double sigmaDistance;
57  double sigmaTemp;
58  QMap<QString, double> sigmaUndefined;
59  double sigmaAngleXZ;
60  double sigmaAngleYZ;
61 };
62 
63 //###########################
64 //sensor configuration itself
65 //###########################
66 
71 {
72 
73 public:
75 
77 
78  SensorConfiguration &operator=(const SensorConfiguration &copy);
79 
80  friend bool operator==(const SensorConfiguration &left, const SensorConfiguration &right){
81 
82  if(left.getName().compare(right.getName()) == 0){
83  return true;
84  }
85  return false;
86 
87  }
88 
89  //##########################################
90  //get or set sensor configuration attributes
91  //##########################################
92 
93  const QString &getName() const;
94  void setName(const QString &name);
95 
96  const bool &getIsSaved() const;
97  void setIsSaved(const bool &isSaved);
98 
99  bool getIsValid() const;
100 
101  const SensorTypes &getTypeOfSensor() const;
102  void setTypeOfSensor(const SensorTypes &type);
103 
104  const QString &getPluginName() const;
105  void setPluginName(const QString &name);
106 
107  const QString &getSensorName() const;
108  void setSensorName(const QString &name);
109 
110  const Accuracy &getAccuracy() const;
111  void setAccuracy(const Accuracy &accuracy);
112 
113  const ConnectionConfig &getConnectionConfig() const;
114  void setConnectionConfig(const ConnectionConfig &cConfig);
115 
116  const QMap<QString, int> &getIntegerParameter() const;
117  void setIntegerParameter(const QMap<QString, int> &intParams);
118 
119  const QMap<QString, double> &getDoubleParameter() const;
120  void setDoubleParameter(const QMap<QString, double> &doubleParams);
121 
122  const QMap<QString, QString> &getStringParameter() const;
123  void setStringParameter(const QMap<QString, QString> &stringParams);
124 
125  const QMultiMap<QString, QString> &getAvailableStringParameter() const;
126  void setAvailableStringParameter(const QMap<QString, QString> &stringParams);
127 
128  //#################
129  //save and load XML
130  //#################
131 
132  QDomElement toOpenIndyXML(QDomDocument &xmlDoc) const;
133  bool fromOpenIndyXML(QDomElement &xmlElem);
134 
135 private:
136 
137  //###############################
138  //sensor configuration attributes
139  //###############################
140 
141  QString name;
142  bool isSaved;
143 
144  QString pluginName;
145  QString sensorName;
146  SensorTypes typeOfSensor;
147 
148  Accuracy accuracy;
149  ConnectionConfig cConfig;
150 
151  //parameter selection
152  QMap<QString, int> integerParameter;
153  QMap<QString, double> doubleParameter;
154  QMap<QString, QString> stringParameter;
155 
156  //all available string parameter (specified by the sensor)
157  QMultiMap<QString, QString> availableStringParameter;
158 
159 };
160 
161 }
162 
163 Q_DECLARE_METATYPE( oi::SensorConfiguration )
164 Q_DECLARE_METATYPE( oi::SensorConfiguration* )
165 
166 #endif // SENSORCONFIGURATION_H
double sigmaAzimuth
Definition: sensorconfiguration.h:53
QString ip
Definition: sensorconfiguration.h:34
double sigmaAngleYZ
Definition: sensorconfiguration.h:60
ConnectionTypes typeOfConnection
Definition: sensorconfiguration.h:32
OiVec sigmaXyz
Definition: sensorconfiguration.h:56
double sigmaAngleXZ
Definition: sensorconfiguration.h:59
double sigmaDistance
Definition: sensorconfiguration.h:55
The OiVec class.
Definition: oivec.h:22
Definition: coordinatesystem.h:15
ConnectionTypes
Definition: types.h:405
QSerialPort::DataBits dataBits
Definition: sensorconfiguration.h:38
QSerialPort::Parity parity
Definition: sensorconfiguration.h:39
QString comPort
Definition: sensorconfiguration.h:36
The SensorConfiguration class.
Definition: sensorconfiguration.h:70
QSerialPort::BaudRate baudRate
Definition: sensorconfiguration.h:37
QMap< QString, double > sigmaUndefined
Definition: sensorconfiguration.h:58
The Accuracy class Save information about the accurycy of a sensor.
Definition: sensorconfiguration.h:48
SensorTypes
Definition: types.h:390
QString port
Definition: sensorconfiguration.h:35
const QString & getName() const
SensorConfiguration::getName.
Definition: sensorconfiguration.cpp:63
The ConnectionConfig class Save all information needed to connect a sensor.
Definition: sensorconfiguration.h:28
QSerialPort::FlowControl flowControl
Definition: sensorconfiguration.h:41
QSerialPort::StopBits stopBits
Definition: sensorconfiguration.h:40
ConnectionConfig()
Definition: sensorconfiguration.h:30
double sigmaZenith
Definition: sensorconfiguration.h:54
friend bool operator==(const SensorConfiguration &left, const SensorConfiguration &right)
Definition: sensorconfiguration.h:80
#define OI_CORE_EXPORT
Definition: types.h:11
double sigmaTemp
Definition: sensorconfiguration.h:57
Accuracy()
Definition: sensorconfiguration.h:50