OpenIndy-Core  0.2.0.43
sensorlistener.h
Go to the documentation of this file.
1 #ifndef SENSORLISTENER_H
2 #define SENSORLISTENER_H
3 
4 #include <QObject>
5 #include <QThread>
6 #include <QTime>
7 #include <QMap>
8 #include <QVariantMap>
9 
10 #include "sensor.h"
11 
12 namespace oi{
13 
14 class SensorControl;
15 
20 class OI_CORE_EXPORT SensorListener : public QObject
21 {
22  friend class SensorControl;
23  Q_OBJECT
24 
25 public:
26  SensorListener(QMutex &locker, QObject *parent = 0);
27 
28  ~SensorListener();
29 
30 signals:
31 
32  //##############################
33  //inform about streaming results
34  //##############################
35 
36  void realTimeReading(const QVariantMap &reading) const;
37  void realTimeStatus(const QMap<QString, QString> &status) const;
38 
39  void connectionLost() const;
40  void connectionReceived() const;
41 
42  void isReadyForMeasurement(const bool &isReady) const;
43 
44  //#######################
45  //special sensor messages
46  //#######################
47 
48  void sensorMessage(const Sensor::SensorMessage &type, const QString &msg, const MessageTypes &msgType, const MessageDestinations &msgDest = eConsoleMessage);
49 
50 private:
51 
52  //#################
53  //get or set sensor
54  //#################
55 
56  void setSensor(const QPointer<Sensor> &sensor);
57  const QPointer<Sensor> &getSensor() const;
58 
59  //################################
60  //activate or deactivate streaming
61  //################################
62 
63  bool getIsActiveStation() const;
64  void setIsActiveStation(const bool &isActiveStation);
65 
66 private slots:
67 
68  //#######################
69  //start or stop streaming
70  //#######################
71 
72  void startStreaming();
73 
74  //################################
75  //get or set reading stream format
76  //################################
77 
78  ReadingTypes getReadingStreamFormat() const;
79  void setReadingStreamFormat(ReadingTypes streamFormat);
80 
81 private:
82 
83  //##########################
84  //sensor listener attributes
85  //##########################
86 
87  QPointer<Sensor> sensor;
88 
89  ReadingTypes streamFormat;
90 
91  bool isActiveStation;
92 
93  QMutex &locker;
94 
95 };
96 
97 }
98 
99 #endif // SENSORLISTENER_H
SensorMessage
Definition: sensor.h:52
ReadingTypes
Definition: types.h:203
Definition: coordinatesystem.h:15
Definition: types.h:38
MessageDestinations
used to specify where to print a message
Definition: types.h:37
MessageTypes
all types of messages
Definition: types.h:29
The SensorListener class The sensor listener handles all sensor streams and is controlled by SensorCo...
Definition: sensorlistener.h:20
The SensorControl class A sensor control object belongs to a station and executes all sensor actions ...
Definition: sensorcontrol.h:24
#define OI_CORE_EXPORT
Definition: types.h:11