forked from pkaselj/CAN_PacketSniffer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SerialReader.h
52 lines (36 loc) · 1.04 KB
/
SerialReader.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef SERIALREADERTHREAD_H
#define SERIALREADERTHREAD_H
#include <QtCore>
#include <QtSerialPort>
#include <QSerialPortInfo>
#include "Structures.h"
class SerialReader : public QObject
{
Q_OBJECT
public:
SerialReader(QApplication* pParent);
~SerialReader();
void Start();
static QList<QSerialPortInfo> getAvailableSerialPorts();
static QList<qint32> getAvailableBaudRates();
signals:
Q_SIGNAL void DataReceived(RawData tableEntry);
public slots:
Q_SLOT void StopExecution();
void ConnectToSerialPort(SerialPortConnectionInfo connectionInfo);
private:
bool m_bStop;
bool m_bConnected;
QByteArray m_receivedData;
QSerialPort* m_pSerialPort;
void run();
RawData AcquireData();
void ReadAndAppendNewDataToBuffer();
void TruncateBufferToSyncSequence();
bool isBufferFilled() const;
QByteArray GetRawCAN_PacketAndTruncateBuffer();
RawData DeserializeRawCAN_Packet(QByteArray& rawCAN_Packet);
private slots:
void DataReadyToBeRead();
};
#endif // SERIALREADERTHREAD_H