2 #include "../include/DCS_ModuleEngineControl.h" 3 #include "../../DCS_Utils/include/DCS_ModuleUtils.h" 44 DWORD readIntervalTimeout;
45 DWORD readTotalTimeoutConstant;
46 DWORD readTotalTimeoutMultiplier;
47 DWORD writeTotalTimeoutConstant;
48 DWORD writeTotalTimeoutMultiplier;
61 DCS_INTERNAL_TEST BOOL write_bytes(HANDLE hComm, LPCSTR charArray, DWORD NbytesToWrite);
67 DCS_INTERNAL_TEST BOOL read_bytes(HANDLE hComm, LPTSTR buffer, DWORD bufferSize, LPDWORD readBufferSize);
113 WINUSB_INTERFACE_HANDLE usb_handle;
185 this->target = target;
188 this->wait_response =
false;
190 full_cmd = std::to_string(axis) + cmd + std::to_string(argument) +
";";
200 this->target = target;
204 if(argument[0] ==
'?')
205 this->wait_response =
true;
207 this->wait_response =
false;
209 full_cmd = std::to_string(axis) + cmd + argument +
";";
218 this->target = target;
221 this->wait_response =
false;
223 full_cmd = (axis > 0 ? std::to_string(axis) :
"") + cmd +
";";
233 this->target = target;
236 this->wait_response =
false;
238 full_cmd = cmd + std::to_string(argument) +
";";
248 this->target = target;
252 if (argument[0] ==
'?')
253 this->wait_response =
true;
255 this->wait_response =
false;
257 full_cmd = cmd + std::string(argument) +
";";
270 c.wait_response = response;
280 static const u64 NextId()
292 if (target != rhs.target)
294 LOG_ERROR(
"Cannot concatenate two commands for different targets.");
302 res.wait_response = wait_response || rhs.wait_response;
303 res.full_cmd = full_cmd + rhs.full_cmd;
309 #pragma warning( push ) 310 #pragma warning( disable : 4251 ) 311 std::string full_cmd;
312 #pragma warning( pop ) 320 #pragma warning( push ) 321 #pragma warning( disable : 4251 ) 342 std::unique_lock<std::mutex> lock(m);
349 Type copy = q.front();
360 std::string schedule(
const Type& value)
362 std::unique_lock<std::mutex> lock(m);
367 if (value.wait_response)
369 std::unique_lock<std::mutex> lock(mr);
371 return response_buffer;
374 response_buffer =
"";
375 return response_buffer;
382 void reply(std::string response)
384 std::unique_lock<std::mutex> lock(mr);
385 response_buffer = response;
394 void notify_unblock()
405 std::unique_lock<std::mutex> lock(m);
406 int s = (int)q.size();
414 std::condition_variable c;
417 std::condition_variable cr;
418 std::string response_buffer;
420 #pragma warning( pop ) Definition: internal.h:164
Definition: internal.h:101
UnitTarget
Enumerates the diferent devices acessible via COM/USB ports.
Definition: DCS_ModuleEngineControl.h:31
Definition: internal.h:111
Definition: internal.h:35
unsigned short u16
Equivalent to uint_16t.
Definition: DCS_ModuleUtils.h:56
signed long i32
Equivalent to int_32t.
Definition: DCS_ModuleUtils.h:53
The ESP301 rotation stage controller target.
Definition: registry.h:70
Definition: internal.h:329
#define LOG_ERROR(msg,...)
Alias to LOG_LVL(Error, msg, VA_ARGS)
Definition: DCS_ModuleUtils.h:37
#define DCS_INTERNAL_TEST
Defines the export interface acessible via the dll-interface applicable for internal functions only...
Definition: exports.h:137
unsigned long long u64
Equivalent to uint_64t.
Definition: DCS_ModuleUtils.h:52
unsigned char u8
Equivalent to uint_8t.
Definition: DCS_ModuleUtils.h:58