DIOS.Dev.DAP.VACUE130DAP.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. #pragma once
  2. #include "DIOS.Dev.DAP.Mould.hpp"
  3. #include "IODeviceWithSCF.tlh"
  4. #include "IODeviceWithSCF.tli"
  5. #include "DIOS.Dev.MSGMould.hpp"
  6. #ifdef DIOSDEVGENDEMO_EXPORTS
  7. #define _DIOSDEVGENDEMO_API __declspec(dllexport)
  8. #else
  9. #define _DIOSDEVGENDEMO_API __declspec(dllimport)
  10. #endif
  11. namespace DIOS::Dev::Detail::DAP
  12. {
  13. //-----------------------------------------------------------------------------
  14. // PTWDAPDevice
  15. //-----------------------------------------------------------------------------
  16. namespace nDev = DIOS::Dev;
  17. class _DIOSDEVGENDEMO_API VACUE130DAP : public IODeviceWithSCF <IODeviceDetail>,public DAPMould
  18. {
  19. using super = IODeviceWithSCF <IODeviceDetail>;
  20. using superGen = DAPMould;
  21. public:
  22. VACUE130DAP(std::shared_ptr <IOEventCenter> center, nsSCF::SCF SCF, string configfile);
  23. ~VACUE130DAP();
  24. virtual std::string GetGUID() const override;
  25. RET_STATUS ClearDAP();
  26. RET_STATUS QueryDAP(float& value);
  27. void OnCallBack(const char* strPackage, DWORD Length);
  28. void SubscribeSelf(dios_mqtt_connection* conn) override;
  29. private:
  30. RET_STATUS HWSend(char* strCommand, int nTimeOut =100);
  31. std::unique_ptr<nsDetail::MSGUnit> m_MSGUnit;
  32. ResDataObject m_DapConfig;
  33. std::string GetDynamicLibraryPath();
  34. std::string GetFileVersion(std::string strFilePathName);
  35. void GetConfData();
  36. string m_strCommunicateType{ "com" };
  37. //指令
  38. void ResetDap();
  39. void TestDAP();
  40. void QueryStatus();
  41. void SetProtocol();
  42. void GetMeanValue();
  43. //发生器数据
  44. float m_fPostKV{ 0.0 };
  45. float m_fPostMAS{ 0.0 };
  46. float m_fPostMA{ 0.0 };
  47. float m_fPostMS{ 0.0 };
  48. //遮光器数据
  49. float m_fSID{ 0.0 };
  50. float m_fXsize{ 0.0 };
  51. float m_fYsize{ 0.0 };
  52. virtual RET_STATUS SetGenCurrentSMState(std::string value) override;
  53. virtual RET_STATUS SetGenPostKV(const std::string value) override;
  54. virtual RET_STATUS SetGenPostMAS(const std::string value) override;
  55. virtual RET_STATUS SetGenPostMA(const std::string value) override;
  56. virtual RET_STATUS SetGenPostMS(const std::string value) override;
  57. virtual RET_STATUS SetCollSID(const std::string value) override;
  58. virtual RET_STATUS SetCollXSIZE(const std::string value) override;
  59. virtual RET_STATUS SetCollYSIZE(const std::string value) override;
  60. private:
  61. void Register();
  62. public:
  63. protected:
  64. private:
  65. void FireNotify (std::string key, std::string context);
  66. };
  67. }
  68. //-----------------------------------------------------------------------------
  69. // DAPDriver
  70. //-----------------------------------------------------------------------------
  71. namespace DIOS::Dev::Detail::DAP
  72. {
  73. class _DIOSDEVGENDEMO_API DAPDriver : public IODriverWithSCF <DriverMould>
  74. {
  75. using super = IODriverWithSCF <DriverMould>;
  76. public:
  77. DAPDriver();
  78. virtual ~DAPDriver();
  79. public:
  80. virtual void Prepare () override;
  81. virtual bool DATA_ACTION Connect () override;
  82. virtual void Disconnect() override;
  83. virtual bool isConnected() const override;
  84. virtual void Dequeue (const char * Packet, DWORD Length) override;
  85. virtual void FireNotify (int code, std::string key, std::string content) override;
  86. virtual auto CreateDevice (int index)->std::unique_ptr <IODevice> override;
  87. virtual std::string DriverProbe () override;
  88. virtual std::string GetResource () override;
  89. virtual std::string DeviceProbe () override;
  90. private:
  91. static PACKET_RET callbackPackageProcess (const char* RecData, DWORD nLength, DWORD& PacketLength);
  92. bool m_bDemoConnected; // 在 DEMO 模式下, 调用过 Connect 吗?
  93. VACUE130DAP* m_pDevice {nullptr};
  94. };
  95. }