DME.BasicMoulds.hpp 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. #pragma once
  2. #include <string>
  3. #include <algorithm>
  4. using namespace std;
  5. #include "DIOS.Dev.MouldDefine.hpp"
  6. #include "DME.BasicMoulds.hpp"
  7. #pragma warning (disable:4244) // warning C4244: “初始化”: 从“double”转换到“float”,可能丢失数据
  8. namespace DIOS::Dev::Detail
  9. {
  10. namespace DME
  11. {
  12. static const char* DeviceDriverType = "{00000020-2345-6789-4567-567890123456}";//"{E5F6G7H8-2345-6789-4567-567890123456}";
  13. static const char* DMEUnitType = "{19103172-3456-7890-6789-789012345678}";
  14. namespace AttrKey
  15. {
  16. static const char* CalibrateValue = "CalibrateValue";
  17. static const char* MeasurementInterval = "MeasurementInterval"; //连续测量时数据返回时间间隔
  18. static const char* Position = "Position";//距离起止点
  19. static const char* Range = "Range"; //量程
  20. static const char* Frequency = "Frequency";//频率
  21. static const char* Resolution = "Resolution";//分辨率 1(1mm),2(0.1mm)
  22. static const char* Distance = "Distance";//距离
  23. static const char* LaserState = "LaserState";//激光状态
  24. static const char* ConnectionStatus = "ConnectionStatus";
  25. static const char* MeasureSID = "MeasureSID";//测量的SID
  26. static const char* MeasureAngle = "MeasureAngle";//测量的角度
  27. }
  28. namespace ActionKey
  29. {
  30. static const char* FetchDistance = "FetchDistance"; //获取距离
  31. static const char* SetLaserState = "SetLaserState"; //设置打开或者关闭激光
  32. static const char* ShutDown = "ShutDown"; //关机
  33. }
  34. //##################################################################################################
  35. //定义具体设备属性
  36. #define UNIT_DATA_INT(NAME, KEY) \
  37. class NAME :public IntMould\
  38. {\
  39. using super = IntMould;\
  40. public:\
  41. NAME(int initialvalue, int lower, int upper, int accuracy)\
  42. :super(KEY, initialvalue, lower, upper, accuracy)\
  43. {}\
  44. ~NAME() {}\
  45. };\
  46. #define UNIT_DATA_INT_withLimit(NAME, KEY, INIT, MIN, MAX, ACC) \
  47. class NAME :public IntMould\
  48. {\
  49. using super = IntMould;\
  50. public:\
  51. NAME(int initialvalue = INIT, int lower = MIN, int upper = MAX, int accuracy = ACC)\
  52. :super(KEY, initialvalue, lower, upper, accuracy)\
  53. {}\
  54. ~NAME() {}\
  55. };\
  56. #define UNIT_DATA_FLOAT(NAME, KEY) \
  57. class NAME :public FloatMould\
  58. {\
  59. using super = FloatMould;\
  60. public:\
  61. NAME(float initialvalue, float lower, float upper, float accuracy)\
  62. :super(KEY, initialvalue, lower, upper, accuracy)\
  63. {}\
  64. ~NAME() {}\
  65. };\
  66. #define UNIT_DATA_STR(NAME, KEY) \
  67. class NAME :public StringMould\
  68. {\
  69. using super = StringMould;\
  70. public:\
  71. NAME(std::string initialvalue)\
  72. :super(KEY, initialvalue)\
  73. {}\
  74. ~NAME() {}\
  75. };\
  76. UNIT_DATA_INT(DistanceMould, AttrKey::Distance);
  77. UNIT_DATA_INT(LaserStateMould, AttrKey::LaserState);
  78. UNIT_DATA_INT(ConnectionStatusMould, AttrKey::ConnectionStatus);
  79. //-----------------------------------------------------------------------------
  80. // ConfigInfo
  81. //-----------------------------------------------------------------------------
  82. namespace ConfKey
  83. {
  84. static const char* DiosVender = "Vender";
  85. static const char* DiosModel = "Model";
  86. static const char* DiosConfig = "DeviceConfig";
  87. static const char* DiosAttribute = "Attribute";
  88. static const char* DiosDescription = "Description";
  89. static const char* DiosSCFType = "SCFType";
  90. static const char* DiosSCFTCPIP = "TCPIP";
  91. static const char* DiosSCFCOM = "COM";
  92. static const char* DiosSCFIP = "ip";
  93. static const char* DiosSCFPort = "port";
  94. static const char* DiosSCFBaudrate = "baudrate";
  95. static const char* DiosSCFBytesize = "bytesize";
  96. static const char* DiosSCFParity = "parity";
  97. static const char* DiosSCFStopbits = "stopbits";
  98. static const char* DiosIsConnect = "IsConnect";
  99. //20220412 新增 <ConfigToolInfo> 以及其内部属性,主要用于webconfig
  100. static const char* DiosConfigToolInfo = "ConfigToolInfo";
  101. static const char* DiosAttributeInfo = "AttributeInfo";
  102. static const char* DiosAttributeKey = "AttributeKey";
  103. static const char* DiosAttributeDescripition = "AttributeDescripition";
  104. static const char* DiosAccess = "Access";
  105. static const char* DiosType = "Type";
  106. static const char* DiosRangeMin = "RangeMin";
  107. static const char* DiosRangeMax = "RangeMax";
  108. static const char* DiosListNum = "ListNum";
  109. static const char* DiosListInfo = "ListInfo";
  110. static const char* DiosList = "List";
  111. static const char* DiosRequired = "Required";
  112. static const char* DiosDefaultValue = "DefaultValue";
  113. static const char* DiosInnerKey = "InnerKey";
  114. static const char* DiosPathID = "PathID";
  115. }
  116. }
  117. }