123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265 |
- #include "StdAfx.h"
- #include "FPDCommonDataList.h"
- CSinglePanelCommonDataList::CSinglePanelCommonDataList(void)
- {
- }
- CSinglePanelCommonDataList::~CSinglePanelCommonDataList(void)
- {
- }
- void CSinglePanelCommonDataList::Init(pCallbackfun pCallback, int nIndex)
- {
- CString strIndex;
- m_pCallback = pCallback;
- strIndex.Format(_T("[%d]"), nIndex); //数组使用Info[Index]形式的名称
-
- //配置
- m_strcFPDType.Init(_T("FPDType") + strIndex,_T("Conf"),_T(""),m_pCallback);
- m_ncSyncMode.Init(_T("SyncMode") + strIndex,_T("Conf"),0,m_pCallback);
- m_strcPanelSerial.Init(_T("PanelSerial") + strIndex,_T("Conf"),_T(""),m_pCallback);
- m_strcFPDFilePath.Init(_T("FPDFilePath") + strIndex,_T("Conf"),_T(""),m_pCallback);
- m_bcPreviewEnable.Init(_T("PreviewEnable") + strIndex,_T("Conf"),0,m_pCallback);
- m_ncFPDExpWindowMode.Init(_T("FPDExpWindowMode") + strIndex,_T("Conf"),0,m_pCallback);
- m_fcFPDExpWindow.Init(_T("FPDExpWindow") + strIndex,_T("Conf"),0.0f,m_pCallback);
- m_bcSaveRawDataMode.Init(_T("SaveRawDataMode") + strIndex,_T("Conf"),true,m_pCallback);
- m_ncWidthOffset.Init(_T("WidthOffset") + strIndex,_T("Conf"),0,m_pCallback);
- m_ncHeightOffset.Init(_T("HeightOffset") + strIndex,_T("Conf"),0,m_pCallback);
- m_fcTempratureLimit.Init(_T("TempratureLimit") + strIndex,_T("Conf"),50.0f,m_pCallback);
- m_fcWIFILimit.Init(_T("WIFILimit") + strIndex,_T("Conf"),10.0f,m_pCallback);
- m_fcBatteryLimit.Init(_T("BatteryLimit") + strIndex,_T("Conf"),10.0f,m_pCallback);
- m_ncSatValue.Init(_T("SatValue") + strIndex,_T("Conf"),9000,m_pCallback);
- m_ncRequireHWMode.Init(_T("RequireHWMode") + strIndex,_T("Conf"),0,m_pCallback);
- m_fcTempratureWarning.Init(_T("TempratureWarning") + strIndex,_T("Conf"),50.0f,m_pCallback);
- m_fcWIFIWarning.Init(_T("WIFIWarning") + strIndex,_T("Conf"),10.0f,m_pCallback);
- m_fcBatteryWarning.Init(_T("BatteryWarning") + strIndex,_T("Conf"),10.0f,m_pCallback);
- //信息
- m_niIndex.Init(_T("Index") + strIndex,_T("Info"), nIndex,m_pCallback);
- m_niImageBits.Init(_T("ImageBits") + strIndex,_T("Info"), 0,m_pCallback);
- m_niRawWidth.Init(_T("RawWidth") + strIndex,_T("Info"), 0,m_pCallback);
- m_niRawHeight.Init(_T("RawHeight") + strIndex,_T("Info"), 0,m_pCallback);
- m_niPreviewWidth.Init(_T("PreviewWidth") + strIndex,_T("Info"), 0,m_pCallback);
- m_niPreviewHeight.Init(_T("PreviewHeight") + strIndex,_T("Info"), 0,m_pCallback);
- m_niFactoryCalType.Init(_T("FactoryCalType") + strIndex,_T("Info"), PANEL_FACTORY_CAL_IMAGE,m_pCallback);
- //状态
- m_nsPanelStatus.Init(_T("PanelStatus") + strIndex,_T("Status"),0,m_pCallback);
- m_nsActiveWidth.Init(_T("ActiveWidth") + strIndex,_T("Status"),0,m_pCallback);
- m_nsActiveHeight.Init(_T("ActiveHeight") + strIndex,_T("Status"),0,m_pCallback);
- m_fsExpWindow.Init(_T("ExpWindow") + strIndex,_T("Status"),0.0f,m_pCallback);
- m_fsTemprature.Init(_T("Temprature") + strIndex,_T("Status"),0.0f,m_pCallback);
- m_fsWIFI.Init(_T("WIFI") + strIndex,_T("Status"),0.0f,m_pCallback);
- m_fsBattery.Init(_T("Battery") + strIndex,_T("Status"),0.0f,m_pCallback);
- m_bsFactoryCorrectionActive.Init(_T("FactoryCorrectionActive") + strIndex,_T("Status"),false,m_pCallback);
- m_bsBatteryCharging.Init(_T("BatteryCharging") + strIndex,_T("Status"),_T(""),m_pCallback);
- //错误
- m_bsAlarmTempratrue.Init(_T("AlarmTempratrue") + strIndex,_T("Error"),false,m_pCallback);
- m_bsAlarmWIFI.Init(_T("AlarmWIFI") + strIndex,_T("Error"),false,m_pCallback);
- m_bsAlarmBattery.Init(_T("AlarmBattery") + strIndex,_T("Error"),false,m_pCallback);
- m_bsErrorGetImage.Init(_T("ErrorGetImage") + strIndex,_T("Error"),false,m_pCallback);
- m_bsErrorCommunication.Init(_T("ErrorCommunicate") + strIndex,_T("Error"),false,m_pCallback);
- m_bsErrorPowerOff.Init(_T("ErrorPowerOff") + strIndex,_T("Error"),false,m_pCallback);
- m_bsErrorSleep.Init(_T("ErrorSleep") + strIndex,_T("Error"),false,m_pCallback);
- m_bsErrorLoadGain.Init(_T("ErrorLoadGain") + strIndex,_T("Error"),false,m_pCallback);
- m_bsErrorLoadCorrection.Init(_T("ErrorLoadCorrection") + strIndex,_T("Error"),false,m_pCallback);
-
- //警告
- m_bsWarnTempratrue.Init(_T("WarnTempratrue") + strIndex,_T("Warning"),false,m_pCallback);
- m_bsWarnWIFI.Init(_T("WarnWIFI") + strIndex,_T("Warning"),false,m_pCallback);
- m_bsWarnBattery.Init(_T("WarnBattery") + strIndex,_T("Warning"),false,m_pCallback);
- m_bsWarnExpoRequest.Init(_T("WarnExpoRequest") + strIndex,_T("Warning"),false,m_pCallback);
- //消息
- m_strmPreViewImageHandle.Init(_T("PreViewImageHandle") + strIndex,_T("Message"),_T(""),m_pCallback);
- m_strmRawImageHandle.Init(_T("RawImageHandle") + strIndex,_T("Message"),_T(""),m_pCallback);
- m_strmBaseInfo.Init(_T("BaseInfo") + strIndex,_T("Message"),_T(""),m_pCallback);
- m_strmMotionStatus.Init(_T("MotionStatus") + strIndex,_T("Message"),_T(""),m_pCallback);
- m_strmStorageStatus.Init(_T("StorageStatus") + strIndex,_T("Message"),_T(""),m_pCallback);
- //功能参数
- }
- int CSinglePanelCommonDataList::OnSetup( CString strName, CString strGroup, CString strValue )
- {
- int nResult = DEVICE_RST_NOTEXIST;
- if (strGroup == _T("Conf"))
- {
- if (m_strcFPDType.Name() == strName)
- {
- nResult = m_strcFPDType.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
- }
- else if (m_ncSyncMode.Name() == strName)
- {
- nResult = m_ncSyncMode.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
- }
- else if (m_strcPanelSerial.Name() == strName)
- {
- nResult = m_strcPanelSerial.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
- }
- else if (m_strcFPDFilePath.Name() == strName)
- {
- nResult = m_strcFPDFilePath.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
- }
- else if (m_bcPreviewEnable.Name() == strName)
- {
- nResult = m_bcPreviewEnable.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
- }
- else if (m_ncFPDExpWindowMode.Name() == strName)
- {
- nResult = m_ncFPDExpWindowMode.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
- }
- else if (m_fcFPDExpWindow.Name() == strName)
- {
- nResult = m_fcFPDExpWindow.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
- }
- else if (m_bcSaveRawDataMode.Name() == strName)
- {
- nResult = m_bcSaveRawDataMode.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
- }
- else if (m_ncWidthOffset.Name() == strName)
- {
- nResult = m_ncWidthOffset.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
- }
- else if (m_ncHeightOffset.Name() == strName)
- {
- nResult = m_ncHeightOffset.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
- }
- else if (m_fcTempratureWarning.Name() == strName)
- {
- nResult = m_fcTempratureWarning.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
- }
- else if (m_fcWIFIWarning.Name() == strName)
- {
- nResult = m_fcWIFIWarning.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
- }
- else if (m_fcBatteryWarning.Name() == strName)
- {
- nResult = m_fcBatteryWarning.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
- }
- else if (m_fcTempratureLimit.Name() == strName)
- {
- nResult = m_fcTempratureLimit.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
- }
- else if (m_fcWIFILimit.Name() == strName)
- {
- nResult = m_fcWIFILimit.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
- }
- else if (m_fcBatteryLimit.Name() == strName)
- {
- nResult = m_fcBatteryLimit.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
- }
- else if (m_ncSatValue.Name() == strName)
- {
- nResult = m_ncSatValue.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
- }
- else if (m_ncRequireHWMode.Name() == strName )
- {
- nResult = m_ncRequireHWMode.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
- }
- }
- return nResult;
- }
- CFPDCommonDataList::CFPDCommonDataList(void)
- {
- }
- CFPDCommonDataList::~CFPDCommonDataList(void)
- {
- }
- void CFPDCommonDataList::Init(pCallbackfun pCallback)
- {
- m_pCallback = pCallback;
- //配置
- m_ncPanelCount.Init(_T("PanelCount"), _T("Conf"), 0, pCallback);
- m_strcConfigPath.Init(_T("configPath"), _T("Conf"), _T(""), pCallback);
- //状态
- m_nsSelectIndex.Init(_T("SelectIndex"), _T("Status"), -1, pCallback);
- m_bsDEMODevice.Init(_T("DEMODevice"), _T("Status"), false, pCallback);
- //消息
- m_nmInitStatus.Init(_T("InitStatus"), _T("Message"), PANEL_EVENT_END_OK, pCallback);
- m_nmSelectPanelStatus.Init(_T("SelectPanelStatus"), _T("Message"), PANEL_EVENT_END_OK, pCallback);
- m_nmAcquisitionStatus.Init(_T("AcquisitionStatus"), _T("Message"), PANEL_EVENT_END_OK, pCallback);
- m_nmOffsetCalibrationStatus.Init(_T("OffsetCalibrationStatus"), _T("Message"), PANEL_EVENT_END_OK, pCallback);
- m_nmCalibrationStatus.Init(_T("CalibrationStatus"), _T("Message"), PANEL_EVENT_END_OK, pCallback);
-
- //功能
- m_npSelectPanelIndex.Init(_T("SelectPanelIndex"), _T("API.Param"), 0, pCallback);
- m_straSelectPanel.Init(_T("SelectPanel"), _T("API"), _T(""), pCallback);
- m_straStartAcquisition.Init(_T("StartAcquisition"), _T("API"), _T(""), pCallback);
- m_straExpoRequest.Init(_T("ExpoRequest"), _T("API"), _T(""), pCallback);
- m_straCancelAcquisition.Init(_T("CancelAcquisition"), _T("API"), _T(""), pCallback);
- m_straOffsetCalibration.Init(_T("OffsetCalibration"), _T("API"), _T(""), pCallback);
- m_straRecoverImage.Init(_T("RecoverImage"), _T("API"), _T(""), pCallback);
- m_straActiveDetector.Init(_T("ActiveDetector"), _T("API"), _T(""), pCallback);
- m_straStartCalibration.Init(_T("StartCalibration"), _T("API"), _T(""), pCallback);
- m_straAcceptCalibrationImage.Init(_T("AcceptCalibrationImage"), _T("API"), _T(""), pCallback);
- m_straRejectCalibrationImage.Init(_T("RejectCalibrationImage"), _T("API"), _T(""), pCallback);
- m_straCancelCalibration.Init(_T("CancelCalibration"), _T("API"), _T(""), pCallback);
- m_straCompleteCalibration.Init(_T("CompleteCalibration"), _T("API"), _T(""), pCallback);
- m_straFactoryOffsetOpen.Init(_T("FactoryOffsetOpen"), _T("API"), _T(""), pCallback);
- m_straFactoryCorrectionOpen.Init(_T("FactoryCorrectionOpen"), _T("API"), _T(""), pCallback);
- m_straFactoryCorrectionClose.Init(_T("FactoryCorrectionClose"), _T("API"), _T(""), pCallback);
-
- m_panels.clear();
- }
- int CFPDCommonDataList::OnSetup( CString strName, CString strGroup, CString strValue )
- {
- int nResult = DEVICE_RST_NOTEXIST;
- int nCount = m_ncPanelCount.nValue();
- //子列表OnSetup
- for (int i=0; i<nCount; i++)
- {
- nResult = m_panels[i].OnSetup(strName, strGroup, strValue);
- if (nResult != DEVICE_RST_NOTEXIST)
- {
- return nResult;
- }
- }
- if (strGroup == _T("Conf"))
- {
- if (m_ncPanelCount.Name() == strName)
- {
- nResult = m_ncPanelCount.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
- PanelsInit(m_ncPanelCount.nValue());
- }
- else if (m_strcConfigPath.Name() == strName)
- {
- nResult = m_strcConfigPath.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
- }
- }
- else if (strGroup == _T("API.Param"))
- {
- if (m_npSelectPanelIndex.Name() == strName)
- {
- nResult = m_npSelectPanelIndex.SetValue(strValue)? DEVICE_RST_OK:DEVICE_RST_FAULT;
- }
- }
- return nResult;
- }
- bool CFPDCommonDataList::PanelsInit( int nCount )
- {
- if (nCount<1 || nCount>PANEL_MAX_COUNT)
- {
- return false;
- }
- int nCurrentCount = m_panels.size();
- for (int i=nCurrentCount; i<nCount; i++)
- {
- CSinglePanelCommonDataList panel;
- m_panels.push_back(panel);
- m_panels.back().Init(m_pCallback, i);
- }
- return true;
- }
|