-
Notifications
You must be signed in to change notification settings - Fork 0
/
dltmultimeter.h
70 lines (52 loc) · 1.33 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
/**
* @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 start();
void stop();
QString getInterface() { return interface; }
void setInterface(QString interface) { this->interface = interface; }
void clearSettings();
void writeSettings(QXmlStreamWriter &xml);
void readSettings(const QString &filename);
signals:
void status(QString text);
void valueMultimeter(QString value,QString unit);
private slots:
void readyRead();
// Watchdog Timeout
void timeout();
private:
QSerialPort serialPort;
QTimer timer;
unsigned int watchDogCounter,watchDogCounterLast;
QString interface;
QByteArray rawData;
float value,lastValue;
QString unit;
void calculateValue();
int calculateNumber(unsigned char a,unsigned char b);
};
#endif // DLT_MULTIMETER_H