-
Notifications
You must be signed in to change notification settings - Fork 0
/
worker.h
45 lines (32 loc) · 880 Bytes
/
worker.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
#ifndef MODBUS_CLI_WORKER_H
#define MODBUS_CLI_WORKER_H
#include <QObject>
#include <QCommandLineParser>
#include "client.h"
namespace Modbus_Cli {
class Worker : public QObject
{
Q_OBJECT
public:
explicit Worker(QObject *parent = nullptr);
bool process(const QStringList& args);
signals:
private slots:
void on_connected();
void on_request_finished();
private:
void doit();
bool is_set(int key);
QString option(int key);
QModbusDataUnit::RegisterType get_type(QString text);
QVector<quint16> get_values(const QString& text);
bool _debug = false;
bool _quiet = false;
int _adr, _start, _count, _repeat, _timeout;
QModbusDataUnit::RegisterType _type;
QCommandLineParser _parser;
QList<QCommandLineOption> _opt;
std::unique_ptr<Client> _client;
};
} // namespace Modbus_Cli
#endif // MODBUS_CLI_WORKER_H