DiosBoxBase.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. #include <windows.h>
  2. #include "LogicDriver.h"
  3. #include "SerialSCF.h"
  4. #include "Mech1D.h"
  5. // TODO: 在此处引用程序需要的其他头文件
  6. //通讯协议
  7. #define PACKET_HEAD1 (0xEE)
  8. #define PACKET_HEAD2 (0x5A)
  9. #define PACKET_TAIL1 (0x0D)
  10. #define PACKET_TAIL2 (0x0A)
  11. #define DIOSCTRLCPU_COM_TIMEOUT (2000)
  12. typedef union _FunctionID
  13. {
  14. struct
  15. {
  16. unsigned char DEVID : 4;//
  17. unsigned char BLOCKID : 4;//
  18. };
  19. unsigned char CharPart;
  20. } FUNCTIONID;
  21. typedef struct _CtrlPacketHead
  22. {
  23. unsigned char szTitle[2];
  24. unsigned char FrameSize;
  25. unsigned char FrameId;
  26. unsigned char FrameCmd;
  27. unsigned char FuncId;
  28. unsigned char Data1;
  29. unsigned char Data2;
  30. unsigned char Data3;
  31. unsigned char Data4;
  32. unsigned char Data5;
  33. }CTRLPACKETHEAD;
  34. typedef union _ShortData
  35. {
  36. struct
  37. {
  38. unsigned char Low;
  39. unsigned char High;
  40. };
  41. unsigned short ShortPart;
  42. } SHORTDATA;
  43. typedef union _ShortData_2
  44. {
  45. struct
  46. {
  47. unsigned char Low;
  48. unsigned char High;
  49. };
  50. short ShortPart;
  51. } SHORTDATA_2;
  52. typedef struct _TOMONODEINFO
  53. {
  54. //unsigned short Pos;先不要位置坐标
  55. unsigned short Angle;
  56. }TOMONODEINFO;
  57. #define SAFE_DELETE_ARRAY(p) { if(p) { delete[] (p); (p)=NULL; } }
  58. #define SAFE_DELETE(p) { if(p) { delete (p); (p)=NULL; } }
  59. #define SAFE_CLOSEHANDLE(h) { if(h) { CloseHandle(h); (h)=NULL; } }
  60. #pragma warning(disable: 4800)
  61. extern Logger *gmotionLog;
  62. extern Logger *gcommLog;
  63. extern Logger *gdriverLog;
  64. extern Logger *gbusinessLog;
  65. extern Logger *gdigitalTwinLog;
  66. #define MOTION_INFO(format,...) __DebugPrintA(gmotionLog,LOG_LEVEL_INFO,__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
  67. #define MOTION_WARN(format,...) __DebugPrintA(gmotionLog,LOG_LEVEL_WARNING,__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
  68. #define MOTION_ERRO(format,...) __DebugPrintA(gmotionLog,LOG_LEVEL_ERROR,__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
  69. #define COMM_INFO(format,...) __DebugPrintA(gcommLog,LOG_LEVEL_INFO,__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
  70. #define COMM_WARN(format,...) __DebugPrintA(gcommLog,LOG_LEVEL_WARNING,__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
  71. #define COMM_ERRO(format,...) __DebugPrintA(gcommLog,LOG_LEVEL_ERROR,__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
  72. #define DRIVER_INFO(format,...) __DebugPrintA(gdriverLog,LOG_LEVEL_INFO,__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
  73. #define DRIVER_WARN(format,...) __DebugPrintA(gdriverLog,LOG_LEVEL_WARNING,__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
  74. #define DRIVER_ERRO(format,...) __DebugPrintA(gdriverLog,LOG_LEVEL_ERROR,__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
  75. #define BUSI_INFO(format,...) __DebugPrintA(gbusinessLog,LOG_LEVEL_INFO,__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
  76. #define BUSI_WARN(format,...) __DebugPrintA(gbusinessLog,LOG_LEVEL_WARNING,__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
  77. #define BUSI_ERRO(format,...) __DebugPrintA(gbusinessLog,LOG_LEVEL_ERROR,__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
  78. #define DIG_TWIN(format,...) __DebugPrintA(gdigitalTwinLog,LOG_LEVEL_INFO,__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
  79. #ifndef DIOSBOX_LIB
  80. #ifdef _WIN64
  81. #ifdef _DEBUG
  82. #pragma comment(lib, "DiosBoxBaseX64D.lib")
  83. #else
  84. #pragma comment(lib, "DiosBoxBaseX64.lib")
  85. #endif
  86. #else
  87. #ifdef _DEBUG
  88. #pragma comment(lib, "DiosBoxBaseD.lib")
  89. #else
  90. #pragma comment(lib, "DiosBoxBase.lib")
  91. #endif
  92. #endif
  93. #endif // DIOSBOX_LIB