-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPfcBus.h
52 lines (42 loc) · 1.36 KB
/
PfcBus.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
#pragma once
#include "Pfc.h"
class PfcBus : public QObject {
Q_OBJECT
public:
explicit PfcBus(QObject *parent = nullptr);
virtual ~PfcBus();
void openPort(const QString& portName, int pollTimeout, int readWriteTimeout);
void closePort();
void resetData();
bool isOpen() const;
void readVer();
void readBasic();
void readAdvanced();
void readSensors();
void readAux();
void sendBytes(const QByteArray& data);
void sendHex(const char* data);
void recvPacket(int id, int size);
void setVar(Pfc::Id id, float value);
float getVar(Pfc::Id id) const;
QString getVer1() const { return mVer1; }
QString getVer2() const { return mVer2; }
QString getModel() const { return mModel; }
QString getNames() const { return mNames; }
const PfcRawBasic& getRawBasic() const { return mRawBasic; }
const PfcRawAdvanced& getRawAdvanced() const { return mRawAdvanced; }
const PfcRawSensors& getRawSensors() const { return mRawSensors; }
const PfcRawAux& getRawAux() const { return mRawAux; }
protected:
QScopedPointer<class QSyncSerialPort> mSerial;
QByteArray mResponse;
QString mVer1;
QString mVer2;
QString mModel;
QString mNames;
PfcRawBasic mRawBasic;
PfcRawAdvanced mRawAdvanced;
PfcRawSensors mRawSensors;
PfcRawAux mRawAux;
float mVars[Pfc::Id_Count];
};