-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathLinkManagerWrapper.h
88 lines (76 loc) · 3.44 KB
/
LinkManagerWrapper.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
#pragma once
#include <memory>
#include <QObject>
#include <QList>
#include <QThread>
#include <QPair>
#include <QUuid>
#include "Link.h"
#include "LinkManager.h"
#include "LinkListModel.h"
class LinkManagerWrapper : public QObject // wrapper for LinkManager in main thread
{
Q_OBJECT
public:
Q_PROPERTY(LinkListModel* linkListModel READ getModelPtr NOTIFY modelChanged)
/*methods*/
LinkManagerWrapper(QObject* parent);
~LinkManagerWrapper();
LinkListModel* getModelPtr();
LinkManager* getWorker();
void closeOpenedLinks();
void openClosedLinks();
public slots:
// #ifdef MOTOR
// void openAsUdp(QUuid uuid, QString address, int sourcePort, int destinationPort, bool isMotorDevice = false);
// void openAsSerial(QUuid uuid, bool isMotorDevice = false);
// #else
// void openAsSerial(QUuid uuid);
// void createAsUdp(QString address, int sourcePort, int destinationPort);
// #endif
void openAsSerial(QUuid uuid, int attribute = 0);
void createAsUdp(QString address, int sourcePort, int destinationPort);
void openAsUdp(QUuid uuid, QString address, int sourcePort, int destinationPort, int attribute = 0);
void createAsTcp(QString address, int sourcePort, int destinationPort);
void openAsTcp(QUuid uuid, QString address, int sourcePort, int destinationPort, int attribute = 0);
void closeLink(QUuid uuid);
void closeFLink(QUuid uuid);
void deleteLink(QUuid uuid);
void updateBaudrate(QUuid uuid, int baudrate);
void appendModifyModelData(QUuid uuid, bool connectionStatus, ControlType controlType, QString portName, int baudrate, bool parity,
LinkType linkType, QString address, int sourcePort, int destinationPort, bool isPinned, bool isHided, bool isNotAvailable);
void deleteModelData(QUuid uuid);
signals:
void modelChanged(); // Q_PROPERTY in .h
// #ifdef MOTOR
// void sendOpenAsSerial(QUuid uuid, bool isMotorDevice = false);
// void sendOpenAsUdp(QUuid uuid, QString address, int sourcePort, int destinationPort, bool isMotorDevice = false);
// #else
// void sendOpenAsSerial(QUuid uuid);
// void sendOpenAsUdp(QUuid uuid, QString address, int sourcePort, int destinationPort);
// #endif
void sendOpenAsSerial(QUuid uuid, int attribute = 0);
void sendCreateAsUdp(QString address, int sourcePort, int destinationPort);
void sendOpenAsUdp(QUuid uuid, QString address, int sourcePort, int destinationPort, int attribute = 0);
void sendCreateAsTcp(QString address, int sourcePort, int destinationPort);
void sendOpenAsTcp(QUuid uuid, QString address, int sourcePort, int destinationPort, int attribute = 0);
void sendCloseLink(QUuid uuid);
void sendFCloseLink(QUuid uuid);
void sendDeleteLink(QUuid uuid);
void sendUpdateBaudrate(QUuid uuid, int baudrate);
void sendUpdateAddress(QUuid uuid, QString address);
void sendUpdateSourcePort(QUuid uuid, int sourcePort);
void sendUpdateDestinationPort(QUuid uuid, int destinationPort);
void sendUpdatePinnedState(QUuid uuid, bool state);
void sendUpdateControlType(QUuid uuid, int controlType);
void sendStopTimer();
void sendOpenFLinks();
void sendCreateAndOpenAsUdpProxy(QString address, int sourcePort, int destinationPort);
void sendCloseUdpProxy();
private:
/*data*/
std::unique_ptr<QThread> workerThread_;
std::unique_ptr<LinkManager> workerObject_;
LinkListModel model_;
QList<QPair<QUuid, LinkType>> forceClosedLinks_;
};