DiosBoxBase.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. #pragma once
  2. #define _HAS_STD_BYTE 0 //此项需在所有包含之前
  3. #include <windows.h>
  4. #include "SCF.hpp"
  5. #include "SerialSCF.h"
  6. #include "Logger.temp.h"
  7. #include "Logger.h"
  8. #include "DIOS.Dev.IODevice.hpp"
  9. using namespace DIOS::Dev::Detail;
  10. #include "DIOS.Dev.Machinery.Model.h"
  11. #include "SimpleLog.hpp"
  12. // TODO: 在此处引用程序需要的其他头文件
  13. //通讯协议
  14. #define PACKET_HEAD1 (0xEE)
  15. #define PACKET_HEAD2 (0x5A)
  16. #define PACKET_TAIL1 (0x0D)
  17. #define PACKET_TAIL2 (0x0A)
  18. #define DIOSCTRLCPU_COM_TIMEOUT (2000)
  19. typedef union _FunctionID
  20. {
  21. struct
  22. {
  23. unsigned char DEVID : 4;//
  24. unsigned char BLOCKID : 4;//
  25. };
  26. unsigned char CharPart;
  27. } FUNCTIONID;
  28. typedef struct _CtrlPacketHead
  29. {
  30. unsigned char szTitle[2];
  31. unsigned char FrameSize;
  32. unsigned char FrameId;
  33. unsigned char FrameCmd;
  34. unsigned char FuncId;
  35. unsigned char Data1;
  36. unsigned char Data2;
  37. unsigned char Data3;
  38. unsigned char Data4;
  39. unsigned char Data5;
  40. }CTRLPACKETHEAD;
  41. typedef union _ShortData
  42. {
  43. struct
  44. {
  45. unsigned char Low;
  46. unsigned char High;
  47. };
  48. unsigned short ShortPart;
  49. } SHORTDATA;
  50. typedef union _ShortData_2
  51. {
  52. struct
  53. {
  54. unsigned char Low;
  55. unsigned char High;
  56. };
  57. short ShortPart;
  58. } SHORTDATA_2;
  59. typedef struct _TOMONODEINFO
  60. {
  61. //unsigned short Pos;先不要位置坐标
  62. unsigned short Angle;
  63. }TOMONODEINFO;
  64. #define SAFE_DELETE_ARRAY(p) { if(p) { delete[] (p); (p)=NULL; } }
  65. #define SAFE_DELETE(p) { if(p) { delete (p); (p)=NULL; } }
  66. #define SAFE_CLOSEHANDLE(h) { if(h) { CloseHandle(h); (h)=NULL; } }
  67. #pragma warning(disable: 4800)
  68. extern SimpleLog *gmotionLog;
  69. extern SimpleLog *gcommLog;
  70. extern SimpleLog *gdriverLog;
  71. extern SimpleLog *gbusinessLog;
  72. extern SimpleLog *gdigitalTwinLog;
  73. //#define if (gmotionLog) gmotionLog->Info(format,...) __DebugPrintA(gmotionLog,LOG_LEVEL_INFO,__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
  74. //#define if (gmotionLog) gmotionLog->Warn(format,...) __DebugPrintA(gmotionLog,LOG_LEVEL_WARNING,__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
  75. //#define if (gmotionLog) gmotionLog->Error(format,...) __DebugPrintA(gmotionLog,LOG_LEVEL_ERROR,__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
  76. //
  77. //#define if(gcommLog) gcommLog->Info(format,...) __DebugPrintA(gcommLog,LOG_LEVEL_INFO,__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
  78. //#define if(gcommLog) gcommLog->Warn(format,...) __DebugPrintA(gcommLog,LOG_LEVEL_WARNING,__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
  79. //#define if(gcommLog) gcommLog->Error(format,...) __DebugPrintA(gcommLog,LOG_LEVEL_ERROR,__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
  80. //
  81. //#define if(gdriverLog) gdriverLog->Info(format,...) __DebugPrintA(gdriverLog,LOG_LEVEL_INFO,__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
  82. //#define if(gdriverLog) gdriverLog->Warn(format,...) __DebugPrintA(gdriverLog,LOG_LEVEL_WARNING,__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
  83. //#define if(gdriverLog) gdriverLog->Error(format,...) __DebugPrintA(gdriverLog,LOG_LEVEL_ERROR,__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
  84. //
  85. //#define if(gbusinessLog) gbusinessLog->Info(format,...) __DebugPrintA(gbusinessLog,LOG_LEVEL_INFO,__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
  86. //#define if(gbusinessLog) gbusinessLog->Warn(format,...) __DebugPrintA(gbusinessLog,LOG_LEVEL_WARNING,__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
  87. //#define if(gbusinessLog) gbusinessLog->Error(format,...) __DebugPrintA(gbusinessLog,LOG_LEVEL_ERROR,__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
  88. //
  89. //#define DIG_TWIN(format,...) __DebugPrintA(gdigitalTwinLog,LOG_LEVEL_INFO,__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
  90. ///#define DIG_TWIN(format,...) //__ReleasePrintA(LOG_LEVEL_INFO,__LINE__,__FUNCTION__,format,__VA_ARGS__)
  91. #ifdef DIOSDEVMACHINERYBASE_EXPORTS
  92. #define _DIOSDEVMACHBASE_API __declspec(dllexport)
  93. #else
  94. #define _DIOSDEVMACHBASE_API __declspec(dllimport)
  95. #endif
  96. #ifndef DIOSBOX_LIB
  97. #ifdef _WIN64
  98. #ifdef _DEBUG
  99. #pragma comment(lib, "DIOS.Dev.Machinery.BaseX64D.lib")
  100. #else
  101. #pragma comment(lib, "DIOS.Dev.Machinery.BaseX64.lib")
  102. #endif
  103. #else
  104. #ifdef _DEBUG
  105. #pragma comment(lib, "DIOS.Dev.Machinery.BaseD.lib")
  106. #else
  107. #pragma comment(lib, "DIOS.Dev.Machinery.Base.lib")
  108. #endif
  109. #endif
  110. #endif // DIOSBOX_LIB