-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patholympusportmanager.h
86 lines (70 loc) · 2.28 KB
/
olympusportmanager.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
#ifndef OLYMPUSPORTMANAGER_H
#define OLYMPUSPORTMANAGER_H
#include <iostream>
#include <conio.h>
#include <QTimer>
#include <QEventLoop>
#include <olympussdk.h>
#include <server.h>
class OlympusPortManager : public QObject
{
Q_OBJECT
public:
explicit OlympusPortManager(QObject *parent = nullptr);
~OlympusPortManager();
MDK_MSL_CMD m_Cmd;
bool initialize();
bool isConnected();
bool isLogged();
bool isBusy();
int enumerateInterface();
bool openInterface(int);
void closeInterface();
void logIn();
void logOut();
private:
bool logged = false;
bool pendingLog = false;
bool waitingResponse = false;
int numInterface = 0;
MessageSocket pendingMessage;
void *pInterface;
ptr_Initialize ptr_init;
ptr_EnumInterface ptr_enumIf;
ptr_GetInterfaceInfo ptr_getInfo;
ptr_OpenInterface ptr_openIf;
ptr_SendCommand ptr_sendCmd;
ptr_RegisterCallback ptr_reCb;
ptr_CloseInterface ptr_closeIf;
bool sendCommand(QString);
void sendResponse();
void clearPendingMessage();
void waitWithoutBlocking(int);
friend int CALLBACK CommandCallback(ULONG MsgId,
ULONG wParam,
ULONG lParam,
PVOID pv,
PVOID pContext,
PVOID pCaller);
friend int CALLBACK NotifyCallback(ULONG MsgId,
ULONG wParam,
ULONG lParam,
PVOID pv,
PVOID pContext,
PVOID pCaller);
friend int CALLBACK ErrorCallback(ULONG MsgId,
ULONG wParam,
ULONG lParam,
PVOID pv,
PVOID pContext,
PVOID pCaller);
signals:
void sendMessageSocket(MessageSocket);
void sendNotify(QString);
void emergencyStop();
void sendGlobalQuit();
private slots:
void receiveRequest(MessageSocket);
void receiveEmergencyStop();
};
#endif // OLYMPUSPORTMANAGER_H