FPDCommonDataList.cpp 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. #include "StdAfx.h"
  2. #include "FPDCommonDataList.h"
  3. CSinglePanelCommonDataList::CSinglePanelCommonDataList(void)
  4. {
  5. }
  6. CSinglePanelCommonDataList::~CSinglePanelCommonDataList(void)
  7. {
  8. }
  9. void CSinglePanelCommonDataList::Init(pCallbackfun pCallback, int nIndex)
  10. {
  11. CString strIndex;
  12. m_pCallback = pCallback;
  13. strIndex.Format(_T("[%d]"), nIndex); //数组使用Info[Index]形式的名称
  14. //配置
  15. m_strcFPDType.Init(_T("FPDType") + strIndex,_T("Conf"),_T(""),m_pCallback);
  16. m_ncSyncMode.Init(_T("SyncMode") + strIndex,_T("Conf"),0,m_pCallback);
  17. m_strcPanelSerial.Init(_T("PanelSerial") + strIndex,_T("Conf"),_T(""),m_pCallback);
  18. m_strcFPDFilePath.Init(_T("FPDFilePath") + strIndex,_T("Conf"),_T(""),m_pCallback);
  19. m_bcPreviewEnable.Init(_T("PreviewEnable") + strIndex,_T("Conf"),0,m_pCallback);
  20. m_ncFPDExpWindowMode.Init(_T("FPDExpWindowMode") + strIndex,_T("Conf"),0,m_pCallback);
  21. m_fcFPDExpWindow.Init(_T("FPDExpWindow") + strIndex,_T("Conf"),0.0f,m_pCallback);
  22. m_bcSaveRawDataMode.Init(_T("SaveRawDataMode") + strIndex,_T("Conf"),true,m_pCallback);
  23. m_ncWidthOffset.Init(_T("WidthOffset") + strIndex,_T("Conf"),0,m_pCallback);
  24. m_ncHeightOffset.Init(_T("HeightOffset") + strIndex,_T("Conf"),0,m_pCallback);
  25. m_fcTempratureLimit.Init(_T("TempratureLimit") + strIndex,_T("Conf"),50.0f,m_pCallback);
  26. m_fcWIFILimit.Init(_T("WIFILimit") + strIndex,_T("Conf"),10.0f,m_pCallback);
  27. m_fcBatteryLimit.Init(_T("BatteryLimit") + strIndex,_T("Conf"),10.0f,m_pCallback);
  28. m_ncSatValue.Init(_T("SatValue") + strIndex,_T("Conf"),9000,m_pCallback);
  29. m_ncRequireHWMode.Init(_T("RequireHWMode") + strIndex,_T("Conf"),0,m_pCallback);
  30. m_fcTempratureWarning.Init(_T("TempratureWarning") + strIndex,_T("Conf"),50.0f,m_pCallback);
  31. m_fcWIFIWarning.Init(_T("WIFIWarning") + strIndex,_T("Conf"),10.0f,m_pCallback);
  32. m_fcBatteryWarning.Init(_T("BatteryWarning") + strIndex,_T("Conf"),10.0f,m_pCallback);
  33. //信息
  34. m_niIndex.Init(_T("Index") + strIndex,_T("Info"), nIndex,m_pCallback);
  35. m_niImageBits.Init(_T("ImageBits") + strIndex,_T("Info"), 0,m_pCallback);
  36. m_niRawWidth.Init(_T("RawWidth") + strIndex,_T("Info"), 0,m_pCallback);
  37. m_niRawHeight.Init(_T("RawHeight") + strIndex,_T("Info"), 0,m_pCallback);
  38. m_niPreviewWidth.Init(_T("PreviewWidth") + strIndex,_T("Info"), 0,m_pCallback);
  39. m_niPreviewHeight.Init(_T("PreviewHeight") + strIndex,_T("Info"), 0,m_pCallback);
  40. m_niFactoryCalType.Init(_T("FactoryCalType") + strIndex,_T("Info"), PANEL_FACTORY_CAL_IMAGE,m_pCallback);
  41. //状态
  42. m_nsPanelStatus.Init(_T("PanelStatus") + strIndex,_T("Status"),0,m_pCallback);
  43. m_nsActiveWidth.Init(_T("ActiveWidth") + strIndex,_T("Status"),0,m_pCallback);
  44. m_nsActiveHeight.Init(_T("ActiveHeight") + strIndex,_T("Status"),0,m_pCallback);
  45. m_fsExpWindow.Init(_T("ExpWindow") + strIndex,_T("Status"),0.0f,m_pCallback);
  46. m_fsTemprature.Init(_T("Temprature") + strIndex,_T("Status"),0.0f,m_pCallback);
  47. m_fsWIFI.Init(_T("WIFI") + strIndex,_T("Status"),0.0f,m_pCallback);
  48. m_fsBattery.Init(_T("Battery") + strIndex,_T("Status"),0.0f,m_pCallback);
  49. m_bsFactoryCorrectionActive.Init(_T("FactoryCorrectionActive") + strIndex,_T("Status"),false,m_pCallback);
  50. m_bsBatteryCharging.Init(_T("BatteryCharging") + strIndex,_T("Status"),_T(""),m_pCallback);
  51. //错误
  52. m_bsAlarmTempratrue.Init(_T("AlarmTempratrue") + strIndex,_T("Error"),false,m_pCallback);
  53. m_bsAlarmWIFI.Init(_T("AlarmWIFI") + strIndex,_T("Error"),false,m_pCallback);
  54. m_bsAlarmBattery.Init(_T("AlarmBattery") + strIndex,_T("Error"),false,m_pCallback);
  55. m_bsErrorGetImage.Init(_T("ErrorGetImage") + strIndex,_T("Error"),false,m_pCallback);
  56. m_bsErrorCommunication.Init(_T("ErrorCommunicate") + strIndex,_T("Error"),false,m_pCallback);
  57. m_bsErrorPowerOff.Init(_T("ErrorPowerOff") + strIndex,_T("Error"),false,m_pCallback);
  58. m_bsErrorSleep.Init(_T("ErrorSleep") + strIndex,_T("Error"),false,m_pCallback);
  59. m_bsErrorLoadGain.Init(_T("ErrorLoadGain") + strIndex,_T("Error"),false,m_pCallback);
  60. m_bsErrorLoadCorrection.Init(_T("ErrorLoadCorrection") + strIndex,_T("Error"),false,m_pCallback);
  61. //警告
  62. m_bsWarnTempratrue.Init(_T("WarnTempratrue") + strIndex,_T("Warning"),false,m_pCallback);
  63. m_bsWarnWIFI.Init(_T("WarnWIFI") + strIndex,_T("Warning"),false,m_pCallback);
  64. m_bsWarnBattery.Init(_T("WarnBattery") + strIndex,_T("Warning"),false,m_pCallback);
  65. m_bsWarnExpoRequest.Init(_T("WarnExpoRequest") + strIndex,_T("Warning"),false,m_pCallback);
  66. //消息
  67. m_strmPreViewImageHandle.Init(_T("PreViewImageHandle") + strIndex,_T("Message"),_T(""),m_pCallback);
  68. m_strmRawImageHandle.Init(_T("RawImageHandle") + strIndex,_T("Message"),_T(""),m_pCallback);
  69. m_strmBaseInfo.Init(_T("BaseInfo") + strIndex,_T("Message"),_T(""),m_pCallback);
  70. m_strmMotionStatus.Init(_T("MotionStatus") + strIndex,_T("Message"),_T(""),m_pCallback);
  71. m_strmStorageStatus.Init(_T("StorageStatus") + strIndex,_T("Message"),_T(""),m_pCallback);
  72. //功能参数
  73. }
  74. int CSinglePanelCommonDataList::OnSetup( CString strName, CString strGroup, CString strValue )
  75. {
  76. int nResult = DEVICE_RST_NOTEXIST;
  77. if (strGroup == _T("Conf"))
  78. {
  79. if (m_strcFPDType.Name() == strName)
  80. {
  81. nResult = m_strcFPDType.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
  82. }
  83. else if (m_ncSyncMode.Name() == strName)
  84. {
  85. nResult = m_ncSyncMode.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
  86. }
  87. else if (m_strcPanelSerial.Name() == strName)
  88. {
  89. nResult = m_strcPanelSerial.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
  90. }
  91. else if (m_strcFPDFilePath.Name() == strName)
  92. {
  93. nResult = m_strcFPDFilePath.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
  94. }
  95. else if (m_bcPreviewEnable.Name() == strName)
  96. {
  97. nResult = m_bcPreviewEnable.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
  98. }
  99. else if (m_ncFPDExpWindowMode.Name() == strName)
  100. {
  101. nResult = m_ncFPDExpWindowMode.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
  102. }
  103. else if (m_fcFPDExpWindow.Name() == strName)
  104. {
  105. nResult = m_fcFPDExpWindow.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
  106. }
  107. else if (m_bcSaveRawDataMode.Name() == strName)
  108. {
  109. nResult = m_bcSaveRawDataMode.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
  110. }
  111. else if (m_ncWidthOffset.Name() == strName)
  112. {
  113. nResult = m_ncWidthOffset.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
  114. }
  115. else if (m_ncHeightOffset.Name() == strName)
  116. {
  117. nResult = m_ncHeightOffset.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
  118. }
  119. else if (m_fcTempratureWarning.Name() == strName)
  120. {
  121. nResult = m_fcTempratureWarning.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
  122. }
  123. else if (m_fcWIFIWarning.Name() == strName)
  124. {
  125. nResult = m_fcWIFIWarning.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
  126. }
  127. else if (m_fcBatteryWarning.Name() == strName)
  128. {
  129. nResult = m_fcBatteryWarning.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
  130. }
  131. else if (m_fcTempratureLimit.Name() == strName)
  132. {
  133. nResult = m_fcTempratureLimit.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
  134. }
  135. else if (m_fcWIFILimit.Name() == strName)
  136. {
  137. nResult = m_fcWIFILimit.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
  138. }
  139. else if (m_fcBatteryLimit.Name() == strName)
  140. {
  141. nResult = m_fcBatteryLimit.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
  142. }
  143. else if (m_ncSatValue.Name() == strName)
  144. {
  145. nResult = m_ncSatValue.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
  146. }
  147. else if (m_ncRequireHWMode.Name() == strName )
  148. {
  149. nResult = m_ncRequireHWMode.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
  150. }
  151. }
  152. return nResult;
  153. }
  154. CFPDCommonDataList::CFPDCommonDataList(void)
  155. {
  156. }
  157. CFPDCommonDataList::~CFPDCommonDataList(void)
  158. {
  159. }
  160. void CFPDCommonDataList::Init(pCallbackfun pCallback)
  161. {
  162. m_pCallback = pCallback;
  163. //配置
  164. m_ncPanelCount.Init(_T("PanelCount"), _T("Conf"), 0, pCallback);
  165. m_strcConfigPath.Init(_T("configPath"), _T("Conf"), _T(""), pCallback);
  166. //状态
  167. m_nsSelectIndex.Init(_T("SelectIndex"), _T("Status"), -1, pCallback);
  168. m_bsDEMODevice.Init(_T("DEMODevice"), _T("Status"), false, pCallback);
  169. //消息
  170. m_nmInitStatus.Init(_T("InitStatus"), _T("Message"), PANEL_EVENT_END_OK, pCallback);
  171. m_nmSelectPanelStatus.Init(_T("SelectPanelStatus"), _T("Message"), PANEL_EVENT_END_OK, pCallback);
  172. m_nmAcquisitionStatus.Init(_T("AcquisitionStatus"), _T("Message"), PANEL_EVENT_END_OK, pCallback);
  173. m_nmOffsetCalibrationStatus.Init(_T("OffsetCalibrationStatus"), _T("Message"), PANEL_EVENT_END_OK, pCallback);
  174. m_nmCalibrationStatus.Init(_T("CalibrationStatus"), _T("Message"), PANEL_EVENT_END_OK, pCallback);
  175. //功能
  176. m_npSelectPanelIndex.Init(_T("SelectPanelIndex"), _T("API.Param"), 0, pCallback);
  177. m_straSelectPanel.Init(_T("SelectPanel"), _T("API"), _T(""), pCallback);
  178. m_straStartAcquisition.Init(_T("StartAcquisition"), _T("API"), _T(""), pCallback);
  179. m_straExpoRequest.Init(_T("ExpoRequest"), _T("API"), _T(""), pCallback);
  180. m_straCancelAcquisition.Init(_T("CancelAcquisition"), _T("API"), _T(""), pCallback);
  181. m_straOffsetCalibration.Init(_T("OffsetCalibration"), _T("API"), _T(""), pCallback);
  182. m_straRecoverImage.Init(_T("RecoverImage"), _T("API"), _T(""), pCallback);
  183. m_straActiveDetector.Init(_T("ActiveDetector"), _T("API"), _T(""), pCallback);
  184. m_straStartCalibration.Init(_T("StartCalibration"), _T("API"), _T(""), pCallback);
  185. m_straAcceptCalibrationImage.Init(_T("AcceptCalibrationImage"), _T("API"), _T(""), pCallback);
  186. m_straRejectCalibrationImage.Init(_T("RejectCalibrationImage"), _T("API"), _T(""), pCallback);
  187. m_straCancelCalibration.Init(_T("CancelCalibration"), _T("API"), _T(""), pCallback);
  188. m_straCompleteCalibration.Init(_T("CompleteCalibration"), _T("API"), _T(""), pCallback);
  189. m_straFactoryOffsetOpen.Init(_T("FactoryOffsetOpen"), _T("API"), _T(""), pCallback);
  190. m_straFactoryCorrectionOpen.Init(_T("FactoryCorrectionOpen"), _T("API"), _T(""), pCallback);
  191. m_straFactoryCorrectionClose.Init(_T("FactoryCorrectionClose"), _T("API"), _T(""), pCallback);
  192. m_panels.clear();
  193. }
  194. int CFPDCommonDataList::OnSetup( CString strName, CString strGroup, CString strValue )
  195. {
  196. int nResult = DEVICE_RST_NOTEXIST;
  197. int nCount = m_ncPanelCount.nValue();
  198. //子列表OnSetup
  199. for (int i=0; i<nCount; i++)
  200. {
  201. nResult = m_panels[i].OnSetup(strName, strGroup, strValue);
  202. if (nResult != DEVICE_RST_NOTEXIST)
  203. {
  204. return nResult;
  205. }
  206. }
  207. if (strGroup == _T("Conf"))
  208. {
  209. if (m_ncPanelCount.Name() == strName)
  210. {
  211. nResult = m_ncPanelCount.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
  212. PanelsInit(m_ncPanelCount.nValue());
  213. }
  214. else if (m_strcConfigPath.Name() == strName)
  215. {
  216. nResult = m_strcConfigPath.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
  217. }
  218. }
  219. else if (strGroup == _T("API.Param"))
  220. {
  221. if (m_npSelectPanelIndex.Name() == strName)
  222. {
  223. nResult = m_npSelectPanelIndex.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
  224. }
  225. }
  226. return nResult;
  227. }
  228. bool CFPDCommonDataList::PanelsInit( int nCount )
  229. {
  230. if (nCount<1 || nCount>PANEL_MAX_COUNT)
  231. {
  232. return false;
  233. }
  234. int nCurrentCount = m_panels.size();
  235. for (int i=nCurrentCount; i<nCount; i++)
  236. {
  237. CSinglePanelCommonDataList panel;
  238. m_panels.push_back(panel);
  239. m_panels.back().Init(m_pCallback, i);
  240. }
  241. return true;
  242. }