DYNSyncBox.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. // 下列 ifdef 块是创建使从 DLL 导出更简单的
  2. // 宏的标准方法。此 DLL 中的所有文件都是用命令行上定义的 WHEELDPC_EXPORTS
  3. // 符号编译的。在使用此 DLL 的
  4. // 任何其他项目上不应定义此符号。这样,源文件中包含此文件的任何其他项目都会将
  5. // SYNCFPDDPC_API 函数视为是从 DLL 导入的,而此 DLL 则将用此宏定义的
  6. // 符号视为是被导出的。
  7. #pragma once
  8. #ifndef UCBSYNCBOX_EXPORTS
  9. #ifdef WIN_64BIT
  10. #ifdef _DEBUG
  11. #pragma comment(lib, "UCBSyncBoxX64D.lib")
  12. #else
  13. #pragma comment(lib, "UCBSyncBoxX64.lib")
  14. #endif
  15. #else
  16. #ifdef _DEBUG
  17. #pragma comment(lib, "UCBSyncBoxD.lib")
  18. #else
  19. #pragma comment(lib, "DYNSyncBox.lib")
  20. #endif
  21. #endif
  22. #endif
  23. #include "DYNHeader.h"
  24. #ifdef UCBSYNCBOX_EXPORTS
  25. #define UCB_API __declspec(dllexport)
  26. #else
  27. #define UCB_API __declspec(dllimport)
  28. #endif
  29. extern "C" UCB_API DriverDPC* GetDriverDPC();
  30. extern "C" UCB_API void ReleaseDriverDPC(DriverDPC *p);
  31. class UCB_API DYNSyncBox : public LogicDriver
  32. {
  33. std::string *m_pWorkpath;
  34. public:
  35. DYNSyncBox(void);
  36. virtual ~DYNSyncBox(void);
  37. virtual bool DriverEntry(ResDataObject &Configuration);
  38. virtual bool Driver_Probe(ResDataObject &HardwareInfo);
  39. virtual bool SYSTEM_CALL SetDriverWorkPath(const char * PARAM_IN pWorkPath);
  40. virtual PVOID SYSTEM_CALL LoadDriver();//无根节点
  41. virtual void SYSTEM_CALL UnloadDriver();
  42. virtual bool SYSTEM_CALL OnHeartBeat();
  43. //virtual DWORD ReceiveHeartBeat(const char * pRevData, DWORD PacketLength);
  44. //virtual bool OnNotify(HANDLE ExitNotify);
  45. virtual DWORD SYSTEM_CALL OnNotify(HANDLE evtList[], DWORD count);
  46. RET_STATUS SYSTEM_CALL GetDriverDictionary(ResDataObject& PARAM_OUT DriverInfo);
  47. virtual bool Connect();
  48. virtual void DisConnect();
  49. //给硬件驱动设置Unique工作路径
  50. //如果是同一设备同一连接情况下,硬件多次接入,系统会保证工作路径是一样的.
  51. //连接后,单一硬件相关的数据要保存在此.
  52. virtual bool SYSTEM_CALL SetDeviceWorkPath(const char * PARAM_IN pWorkPath);
  53. //逻辑设备树的加载和卸载
  54. virtual PVOID SYSTEM_CALL LoadLogicDevices();
  55. virtual void SYSTEM_CALL UnloadLogicDevices();
  56. virtual bool Device_Probe(ResDataObject &HardwareInfo);
  57. bool SendBySCF(const char * chChannelID, bool bStatus);
  58. bool SendSPSBySCF(const char * chChannelID, int nCycle, int nPulse, int nWaitTime);
  59. bool SendSPEBySCF(const char * chChannelID, UCHAR cMode, UCHAR cEnable, int nWaitTime);
  60. bool SendSMSBySCF(const char * cExpMode, const char *cExpCount, int nWaitTime);
  61. int DealtheSignal(const char *channel,int state);
  62. int DealCanData(const char *cmd, int len);
  63. int SetSignal(const char *name, int state);
  64. int SetPWM(float fpps);
  65. int SetPWMState(bool state);
  66. int SetAreaType();
  67. int NotifySignal(const char *name, int state);
  68. /*void start();
  69. void stop();*/
  70. bool SendCANBySCF(int cmdID, unsigned char * cmd, int cmdlen);
  71. class OemSeq *m_pSynFPD;
  72. class CGenSeq *m_pSynGen;
  73. class CCollimaotr *m_pColllimator;
  74. //void * m_pNotify;
  75. void SetCANState(bool state);
  76. void CanShakeHand();
  77. void ClearState();
  78. void ClearSignal();
  79. bool m_nInExpState;
  80. DWORD m_wStartEXPTime;
  81. string CurrentExamMode;
  82. int m_nExpTimes;
  83. int m_nCurrentExpTimes;
  84. int m_nCircleTime;
  85. bool m_bINEEnable;
  86. private:
  87. int ChartoInt(char uc);
  88. int CalChecksum(const char * cCmd, int nCmdSize);
  89. bool FormatCmd(char *cCmd, int &nSize);
  90. bool CmdtoString(const char * cCmd, int nCmdSize, string &strCmd);
  91. static PACKET_RET EventCallback(const char * pRecData, DWORD nLength, DWORD & PacketLength);
  92. string GetContentFromString(string &strContent, char ch);
  93. int String2Hex(string str);
  94. typedef SCF* (*GetSCF)();
  95. GetSCF getSCF;
  96. typedef void(*ReleaseSCF)(SCF *p);
  97. ReleaseSCF releaseSCF;
  98. SCFPacket *m_pSendPacket;
  99. SCFPacket *m_pReceivePacket;
  100. SCF *m_pSCFInstance;
  101. DWORD m_wReceiveTime;
  102. ResDataObject ResDYNConfig;
  103. DYNHeader_t m_DYNMap;
  104. private:
  105. HMODULE m_DllFileHandle;
  106. };