123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- #include <windows.h>
- #include "LogicDriver.h"
- #include "SerialSCF.h"
- #include "Mech1D.h"
- // TODO: 在此处引用程序需要的其他头文件
- //通讯协议
- #define PACKET_HEAD1 (0xEE)
- #define PACKET_HEAD2 (0x5A)
- #define PACKET_TAIL1 (0x0D)
- #define PACKET_TAIL2 (0x0A)
- #define DIOSCTRLCPU_COM_TIMEOUT (2000)
- typedef union _FunctionID
- {
- struct
- {
- unsigned char DEVID : 4;//
- unsigned char BLOCKID : 4;//
- };
- unsigned char CharPart;
- } FUNCTIONID;
- typedef struct _CtrlPacketHead
- {
- unsigned char szTitle[2];
- unsigned char FrameSize;
- unsigned char FrameId;
- unsigned char FrameCmd;
- unsigned char FuncId;
- unsigned char Data1;
- unsigned char Data2;
- unsigned char Data3;
- unsigned char Data4;
- unsigned char Data5;
- }CTRLPACKETHEAD;
- typedef union _ShortData
- {
- struct
- {
- unsigned char Low;
- unsigned char High;
- };
- unsigned short ShortPart;
- } SHORTDATA;
- typedef union _ShortData_2
- {
- struct
- {
- unsigned char Low;
- unsigned char High;
- };
- short ShortPart;
- } SHORTDATA_2;
- typedef struct _TOMONODEINFO
- {
- //unsigned short Pos;先不要位置坐标
- unsigned short Angle;
- }TOMONODEINFO;
- #define SAFE_DELETE_ARRAY(p) { if(p) { delete[] (p); (p)=NULL; } }
- #define SAFE_DELETE(p) { if(p) { delete (p); (p)=NULL; } }
- #define SAFE_CLOSEHANDLE(h) { if(h) { CloseHandle(h); (h)=NULL; } }
- #pragma warning(disable: 4800)
- extern Logger *gmotionLog;
- extern Logger *gcommLog;
- extern Logger *gdriverLog;
- extern Logger *gbusinessLog;
- extern Logger *gdigitalTwinLog;
- #define MOTION_INFO(format,...) __DebugPrintA(gmotionLog,LOG_LEVEL_INFO,__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
- #define MOTION_WARN(format,...) __DebugPrintA(gmotionLog,LOG_LEVEL_WARNING,__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
- #define MOTION_ERRO(format,...) __DebugPrintA(gmotionLog,LOG_LEVEL_ERROR,__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
- #define COMM_INFO(format,...) __DebugPrintA(gcommLog,LOG_LEVEL_INFO,__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
- #define COMM_WARN(format,...) __DebugPrintA(gcommLog,LOG_LEVEL_WARNING,__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
- #define COMM_ERRO(format,...) __DebugPrintA(gcommLog,LOG_LEVEL_ERROR,__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
- #define DRIVER_INFO(format,...) __DebugPrintA(gdriverLog,LOG_LEVEL_INFO,__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
- #define DRIVER_WARN(format,...) __DebugPrintA(gdriverLog,LOG_LEVEL_WARNING,__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
- #define DRIVER_ERRO(format,...) __DebugPrintA(gdriverLog,LOG_LEVEL_ERROR,__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
- #define BUSI_INFO(format,...) __DebugPrintA(gbusinessLog,LOG_LEVEL_INFO,__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
- #define BUSI_WARN(format,...) __DebugPrintA(gbusinessLog,LOG_LEVEL_WARNING,__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
- #define BUSI_ERRO(format,...) __DebugPrintA(gbusinessLog,LOG_LEVEL_ERROR,__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
- #define DIG_TWIN(format,...) __DebugPrintA(gdigitalTwinLog,LOG_LEVEL_INFO,__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
- #ifndef DIOSBOX_LIB
- #ifdef _WIN64
- #ifdef _DEBUG
- #pragma comment(lib, "DiosBoxBaseX64D.lib")
- #else
- #pragma comment(lib, "DiosBoxBaseX64.lib")
- #endif
- #else
- #ifdef _DEBUG
- #pragma comment(lib, "DiosBoxBaseD.lib")
- #else
- #pragma comment(lib, "DiosBoxBase.lib")
- #endif
- #endif
- #endif // DIOSBOX_LIB
|