DAP.BasicMoulds.hpp 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. #pragma once
  2. #include <string>
  3. #include <algorithm>
  4. using namespace std;
  5. //
  6. //#include "TmplMould.tlh"
  7. //#include "TmplMould.tli"
  8. #include "DIOS.Dev.MouldDefine.hpp"
  9. #pragma warning (disable:4244) // warning C4244: “初始化”: 从“double”转换到“float”,可能丢失数据
  10. namespace DIOS::Dev::Detail
  11. {
  12. namespace DAP
  13. {
  14. static const char* DeviceDriverType = "{18FDF176-DECE-445F-A52C-A14BDD3AC2C1}";
  15. static const char* DAPUnitType = "{123492D6-A546-4ACF-8EF1-2CCAA9EA974E}";
  16. namespace AttrKey
  17. {
  18. static const char* DAP = "DAP";
  19. static const char* ConnectionStatus = "ConnectionStatus";
  20. }
  21. namespace ActionKey
  22. {
  23. static const char* Clear_DAP = "Clear_DAP";
  24. static const char* GetValue_DAP = "GetValue_DAP";
  25. }
  26. ////-----------------------------------------------------------------------------
  27. //// FloatMould
  28. ////-----------------------------------------------------------------------------
  29. //class FloatMould : public TmplMould <float>
  30. //{
  31. // using super = TmplMould <float>;
  32. //public:
  33. // FloatMould(const char* strkey, float initialvalue, float min, float max, float accuracy)
  34. // :super(initialvalue, min, max, accuracy)
  35. // {
  36. // Key = strkey;
  37. // m_Value = initialvalue;
  38. // }
  39. //
  40. // ~FloatMould() {}
  41. // std::string GetDescription ();
  42. // std::string GetAttribute ();
  43. // std::string JSGet();
  44. // std::string GetKey();
  45. //protected:
  46. // std::string Key;
  47. //};
  48. //-----------------------------------------------------------------------------
  49. // DOSEMould
  50. //-----------------------------------------------------------------------------
  51. class DOSEMould : public FloatMould
  52. {
  53. using super = FloatMould;
  54. public:
  55. DOSEMould(float initialvalue, float min, float max, float accuracy)
  56. :super(AttrKey::DAP, initialvalue, min, max, accuracy) {}
  57. ~DOSEMould() {}
  58. static constexpr const char * Unit { "dGycm2" };
  59. std::string strUnit = Unit;
  60. //std::string GetDescription();
  61. };
  62. class ConnectionStatusMould : public IntMould
  63. {
  64. using super = IntMould;
  65. public:
  66. ConnectionStatusMould(int initialvalue, int min, int max, int accuracy)
  67. :super(AttrKey::ConnectionStatus, initialvalue, min, max, accuracy) {}
  68. ~ConnectionStatusMould() {}
  69. };
  70. //-----------------------------------------------------------------------------
  71. // ConfigInfo
  72. //-----------------------------------------------------------------------------
  73. namespace ConfKey
  74. {
  75. static const char* DiosType = "Vender";
  76. static const char* DiosModel = "Model";
  77. static const char* DiosConfig = "DeviceConfig";
  78. static const char* DiosAttribute = "Attribute";
  79. static const char* DiosDescription = "Description";
  80. static const char* DiosSCFType = "SCFType";
  81. static const char* DiosSCFTCPIP = "TCPIP";
  82. static const char* DiosSCFCOM = "COM";
  83. static const char* DiosSCFIP = "ip";
  84. static const char* DiosSCFPort = "port";
  85. static const char* DiosSCFBaudrate = "baudrate";
  86. static const char* DiosSCFBytesize = "bytesize";
  87. static const char* DiosSCFParity = "parity";
  88. static const char* DiosSCFStopbits = "stopbits";
  89. static const char* DiosIsConnect = "IsConnect";
  90. }
  91. }
  92. }