DYNSyncBox.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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. RET_STATUS GetDeviceResource(ResDataObject *pDeviceResource);
  58. RET_STATUS DATA_ACTION GetDeviceConfig(ResDataObject PARAM_OUT *pDeviceConfig);
  59. RET_STATUS DATA_ACTION SetDeviceConfig(ResDataObject PARAM_IN *DeviceConfig);
  60. bool SendBySCF(const char * chChannelID, bool bStatus);
  61. bool SendSPSBySCF(const char * chChannelID, int nCycle, int nPulse, int nWaitTime);
  62. bool SendSPEBySCF(const char * chChannelID, UCHAR cMode, UCHAR cEnable, int nWaitTime);
  63. bool SendSMSBySCF(const char * cExpMode, const char *cExpCount, int nWaitTime);
  64. int DealtheSignal(const char *channel,int state);
  65. int DealCanData(const char *cmd, int len);
  66. int SetSignal(const char *name, int state);
  67. int SetPWM(float fpps);
  68. int SetPWMState(bool state);
  69. int SetAreaType();
  70. int NotifySignal(const char *name, int state);
  71. /*void start();
  72. void stop();*/
  73. bool SendCANBySCF(int cmdID, unsigned char * cmd, int cmdlen);
  74. class OemSeq *m_pSynFPD;
  75. class CGenSeq *m_pSynGen;
  76. class CCollimaotr *m_pColllimator;
  77. //void * m_pNotify;
  78. void SetCANState(bool state);
  79. void CanShakeHand();
  80. void ClearState();
  81. void ClearSignal();
  82. bool m_nInExpState;
  83. DWORD m_wStartEXPTime;
  84. string CurrentExamMode;
  85. int m_nExpTimes;
  86. int m_nCurrentExpTimes;
  87. int m_nCircleTime;
  88. bool m_bINEEnable;
  89. private:
  90. int ChartoInt(char uc);
  91. int CalChecksum(const char * cCmd, int nCmdSize);
  92. bool FormatCmd(char *cCmd, int &nSize);
  93. bool CmdtoString(const char * cCmd, int nCmdSize, string &strCmd);
  94. static PACKET_RET EventCallback(const char * pRecData, DWORD nLength, DWORD & PacketLength);
  95. string GetContentFromString(string &strContent, char ch);
  96. int String2Hex(string str);
  97. typedef SCF* (*GetSCF)();
  98. GetSCF getSCF;
  99. typedef void(*ReleaseSCF)(SCF *p);
  100. ReleaseSCF releaseSCF;
  101. SCFPacket *m_pSendPacket;
  102. SCFPacket *m_pReceivePacket;
  103. SCF *m_pSCFInstance;
  104. DWORD m_wReceiveTime;
  105. ResDataObject ResDYNConfig;
  106. DYNHeader_t m_DYNMap;
  107. private:
  108. HMODULE m_DllFileHandle;
  109. };