SYNBOX.BasicMoulds.hpp 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  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 SYNBOX
  13. {
  14. static const char* DeviceDriverType = "{93A0633D-0BF0-4C45-9973-BFF841D5E2DC}";
  15. static const char* SyncConsoleUnitType = "{D1AF818B-72D0-400E-B780-DF58E2EF23D4}";
  16. namespace AttrKey
  17. {
  18. static const char* SYNSTATE = "SYNBOXSTATUS"; //同步盒设备状态
  19. enum SYNBOX_STATUS {
  20. SYNBOX_STATUS_SHUTDOWN,
  21. SYNBOX_STATUS_INIT,
  22. SYNBOX_STATUS_SLEEP,
  23. SYNBOX_STATUS_CHARGING,//充电
  24. SYNBOX_STATUS_STANDBY,
  25. SYNBOX_STATUS_ERROR,
  26. SYNBOX_STATUS_SERVICE,
  27. SYNBOX_STATUS_MAX
  28. };
  29. static const char* WORKSTATION = "WORKSTATION";
  30. static const char* EXPMODE = "EXPMODE";
  31. static const char* EXPFRAMERAT = "EXPFRAMERAT";
  32. static const char* EXPTIMES = "EXPTIMES";
  33. static const char* DiosGeneratorSync = "GENERATORSYNCSTATE";
  34. static const char* DiosGRIDSync = "GRIDSYNCSTATE";
  35. typedef enum _Dios_Generator_Sync
  36. {
  37. GENERATOR_SYNC_ERR = -1,
  38. GENERATOR_RAD_OFF,
  39. GENERATOR_RAD_PREPARE,
  40. GENERATOR_RAD_READY,
  41. GENERATOR_RAD_XRAYON,
  42. GENERATOR_RAD_XRAYOFF,
  43. GENERATOR_FLU_OFF,
  44. GENERATOR_FLU_READY,
  45. GENERATOR_FLU_XRAYON,
  46. GENERATOR_FLU_XRAYOFF,
  47. GENERATOR_FLU_CINE_READY,
  48. GENERATOR_SYNC_MAX
  49. }GENERATOR_SYNC;
  50. static const char* DiosHandSwitch = "HANDSWITCHSTATE";
  51. typedef enum _HAND_SWITCH {
  52. HAND_OFF,
  53. HAND_DWON1,
  54. HAND_DWON2,
  55. HAND_MAX
  56. }HAND_SWITCH;
  57. static const char* DiosFootSwitch = "FOOTSWITCHSTATE";
  58. typedef enum _FOOT_SWITCH {
  59. FOOT_OFF,
  60. FOOT_DWON1,
  61. FOOT_MAX
  62. }FOOT_SWITCH;
  63. static const char* TOTALEXPSURENUMBER = "TotalExposureNumber";
  64. static const char* CURRENTEXPOSUREBNUMBER = "CurrentExposureNumber";
  65. static const char* DiosDetectorStatus = "DETECTORSTATUS";
  66. typedef enum _Dios_Detector_Status
  67. {
  68. DETECTOR_STATUS_SHUTDOWN,
  69. DETECTOR_STATUS_INIT,
  70. DETECTOR_STATUS_SLEEP,
  71. DETECTOR_STATUS_WAKEUP,//低能耗,能工作
  72. DETECTOR_STATUS_STANDBY,//高能耗,能采集
  73. //DETECTOR_STATUS_ACQ_WAIT,//在STANDBY状态,执行ACQ Action且没到ACQ状态
  74. DETECTOR_STATUS_ACQ,
  75. //DETECTOR_STATUS_STANDBY_WAIT,//在ACQ状态,执行StopAcq Action且没到STANDBY状态
  76. DETECTOR_STATUS_ERROR,
  77. DETECTOR_STATUS_MAX
  78. }DETECTOR_STATUS;
  79. static const char* DiosXwindowStatus = "XwindowStatus";
  80. typedef enum _Xwindow_Status {
  81. XWINDOW_OFF,
  82. XWINDOW_ON,
  83. XWINDOW_MAX
  84. }XWINDOW_STATUS;
  85. typedef enum _Xgrid_Status {
  86. XGRID_DISABLE,
  87. XGRID_ENABLE,
  88. }XGRID_STATUS;
  89. }
  90. namespace ActionKey
  91. {
  92. static const char* Reset = "RESET";
  93. static const char* SetValue_WORKSTATION = "SetValue_WORKSTATION";
  94. static const char* SetExpMode = "SetExpMode";
  95. static const char* SetGeneratortoSyncStatus = "SetGeneratortoSyncStatus";
  96. static const char* SetExpEnable = "SetExpEnable";
  97. static const char* SetExpDisable = "SetExpDisable";
  98. static const char* PrepareAcquisition = "PrepareAcquisition";
  99. static const char* StartWindowRequest = "StartWindowRequest";
  100. static const char* SetExposureTimes = "SetExposureTimes";
  101. static const char* StopWindowRequest = "StopWindowRequest";
  102. static const char* SetFrameRate = "SetFrameRate";
  103. static const char* SetValue_PPS = "SetValue_PPS";
  104. static const char* SetGenAECSignal = "SetGenAECSignal";
  105. static const char* SimulateFootSwitchSignal = "SimulateFootSwitchSignal";
  106. static const char* SimulateHandSwitchSignal = "SimulateHandSwitchSignal";
  107. static const char* SetDirectSignal = "SetDirectSignal";
  108. static const char* ActiveSyncMode = "ActiveSyncMode";//取代WorkStation设置同步模式,由上层调用设置
  109. }
  110. //##################################################################################################
  111. //定义具体设备属性
  112. #define UNIT_DATA_INT(NAME, KEY) \
  113. class NAME :public IntMould\
  114. {\
  115. using super = IntMould;\
  116. public:\
  117. NAME(int initialvalue, int lower, int upper, int accuracy)\
  118. :super(KEY, initialvalue, lower, upper, accuracy)\
  119. {}\
  120. ~NAME() {}\
  121. };\
  122. #define UNIT_DATA_INT_withLimit(NAME, KEY, INIT, MIN, MAX, ACC) \
  123. class NAME :public IntMould\
  124. {\
  125. using super = IntMould;\
  126. public:\
  127. NAME(int initialvalue = INIT, int lower = MIN, int upper = MAX, int accuracy = ACC)\
  128. :super(KEY, initialvalue, lower, upper, accuracy)\
  129. {}\
  130. ~NAME() {}\
  131. };\
  132. #define UNIT_DATA_FLOAT(NAME, KEY) \
  133. class NAME :public FloatMould\
  134. {\
  135. using super = FloatMould;\
  136. public:\
  137. NAME(float initialvalue, float lower, float upper, float accuracy)\
  138. :super(KEY, initialvalue, lower, upper, accuracy)\
  139. {}\
  140. ~NAME() {}\
  141. };\
  142. #define UNIT_DATA_STR(NAME, KEY) \
  143. class NAME :public StringMould\
  144. {\
  145. using super = StringMould;\
  146. public:\
  147. NAME(std::string initialvalue)\
  148. :super(KEY, initialvalue)\
  149. {}\
  150. ~NAME() {}\
  151. };\
  152. UNIT_DATA_INT(SYNSTATEMould, AttrKey::SYNSTATE);
  153. UNIT_DATA_INT(HANDSWITCHMould, AttrKey::DiosHandSwitch);
  154. UNIT_DATA_INT(GENSYNSTATEMould, AttrKey::DiosGeneratorSync);
  155. UNIT_DATA_INT(TOTALEXPNUMMould, AttrKey::TOTALEXPSURENUMBER);
  156. UNIT_DATA_INT(CUREXPNUMMould, AttrKey::CURRENTEXPOSUREBNUMBER);
  157. UNIT_DATA_INT(DETECTORSTATUSMould, AttrKey::DiosDetectorStatus);
  158. UNIT_DATA_INT(XWINDOWSTATUSMould, AttrKey::DiosXwindowStatus);
  159. UNIT_DATA_STR(WORKSTATIONMould, AttrKey::WORKSTATION);
  160. UNIT_DATA_STR(EXPMODEMould, AttrKey::EXPMODE);
  161. UNIT_DATA_INT(EXPFRAMERATEMould, AttrKey::EXPFRAMERAT);
  162. UNIT_DATA_INT(EXPTIMESMould, AttrKey::EXPTIMES);
  163. UNIT_DATA_INT(GRIDSYNSTATEMould, AttrKey::DiosGRIDSync);
  164. //-----------------------------------------------------------------------------
  165. // _tSyncModeArgs
  166. //-----------------------------------------------------------------------------
  167. struct _tSyncModeArgs
  168. {
  169. string strWS;
  170. string strSyncMode;
  171. string strSyncValue;
  172. };
  173. //-----------------------------------------------------------------------------
  174. // ConfigInfo
  175. //-----------------------------------------------------------------------------
  176. namespace ConfKey
  177. {
  178. static const char* DiosType = "Vender";
  179. static const char* DiosModel = "Model";
  180. static const char* DiosConfig = "DeviceConfig";
  181. static const char* DiosAttribute = "Attribute";
  182. static const char* DiosDescription = "Description";
  183. static const char* AttributeType = "Type";
  184. static const char* AttributeAccess = "Access";
  185. static const char* AttributeRangeMax = "RangeMax";
  186. static const char* AttributeRangeMin = "RangeMin";
  187. static const char* AttributeListNum = "ListNum";
  188. static const char* AttributeList = "List";
  189. static const char* AttributeRequired = "Required";
  190. static const char* AttributeDefaultValue = "DefaultValue";
  191. static const char* DiosSCFType = "SCFType";
  192. static const char* DiosSCFTCPIP = "TCPIP";
  193. static const char* DiosSCFCOM = "COM";
  194. static const char* DiosSCFIP = "ip";
  195. static const char* DiosSCFPort = "port";
  196. static const char* DiosSCFBaudrate = "baudrate";
  197. static const char* DiosSCFBytesize = "bytesize";
  198. static const char* DiosSCFParity = "parity";
  199. static const char* DiosSCFStopbits = "stopbits";
  200. static const char* DiosIsConnect = "IsConnect";
  201. }
  202. }
  203. }