Witmotion IMU Library  1.3.1~dev_4684448
Open source UART communication library for sensor devices manufactured by WitMotion Shenzhen Co.,Ltd
message-enumerator.h
1 #ifndef WITMOTION_MESSAGE_ENUMERATOR
2 #define WITMOTION_MESSAGE_ENUMERATOR
3 
4 #include <QCommandLineParser>
5 #include <QCommandLineOption>
6 #include <QFile>
7 #include <QIODevice>
8 
9 #include <iostream>
10 #include <string>
11 
12 #include <signal.h>
13 #include <stdlib.h>
14 #include <stdio.h>
15 #include <unistd.h>
16 
17 #include "witmotion/serial.h"
18 
19 namespace witmotion
20 {
21 
23 {
24  Q_OBJECT
25 private:
27  QString port_name;
28  QSerialPort::BaudRate port_rate;
29  QThread reader_thread;
31  QTextStream ttyout;
33  size_t unknown_ids;
34  bool log_set;
35  QString log_name;
36  QStringList log;
37  QFile* logfile;
38  QSet<uint8_t> unknown;
39 
40  void BuildLog();
41 public:
42  QGeneralSensorController(const QString port, const QSerialPort::BaudRate rate);
43  virtual ~QGeneralSensorController();
44  void Start();
45  void SetLog(const QString name);
46  void SetInterval(uint32_t ms);
47  void SetTimeout(uint32_t ms);
48 public slots:
49  void Packet(const witmotion_datapacket& packet);
50  void Error(const QString& description);
51 signals:
52  void RunReader();
53 };
54 
55 }
56 #endif