1 #ifndef WITMOTION_SERIAL_H
2 #define WITMOTION_SERIAL_H
4 #include "witmotion/types.h"
5 #include "witmotion/util.h"
20 QSerialPort* witmotion_port;
21 QSerialPort::BaudRate port_rate;
23 quint16 avail_rep_count;
24 uint8_t raw_data[128];
26 bool user_defined_return_interval;
27 uint32_t return_interval;
28 bool user_defined_timeout;
30 uint32_t timeout_counter;
34 QMetaObject::Connection timer_connection;
35 QMetaObject::Connection config_connection;
46 volatile bool configuring;
47 std::list<witmotion_config_packet> configuration;
49 virtual void Configure();
52 void SetBaudRate(
const QSerialPort::BaudRate& rate);
53 QBaseSerialWitmotionSensorReader(
const QString device,
const QSerialPort::BaudRate rate);
54 virtual ~QBaseSerialWitmotionSensorReader();
56 virtual void Suspend();
57 void ValidatePackets(
const bool value);
58 void SetSensorPollInterval(
const uint32_t ms);
59 void SetSensorTimeout(
const uint32_t ms);
69 QSerialPort::BaudRate port_rate;
73 virtual const std::set<witmotion_packet_id>* RegisteredPacketTypes() = 0;
74 QAbstractWitmotionSensorController(
const QString tty_name,
const QSerialPort::BaudRate rate);
75 virtual void Start() = 0;
76 virtual ~QAbstractWitmotionSensorController();
77 virtual void Calibrate() = 0;
78 virtual void SetBaudRate(
const QSerialPort::BaudRate& rate) = 0;
79 void SetValidation(
const bool validate);
82 virtual void Error(
const QString& description);
85 void ErrorOccurred(
const QString& description);