-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdltmultimeter.h
103 lines (77 loc) · 2.16 KB
/
dltmultimeter.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
/**
* @licence app begin@
* Copyright (C) 2021 Alexander Wenzel
*
* This file is part of the DLT Multimeter project.
*
* \copyright This code is licensed under GPLv3.
*
* \author Alexander Wenzel <[email protected]>
*
* \file dltmultimeter.h
* @licence end@
*/
#ifndef DLT_MULTIMETER_H
#define DLT_MULTIMETER_H
#include <QObject>
#include <QXmlStreamWriter>
#include <QXmlStreamReader>
#include <QSerialPort>
#include <QTimer>
class DLTMultimeter : public QObject
{
Q_OBJECT
public:
explicit DLTMultimeter(QObject *parent = nullptr);
~DLTMultimeter();
void checkPortName();
void start();
void stop();
QString getInterface() { return interface; }
void setInterface(QString interface) { this->interface = interface; }
// Active
bool getActive() { return active; }
void setActive(bool active) { this->active = active; }
int getType() { return type; }
void setType(int type) { this->type = type; }
void clearSettings();
void writeSettings(QXmlStreamWriter &xml,int num);
void readSettings(const QString &filename,int num);
void on();
void off();
void setVoltage(float value);
QString getPowerName() { return powerName; }
void setPowerName(const QString &powerName) { this->powerName = powerName; }
float getSubstractCurrent() const;
void setSubstractCurrent(float newSubstractCurrent);
signals:
void status(QString text);
void valueMultimeter(QString value,QString unit);
private slots:
void readyRead();
// Watchdog Timeout
void timeout();
void timeoutRequest();
private:
QSerialPort serialPort;
QTimer timer;
QTimer timerRequest;
unsigned int watchDogCounter,watchDogCounterLast;
int type;
QString interface;
QString interfaceSerialNumber;
ushort interfaceProductIdentifier;
ushort interfaceVendorIdentifier;
QString powerName;
float substractCurrent;
bool active;
QByteArray serialData;
QByteArray rawData;
float value;
QString unit;
void calculateValue();
int calculateNumber(unsigned char a,unsigned char b);
bool readVoltageOngoing;
QString voltageCmd;
};
#endif // DLT_MULTIMETER_H