rio.hh
Go to the documentation of this file.
1 
9 #pragma once
10 
11 
12 // stdlib
13 #include <vector>
14 // 3rd party
15 #include <QByteArray>
16 #include <QDebug>
17 #include <QObject>
18 // dfti
19 #include "sensor/serialsensor.hh"
20 #include "settings/settings.hh"
21 
22 
24 #define ONE_BYTE 2
25 
26 
27 namespace dfti {
28 
29 
31 const char rioSep = '$';
33 const char rioTerm = '\n';
35 const QString rioStart{"$$$"};
37 const QString rioTermStr{"\r\n"};
38 
39 
41 
48 bool validateRIOChecksum(QByteArray pkt);
49 
50 
52 struct RIOData
53 {
55  std::vector<float> values;
56 };
57 
58 
60 
67 class RIO : public SerialSensor
68 {
69  Q_OBJECT;
70 
71 public:
73 
77  explicit RIO(Settings *_settings, QObject* _parent = nullptr);
78 
79 public slots:
81  void readData(void);
82 
83 signals:
85  void measurementUpdate(RIOData data);
86 
87 private:
89 
95  QByteArray _buf;
96 
98  RIOData data;
99 };
100 
101 
102 }; // namespace dfti
Serial IO Sensor interface.
Base class for interfacing with sensors over a serial port (UART/RS-232).
Definition: serialsensor.hh:30
bool validateRIOChecksum(QByteArray pkt)
Validate the RIO packet checksum.
Definition: rio.cc:98
std::vector< float > values
Vector of RIO values.
Definition: rio.hh:55
Definition: autopilot.cc:12
const QString rioTermStr
RIO packet terminator string.
Definition: rio.hh:37
Settings manager.
Definition: settings.hh:30
Serial driver to acquire data from a generic Remote I/O device.
Definition: rio.hh:67
Structure to hold control effector data.
Definition: rio.hh:52
const char rioSep
RIO packet separator.
Definition: rio.hh:31
const char rioTerm
RIO packet terminator.
Definition: rio.hh:33
const QString rioStart
RIO packet start.
Definition: rio.hh:35
DFTI settings manager interface.