-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmc_api_dll.h
186 lines (142 loc) · 3.82 KB
/
mc_api_dll.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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
/*
* mc_api_dll.h
*
* Created on: Jan 27, 2011
* Author: andy
*/
#ifndef MC_API_DLL_H_
#define MC_API_DLL_H_
#ifdef __cplusplus
extern "C" {
#endif
#ifdef BUILDING_MC_API_DLL
#define MC_API_DLL __declspec(dllexport)
#else
#define MC_API_DLL __declspec(dllimport)
#endif
#define MC_API_OK 0
#define MC_API_ERROR -1
#define MC_API_TRUE 1
#define MC_API_FALSE 0
/*
* This is the SharedMemory object from interprocess.h
*
*/
typedef struct SharedMemory_t *SharedMemory_handle;
/*
* Returns MC_API_OK if server is running
* Returns MC_API_ERROR otherwise
*/
int MC_API_PingServer(SharedMemory_handle sm);
/*
* Start Server
*
* To Be Used Only by MindControl
*
* The server has some unique properties. It does not wait to acquire a mutex.
* If it tries to access shared memory, and the memory is busy, it will simply return
* that the memory is busy.
*
* The server also has no refractory period. It can read or write in sequence
* as often as it wants. If the server reads repeatedly in a loop it oculd theoretically
* lock out other processes from accessing the shared memory, but thats ok, because its the server.
*
* By default the client has a 7ms refractory period.
* When the client reads from shared memory, the process
* sleeps for 7ms. This ensures that a client cannot lock up the shared memory
* A client will also wait up to 4ms to acquire a mutex lock.
*
*
* Returns handle to shared memory object
* Returns NULL if there is an error
*
*
*/
SharedMemory_handle MC_API_StartServer();
/*
* To Be Used Only by MindControl
*
* Returns MC_API_OK or
* Returns MC_API_ERROR otherwise
*
*/
int MC_API_StopServer(SharedMemory_handle sm);
/*
* Returns pointer to Shared Memory handle
* Returns NULL otherwise.
*
* By default the client has a 7ms refractory period.
* When the client reads from shared memory, the process
* sleeps for 7ms. This ensures that a client cannot lock up the shared memory
* A client will also wait up to 4ms to acquire a mutex lock.
*
*/
SharedMemory_handle MC_API_StartClient();
/*
* Returns MC_API_OK or
* Returns MC_API_ERROR otherwise
*
*/
int MC_API_StopClient(SharedMemory_handle sm);
/*
* Registers the presence of a laser controller software
* that will provide the power level of
* the blue or green lasers.
*
*/
int MC_API_RegisterLaserController(SharedMemory_handle sm);
/*
* Check to see if laser controller is present
* Returns MC_API_TRUE 1 if laser controller is present
* Returns MC_API_FALSE 0 if no laser controller is present
* Returns MC_API_ERROR -1 otherwise
*
*/
int MC_API_isLaserControllerPresent(SharedMemory_handle sm);
/*
* Unregisters Laser Controller
*
*/
int MC_API_UnRegisterLaserController(SharedMemory_handle sm);
/*
* Set the Laser Power, an integer value between 1 and 100
* Returns MC_API_OK
* Returns MC_API_ERROR if error.
*/
int MC_API_SetGreenLaserPower(SharedMemory_handle sm, int power);
int MC_API_SetBlueLaserPower(SharedMemory_handle sm, int power);
/*
* Get the laser power. An integer value between 1 and 100
* Returns MC_API_ERROR if the value cannot be acquired.
*/
int MC_API_GetGreenLaserPower(SharedMemory_handle sm);
int MC_API_GetBlueLaserPower(SharedMemory_handle sm);
/*
* Set current frame
* Returns MC_API_OK
* Returns MC_API_ERROR if error.
*/
int MC_API_SetCurrentFrame(SharedMemory_handle sm, int frame);
/*
* Get current frame
* Returns frame number
* Returns MC_API_ERROR if error.
*/
int MC_API_GetCurrentFrame(SharedMemory_handle sm);
/*
* Set DLP on/off
* Returns MC_API_OK
* Returns MC_API_ERROR if error.
*/
int MC_API_SetDLPOnOff(SharedMemory_handle sm, int isOn);
/*
* Get DLP on/off
* Returns 1 if on
* Returns 0 if off
* Returns MC_API_ERROR if error.
*/
int MC_API_GetDLPOnOff(SharedMemory_handle sm);
#ifdef __cplusplus
}
#endif
#endif /* MC_API_DLL_H_ */