-
Notifications
You must be signed in to change notification settings - Fork 46
/
TestClient.h
123 lines (85 loc) · 3.06 KB
/
TestClient.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#ifndef TESTCLIENT_H
#define TESTCLIENT_H
#include "SlipProtocol.h"
#include "PortManager.h"
#include "JLinkManager.h"
#include "TestMethodManager.h"
#include "SessionManager.h"
#include "Logger.h"
#include "RailtestClient.h"
class TestClient : public QObject
{
Q_OBJECT
public:
enum DutState {inactive, untested, tested, warning};
explicit TestClient(const QSharedPointer<QSettings> &settings, int no, QObject *parent = nullptr);
~TestClient();
void setLogger(const QSharedPointer<Logger> &logger);
void setDutsNumbers(QString numbers);
void setPort(const QString& portName);
void open();
QMap<int, Dut> getDuts() {return _duts;}
public slots:
QStringList availiblePorts() const;
void open(QString id);
int no() const {return _no;}
bool isActive() const; //True, if at least one DUT connected
bool isConnected() const {return _isConnected;}
int dutsCount() const {return _duts.size();}
Dut dut(int slot) const {return _duts[slot];}
void setCurrentSlot(int slot) {_currentSlot = slot;}
void setDutProperty(int slot, const QString& property, const QVariant& value);
QVariant dutProperty(int slot, const QString& property);
int dutNo(int slot) const {return _duts[slot]["no"].toInt();}
int dutState(int slot) const {return _duts[slot]["state"].toInt();}
void setDutState(int slot, int state) {_duts[slot]["state"] = state;}
bool isDutAvailable(int slot) const {return _duts[slot]["state"].toBool();}
bool isDutChecked(int slot) const {return _duts[slot]["checked"].toBool();}
void setDutChecked(int no, bool checked);
void addDutError(int slot, QString error);
void setAllDutsChecked();
void reverseDutsChecked();
void resetDut(int slot);
//SLIP commands
int switchSWD(int slot);
int powerOn(int slot);
int powerOff(int slot);
int readDIN(int slot, int DIN);
int setDOUT(int slot, int DOUT);
int clearDOUT(int slot, int DOUT);
int readCSA(int gain);
int readAIN(int slot, int AIN, int gain);
int daliOn();
int daliOff();
int readDaliADC();
int readDinADC(int slot, int DIN);
int read24V();
int read3V();
int readTemperature();
QStringList railtestCommand(int channel, const QByteArray &cmd);
void testRadio(int slot, QString RfModuleId, int channel, int power, int minRSSI, int maxRSSI, int count);
void setTimeout(int value) { Q_UNUSED(value); }
signals:
// void responseRecieved(QStringList response);
void dutChanged(Dut);
void dutFullyTested(Dut);
void slotFullyTested(int);
void commandSequenceStarted();
void commandSequenceFinished();
private slots:
void onRfReplyReceived(QString id, QVariantMap params);
void delay(int msec);
private:
PortManager _portManager;
int _no;
QSharedPointer<QSettings> _settings;
QSharedPointer<Logger> _logger;
QMap<int, Dut> _duts;
bool _isConnected = false;
int _currentSlot = 0;
int _rfRSSI;
int _rfCount;
QVector<int> _rssiValues;
uint8_t _sequenceCounter = 0;
};
#endif // TESTCLIENT_H