-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patholympussdk.h
169 lines (135 loc) · 5.36 KB
/
olympussdk.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#ifndef OLYMPUSSDK_H
#define OLYMPUSSDK_H
#include <QLibrary>
#include <Windows.h>
#define SZ_SMALL 8 //
#define MAX_TAG_SIZE 32 // command tag size
#define MAX_COMMAND_SIZE 256 // command buffer size
#define MAX_RESPONSE_SIZE 256 // response buffer size
//-----------------------------------------------------------------------------
// in/out
#define IN
#define OUT
#define CALLBACK __stdcall
//-----------------------------------------------------------------------------
// unit list
typedef enum tag_eDeviceType {
e_DTUnknown = 0, // unknown unit
// motor unit
e_DTNosepiece = 20000, // nose piece
e_DTFilterWheel = 20002, // filter wheel
e_DTLamp = 20003, // lamp
e_DTApertureStop = 20004, // AS
e_DTShutter = 20005, // shutter
e_DTMagnificationDevice = 20006,
e_DTMagnificationChanger= 20007, //
e_DTTopLens = 20008, // top lens
e_DTLightPathSwitch = 20009, // light path switcher
e_DTZoom = 20010, // zoom
e_DTStageInsert = 20050,
e_DTSlideLoader = 30000,
e_DTManualControl = 40000,
e_DTFocus = 25000, // focus
e_DTCondenser = 25001, // condenser
e_DTMirror = 25002, // mirror
e_DTHandSwitch = 25003, // hand switch
e_DTAberLens = 25004, // aber lens
e_DTFieldStop = 25005, // FS
e_DTCorrectionRing = 25007, // correction ring
e_DTStage = 20051, // stage
e_DTSample = 20052, // sample, attached to stage ??
e_DTMicroscope = 60000, // microscope system
e_DTTiny = 61000 // tiny board
} eDeviceType;
// command status
typedef enum tag_eMDK_CmdStatus {
e_Cmd_Init = 0, // initial state
e_Cmd_Queue, // queued
e_Cmd_Wait, // waiting for response
e_Cmd_Complete, // completion
e_Cmd_Timeout, // timeout
e_Cmd_Abort // aborted
} eMDK_CmdStatus;
//-----------------------------------------------------------------------------
// command block
typedef struct tag_MDK_MSL_CMD {
DWORD m_Signature; // command block signature
//-------------------------------------------
// basic fields
eDeviceType m_Type; // unit type
WORD m_Sequence; // command sequence
char m_From[SZ_SMALL]; // from
char m_To[SZ_SMALL]; // to
eMDK_CmdStatus m_Status; // command statys
DWORD m_Result; // result
BOOL m_Sync; // sync or async?
BOOL m_Command; // command or query? (refer command tag)
BOOL m_SendOnly; // TRUE means NOT wait response.
//-------------------------------------------
// management field
time_t m_StartTime; // start time
time_t m_FinishTime; // end time
DWORD m_Timeout; // time out (ms)
void *m_Callback; // callback entry
void *m_Event; // event info
void *m_Context; // context
UINT m_TimerID; // timer ID
void *m_PortContext; // port info.
//-------------------------------------------
// extend field (for indivisual command)
ULONG m_Ext1; // extend info 1
ULONG m_Ext2; // extend info 2
ULONG m_Ext3; // extend info 3
LONGLONG m_lExt1; // LONGLONG extend info 1
LONGLONG m_lExt2; // LONGLONG extend info 2
//-------------------------------------------
// tag fields
DWORD m_TagSize; // tag size
BYTE m_CmdTag[MAX_TAG_SIZE];
//-------------------------------------------
// command string
DWORD m_CmdSize; // size of command string
BYTE m_Cmd[MAX_COMMAND_SIZE];
//-------------------------------------------
// response string
DWORD m_RspSize; // size of response string
BYTE m_Rsp[MAX_RESPONSE_SIZE];
} MDK_MSL_CMD, *PMDK_MSL_CMD;
typedef int (__stdcall *GT_CALLBACK_ENTRY)(
ULONG MsgId, // Callback ID.
ULONG wParam, // Callback parameter, it depends on callback event.
ULONG lParam, // Callback parameter, it depends on callback event.
PVOID pv, // Callback parameter, it depends on callback event.
PVOID pContext, // This contains information on this call back function.
PVOID pCaller // This is the pointer specified by a user in the requirement function.
);
typedef GT_CALLBACK_ENTRY GT_MDK_CALLBACK;
//--------------DLL FUNCTIONS-----------------------------
typedef int (*ptr_Initialize)();
typedef int (*ptr_EnumInterface)();
typedef int (*ptr_GetInterfaceInfo)(
IN int iInterfaceIndex, // interface index
OUT void **pInterface // interface class address location
);
typedef bool (*ptr_OpenInterface)(
IN void *pInterface // interface class address
);
typedef bool (*ptr_CloseInterface)(
IN void *pInterface // interface class address
);
typedef bool (*ptr_ConfigInterface)(
IN void *pInterface, // interface class address
IN HWND hWnd // window handle for setting interface
);
typedef bool (*ptr_SendCommand)(
IN void *pInterface, // interface class address
IN MDK_MSL_CMD *cmd // command structure.
);
typedef bool (*ptr_RegisterCallback)(
IN void *pInterface, // interface class address
IN GT_MDK_CALLBACK Cb_Complete, // callback for command completion
IN GT_MDK_CALLBACK Cb_Notify, // callback for notification
IN GT_MDK_CALLBACK Cb_Error, // callback for error notification
IN void *pContext // callback context.
);
#endif // OLYMPUSSDK_H