TG Motion  version 421 - 4033/904 cnc 121
Real-time system for controlling servo drives and I/O modules
tgm_comm_int_ii_dll.h
Go to the documentation of this file.
1 /*
2 *-----------------------------------------------------------------------------+
3 * **************************** tgm_comm_int_ii_dll.h ************************ |
4 *-----------------------------------------------------------------------------+
5 * Copyright 2017 by TG Drives s.r.o. |
6 * |
7 * TG Drives s.r.o. |
8 * Olomoucka 1290/79 |
9 * CZ-627 00 Brno |
10 * Czech Republic |
11 * |
12 *-----------------------------------------------------------------------------+
13 * Description: |
14 * wrapper for TGM_Comm_Int_2.dll or libTGM_Comm_Int_2.so (dynamic load) |
15 * uses plain Win32 API on Windows |
16 * uses Qt functions on Linux |
17 * |
18 *-----------------------------------------------------------------------------+
19 * - rewritten according to comments of Frantisek Mikulu
20 * - added assertions to almost all function
21 * (mainly pointer check against nullptr)
22 */
23 
40 /*
41  * Note: some helper function are not yet documented.
42  *
43 */
44 
45 #ifndef TGMCOMMINT2_DLL_H
46 #define TGMCOMMINT2_DLL_H
47 
48 #ifdef __linux__
49 #define COM_CALLTYPE
50 #else
51 #define COM_CALLTYPE _cdecl
52 #endif
53 
54 #define MAX_OFFLINE_COUNT 100
55 
56 #include <stdint.h>
57 #include <assert.h>
58 
59 #if defined WIN32
60 # include <Windows.h>
61 # include <tchar.h>
62 # include <stdio.h>
63 #elif !defined UNDER_RTSS
64 # include <QLibrary>
65 # include <QDebug>
66 # include <QFileInfo>
67 #endif
68 
69 // windows specific data types
70 #ifdef WIN32
71 
72 // prevent multiple typedefs by #define trick
73 # ifndef TGM_HWND
74 # define TGM_HWND TGM_HWND
75  typedef HWND TGM_HWND;
76 # endif
77 
78 # if !defined _UNICODE
79 # error "_UNICODE must be defined for WIN32"
80 # endif
81 
82 # ifndef TGM_TCHAR
83 # define TGM_TCHAR TGM_TCHAR
84  typedef wchar_t TGM_TCHAR;
85 # endif
86 
87 # ifndef TGM_WCHAR
88 # define TGM_WCHAR TGM_WCHAR
89  typedef wchar_t TGM_WCHAR; // wchar_t on Windows is 16bits wide
90 # endif
91 
92 # ifndef TGM_TEXT
93 # define TGM_TEXT(a) TEXT(a)
94 # endif
95 
96 #else // linux or rtss
97 
98 # ifndef TGM_HWND
99 # define TGM_HWND TGM_HWND
100  typedef intptr_t TGM_HWND;
101 # endif
102 
103 # ifndef TGM_TCHAR
104 # define TGM_TCHAR TGM_TCHAR
105  typedef char TGM_TCHAR;
106 # endif
107 
108 # ifndef TGM_WCHAR
109 # define TGM_WCHAR TGM_WCHAR
110  typedef uint16_t TGM_WCHAR; // to keep the TGM structures the same on Windows and Linux
111  // we must use UTF-16 coding on Linux as well, thus WCHAR is 16bits
112  // (naturally, the wchar_t on Linux can be 32bits and is
113  // platform dependent)
114 # endif
115 
116 # ifndef TGM_TEXT
117 # define TGM_TEXT(a) (a)
118 # endif
119 
120 #endif
121 
122 // by default none of the wrapper function is declared as virtual
123 // but if the default error output is to be changed
124 // it can be done by declaring the respective functions
125 // as virtual and redefine them in a derived class
126 #define TGM_COMM_INT_VIRTUAL
127 //#define TGM_COMM_INT_VIRTUAL virtual
128 
129 
130 #ifdef WIN32
131 # if _MSC_VER < 1800 // below Visual Studio 2013
132 # pragma warning(push)
133 # pragma warning(disable : 4480) // VS2010: disable warning: non-standard extension used
134 # endif // Visual Studio 2013+
135 #endif
136 
137 #ifndef ENUM_CLASS_DEFINED
138 # ifdef __GNUC__
139 # define ENUM_CLASS class
140 # elif _MSC_VER < 1800 // below Visual Studio 2013
141 # define ENUM_CLASS
142 # else // Visual Studio 2013+
143 # define ENUM_CLASS class
144 # endif // _MSC_VER < 1800
145 # define ENUM_CLASS_DEFINED
146 #endif // !ENUM_CLASS_DEFINED
147 
170 {
171 public:
172  // constants - declared as enum class - strongly typed enums increase safety and readability of code
173  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
177  enum ENUM_CLASS error_code : int32_t
178  {
179  Success = 0,
189  };
190 
191  // conversion - for interfacing with C or Deplhi
192  static int32_t errorCodeToInt(error_code errorCode)
193  {
194  return static_cast<int32_t>(errorCode);
195  }
196 
197  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
201  enum ENUM_CLASS device : uint32_t
202  {
203  Local_TGM = 0,
204  TGM_Mini = 1,
206  };
207 
208  // conversion - for interfacing with C or Deplhi
209  static uint32_t deviceToInt(device deviceType)
210  {
211  return static_cast<uint32_t>(deviceType);
212  }
213  static device intToDevice(uint32_t deviceType)
214  {
215  switch (deviceType)
216  {
217  case static_cast<uint32_t>(device::Local_TGM) :
218  return device::Local_TGM;
219  case static_cast<uint32_t>(device::TGM_Mini) :
220  return device::TGM_Mini;
221  case static_cast<uint32_t>(device::TGM_REMOTE) :
222  return device::TGM_REMOTE;
223  default:
224  return device::Local_TGM;
225  }
226  }
227 
228  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
232  enum ENUM_CLASS connected_memory : int32_t
233  {
234  None = 0,
242  };
243 
244  // conversion - for interfacing with C or Deplhi
245  static int32_t connectedMemoryToInt(connected_memory mem)
246  {
247  return static_cast<int32_t>(mem);
248  }
249 
250  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
254  enum ENUM_CLASS compatibility : int32_t
255  {
256  App_ID_None = -1, // do not test App ID compatibility
257  App_Mem_ID_None = -1, // do not test App Mem ID compatibility
258  };
259 
260  // conversion - for interfacing with C or Deplhi
261  static int32_t compatibilityToInt(compatibility comp)
262  {
263  return static_cast<int32_t>(comp);
264  }
265 
266  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
270  enum ENUM_CLASS status : int32_t
271  {
272  Simulation_Mode_TGM = 2,
273  Online = 1,
285  };
286  // conversion - for interfacing with C or Deplhi
287  static int32_t statusToInt(status statusCode)
288  {
289  return static_cast<int32_t>(statusCode);
290  }
291 
292  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
296  enum ENUM_CLASS read_write : int32_t
297  {
298  OK = 0,
304 
305  // must be the same values as in ERR enum
308  };
309  // conversion - for interfacing with C or Deplhi
310  static int32_t readWriteToInt(read_write rwCode)
311  {
312  return static_cast<int32_t>(rwCode);
313  }
314 
315  // Shared memory numbers ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
320  enum ENUM_CLASS shared_memory : uint32_t
321  {
322  SYSTEM = 0,
323  DATA = 1,
324  CAM = 2,
325  OSC = 3,
326  SERVO = 4,
327  DIO = 5,
328  INTERP = 6,
329  INTERP_W = 7,
330  INTERP_R = 8,
331  ODS = 9,
332  CNC_EX = 10,
333  G_CODE = 11,
335  CNC_INI = 13,
336  UNIVERSAL = 14,
337  NMemories = 15,
338  };
339 
340  // converions functions - for interfacing with C or Deplhi
341  static uint32_t memoryTypeToInt(shared_memory memoryType)
342  {
343  return static_cast<uint32_t>(memoryType);
344  }
345 
346  static shared_memory intToMemoryType(uint32_t memoryType)
347  {
348  switch (memoryType)
349  {
350  case 0: return shared_memory::SYSTEM;
351  case 1: return shared_memory::DATA;
352  case 2: return shared_memory::CAM;
353  case 3: return shared_memory::OSC;
354  case 4: return shared_memory::SERVO;
355  case 5: return shared_memory::DIO;
356  case 6: return shared_memory::INTERP;
357  case 7: return shared_memory::INTERP_W;
358  case 8: return shared_memory::INTERP_R;
359  case 9: return shared_memory::ODS;
360  case 10: return shared_memory::CNC_EX;
361  case 11: return shared_memory::G_CODE;
362  case 12: return shared_memory::CNC_EX_LOCAL;
363  case 13: return shared_memory::CNC_INI;
364  case 14: return shared_memory::UNIVERSAL;
365  default:
366  // check if the enum class shared_memory has not been changed
367  // if so, this static_assert must be changed accordingly
368  static_assert(static_cast<uint32_t>(shared_memory::NMemories) == 15, "Number of shared memories must be 15");
369  return shared_memory::NMemories;
370  }
371  }
372 
373  // real-time process (RTSS or Zynq) needs only enums above
374  // so rest of code will not be used for it
375 #ifndef UNDER_RTSS
376 
377 public:
378  CTGM_COMM_INT_2() {}
379  TGM_COMM_INT_VIRTUAL ~CTGM_COMM_INT_2()
380  {
383  }
384 
385 
386 public:
394  error_code LoadDll(const char * fileName)
395  {
396  assert(fileName != nullptr);
397  error_code rv = preLoadDll(fileName);
398  if (rv != error_code::Success)
399  return rv;
400  m_pCREATE_INTERFACE_2 = reinterpret_cast<TGM_CREATE_INTERFACE_2 *>(getFuncAddress(fileName, "Create_Interface_2"));
401  m_pDESTROY_INTERFACE = reinterpret_cast<TGM_DESTROY_INTERFACE *>(getFuncAddress(fileName, "Destroy_Interface"));
402  m_pOPEN_CONNECTION = reinterpret_cast<TGM_OPEN_CONNECTION *>(getFuncAddress(fileName, "Open_Connection"));
403  m_pCHANGE_CONNECTION = reinterpret_cast<TGM_CHANGE_CONNECTION *>(getFuncAddress(fileName, "Change_Connection"));
404  m_pCLOSE_CONNECTION = reinterpret_cast<TGM_CLOSE_CONNECTION *>(getFuncAddress(fileName, "Close_Connection"));
405  m_pGET_DLL_INFO = reinterpret_cast<TGM_GET_DLL_INFO *>(getFuncAddress(fileName, "Get_DLL_Info"));
406  m_pSET_APP_COMPATIBILITY_VN = reinterpret_cast<TGM_SET_APP_COMPATIBILITY_VN *>(getFuncAddress(fileName, "Set_App_Compatibility_VN"));
407  m_pGET_STATUS = reinterpret_cast<TGM_GET_STATUS *>(getFuncAddress(fileName, "Get_Status"));
408  m_pGET_STATUS_GRAPHICS = reinterpret_cast<TGM_GET_STATUS_GRAPHICS *>(getFuncAddress(fileName, "Get_Status_Graphics"));
409  m_pGET_CONNECTIONS_INFO_2 = reinterpret_cast<TGM_GET_CONNECTIONS_INFO_2 *>(getFuncAddress(fileName, "Get_Connections_Info_2"));
410  m_pGET_SERVER_INFO = reinterpret_cast<TGM_GET_SERVER_INFO *>(getFuncAddress(fileName, "Get_Server_Info"));
411 
412  m_pSHOW_CONNECTIONS_INFO_WIN = reinterpret_cast<TGM_SHOW_CONNECTIONS_INFO_WIN *>(getFuncAddress(fileName, "Show_Connections_Info_Win"));
413  m_pCLOSE_CONNECTIONS_INFO_WIN = reinterpret_cast<TGM_CLOSE_CONNECTIONS_INFO_WIN *>(getFuncAddress(fileName, "Close_Connections_Info_Win"));
414  m_pGET_CONNECTIONS_INFO_WIN_DIMENSION = reinterpret_cast<TGM_GET_CONNECTIONS_INFO_WIN_DIMENSION *>(getFuncAddress(fileName, "Get_Connections_Info_Win_Dimension"));
415 
416  m_pREAD_I32 = reinterpret_cast<TGM_READ_I32 *>(getFuncAddress(fileName, "Read_I32"));
417  m_pREAD_I64 = reinterpret_cast<TGM_READ_I64 *>(getFuncAddress(fileName, "Read_I64"));
418  m_pREAD_double = reinterpret_cast<TGM_READ_double *>(getFuncAddress(fileName, "Read_Double"));
419  m_pREAD_BLOCK = reinterpret_cast<TGM_READ_BLOCK *>(getFuncAddress(fileName, "Read_Block"));
420  m_pREAD_LPSTR = reinterpret_cast<TGM_READ_LPSTR *>(getFuncAddress(fileName, "Read_LPSTR"));
421  m_pREAD_LPWSTR = reinterpret_cast<TGM_READ_LPWSTR *>(getFuncAddress(fileName, "Read_LPWSTR"));
422  m_pWRITE_I32 = reinterpret_cast<TGM_WRITE_I32 *>(getFuncAddress(fileName, "Write_I32"));
423  m_pWRITE_I64 = reinterpret_cast<TGM_WRITE_I64 *>(getFuncAddress(fileName, "Write_I64"));
424  m_pWRITE_double = reinterpret_cast<TGM_WRITE_double *>(getFuncAddress(fileName, "Write_Double"));
425  m_pWRITE_BLOCK = reinterpret_cast<TGM_WRITE_BLOCK *>(getFuncAddress(fileName, "Write_Block"));
426  m_pWRITE_LPSTR = reinterpret_cast<TGM_WRITE_LPSTR *>(getFuncAddress(fileName, "Write_LPSTR"));
427  m_pWRITE_LPWSTR = reinterpret_cast<TGM_WRITE_LPWSTR *>(getFuncAddress(fileName, "Write_LPWSTR"));
428  m_pSET_BIT_I32 = reinterpret_cast<TGM_SET_BIT_I32 *>(getFuncAddress(fileName, "SetB_I32"));
429  m_pSET_BIT_I64 = reinterpret_cast<TGM_SET_BIT_I64 *>(getFuncAddress(fileName, "SetB_I64"));
430  m_pCLR_BIT_I32 = reinterpret_cast<TGM_CLR_BIT_I32 *>(getFuncAddress(fileName, "ClrB_I32"));
431  m_pCLR_BIT_I64 = reinterpret_cast<TGM_CLR_BIT_I64 *>(getFuncAddress(fileName, "ClrB_I64"));
432  m_pTGL_BIT_I32 = reinterpret_cast<TGM_TGL_BIT_I32 *>(getFuncAddress(fileName, "TglB_I32"));
433  m_pTGL_BIT_I64 = reinterpret_cast<TGM_TGL_BIT_I64 *>(getFuncAddress(fileName, "TglB_I64"));
434  m_pREAD_I32_DIRECT = reinterpret_cast<TGM_READ_I32_DIRECT *>(getFuncAddress(fileName, "Read_I32_Direct"));
435  m_pREAD_I64_DIRECT = reinterpret_cast<TGM_READ_I64_DIRECT *>(getFuncAddress(fileName, "Read_I64_Direct"));
436  m_pREAD_double_DIRECT = reinterpret_cast<TGM_READ_double_DIRECT *>(getFuncAddress(fileName, "Read_Double_Direct"));
437  m_pREAD_BLOCK_DIRECT = reinterpret_cast<TGM_READ_BLOCK_DIRECT *>(getFuncAddress(fileName, "Read_Block_Direct"));
438  m_pREAD_LPSTR_DIRECT = reinterpret_cast<TGM_READ_LPSTR_DIRECT *>(getFuncAddress(fileName, "Read_LPSTR_Direct"));
439  m_pREAD_LPWSTR_DIRECT = reinterpret_cast<TGM_READ_LPWSTR_DIRECT *>(getFuncAddress(fileName, "Read_LPWSTR_Direct"));
440  m_pWRITE_I32_DIRECT = reinterpret_cast<TGM_WRITE_I32_DIRECT *>(getFuncAddress(fileName, "Write_I32_Direct"));
441  m_pWRITE_I64_DIRECT = reinterpret_cast<TGM_WRITE_I64_DIRECT *>(getFuncAddress(fileName, "Write_I64_Direct"));
442  m_pWRITE_double_DIRECT = reinterpret_cast<TGM_WRITE_double_DIRECT *>(getFuncAddress(fileName, "Write_Double_Direct"));
443  m_pWRITE_BLOCK_DIRECT = reinterpret_cast<TGM_WRITE_BLOCK_DIRECT *>(getFuncAddress(fileName, "Write_Block_Direct"));
444  m_pWRITE_LPSTR_DIRECT = reinterpret_cast<TGM_WRITE_LPSTR_DIRECT *>(getFuncAddress(fileName, "Write_LPSTR_Direct"));
445  m_pWRITE_LPWSTR_DIRECT = reinterpret_cast<TGM_WRITE_LPWSTR_DIRECT *>(getFuncAddress(fileName, "Write_LPWSTR_Direct"));
446  m_pSET_BIT_I32_DIRECT = reinterpret_cast<TGM_SET_BIT_I32_DIRECT *>(getFuncAddress(fileName, "SetB_I32_Direct"));
447  m_pSET_BIT_I64_DIRECT = reinterpret_cast<TGM_SET_BIT_I64_DIRECT *>(getFuncAddress(fileName, "SetB_I64_Direct"));
448  m_pCLR_BIT_I32_DIRECT = reinterpret_cast<TGM_CLR_BIT_I32_DIRECT *>(getFuncAddress(fileName, "ClrB_I32_Direct"));
449  m_pCLR_BIT_I64_DIRECT = reinterpret_cast<TGM_CLR_BIT_I64_DIRECT *>(getFuncAddress(fileName, "ClrB_I64_Direct"));
450  m_pTGL_BIT_I32_DIRECT = reinterpret_cast<TGM_TGL_BIT_I32_DIRECT *>(getFuncAddress(fileName, "TglB_I32_Direct"));
451  m_pTGL_BIT_I64_DIRECT = reinterpret_cast<TGM_TGL_BIT_I64_DIRECT *>(getFuncAddress(fileName, "TglB_I64_Direct"));
452  m_pFLUSH_BUFFER = reinterpret_cast<TGM_FLUSH_BUFFER *>(getFuncAddress(fileName, "Fluh_Buffer"));
453 
454 #if defined __linux__
455  QFileInfo dirAndPath(fileName);
456  return Create_Interface_2(qPrintable(dirAndPath.absolutePath()));
457 #else
458  // convert ANSI to UNICODE
459  wchar_t dirAndPath[_MAX_DIR + _MAX_PATH], path[_MAX_PATH];
460  int wchars_num = MultiByteToWideChar(CP_UTF8, 0, fileName, -1, NULL, 0);
461  if (wchars_num <= 0)
462  {
463  return error_code::Invalid_Data;
464  }
465  WCHAR* fileNameW = new WCHAR[static_cast<size_t>(wchars_num)];
466  MultiByteToWideChar(CP_UTF8, 0, fileName, -1, fileNameW, wchars_num);
467 
468  _wsplitpath_s(fileNameW, dirAndPath, _countof(dirAndPath), path, _countof(path), nullptr, 0, nullptr, 0);
469  delete[] fileNameW;
470 
471  wcscat_s(dirAndPath, path);
472  return Create_Interface_2(dirAndPath);
473 #endif
474  }
481  error_code Create_Interface_2(const TGM_TCHAR *DLL_Directory)
482  {
483  assert(DLL_Directory != nullptr);
484  if (m_nCreateInterfaceCalled > 0)
485  return error_code::Interface_Already_Exists;
486 
487  if (m_pCREATE_INTERFACE_2)
488  {
489  status statusCode = Get_Status();
490  if (statusCode == status::Offline_Interface_Not_Create)
491  {
492  m_offlineCounter = 0;
493  error_code code = dispErrorCode(("Create_Interface_2"), m_pCREATE_INTERFACE_2(DLL_Directory));
494  if (code == error_code::Success)
495  {
496  m_nCreateInterfaceCalled++;
497  m_bCreateInterfaceAlreadyCalledByApplication = false;
498  }
499  return code;
500  }
501  else
502  {
503  m_nCreateInterfaceCalled++;
504  // interface has been created by parent application
505  // so we cannot destroy it - protect by this flag
506  m_bCreateInterfaceAlreadyCalledByApplication = true;
507  return error_code::Success;
508  }
509  }
510  return error_code::Not_Detect_Comm_DLL;
511  }
516  {
517  m_nCreateInterfaceCalled--;
518  if(m_nCreateInterfaceCalled != 0)
519  return;
520 
521  if (m_pDESTROY_INTERFACE)
522  {
523  // if the create interface was called before this wrapper, e.g. by application
524  // we cannot destroy it, since the subsequent call of Destroy_Interface
525  // would fail
526  if (m_bCreateInterfaceAlreadyCalledByApplication == false)
527  m_pDESTROY_INTERFACE();
528  }
529  m_hModule.unload();
530  }
540  error_code Open_Connection(int32_t keepOnline, int32_t commTimeout, device deviceType, uint32_t IPAddress)
541  {
542  // exactly one call of Create_Interface is needed to open an connection
543  if (m_nCreateInterfaceCalled != 1)
544  return error_code::Interface_Not_Create;
545 
546  // another check inside TGM_Comm_Int_2.dll
547  status statusCode = Get_Status();
548  if (statusCode == status::Offline_Interface_Not_Create)
549  return error_code::Interface_Not_Create;
550 
551  // cannot call Open_Connection multiple times without Close_Connection
552  if (m_nOpenConnectionCalled > 0)
553  return error_code::Connection_Already_Exists;
554 
555  m_nOpenConnectionCalled++;
556 
557  error_code rv = error_code::Not_Detect_Comm_DLL;
558  if (statusCode == status::Offline_Connection_Not_Opened)
559  {
560  m_offlineCounter = 0;
561  if (m_pOPEN_CONNECTION)
562  {
563  m_bOpenConnectionAlreadyCalledByApplication = false;
564  rv = dispErrorCode(("Open_Connection"), m_pOPEN_CONNECTION(keepOnline, commTimeout, deviceType, IPAddress));
565  }
566  }
567  else
568  {
569  // OpenConnection was already called by parent application
570  // therefore we cannot CloseConnection
571  m_bOpenConnectionAlreadyCalledByApplication = true;
572  }
573 
574  return rv;
575  }
581  {
582  if (m_nCreateInterfaceCalled != 1)
583  return error_code::Interface_Not_Create;
584 
585  // another check inside TGM_Comm_Int_2.dll
586  status statusCode = Get_Status();
587  if (statusCode == status::Offline_Interface_Not_Create)
588  return error_code::Interface_Not_Create;
589 
590  m_nOpenConnectionCalled--;
591  if(m_nOpenConnectionCalled != 0)
592  {
593  return error_code::Connection_Not_Open;
594  }
595 
596  // we can close connection only if it is opened by the wrapper
597  if (m_bOpenConnectionAlreadyCalledByApplication == false)
598  {
599  if (m_pCLOSE_CONNECTION)
600  return dispErrorCode(("Close_Connection"), m_pCLOSE_CONNECTION());
601  return error_code::Not_Detect_Comm_DLL;
602  }
603  return error_code::Success;
604  }
611  error_code Change_Connection(device deviceType, uint32_t IPAddress)
612  {
613  if (m_nCreateInterfaceCalled != 1)
614  return error_code::Interface_Not_Create;
615 
616  // another check inside TGM_Comm_Int_2.dll
617  status statusCode = Get_Status();
618  if (statusCode == status::Offline_Interface_Not_Create)
619  return error_code::Interface_Not_Create;
620 
621  // only one OpenConnection can be called
622  if(m_nOpenConnectionCalled != 1)
623  {
624  return error_code::Connection_Not_Open;
625  }
626 
627  return dispErrorCode(("CHANGE_CONNECTION"), m_pCHANGE_CONNECTION(deviceType, IPAddress));
628  }
637  error_code Get_Dll_Info(device deviceType, int32_t *pVersion, int32_t *pCompatibilityID, int32_t *pCompatibilityMemID)
638  {
639  assert(pVersion != nullptr);
640  assert(pCompatibilityID != nullptr);
641  assert(pCompatibilityMemID != nullptr);
642  if (m_pGET_DLL_INFO)
643  return dispErrorCode(("GET_DLL_INFO"), m_pGET_DLL_INFO(deviceType, pVersion, pCompatibilityID, pCompatibilityMemID));
644  return error_code::Not_Detect_Comm_DLL;
645  }
646 
658  void Set_App_Compatibility_VN(int32_t compatibilityID, int32_t compatibilityMemID, int32_t version, const TGM_TCHAR *appName)
659  {
660  assert(appName != nullptr);
661  if (m_pSET_APP_COMPATIBILITY_VN)
662  m_pSET_APP_COMPATIBILITY_VN(compatibilityID, compatibilityMemID, version, appName);
663  }
669  {
670  if (m_pGET_STATUS)
671  return m_pGET_STATUS();
672  return status::Offline_Not_Detect_Comm_DLL;
673  }
674 
683  status Get_Status_Graphics(int32_t *pBackgroundColor, int32_t *pTextColor, TGM_TCHAR *statusText)
684  {
685  if (m_pGET_STATUS_GRAPHICS)
686  return m_pGET_STATUS_GRAPHICS(pBackgroundColor, pTextColor, statusText);
687  return status::Offline_Not_Detect_Comm_DLL;
688  }
689 
697  error_code Show_Connections_Info_Win(TGM_HWND parent, int32_t enableChangeConnection)
698  {
699  if (m_pSHOW_CONNECTIONS_INFO_WIN)
700  return m_pSHOW_CONNECTIONS_INFO_WIN(parent, enableChangeConnection);
701  return error_code::Not_Detect_Comm_DLL;
702  }
703 
709  {
710  if (m_pCLOSE_CONNECTIONS_INFO_WIN)
711  return m_pCLOSE_CONNECTIONS_INFO_WIN();
712  return error_code::Not_Detect_Comm_DLL;
713  }
714 
722  void Get_Connections_Info_Win_Dimension(int32_t *pWidth, int32_t *pHeight)
723  {
724  assert(pWidth != nullptr);
725  assert(pHeight != nullptr);
726  if (m_pGET_CONNECTIONS_INFO_WIN_DIMENSION)
727  m_pGET_CONNECTIONS_INFO_WIN_DIMENSION(pWidth, pHeight);
728  }
729 
738  error_code Get_Connections_Info_2(device *pDeviceType, uint32_t *IPAddress, connected_memory *pConnectedMemory)
739  {
740  assert(pDeviceType != nullptr);
741  assert(IPAddress != nullptr);
742  assert(pConnectedMemory != nullptr);
743  if (m_pGET_CONNECTIONS_INFO_2)
744  return dispErrorCode(("GET_CONNECTIONS_INFO_2"), m_pGET_CONNECTIONS_INFO_2(pDeviceType, IPAddress, pConnectedMemory));
745  return error_code::Not_Detect_Comm_DLL;
746  }
747 
758  int32_t *pCompatibilityID,
759  int32_t *pCompatibilityMemID,
760  status *pConnectionStatus)
761  {
762  assert(pCompatibilityID != nullptr);
763  assert(pCompatibilityMemID != nullptr);
764  assert(pConnectionStatus != nullptr);
765  if (m_pGET_SERVER_INFO)
766  return dispErrorCode(("GET_SERVER_INFO"), m_pGET_SERVER_INFO(deviceType, pCompatibilityID, pCompatibilityMemID, pConnectionStatus));
767  return error_code::Not_Detect_Comm_DLL;
768  }
769  // access functions
780  read_write Read_I32(shared_memory memoryType, uint32_t offset, int32_t *pValue)
781  {
782  assert(pValue != nullptr);
783  if (m_offlineCounter >= MAX_OFFLINE_COUNT)
784  return read_write::ERR_Device_Busy;
785  if (m_pREAD_I32)
786  return dispErrorCode(("READ_I32"), m_pREAD_I32(memoryType, offset, pValue));
787  return read_write::ERR_Not_Detect_Comm_DLL;
788  }
799  read_write Read_I64(shared_memory memoryType, uint32_t offset, int64_t *pValue)
800  {
801  assert(pValue != nullptr);
802  if (m_offlineCounter >= MAX_OFFLINE_COUNT)
803  return read_write::ERR_Device_Busy;
804  if (m_pREAD_I64)
805  return dispErrorCode(("READ_I64"), m_pREAD_I64(memoryType, offset, pValue));
806  return read_write::ERR_Not_Detect_Comm_DLL;
807  }
818  read_write Read_Double(shared_memory memoryType, uint32_t offset, double *pValue)
819  {
820  assert(pValue != nullptr);
821  if (m_offlineCounter >= MAX_OFFLINE_COUNT)
822  return read_write::ERR_Device_Busy;
823  if (m_pREAD_double)
824  return dispErrorCode(("READ_double"), m_pREAD_double(memoryType, offset, pValue));
825  return read_write::ERR_Not_Detect_Comm_DLL;
826  }
838  read_write Read_BLOCK(shared_memory memoryType, uint32_t offset, void *buffer, uint32_t bufferLength)
839  {
840  assert(buffer != nullptr);
841  assert(bufferLength > 0);
842  if (m_offlineCounter >= MAX_OFFLINE_COUNT)
843  return read_write::ERR_Device_Busy;
844  if (m_pREAD_BLOCK)
845  return dispErrorCode(("READ_BLOCK"), m_pREAD_BLOCK(memoryType, offset, buffer, bufferLength));
846  return read_write::ERR_Not_Detect_Comm_DLL;
847  }
861  read_write Read_LPSTR(shared_memory memoryType, uint32_t offset, char *buffer, uint32_t buffer_Char_Len, uint32_t *pRead_Char_Count)
862  {
863  assert(buffer != nullptr);
864  assert(buffer_Char_Len > 0);
865  assert(pRead_Char_Count != nullptr);
866  if (m_offlineCounter >= MAX_OFFLINE_COUNT)
867  return read_write::ERR_Device_Busy;
868  if (m_pREAD_LPSTR)
869  return dispErrorCode(("Read_LPSTR"), m_pREAD_LPSTR(memoryType, offset, buffer, buffer_Char_Len, pRead_Char_Count));
870  return read_write::ERR_Not_Detect_Comm_DLL;
871  }
883  read_write Read_LPWSTR(shared_memory memoryType, uint32_t offset, TGM_WCHAR *buffer, uint32_t buffer_Char_Len, uint32_t *pRead_Char_Count)
884  {
885  assert(buffer != nullptr);
886  assert(buffer_Char_Len > 0);
887  assert(pRead_Char_Count != nullptr);
888  if (m_offlineCounter >= MAX_OFFLINE_COUNT)
889  return read_write::ERR_Device_Busy;
890  if (m_pREAD_LPWSTR)
891  return dispErrorCode(("Read_LPWSTR"), m_pREAD_LPWSTR(memoryType, offset, buffer, buffer_Char_Len, pRead_Char_Count));
892  return read_write::ERR_Not_Detect_Comm_DLL;
893  }
902  read_write Write_I32(shared_memory memoryType, uint32_t offset, int32_t Value)
903  {
904  if (m_offlineCounter >= MAX_OFFLINE_COUNT)
905  return read_write::ERR_Device_Busy;
906  if (m_pWRITE_I32)
907  return dispErrorCode(("WRITE_I32"), m_pWRITE_I32(memoryType, offset, Value));
908  return read_write::ERR_Not_Detect_Comm_DLL;
909  }
918  read_write Write_I64(shared_memory memoryType, uint32_t offset, int64_t Value)
919  {
920  if (m_offlineCounter >= MAX_OFFLINE_COUNT)
921  return read_write::ERR_Device_Busy;
922  if (m_pWRITE_I64)
923  return dispErrorCode(("WRITE_I64"), m_pWRITE_I64(memoryType, offset, Value));
924  return read_write::ERR_Not_Detect_Comm_DLL;
925  }
935  read_write Write_Double(shared_memory memoryType, uint32_t offset, double Value)
936  {
937  if (m_offlineCounter >= MAX_OFFLINE_COUNT)
938  return read_write::ERR_Device_Busy;
939  if (m_pWRITE_double)
940  return dispErrorCode(("WRITE_double"), m_pWRITE_double(memoryType, offset, Value));
941  return read_write::ERR_Not_Detect_Comm_DLL;
942  }
956  read_write Write_BLOCK(shared_memory memoryType, uint32_t offset, const void *buffer, uint32_t bufferLength)
957  {
958  assert(buffer != nullptr);
959  assert(bufferLength > 0);
960  if (m_offlineCounter >= MAX_OFFLINE_COUNT)
961  return read_write::ERR_Device_Busy;
962  if (m_pWRITE_BLOCK)
963  return dispErrorCode(("WRITE_BLOCK"), m_pWRITE_BLOCK(memoryType, offset, buffer, bufferLength));
964  return read_write::ERR_Not_Detect_Comm_DLL;
965  }
966 
980  read_write Write_LPSTR(shared_memory memoryType, uint32_t offset, const char *buffer, uint32_t Write_Char_Len)
981  {
982  assert(buffer != nullptr);
983  assert(Write_Char_Len > 0);
984  if (m_offlineCounter >= MAX_OFFLINE_COUNT)
985  return read_write::ERR_Device_Busy;
986  if (m_pWRITE_LPSTR)
987  return dispErrorCode(("Write_LPSTR"), m_pWRITE_LPSTR(memoryType, offset, buffer, Write_Char_Len));
988  return read_write::ERR_Not_Detect_Comm_DLL;
989  }
990 
1004  read_write Write_LPWSTR(shared_memory memoryType, uint32_t offset, const TGM_WCHAR *buffer, uint32_t Write_Char_Len)
1005  {
1006  assert(buffer != nullptr);
1007  assert(Write_Char_Len > 0);
1008  if (m_offlineCounter >= MAX_OFFLINE_COUNT)
1009  return read_write::ERR_Device_Busy;
1010  if (m_pWRITE_LPWSTR)
1011  return dispErrorCode(("Write_LPWSTR"), m_pWRITE_LPWSTR(memoryType, offset, buffer, Write_Char_Len));
1012  return read_write::ERR_Not_Detect_Comm_DLL;
1013  }
1023  read_write Set_Bit_I32(shared_memory memoryType, uint32_t offset, int32_t Value)
1024  {
1025  assert((offset & 0x3) == 0); // offset must be aligned to 4 bytes
1026  if (m_offlineCounter >= MAX_OFFLINE_COUNT)
1027  return read_write::ERR_Device_Busy;
1028  if (m_pSET_BIT_I32)
1029  return dispErrorCode(("SET_BIT_I32"), m_pSET_BIT_I32(memoryType, offset, Value));
1030  return read_write::ERR_Not_Detect_Comm_DLL;
1031  }
1041  read_write Set_Bit_I64(shared_memory memoryType, uint32_t offset, int64_t Value)
1042  {
1043  assert((offset & 0x7) == 0); // offset must be aligned to 8 bytes
1044  if (m_offlineCounter >= MAX_OFFLINE_COUNT)
1045  return read_write::ERR_Device_Busy;
1046  if (m_pSET_BIT_I64)
1047  return dispErrorCode(("SET_BIT_I64"), m_pSET_BIT_I64(memoryType, offset, Value));
1048  return read_write::ERR_Not_Detect_Comm_DLL;
1049  }
1059  read_write Clr_Bit_I32(shared_memory memoryType, uint32_t offset, int32_t Value)
1060  {
1061  assert((offset & 0x3) == 0); // offset must be aligned to 4 bytes
1062  if (m_offlineCounter >= MAX_OFFLINE_COUNT)
1063  return read_write::ERR_Device_Busy;
1064  if (m_pCLR_BIT_I32)
1065  return dispErrorCode(("CLR_BIT_I32"), m_pCLR_BIT_I32(memoryType, offset, Value));
1066  return read_write::ERR_Not_Detect_Comm_DLL;
1067  }
1077  read_write Clr_Bit_I64(shared_memory memoryType, uint32_t offset, int64_t Value)
1078  {
1079  assert((offset & 0x7) == 0); // offset must be aligned to 8 bytes
1080  if (m_offlineCounter >= MAX_OFFLINE_COUNT)
1081  return read_write::ERR_Device_Busy;
1082  if (m_pCLR_BIT_I64)
1083  return dispErrorCode(("CLR_BIT_I64"), m_pCLR_BIT_I64(memoryType, offset, Value));
1084  return read_write::ERR_Not_Detect_Comm_DLL;
1085  }
1095  read_write Tgl_Bit_I32(shared_memory memoryType, uint32_t offset, int32_t Value)
1096  {
1097  assert((offset & 0x3) == 0); // offset must be aligned to 4 bytes
1098  if (m_offlineCounter >= MAX_OFFLINE_COUNT)
1099  return read_write::ERR_Device_Busy;
1100  if (m_pTGL_BIT_I32)
1101  return dispErrorCode(("TGL_BIT_I32"), m_pTGL_BIT_I32(memoryType, offset, Value));
1102  return read_write::ERR_Not_Detect_Comm_DLL;
1103  }
1113  read_write Tgl_Bit_I64(shared_memory memoryType, uint32_t offset, int64_t Value)
1114  {
1115  assert((offset & 0x7) == 0); // offset must be aligned to 8 bytes
1116  if (m_offlineCounter >= MAX_OFFLINE_COUNT)
1117  return read_write::ERR_Device_Busy;
1118  if (m_pTGL_BIT_I64)
1119  return dispErrorCode(("TGL_BIT_I64"), m_pTGL_BIT_I64(memoryType, offset, Value));
1120  return read_write::ERR_Not_Detect_Comm_DLL;
1121  }
1122 
1133  read_write Read_I32_DIRECT(shared_memory memoryType, uint32_t offset, int32_t *pValue)
1134  {
1135  assert(pValue != nullptr);
1136  if (m_offlineCounter >= MAX_OFFLINE_COUNT)
1137  return read_write::ERR_Device_Busy;
1138  if (m_pREAD_I32_DIRECT)
1139  return dispErrorCode(("READ_I32_DIRECT"), m_pREAD_I32_DIRECT(memoryType, offset, pValue));
1140  return read_write::ERR_Not_Detect_Comm_DLL;
1141  }
1152  read_write Read_I64_DIRECT(shared_memory memoryType, uint32_t offset, int64_t *pValue)
1153  {
1154  assert(pValue != nullptr);
1155  if (m_offlineCounter >= MAX_OFFLINE_COUNT)
1156  return read_write::ERR_Device_Busy;
1157  if (m_pREAD_I64_DIRECT)
1158  return dispErrorCode(("READ_I64_DIRECT"), m_pREAD_I64_DIRECT(memoryType, offset, pValue));
1159  return read_write::ERR_Not_Detect_Comm_DLL;
1160  }
1171  read_write Read_Double_DIRECT(shared_memory memoryType, uint32_t offset, double *pValue)
1172  {
1173  assert(pValue != nullptr);
1174  if (m_offlineCounter >= MAX_OFFLINE_COUNT)
1175  return read_write::ERR_Device_Busy;
1176  if (m_pREAD_double_DIRECT)
1177  return dispErrorCode(("READ_double_DIRECT"), m_pREAD_double_DIRECT(memoryType, offset, pValue));
1178  return read_write::ERR_Not_Detect_Comm_DLL;
1179  }
1191  read_write Read_BLOCK_DIRECT(shared_memory memoryType, uint32_t offset, void *buffer, uint32_t bufferLength)
1192  {
1193  assert(buffer != nullptr);
1194  assert(bufferLength > 0);
1195  if (m_offlineCounter >= MAX_OFFLINE_COUNT)
1196  return read_write::ERR_Device_Busy;
1197  if (m_pREAD_BLOCK_DIRECT)
1198  return dispErrorCode(("READ_BLOCK_DIRECT"), m_pREAD_BLOCK_DIRECT(memoryType, offset, buffer, bufferLength));
1199  return read_write::ERR_Not_Detect_Comm_DLL;
1200  }
1214  read_write Read_LPSTR_DIRECT(shared_memory memoryType, uint32_t offset, char *buffer, uint32_t buffer_Char_Len, uint32_t *pRead_Char_Count)
1215  {
1216  assert(buffer != nullptr);
1217  assert(buffer_Char_Len > 0);
1218  assert(pRead_Char_Count != nullptr);
1219  if (m_offlineCounter >= MAX_OFFLINE_COUNT)
1220  return read_write::ERR_Device_Busy;
1221  if (m_pREAD_LPSTR)
1222  return dispErrorCode(("Read_LPSTR_DIRECT"), m_pREAD_LPSTR(memoryType, offset, buffer, buffer_Char_Len, pRead_Char_Count));
1223  return read_write::ERR_Not_Detect_Comm_DLL;
1224  }
1238  read_write Read_LPWSTR_DIRECT(shared_memory memoryType, uint32_t offset, TGM_WCHAR *buffer, uint32_t buffer_Char_Len, uint32_t *pRead_Char_Count)
1239  {
1240  assert(buffer != nullptr);
1241  assert(buffer_Char_Len > 0);
1242  assert(pRead_Char_Count != nullptr);
1243  if (m_offlineCounter >= MAX_OFFLINE_COUNT)
1244  return read_write::ERR_Device_Busy;
1245  if (m_pREAD_LPWSTR)
1246  return dispErrorCode(("Read_LPWSTR_DRIECT"), m_pREAD_LPWSTR(memoryType, offset, buffer, buffer_Char_Len, pRead_Char_Count));
1247  return read_write::ERR_Not_Detect_Comm_DLL;
1248  }
1257  read_write Write_I32_DIRECT(shared_memory memoryType, uint32_t offset, int32_t Value)
1258  {
1259  if (m_offlineCounter >= MAX_OFFLINE_COUNT)
1260  return read_write::ERR_Device_Busy;
1261  if (m_pWRITE_I32_DIRECT)
1262  return dispErrorCode(("WRITE_I32_DIRECT"), m_pWRITE_I32_DIRECT(memoryType, offset, Value));
1263  return read_write::ERR_Not_Detect_Comm_DLL;
1264  }
1273  read_write Write_I64_DIRECT(shared_memory memoryType, uint32_t offset, int64_t Value)
1274  {
1275  if (m_offlineCounter >= MAX_OFFLINE_COUNT)
1276  return read_write::ERR_Device_Busy;
1277  if (m_pWRITE_I64_DIRECT)
1278  return dispErrorCode(("WRITE_I64_DIRECT"), m_pWRITE_I64_DIRECT(memoryType, offset, Value));
1279  return read_write::ERR_Not_Detect_Comm_DLL;
1280  }
1289  read_write Write_Double_DIRECT(shared_memory memoryType, uint32_t offset, double Value)
1290  {
1291  if (m_offlineCounter >= MAX_OFFLINE_COUNT)
1292  return read_write::ERR_Device_Busy;
1293  if (m_pWRITE_double_DIRECT)
1294  return dispErrorCode(("WRITE_double_DIRECT"), m_pWRITE_double_DIRECT(memoryType, offset, Value));
1295  return read_write::ERR_Not_Detect_Comm_DLL;
1296  }
1297 
1310  read_write Write_BLOCK_DIRECT(shared_memory memoryType, uint32_t offset, const void *buffer, uint32_t bufferLength)
1311  {
1312  assert(buffer != nullptr);
1313  assert(bufferLength > 0);
1314  if (m_offlineCounter >= MAX_OFFLINE_COUNT)
1315  return read_write::ERR_Device_Busy;
1316  if (m_pWRITE_BLOCK_DIRECT)
1317  return dispErrorCode(("WRITE_BLOCK_DIRECT"), m_pWRITE_BLOCK_DIRECT(memoryType, offset, buffer, bufferLength));
1318  return read_write::ERR_Not_Detect_Comm_DLL;
1319  }
1331  read_write Write_LPSTR_DIRECT(shared_memory memoryType, uint32_t offset, const char *buffer, uint32_t Write_Char_Len)
1332  {
1333  assert(buffer != nullptr);
1334  assert(Write_Char_Len > 0);
1335  if (m_offlineCounter >= MAX_OFFLINE_COUNT)
1336  return read_write::ERR_Device_Busy;
1337  if (m_pWRITE_LPSTR_DIRECT)
1338  return dispErrorCode(("Write_LPSTR_Direct"), m_pWRITE_LPSTR_DIRECT(memoryType, offset, buffer, Write_Char_Len));
1339  return read_write::ERR_Not_Detect_Comm_DLL;
1340  }
1341 
1353  read_write Write_LPWSTR_DIRECT(shared_memory memoryType, uint32_t offset, const TGM_WCHAR *buffer, uint32_t Write_Char_Len)
1354  {
1355  assert(buffer != nullptr);
1356  assert(Write_Char_Len > 0);
1357  if (m_offlineCounter >= MAX_OFFLINE_COUNT)
1358  return read_write::ERR_Device_Busy;
1359  if (m_pWRITE_LPWSTR_DIRECT)
1360  return dispErrorCode(("Write_LPWSTR_Direct"), m_pWRITE_LPWSTR_DIRECT(memoryType, offset, buffer, Write_Char_Len));
1361  return read_write::ERR_Not_Detect_Comm_DLL;
1362  }
1372  read_write Set_Bit_I32_DIRECT(shared_memory memoryType, uint32_t offset, int32_t Value)
1373  {
1374  assert((offset & 0x3) == 0); // offset must be aligned to 4 bytes
1375  if (m_offlineCounter >= MAX_OFFLINE_COUNT)
1376  return read_write::ERR_Device_Busy;
1377  if (m_pSET_BIT_I32_DIRECT)
1378  return dispErrorCode(("SET_BIT_I32_DIRECT"), m_pSET_BIT_I32_DIRECT(memoryType, offset, Value));
1379  return read_write::ERR_Not_Detect_Comm_DLL;
1380  }
1390  read_write Set_Bit_I64_DIRECT(shared_memory memoryType, uint32_t offset, int64_t Value)
1391  {
1392  assert((offset & 0x7) == 0); // offset must be aligned to 8 bytes
1393  if (m_offlineCounter >= MAX_OFFLINE_COUNT)
1394  return read_write::ERR_Device_Busy;
1395  if (m_pSET_BIT_I64_DIRECT)
1396  return dispErrorCode(("SET_BIT_I64_DIRECT"), m_pSET_BIT_I64_DIRECT(memoryType, offset, Value));
1397  return read_write::ERR_Not_Detect_Comm_DLL;
1398  }
1408  read_write Clr_Bit_I32_DIRECT(shared_memory memoryType, uint32_t offset, int32_t Value)
1409  {
1410  assert((offset & 0x3) == 0); // offset must be aligned to 4 bytes
1411  if (m_offlineCounter >= MAX_OFFLINE_COUNT)
1412  return read_write::ERR_Device_Busy;
1413  if (m_pCLR_BIT_I32_DIRECT)
1414  return dispErrorCode(("CLR_BIT_I32_DIRECT"), m_pCLR_BIT_I32_DIRECT(memoryType, offset, Value));
1415  return read_write::ERR_Not_Detect_Comm_DLL;
1416  }
1426  read_write Clr_Bit_I64_DIRECT(shared_memory memoryType, uint32_t offset, int64_t Value)
1427  {
1428  assert((offset & 0x7) == 0); // offset must be aligned to 8 bytes
1429  if (m_offlineCounter >= MAX_OFFLINE_COUNT)
1430  return read_write::ERR_Device_Busy;
1431  if (m_pCLR_BIT_I64_DIRECT)
1432  return dispErrorCode(("CLR_BIT_I64_DIRECT"), m_pCLR_BIT_I64_DIRECT(memoryType, offset, Value));
1433  return read_write::ERR_Not_Detect_Comm_DLL;
1434  }
1444  read_write Tgl_Bit_I32_DIRECT(shared_memory memoryType, uint32_t offset, int32_t Value)
1445  {
1446  assert((offset & 0x3) == 0); // offset must be aligned to 4 bytes
1447  if (m_offlineCounter >= MAX_OFFLINE_COUNT)
1448  return read_write::ERR_Device_Busy;
1449  if (m_pTGL_BIT_I32_DIRECT)
1450  return dispErrorCode(("TGL_BIT_I32_DIRECT"), m_pTGL_BIT_I32_DIRECT(memoryType, offset, Value));
1451  return read_write::ERR_Not_Detect_Comm_DLL;
1452  }
1462  read_write Tgl_Bit_I64_DIRECT(shared_memory memoryType, uint32_t offset, int64_t Value)
1463  {
1464  assert((offset & 0x7) == 0); // offset must be aligned to 8 bytes
1465  if (m_offlineCounter >= MAX_OFFLINE_COUNT)
1466  return read_write::ERR_Device_Busy;
1467  if (m_pTGL_BIT_I64_DIRECT)
1468  return dispErrorCode(("TGL_BIT_I64_DIRECT"), m_pTGL_BIT_I64_DIRECT(memoryType, offset, Value));
1469  return read_write::ERR_Not_Detect_Comm_DLL;
1470  }
1477  {
1478  if (m_pFLUSH_BUFFER)
1479  return dispErrorCode(("FLUSH_BUFFER"), m_pFLUSH_BUFFER());
1480  return read_write::ERR_Interface_Not_Create;
1481  }
1482 
1483  // suplemental helpers: convert enum classes to strings
1484  // UNICODE/ANSI versions
1490  static const TGM_TCHAR * DeviceToString(device deviceType)
1491  {
1492  switch (deviceType)
1493  {
1494  case device::Local_TGM:
1495  return TGM_TEXT("Device_Local_TGM");
1496  case device::TGM_Mini:
1497  return TGM_TEXT("Device_TGM_Mini");
1498  case device::TGM_REMOTE:
1499  return TGM_TEXT("Device_TGM_REMOTE");
1500  }
1501  // to satisfy Visual C++ compiler
1502  return TGM_TEXT("<Unknown device>");
1503  }
1504 
1510  static const TGM_TCHAR * StatusToString(status code)
1511  {
1512  switch (code)
1513  {
1514  case status::Simulation_Mode_TGM:
1515  return TGM_TEXT("Status_Simulation_Mode_TGM");
1516  case status::Online:
1517  return TGM_TEXT("Status_Online");
1518  case status::Offline_Connection_Proceeds:
1519  return TGM_TEXT("Status_Offline_Connection_Proceeds");
1520  case status::Offline_Device_Offline:
1521  return TGM_TEXT("Status_Offline_Device_Offline");
1522  case status::Offline_Incompatible_DLL_ID:
1523  return TGM_TEXT("Status_Offline_Incompatible_DLL_ID");
1524  case status::Offline_Incompatible_DLL_Mem_ID:
1525  return TGM_TEXT("Status_Offline_Incompatible_DLL_Mem_ID");
1526  case status::Offline_Incompatible_DEVICE_ID:
1527  return TGM_TEXT("Status_Offline_Incompatible_DEVICE_ID");
1528  case status::Offline_Incompatible_DEVICE_Mem_ID:
1529  return TGM_TEXT("Status_Offline_Incompatible_DEVICE_Mem_ID");
1530  case status::Offline_Not_Detect_Comm_DLL:
1531  return TGM_TEXT("Status_Offline_Not_Detect_Comm_DLL");
1532  case status::Offline_Open_Connection_Failed:
1533  return TGM_TEXT("Status_Offline_Open_Connection_Failed");
1534  case status::Offline_Init_Connection_Failed:
1535  return TGM_TEXT("Status_Offline_Init_Connection_Failed");
1536  case status::Offline_Connection_Not_Opened:
1537  return TGM_TEXT("Status_Offline_Connection_Not_Opened");
1538  case status::Offline_Interface_Not_Create:
1539  return TGM_TEXT("Status_Offline_Interface_Not_Create");
1540  }
1541  // to satisfy Visual C++ compiler
1542  return TGM_TEXT("<Unknown status>");
1543  }
1544 
1550  static const TGM_TCHAR * ReadWriteCodeToString(read_write code)
1551  {
1552  switch (code)
1553  {
1554  case read_write::OK:
1555  return TGM_TEXT("RW_OK");
1556  case read_write::OK_Offline_Data:
1557  return TGM_TEXT("RW_OK_Offline_Data");
1558  case read_write::ERR_Invalid_Data:
1559  return TGM_TEXT("RW_ERR_Invalid_Data");
1560  case read_write::ERR_Device_Busy:
1561  return TGM_TEXT("RW_ERR_Device_Busy");
1562  case read_write::ERR_Interface_Not_Create:
1563  return TGM_TEXT("RW_ERR_Interface_Not_Create");
1564  case read_write::ERR_Unsupported_Function:
1565  return TGM_TEXT("RW_ERR_Unsupported_Function");
1566  case read_write::ERR_Connection_Not_Open:
1567  return TGM_TEXT("RW_ERR_Connection_Not_Open");
1568  case read_write::ERR_Not_Detect_Comm_DLL:
1569  return TGM_TEXT("RW_ERR_Not_Detect_Comm_DLL");
1570  }
1571  // to satisfy Visual C++ compiler
1572  return TGM_TEXT("<Unknown RW_ERR>");
1573  }
1574 
1575  // ANSI only versions
1581  static const char * DeviceToStringA(device deviceType)
1582  {
1583  switch (deviceType)
1584  {
1585  case device::Local_TGM:
1586  return ("Device_Local_TGM");
1587  case device::TGM_Mini:
1588  return ("Device_TGM_Mini");
1589  case device::TGM_REMOTE:
1590  return ("Device_TGM_REMOTE");
1591  }
1592  // to satisfy Visual C++ compiler
1593  return ("<Unknown device>");
1594  }
1595 
1601  static const char * StatusToStringA(status code)
1602  {
1603  switch (code)
1604  {
1605  case status::Simulation_Mode_TGM:
1606  return ("Status_Simulation_Mode_TGM");
1607  case status::Online:
1608  return ("Status_Online");
1609  case status::Offline_Connection_Proceeds:
1610  return ("Status_Offline_Connection_Proceeds");
1611  case status::Offline_Device_Offline:
1612  return ("Status_Offline_Device_Offline");
1613  case status::Offline_Incompatible_DLL_ID:
1614  return ("Status_Offline_Incompatible_DLL_ID");
1615  case status::Offline_Incompatible_DLL_Mem_ID:
1616  return ("Status_Offline_Incompatible_DLL_Mem_ID");
1617  case status::Offline_Incompatible_DEVICE_ID:
1618  return ("Status_Offline_Incompatible_DEVICE_ID");
1619  case status::Offline_Incompatible_DEVICE_Mem_ID:
1620  return ("Status_Offline_Incompatible_DEVICE_Mem_ID");
1621  case status::Offline_Not_Detect_Comm_DLL:
1622  return ("Status_Offline_Not_Detect_Comm_DLL");
1623  case status::Offline_Open_Connection_Failed:
1624  return ("Status_Offline_Open_Connection_Failed");
1625  case status::Offline_Init_Connection_Failed:
1626  return ("Status_Offline_Init_Connection_Failed");
1627  case status::Offline_Connection_Not_Opened:
1628  return ("Status_Offline_Connection_Not_Opened");
1629  case status::Offline_Interface_Not_Create:
1630  return ("Status_Offline_Interface_Not_Create");
1631  }
1632  // to satisfy Visual C++ compiler
1633  return ("<Unknown status>");
1634  }
1635 
1641  static const char * ReadWriteCodeToStringA(read_write code)
1642  {
1643  switch (code)
1644  {
1645  case read_write::OK:
1646  return "RW_OK";
1647  case read_write::OK_Offline_Data:
1648  return "RW_OK_Offline_Data";
1649  case read_write::ERR_Invalid_Data:
1650  return "RW_ERR_Invalid_Data";
1651  case read_write::ERR_Device_Busy:
1652  return "RW_ERR_Device_Busy";
1653  case read_write::ERR_Interface_Not_Create:
1654  return "RW_ERR_Interface_Not_Create";
1655  case read_write::ERR_Unsupported_Function:
1656  return "RW_ERR_Unsupported_Function";
1657  case read_write::ERR_Connection_Not_Open:
1658  return "RW_ERR_Connection_Not_Open";
1659  case read_write::ERR_Not_Detect_Comm_DLL:
1660  return "RW_ERR_Not_Detect_Comm_DLL";
1661  }
1662  // to satisfy Visual C++ compiler
1663  return ("<Unknown RW_ERR>");
1664  }
1665 
1671  static const char * ErrorCodeToStringA(error_code code)
1672  {
1673  switch (code)
1674  {
1675  case error_code::Success:
1676  return "OK";
1677  case error_code::Device_Type:
1678  return "ERR_Device_Type";
1679  case error_code::Interface_Not_Create:
1680  return "ERR_Interface_Not_Create";
1681  case error_code::Connection_Not_Open:
1682  return "ERR_Connection_Not_Open";
1683  case error_code::Not_Detect_Comm_DLL:
1684  return "ERR_Not_Detect_Comm_DLL";
1685  case error_code::Interface_Already_Exists:
1686  return "ERR_Interface_Already_Exists";
1687  case error_code::Interface_Create_Off_Mem:
1688  return "ERR_Interface_Create_Off_Mem";
1689  case error_code::Connection_Already_Exists:
1690  return "ERR_Connection_Already_Exists";
1691  case error_code::Connection_Create_Thread:
1692  return "ERR_Connection_Create_Thread";
1693  case error_code::Invalid_Data:
1694  return "ERR_Invalid_Data";
1695  }
1696  // to satisfy Visual C++ compiler
1697  return ("<Unknown error code>");
1698  }
1699 
1705  static const char * MemoryTypeToStringA(shared_memory memory)
1706  {
1707  switch (memory)
1708  {
1709  case CTGM_COMM_INT_2::shared_memory::SYSTEM:
1710  return "TGM_System";
1711  case CTGM_COMM_INT_2::shared_memory::DATA:
1712  return "TGM_Data";
1713  case CTGM_COMM_INT_2::shared_memory::CAM:
1714  return "TGM_Cam_Profile";
1715  case CTGM_COMM_INT_2::shared_memory::OSC:
1716  return "TGM_Oscilloscope";
1717  case CTGM_COMM_INT_2::shared_memory::SERVO:
1718  return "TGM_Servo";
1719  case CTGM_COMM_INT_2::shared_memory::DIO:
1720  return "TGM_Dio";
1721  case CTGM_COMM_INT_2::shared_memory::INTERP:
1722  return "TGM_interpolator";
1723  case CTGM_COMM_INT_2::shared_memory::INTERP_W:
1724  return "InterpolatorWriteMemory";
1725  case CTGM_COMM_INT_2::shared_memory::INTERP_R:
1726  return "InterpolatorReadMemory";
1727  case CTGM_COMM_INT_2::shared_memory::ODS:
1728  return "TGM_ODS";
1729  case CTGM_COMM_INT_2::shared_memory::CNC_EX:
1730  return "TGM_CNCEX";
1731  case CTGM_COMM_INT_2::shared_memory::G_CODE:
1732  return "TGM_GCODE";
1733  case CTGM_COMM_INT_2::shared_memory::CNC_INI:
1734  return "TGM_CNCINI";
1735  case CTGM_COMM_INT_2::shared_memory::UNIVERSAL:
1736  return "TGM_Universal";
1737  case CTGM_COMM_INT_2::shared_memory::CNC_EX_LOCAL:
1738  return "<TGM_CNCEX_Local>";
1739  case CTGM_COMM_INT_2::shared_memory::NMemories:
1740  return "<Unknown memory type>";
1741  }
1742  // to satisfy Visual C++ compiler
1743  return "<Unknown memory type>";
1744  }
1745 
1746 private:
1747  // portability code (Windows & linux with Qt)
1749  // loading library - xLibrary class
1750  // native Windows code uses Qt functions syntax
1751  #ifdef WIN32
1752  // misc. typedefs
1753  typedef void _xFunctionPointer();
1754  typedef _xFunctionPointer *x_FunctionPointer;
1755 
1756  class x_Library
1757  {
1758  public:
1759  x_Library() : m_hModule(NULL) { m_fileName[0] = '\0'; }
1760 
1761  ~x_Library()
1762  {
1763  unload();
1764  }
1765 
1766  x_FunctionPointer resolve(const char * funcName) const
1767  {
1768  assert(funcName != nullptr);
1769  if (m_hModule != NULL)
1770  return reinterpret_cast<x_FunctionPointer>(GetProcAddress(m_hModule, funcName));
1771  return NULL;
1772  }
1773  void setFileName(const char * fileName) { strcpy_s(m_fileName, fileName); }
1774  void load() { m_hModule = LoadLibraryA(m_fileName); }
1775  bool isLoaded() { return m_hModule == NULL ? false : true; }
1776  HMODULE GetHModule() const { return m_hModule; }
1777  bool unload()
1778  {
1779  bool rv = false;
1780  if (m_hModule != NULL)
1781  {
1782  if(FreeLibrary(m_hModule) != FALSE)
1783  rv = true;
1784  }
1785  m_hModule = nullptr;
1786  return rv;
1787  }
1788 
1789  protected:
1790  char m_fileName[_MAX_PATH];
1791  HMODULE m_hModule;
1792  };
1793  #else // !WIN32
1794  typedef QLibrary x_Library;
1795  typedef QFunctionPointer x_FunctionPointer;
1796  #endif // !WIN32
1797 
1799  // display warning or error string to standard debug output
1800 #ifdef WIN32
1801  // ANSI version
1802  void x_warning(const char * pszFormat, ...)
1803  {
1804  assert(pszFormat != nullptr);
1805  va_list args;
1806  va_start(args, pszFormat);
1807 
1808  char out[256];
1809  const int outLastIndex = static_cast<int>(_countof(out) - 1);
1810  // print out the text
1811  int nChars = vsnprintf_s(out, _TRUNCATE, pszFormat, args);
1812  if (nChars < 0)
1813  {
1814  out[outLastIndex] = '\0';
1815  nChars = static_cast<int>(strlen(out));
1816  }
1817 
1818  // implemet Qt functionality -> auto append \n if necessary
1819  if (nChars > 0 && nChars < outLastIndex)
1820  {
1821  if (out[nChars - 1] != '\n')
1822  {
1823  out[nChars] = '\n';
1824  out[nChars + 1] = '\0';
1825  }
1826  }
1827 
1828  OutputDebugStringA(out);
1829  va_end(args);
1830  }
1831 #else // !WIN32
1832 # define x_warning(strFormat, ...) qWarning(strFormat, ##__VA_ARGS__)
1833 #endif // !WIN32
1834 
1835 protected:
1836  x_Library m_hModule;
1837  // for simplicity with UNICODE vs ANSI version, do not print file name, which can be UNICODE or ANSI
1838  // depending on platform
1839  // function can be virtual for easy replacement in derived platform specific class
1840  TGM_COMM_INT_VIRTUAL void errDllNotFound(const char *aFileName)
1841  {
1842  x_warning("CTGM_COMM_INT_2: Dynamic library %s not found", aFileName);
1843 #ifdef __linux__
1844  perror("Additional info:");
1845 #endif // __linux__
1846  }
1847  TGM_COMM_INT_VIRTUAL void errFuncNotFound(const char *aFileName, const char *funcName)
1848  {
1849  x_warning("CTGM_COMM_INT_2: Function %s not found in library %s", funcName, aFileName);
1850 #ifdef __linux__
1851  perror("Additional info:");
1852 #endif // __linux__
1853  }
1854 
1855  x_FunctionPointer getFuncAddress(const char *aFileName, const char *funcName)
1856  {
1857  assert(aFileName != nullptr);
1858  assert(funcName != nullptr);
1859  x_FunctionPointer func = m_hModule.resolve(funcName);
1860  if (!func)
1861  {
1862  errFuncNotFound(aFileName, funcName);
1863  }
1864  return func;
1865  }
1866  error_code preLoadDll(const char *aFileName)
1867  {
1868  assert(aFileName != nullptr);
1869  m_hModule.setFileName(aFileName);
1870  m_hModule.load();
1871  if (m_hModule.isLoaded() == false)
1872  {
1873  errDllNotFound(aFileName);
1874  return error_code::Not_Detect_Comm_DLL;
1875  }
1876  return error_code::Success;
1877  }
1878 
1879  TGM_COMM_INT_VIRTUAL error_code dispErrorCode(const char *funcName, error_code code)
1880  {
1881  assert(funcName != nullptr);
1882  switch (code)
1883  {
1884  case error_code::Success:
1885  m_offlineCounter = 0;
1886  break;
1887  case error_code::Device_Type:
1888  x_warning("%s ERR_Device_Type", funcName);
1889  break;
1890  case error_code::Interface_Not_Create:
1891  x_warning("%s ERR_Interface_Not_Create", funcName);
1892  break;
1893  case error_code::Connection_Not_Open:
1894  x_warning("%s ERR_Connection_Not_Open", funcName);
1895  break;
1896  case error_code::Not_Detect_Comm_DLL:
1897  x_warning("%s ERR_Not_Detect_Comm_DLL", funcName);
1898  break;
1899  case error_code::Interface_Already_Exists:
1900  x_warning("%s ERR_Interface_Already_Exists", funcName);
1901  break;
1902  case error_code::Interface_Create_Off_Mem:
1903  x_warning("%s ERR_Interface_Create_Off_Mem", funcName);
1904  break;
1905  case error_code::Connection_Already_Exists:
1906  x_warning("%s ERR_Connection_Already_Exists", funcName);
1907  break;
1908  case error_code::Connection_Create_Thread:
1909  x_warning("%s ERR_Connection_Create_Thread", funcName);
1910  break;
1911  case error_code::Invalid_Data:
1912  x_warning("%s ERR_Invalid_Data", funcName);
1913  break;
1914  }
1915  return code;
1916  }
1917 
1918  TGM_COMM_INT_VIRTUAL read_write dispErrorCode(const char *funcName, read_write code)
1919  {
1920  assert(funcName != nullptr);
1921  switch (code)
1922  {
1923  case read_write::OK:
1924  m_offlineCounter = 0;
1925  break;
1926  case read_write::OK_Offline_Data:
1927  m_offlineCounter = 0;
1928  break;
1929  case read_write::ERR_Invalid_Data:
1930  x_warning("%s RW_ERR_Invalid_Data", funcName);
1931  break;
1932  case read_write::ERR_Device_Busy:
1933  if (m_offlineCounter < MAX_OFFLINE_COUNT)
1934  m_offlineCounter++;
1935  x_warning("%s RW_ERR_Device_Busy", funcName);
1936  break;
1937  case read_write::ERR_Interface_Not_Create:
1938  x_warning("%s RW_ERR_Interface_Not_Create", funcName);
1939  break;
1940  case read_write::ERR_Unsupported_Function:
1941  x_warning("%s RW_ERR_Unsupported_Function", funcName);
1942  break;
1943  case read_write::ERR_Connection_Not_Open:
1944  x_warning("%s RW_ERR_Connection_Not_Open", funcName);
1945  break;
1946  case read_write::ERR_Not_Detect_Comm_DLL:
1947  x_warning("%s RW_ERR_Not_Detect_Comm_DLL", funcName);
1948  break;
1949  }
1950  return code;
1951  }
1952 
1953 protected:
1954  // functions declaration
1955  typedef error_code COM_CALLTYPE TGM_CREATE_INTERFACE_2(const TGM_TCHAR *DLL_Directory);
1956  typedef void COM_CALLTYPE TGM_SET_APP_COMPATIBILITY_VN(int32_t compatibilityID, int32_t compatibilityMemID, int32_t version, const TGM_TCHAR *appName);
1957  typedef void COM_CALLTYPE TGM_DESTROY_INTERFACE();
1958  typedef error_code COM_CALLTYPE TGM_OPEN_CONNECTION(int32_t keepOnline, int32_t commTimeout, device deviceType, uint32_t IPAddress);
1959  typedef error_code COM_CALLTYPE TGM_CHANGE_CONNECTION(device deviceType, uint32_t IPAddress);
1960  typedef error_code COM_CALLTYPE TGM_CLOSE_CONNECTION();
1961  typedef error_code COM_CALLTYPE TGM_GET_DLL_INFO(device deviceType, int32_t *pVersion, int32_t *pCompatibilityID, int32_t *pCompatibilityMemID);
1962  typedef status COM_CALLTYPE TGM_GET_STATUS();
1963  typedef status COM_CALLTYPE TGM_GET_STATUS_GRAPHICS(int32_t *pBackColor, int32_t *pTextColor, TGM_TCHAR *buffer); // min 128 characters
1964 
1965  typedef error_code COM_CALLTYPE TGM_GET_CONNECTIONS_INFO_2(device *pDeviceType, uint32_t *pIPAddress, connected_memory *pConnectedMemory);
1966  typedef error_code COM_CALLTYPE TGM_GET_SERVER_INFO(device deviceType, int32_t *pCompatibilityID, int32_t *pCompatibilityMemID, status *pConnectionStatus);
1967  typedef error_code COM_CALLTYPE TGM_SHOW_CONNECTIONS_INFO_WIN(TGM_HWND parent, int32_t enableChangeConnection);
1968  typedef error_code COM_CALLTYPE TGM_CLOSE_CONNECTIONS_INFO_WIN();
1969  typedef void COM_CALLTYPE TGM_GET_CONNECTIONS_INFO_WIN_DIMENSION(int32_t *Width, int32_t *Height); // not yet implemented in the wrapper and Linux version
1970  // access functions
1971  typedef read_write COM_CALLTYPE TGM_READ_I32(shared_memory memoryType, uint32_t offset, int32_t *pValue);
1972  typedef read_write COM_CALLTYPE TGM_READ_I64(shared_memory memoryType, uint32_t offset, int64_t *pValue);
1973  typedef read_write COM_CALLTYPE TGM_READ_double(shared_memory memoryType, uint32_t offset, double *pValue);
1974  typedef read_write COM_CALLTYPE TGM_READ_BLOCK(shared_memory memoryType, uint32_t offset, void *buffer, uint32_t bufferLength);
1975  typedef read_write COM_CALLTYPE TGM_READ_LPSTR(shared_memory memoryType, uint32_t offset, char *buffer, uint32_t buffer_Char_Len, uint32_t *pRead_Char_Count);
1976  typedef read_write COM_CALLTYPE TGM_READ_LPWSTR(shared_memory memoryType, uint32_t offset, TGM_WCHAR *buffer, uint32_t buffer_Char_Len, uint32_t *pRead_Char_Count);
1977  typedef read_write COM_CALLTYPE TGM_WRITE_I32(shared_memory memoryType, uint32_t offset, int32_t Value);
1978  typedef read_write COM_CALLTYPE TGM_WRITE_I64(shared_memory memoryType, uint32_t offset, int64_t Value);
1979  typedef read_write COM_CALLTYPE TGM_WRITE_double(shared_memory memoryType, uint32_t offset, double Value);
1980  typedef read_write COM_CALLTYPE TGM_WRITE_BLOCK(shared_memory memoryType, uint32_t offset, const void *buffer, uint32_t bufferLength);
1981  typedef read_write COM_CALLTYPE TGM_WRITE_LPSTR(shared_memory memoryType, uint32_t offset, const char *Buffer, uint32_t Write_Char_Len);
1982  typedef read_write COM_CALLTYPE TGM_WRITE_LPWSTR(shared_memory memoryType, uint32_t offset, const TGM_WCHAR *Buffer, uint32_t Write_Char_Len);
1983  typedef read_write COM_CALLTYPE TGM_SET_BIT_I32(shared_memory memoryType, uint32_t offset, int32_t Value);
1984  typedef read_write COM_CALLTYPE TGM_SET_BIT_I64(shared_memory memoryType, uint32_t offset, int64_t Value);
1985  typedef read_write COM_CALLTYPE TGM_CLR_BIT_I32(shared_memory memoryType, uint32_t offset, int32_t Value);
1986  typedef read_write COM_CALLTYPE TGM_CLR_BIT_I64(shared_memory memoryType, uint32_t offset, int64_t Value);
1987  typedef read_write COM_CALLTYPE TGM_TGL_BIT_I32(shared_memory memoryType, uint32_t offset, int32_t Value);
1988  typedef read_write COM_CALLTYPE TGM_TGL_BIT_I64(shared_memory memoryType, uint32_t offset, int64_t Value);
1989  // direct access functions -> wait for a response
1990  typedef read_write COM_CALLTYPE TGM_READ_I32_DIRECT(shared_memory memoryType, uint32_t offset, int32_t *pValue);
1991  typedef read_write COM_CALLTYPE TGM_READ_I64_DIRECT(shared_memory memoryType, uint32_t offset, int64_t *pValue);
1992  typedef read_write COM_CALLTYPE TGM_READ_double_DIRECT(shared_memory memoryType, uint32_t offset, double *pValue);
1993  typedef read_write COM_CALLTYPE TGM_READ_BLOCK_DIRECT(shared_memory memoryType, uint32_t offset, void *buffer, uint32_t bufferLength);
1994  typedef read_write COM_CALLTYPE TGM_READ_LPSTR_DIRECT(shared_memory memoryType, uint32_t offset, char *buffer, uint32_t buffer_Char_Len, uint32_t *pRead_Char_Count);
1995  typedef read_write COM_CALLTYPE TGM_READ_LPWSTR_DIRECT(shared_memory memoryType, uint32_t offset, TGM_WCHAR *buffer, uint32_t buffer_Char_Len, uint32_t *pRead_Char_Count);
1996 
1997  typedef read_write COM_CALLTYPE TGM_WRITE_I32_DIRECT(shared_memory memoryType, uint32_t offset, int32_t Value);
1998  typedef read_write COM_CALLTYPE TGM_WRITE_I64_DIRECT(shared_memory memoryType, uint32_t offset, int64_t Value);
1999  typedef read_write COM_CALLTYPE TGM_WRITE_double_DIRECT(shared_memory memoryType, uint32_t offset, double Value);
2000  typedef read_write COM_CALLTYPE TGM_WRITE_BLOCK_DIRECT(shared_memory memoryType, uint32_t offset, const void *buffer, uint32_t bufferLength);
2001  typedef read_write COM_CALLTYPE TGM_WRITE_LPSTR_DIRECT(shared_memory memoryType, uint32_t offset, const char *Buffer, uint32_t Write_Char_Len);
2002  typedef read_write COM_CALLTYPE TGM_WRITE_LPWSTR_DIRECT(shared_memory memoryType, uint32_t offset, const TGM_WCHAR *Buffer, uint32_t Write_Char_Len);
2003 
2004  typedef read_write COM_CALLTYPE TGM_SET_BIT_I32_DIRECT(shared_memory memoryType, uint32_t offset, int32_t Value);
2005  typedef read_write COM_CALLTYPE TGM_SET_BIT_I64_DIRECT(shared_memory memoryType, uint32_t offset, int64_t Value);
2006  typedef read_write COM_CALLTYPE TGM_CLR_BIT_I32_DIRECT(shared_memory memoryType, uint32_t offset, int32_t Value);
2007  typedef read_write COM_CALLTYPE TGM_CLR_BIT_I64_DIRECT(shared_memory memoryType, uint32_t offset, int64_t Value);
2008  typedef read_write COM_CALLTYPE TGM_TGL_BIT_I32_DIRECT(shared_memory memoryType, uint32_t offset, int32_t Value);
2009  typedef read_write COM_CALLTYPE TGM_TGL_BIT_I64_DIRECT(shared_memory memoryType, uint32_t offset, int64_t Value);
2010 
2011  typedef read_write COM_CALLTYPE TGM_FLUSH_BUFFER();
2012 
2013  TGM_CREATE_INTERFACE_2 *m_pCREATE_INTERFACE_2 = nullptr;
2014  TGM_DESTROY_INTERFACE *m_pDESTROY_INTERFACE = nullptr;
2015  TGM_OPEN_CONNECTION *m_pOPEN_CONNECTION = nullptr;
2016  TGM_CHANGE_CONNECTION *m_pCHANGE_CONNECTION = nullptr;
2017  TGM_CLOSE_CONNECTION *m_pCLOSE_CONNECTION = nullptr;
2018  TGM_GET_DLL_INFO *m_pGET_DLL_INFO = nullptr;
2019  TGM_SET_APP_COMPATIBILITY_VN *m_pSET_APP_COMPATIBILITY_VN = nullptr;
2020  TGM_GET_STATUS *m_pGET_STATUS = nullptr;
2021  TGM_GET_STATUS_GRAPHICS *m_pGET_STATUS_GRAPHICS = nullptr;
2022  TGM_GET_CONNECTIONS_INFO_2 *m_pGET_CONNECTIONS_INFO_2 = nullptr;
2023  TGM_GET_SERVER_INFO *m_pGET_SERVER_INFO = nullptr;
2024  TGM_SHOW_CONNECTIONS_INFO_WIN *m_pSHOW_CONNECTIONS_INFO_WIN = nullptr;
2025  TGM_CLOSE_CONNECTIONS_INFO_WIN *m_pCLOSE_CONNECTIONS_INFO_WIN = nullptr;
2026  TGM_GET_CONNECTIONS_INFO_WIN_DIMENSION *m_pGET_CONNECTIONS_INFO_WIN_DIMENSION = nullptr;
2027  TGM_READ_I32 *m_pREAD_I32 = nullptr;
2028  TGM_READ_I64 *m_pREAD_I64 = nullptr;
2029  TGM_READ_double *m_pREAD_double = nullptr;
2030  TGM_READ_BLOCK *m_pREAD_BLOCK = nullptr;
2031  TGM_READ_LPSTR *m_pREAD_LPSTR = nullptr;
2032  TGM_READ_LPWSTR *m_pREAD_LPWSTR = nullptr;
2033  TGM_WRITE_I32 *m_pWRITE_I32 = nullptr;
2034  TGM_WRITE_I64 *m_pWRITE_I64 = nullptr;
2035  TGM_WRITE_double *m_pWRITE_double = nullptr;
2036  TGM_WRITE_BLOCK *m_pWRITE_BLOCK = nullptr;
2037  TGM_WRITE_LPSTR *m_pWRITE_LPSTR = nullptr;
2038  TGM_WRITE_LPWSTR *m_pWRITE_LPWSTR = nullptr;
2039  TGM_SET_BIT_I32 *m_pSET_BIT_I32 = nullptr;
2040  TGM_SET_BIT_I64 *m_pSET_BIT_I64 = nullptr;
2041  TGM_CLR_BIT_I32 *m_pCLR_BIT_I32 = nullptr;
2042  TGM_CLR_BIT_I64 *m_pCLR_BIT_I64 = nullptr;
2043  TGM_TGL_BIT_I32 *m_pTGL_BIT_I32 = nullptr;
2044  TGM_TGL_BIT_I64 *m_pTGL_BIT_I64 = nullptr;
2045  TGM_READ_I32_DIRECT *m_pREAD_I32_DIRECT = nullptr;
2046  TGM_READ_I64_DIRECT *m_pREAD_I64_DIRECT = nullptr;
2047  TGM_READ_double_DIRECT *m_pREAD_double_DIRECT = nullptr;
2048  TGM_READ_BLOCK_DIRECT *m_pREAD_BLOCK_DIRECT = nullptr;
2049  TGM_READ_LPSTR_DIRECT *m_pREAD_LPSTR_DIRECT = nullptr;
2050  TGM_READ_LPWSTR_DIRECT *m_pREAD_LPWSTR_DIRECT = nullptr;
2051  TGM_WRITE_I32_DIRECT *m_pWRITE_I32_DIRECT = nullptr;
2052  TGM_WRITE_I64_DIRECT *m_pWRITE_I64_DIRECT = nullptr;
2053  TGM_WRITE_double_DIRECT *m_pWRITE_double_DIRECT = nullptr;
2054  TGM_WRITE_BLOCK_DIRECT *m_pWRITE_BLOCK_DIRECT = nullptr;
2055  TGM_WRITE_LPSTR_DIRECT *m_pWRITE_LPSTR_DIRECT = nullptr;
2056  TGM_WRITE_LPWSTR_DIRECT *m_pWRITE_LPWSTR_DIRECT = nullptr;
2057  TGM_SET_BIT_I32_DIRECT *m_pSET_BIT_I32_DIRECT = nullptr;
2058  TGM_SET_BIT_I64_DIRECT *m_pSET_BIT_I64_DIRECT = nullptr;
2059  TGM_CLR_BIT_I32_DIRECT *m_pCLR_BIT_I32_DIRECT = nullptr;
2060  TGM_CLR_BIT_I64_DIRECT *m_pCLR_BIT_I64_DIRECT = nullptr;
2061  TGM_TGL_BIT_I32_DIRECT *m_pTGL_BIT_I32_DIRECT = nullptr;
2062  TGM_TGL_BIT_I64_DIRECT *m_pTGL_BIT_I64_DIRECT = nullptr;
2063  TGM_FLUSH_BUFFER *m_pFLUSH_BUFFER = nullptr;
2064 
2065  size_t m_offlineCounter = 0;
2066 
2067  int32_t m_nCreateInterfaceCalled = 0; // protect incorrect CreatInterface/DestroyInterface call order
2068  int32_t m_nOpenConnectionCalled = 0; // protect incorrect OpenConnection/CloseConnection call order
2069 
2070  // protect multiple call to CreateInterface and OpenConnection
2071  // if parent application already calls these functions, the wrapper must ignore them
2072  // usable if the wrapper is used in sub-DLL, which uses TGM_Comm_Int_2.dll
2073  // independently on the parent application
2074  // For example: Qt_CNC_Tester.exe uses this wrapper for working with TGM_Comm_Int_2.dll
2075  // directly. But Qt_CNC_Tester.exe also uses SF_TCh.dll, which in turn internally also uses
2076  // TGM_Comm_Int_2.dll (by this wrapper).
2077  // Therefore by using these flags, multiple call to CreateInterface/OpenConnection
2078  // will be avoided without an error.
2079  bool m_bCreateInterfaceAlreadyCalledByApplication = false;
2080  bool m_bOpenConnectionAlreadyCalledByApplication = false;
2081 
2082 #endif // UNDER_RTSS
2083 
2084 private:
2085  // prevent from copying
2086  CTGM_COMM_INT_2(const CTGM_COMM_INT_2 &other);
2087  CTGM_COMM_INT_2 &operator=(const CTGM_COMM_INT_2 &other);
2088 
2089 };
2090 
2091 // useful typedefs - abbreviations of enum classes inside CTGM_COMM_INT_2
2092 // TGM_IF = TGMotion interface
2097 
2102 
2107 
2112 
2117 
2122 
2123 #ifdef WIN32
2124 # if _MSC_VER < 1800 // below Visual Studio 2013
2125 # pragma warning(pop)
2126 # endif
2127 #endif
2128 
2129 #endif // TGMCOMMINT2_DLL_H
enum ENUM_CLASS TGM_Mini
TGM mini connected via network, valid IP address is needed for Open_Connection()
read_write Write_LPSTR(shared_memory memoryType, uint32_t offset, const char *buffer, uint32_t Write_Char_Len)
Write ANSI string to shared memory.
#define _countof(array)
determine number of elements in an array (not bytes)
Definition: TGM_CNC.h:58
enum ENUM_CLASS Offline_Init_Connection_Failed
Offline -.
read_write Read_LPWSTR(shared_memory memoryType, uint32_t offset, TGM_WCHAR *buffer, uint32_t buffer_Char_Len, uint32_t *pRead_Char_Count)
Read UTF-16 string from memory. For remote devices, the read request is sent and the function returns...
enum ENUM_CLASS read_write
return values of Read_xxx and Write_xxx functions
CTGM_COMM_INT_2::read_write TGM_IF_RW
Simplify write of CTGM_COMM_INT_2::read_write.
enum ENUM_CLASS Connection_Create_Thread
working thread cannot be created
enum ENUM_CLASS REM_Client_Offline
client offline memories (TGM_REMOTE)
enum ENUM_CLASS Offline_Incompatible_DLL_ID
Offline - wrong App ID compatibility number of DLL and application.
enum ENUM_CLASS Device_Type
unknown device type
CTGM_COMM_INT_2::shared_memory TGM_IF_MEM
Simplify write of CTGM_COMM_INT_2::shared_memory.
enum ENUM_CLASS TGM_REMOTE
TG Motion running on remote PC.
read_write Read_I64_DIRECT(shared_memory memoryType, uint32_t offset, int64_t *pValue)
Read 64bit integer from shared memory. For remote devices the function always waits for response...
error_code Close_Connections_Info_Win()
Closes connection info window opened by Show_Connections_Info_Win.
enum ENUM_CLASS INTERP_R
InterpolatorReadMemory.
enum ENUM_CLASS OK_Offline_Data
OK - data are read from offline memory (TGM simulation)
enum ENUM_CLASS Interface_Create_Off_Mem
Offline shared memory cannot be created.
enum ENUM_CLASS INTERP
TGM_Interpolator.
enum ENUM_CLASS CNC_INI
TGM_CNCINI (cnc ini file)
static const char * ReadWriteCodeToStringA(read_write code)
Converts read_write error code to ANSI string.
enum ENUM_CLASS Connection_Not_Open
Open_Connection not called
read_write Read_BLOCK(shared_memory memoryType, uint32_t offset, void *buffer, uint32_t bufferLength)
Read block of shared memory. For remote devices, the read request is sent and the function returns th...
enum ENUM_CLASS REM_Server
server memories (TGM_REMOTE)
enum ENUM_CLASS Offline_Connection_Not_Opened
Offline - no connection opened.
enum ENUM_CLASS Online
Online - connection established.
read_write Clr_Bit_I64(shared_memory memoryType, uint32_t offset, int64_t Value)
Performs logical NAND on 64bit integer in shared memory. (i.e. originalValue &= ~Value).
enum ENUM_CLASS ERR_Interface_Not_Create
ERR - Create_Interface not called.
Oscilloscope control.
Definition: TGM.h:520
enum ENUM_CLASS NMemories
number of memories (without the CNC_EX_LOCAL)
enum ENUM_CLASS ERR_Connection_Not_Open
ERR - Open_Connection not called.
static const char * ErrorCodeToStringA(error_code code)
Converts error_code to ANSI string.
error_code Create_Interface_2(const TGM_TCHAR *DLL_Directory)
Create communication interface.
error_code Show_Connections_Info_Win(TGM_HWND parent, int32_t enableChangeConnection)
Displays Connection Info window with an info of all the connections and plug-in modules.
enum ENUM_CLASS error_code
Error codes returned by most of the functions.
enum ENUM_CLASS Local_Offline
local offline memories (TGM simulation)
read_write Set_Bit_I32_DIRECT(shared_memory memoryType, uint32_t offset, int32_t Value)
Performs logical OR on 32bit integer in shared memory. (i.e. originalValue |= Value). For remote devices the function always wait for acknowledge.
enum ENUM_CLASS Offline_Open_Connection_Failed
Offline - invalid parameters of Open_Connection() function.
enum ENUM_CLASS DATA
TGM_DATA.
read_write Read_Double(shared_memory memoryType, uint32_t offset, double *pValue)
Read double floating point value (8 bytes) from shared memory. For remote devices, the read request is sent and the function returns the last (previous) stored local value.
error_code Close_Connection()
Close already opened connection. Each call to Open_Connection must match the Close_Connection.
error_code Open_Connection(int32_t keepOnline, int32_t commTimeout, device deviceType, uint32_t IPAddress)
Establishes a communication with a given device.
CTGM_COMM_INT_2::device TGM_IF_DEV
Simplify write of CTGM_COMM_INT_2::device.
read_write Write_BLOCK_DIRECT(shared_memory memoryType, uint32_t offset, const void *buffer, uint32_t bufferLength)
Write double to shared memory. For remote devices the function always waits for acknowledge.
read_write Clr_Bit_I32_DIRECT(shared_memory memoryType, uint32_t offset, int32_t Value)
Performs logical NAND on 32bit integer in shared memory. (i.e. originalValue &= ~Value). For remote devices the function always wait for acknowledge.
enum ENUM_CLASS Offline_Device_Offline
Offline - device is not connected (ether TG Motion is not running locally or remote device is not con...
enum ENUM_CLASS CAM
TGM_Cam_Profile.
static const TGM_TCHAR * DeviceToString(device deviceType)
Converts device type to UNICODE (Windows) or ANSI (Linux) string.
read_write Write_LPWSTR_DIRECT(shared_memory memoryType, uint32_t offset, const TGM_WCHAR *buffer, uint32_t Write_Char_Len)
Write UNICODE string (UTF-16) to shared memory. For remote devices the function always waits for ackn...
enum ENUM_CLASS Offline_Interface_Not_Create
Offline - interface not created.
enum ENUM_CLASS compatibility
Compatibility types.
read_write Write_LPWSTR(shared_memory memoryType, uint32_t offset, const TGM_WCHAR *buffer, uint32_t Write_Char_Len)
Write UNICODE string (UTF-16) to shared memory.
read_write Read_LPSTR_DIRECT(shared_memory memoryType, uint32_t offset, char *buffer, uint32_t buffer_Char_Len, uint32_t *pRead_Char_Count)
Read ANSI string from memory. For remote devices the function always waits for response, i.e. it returns the actual data.
Describes one servo drive (or axis)
Definition: TGM.h:782
enum ENUM_CLASS Local_TGM_Online
local TGM memories (TGM running under real-time)
enum ENUM_CLASS ERR_Device_Busy
ERR - timeout R/W.
read_write Write_LPSTR_DIRECT(shared_memory memoryType, uint32_t offset, const char *buffer, uint32_t Write_Char_Len)
Write ANSI string to shared memory. For remote devices the function always waits for acknowledge...
enum ENUM_CLASS status
connection status (return codes of Get_Status())
enum ENUM_CLASS shared_memory
Shared memory numbers.
enum ENUM_CLASS ERR_Invalid_Data
ERR - invalid memory type, offset, length, etc.
read_write Set_Bit_I64(shared_memory memoryType, uint32_t offset, int64_t Value)
Performs logical OR on 64bit integer in shared memory. (i.e. originalValue |= Value).
read_write Read_I32_DIRECT(shared_memory memoryType, uint32_t offset, int32_t *pValue)
Read 32bit integer from shared memory. For remote devices the function always waits for response...
enum ENUM_CLASS Offline_Incompatible_DLL_Mem_ID
Offline - wrong App Mem ID compatibility number of DLL and application.
read_write Read_LPSTR(shared_memory memoryType, uint32_t offset, char *buffer, uint32_t buffer_Char_Len, uint32_t *pRead_Char_Count)
Read ANSI string from memory. For remote devices, the read request is sent and the function returns t...
static const TGM_TCHAR * StatusToString(status code)
Converts status value to its text representation - UNICODE (Windows) or ANSI (Linux) ...
enum ENUM_CLASS Offline_Connection_Proceeds
Offline - waiting for connection (usually for remote devices)
static const char * StatusToStringA(status code)
Converts status value to ANSI string.
enum ENUM_CLASS Invalid_Data
invalid data - memory number, offset, etc.
C++ wrapper class for TGM_Comm_Int_2 library functions.
read_write Set_Bit_I32(shared_memory memoryType, uint32_t offset, int32_t Value)
Performs logical OR on 32bit integer in shared memory. (i.e. originalValue |= Value).
read_write Tgl_Bit_I32_DIRECT(shared_memory memoryType, uint32_t offset, int32_t Value)
Performs logical XOR on 32bit integer in shared memory. (i.e. originalValue ^= Value). For remote devices the function always wait for acknowledge.
enum ENUM_CLASS CNC_EX
TGM_CNCEX (CNC module)
static const char * MemoryTypeToStringA(shared_memory memory)
Converts memory type to its ANSI name.
CTGM_COMM_INT_2::connected_memory TGM_IF_CONN_MEM
Simplify write of CTGM_COMM_INT_2::connected_memory.
error_code Get_Connections_Info_2(device *pDeviceType, uint32_t *IPAddress, connected_memory *pConnectedMemory)
Returns information about actually opened communication.
read_write Tgl_Bit_I32(shared_memory memoryType, uint32_t offset, int32_t Value)
Performs logical XOR on 32bit integer in shared memory. (i.e. originalValue ^= Value).
enum ENUM_CLASS UNIVERSAL
TGM_Universal.
read_write Tgl_Bit_I64(shared_memory memoryType, uint32_t offset, int64_t Value)
Performs logical XOR on 64bit integer in shared memory. (i.e. originalValue ^= Value).
enum ENUM_CLASS Interface_Already_Exists
Create_Interface_2 already called
enum ENUM_CLASS Offline_Incompatible_DEVICE_ID
Offline - wrong Device ID compatibility number of DLL and application.
read_write Flush_Buffer()
For remote devices, send all the requests stored in command queue (i.e. sends all non-direct Read and...
read_write Read_LPWSTR_DIRECT(shared_memory memoryType, uint32_t offset, TGM_WCHAR *buffer, uint32_t buffer_Char_Len, uint32_t *pRead_Char_Count)
Read UTF-16 string from memory. For remote devices the function always waits for response, i.e. it returns the actual data.
static const TGM_TCHAR * ReadWriteCodeToString(read_write code)
Converts return valud of Read_XXX and Write_XXX functions to UNICODE (Windows) or ANSI (Linux) string...
enum ENUM_CLASS REM_Server_Offline
server offline memories (TGM_REMOTE)
read_write Tgl_Bit_I64_DIRECT(shared_memory memoryType, uint32_t offset, int64_t Value)
Performs logical XOR on 64bit integer in shared memory. (i.e. originalValue ^= Value). For remote devices the function always wait for acknowledge.
enum ENUM_CLASS G_CODE
TGM_GCODE (gcode in binary format storage)
read_write Read_BLOCK_DIRECT(shared_memory memoryType, uint32_t offset, void *buffer, uint32_t bufferLength)
Read data from shared memory. For remote devices the function always waits for response, i.e. it returns the actual data.
error_code Get_Dll_Info(device deviceType, int32_t *pVersion, int32_t *pCompatibilityID, int32_t *pCompatibilityMemID)
Get information about communication library (depending on device type)
read_write Write_I64(shared_memory memoryType, uint32_t offset, int64_t Value)
Write 64bit integer to shared memory. For remote devices, the write request is sent and the function ...
status Get_Status_Graphics(int32_t *pBackgroundColor, int32_t *pTextColor, TGM_TCHAR *statusText)
Returns actual status and its text representation.
enum ENUM_CLASS Interface_Not_Create
Create_Interface_2 function not called
void Get_Connections_Info_Win_Dimension(int32_t *pWidth, int32_t *pHeight)
Returns recommended width and height of the Connection Info window.
void Destroy_Interface()
Closes created interface. Need to be called during application termination.
read_write Clr_Bit_I64_DIRECT(shared_memory memoryType, uint32_t offset, int64_t Value)
Performs logical NAND on 64bit integer in shared memory. (i.e. originalValue &= ~Value). For remote devices the function always wait for acknowledge.
status Get_Status()
Returns actual status.
enum ENUM_CLASS Connection_Already_Exists
Open_Connection already called
enum ENUM_CLASS ERR_Unsupported_Function
ERR - function is not supported by device.
Shared memory named "TGM_System".
Definition: TGM.h:583
error_code Change_Connection(device deviceType, uint32_t IPAddress)
Change connection type on the fly.
CTGM_COMM_INT_2::error_code TGM_IF_ERR
Simplify write of CTGM_COMM_INT_2::error_code.
error_code Get_Server_Info(device deviceType, int32_t *pCompatibilityID, int32_t *pCompatibilityMemID, status *pConnectionStatus)
Returns information about the remote server.
read_write Write_I32_DIRECT(shared_memory memoryType, uint32_t offset, int32_t Value)
Write 32bit integer to shared memory. For remote devices the function always waits for acknowledge...
enum ENUM_CLASS ERR_Not_Detect_Comm_DLL
TGM_Comm_Int_2.dll or suplemental DLL not found (TGM_MINI.dll, TGM_Remote.dll)
CTGM_COMM_INT_2::status TGM_IF_STAT
Simplify write of CTGM_COMM_INT_2::status.
read_write Set_Bit_I64_DIRECT(shared_memory memoryType, uint32_t offset, int64_t Value)
Performs logical OR on 64bit integer in shared memory. (i.e. originalValue |= Value). For remote devices the function always wait for acknowledge.
enum ENUM_CLASS INTERP_W
InterpolatorWriteMemory.
enum ENUM_CLASS TGM_Mini_Offline
offline memory of TGMmini (remote)
read_write Write_I32(shared_memory memoryType, uint32_t offset, int32_t Value)
Write 32bit integer to shared memory. For remote devices, the write request is sent and the function ...
static const char * DeviceToStringA(device deviceType)
Convert device type to ANSI string.
enum ENUM_CLASS TGM_Mini_Online
TGMmini memories (remote)
enum ENUM_CLASS Not_Detect_Comm_DLL
TGM_Comm_Int_2.dll or supplemental DLL not found (TGM_MINI.dll, TGM_Remote.dll)
enum ENUM_CLASS Offline_Incompatible_DEVICE_Mem_ID
Offline - wrong Device memory ID compatibility number of DLL and application.
read_write Write_Double(shared_memory memoryType, uint32_t offset, double Value)
Write double floating point value (8 bytes) to shared memory. For remote devices, the write request i...
read_write Write_BLOCK(shared_memory memoryType, uint32_t offset, const void *buffer, uint32_t bufferLength)
Write block (any memory structure) to shared memory.
enum ENUM_CLASS Offline_Not_Detect_Comm_DLL
Offline - suplemental comm dll not found.
read_write Read_Double_DIRECT(shared_memory memoryType, uint32_t offset, double *pValue)
Read double floating point value (8 bytes) from shared memory. For remote devices the function always...
read_write Clr_Bit_I32(shared_memory memoryType, uint32_t offset, int32_t Value)
Performs logical NAND on 32bit integer in shared memory. (i.e. originalValue &= ~Value).
read_write Read_I64(shared_memory memoryType, uint32_t offset, int64_t *pValue)
Read 64bit integer from shared memory. For remote devices, the read request is sent and the function ...
read_write Write_I64_DIRECT(shared_memory memoryType, uint32_t offset, int64_t Value)
Write 64bit integer to shared memory. For remote devices the function always waits for acknowledge...
void Set_App_Compatibility_VN(int32_t compatibilityID, int32_t compatibilityMemID, int32_t version, const TGM_TCHAR *appName)
Set application compatibility request values.
error_code LoadDll(const char *fileName)
First function to be called. Loads the TGM_Comm_Int_2.dll and gets pointers to all of its exported fu...
enum ENUM_CLASS connected_memory
Connected memory types.
read_write Write_Double_DIRECT(shared_memory memoryType, uint32_t offset, double Value)
Write double floating point value (8 bytes) to shared memory. For remote devices the function always ...
enum ENUM_CLASS ODS
TGM_ODS (OutputDebugString)
enum ENUM_CLASS CNC_EX_LOCAL
local device only, DLL shadow of shared TGM_CNCEX
enum ENUM_CLASS device
Allowed device types.
read_write Read_I32(shared_memory memoryType, uint32_t offset, int32_t *pValue)
Read 32bit integer from shared memory. For remote devices, the read request is sent and the function ...
Describes one servo input/output module.
Definition: TGM.h:850