diff --git a/src/lpCoreCtrl/CoreCtrl.cpp b/src/lpCoreCtrl/CoreCtrl.cpp index 2c611c9..d052fe7 100644 --- a/src/lpCoreCtrl/CoreCtrl.cpp +++ b/src/lpCoreCtrl/CoreCtrl.cpp @@ -165,7 +165,7 @@ void CCoreCtrl::ISnapImage(const QStringList& camKeys) if (camKeys.size() <= 0) return; CameraCtrl ctrl; - ctrl.m_ctrlType = 3; + ctrl.m_ctrlType = EM_SNAPCAM; ctrl.strCamName = camKeys.first(); m_safeList.push_back(ctrl); } @@ -190,6 +190,42 @@ void CCoreCtrl::ISetCameraProperty(const QString& strSerial, TP_CAMERA_PROPERTY& return m_camDevManager->ISetCameraProperty(strSerial, property); } +bool CCoreCtrl::IOpenCamera(const QString& strSerial) +{ + CameraCtrl ctrl; + ctrl.m_ctrlType = EM_OPENCAM; + ctrl.strCamName = strSerial; + m_safeList.push_back(ctrl); + return true; +} + +bool CCoreCtrl::ICloseCamera(const QString& strSerial) +{ + CameraCtrl ctrl; + ctrl.m_ctrlType = EM_CLOSECAM; + ctrl.strCamName = strSerial; + m_safeList.push_back(ctrl); + return true; +} + +bool CCoreCtrl::IStartCamera(const QString& strSerial) +{ + CameraCtrl ctrl; + ctrl.m_ctrlType = EM_STARTCAM; + ctrl.strCamName = strSerial; + m_safeList.push_back(ctrl); + return true; +} + +bool CCoreCtrl::IStopCamera(const QString& strSerial) +{ + CameraCtrl ctrl; + ctrl.m_ctrlType = EM_STOPCAM; + ctrl.strCamName = strSerial; + m_safeList.push_back(ctrl); + return true; +} + bool CCoreCtrl::IRunAlg(const QString& strSerial, bool bRun) { return m_camDevManager->IRunAlg(strSerial, bRun); @@ -319,24 +355,30 @@ void CCoreCtrl::onRunTask() if (m_safeList.getSize() > 0) { CameraCtrl ctrl; m_safeList.pop_front(ctrl); - if (ctrl.m_ctrlType == 0)//开始相机 外触发 + if (ctrl.m_ctrlType == EM_OPENCAM)//开始相机 外触发 { //onStartCamera(ctrl.strCamName); + m_camDevManager->IOpenCamera(ctrl.strCamName); } - else if (ctrl.m_ctrlType == 1)//停止相机 + else if (ctrl.m_ctrlType == EM_CLOSECAM)//停止相机 { //onStopCamera(ctrl.strCamName); + m_camDevManager->ICloseCamera(ctrl.strCamName); } - else if (ctrl.m_ctrlType == 2)//开始相机 软触发 + else if (ctrl.m_ctrlType == EM_STARTCAM)//开始相机 软触发 { //onStartSoftCamera(ctrl.strCamName); + m_camDevManager->IStartCamera(ctrl.strCamName); + } + else if (ctrl.m_ctrlType == EM_STOPCAM) {//停止相机 + m_camDevManager->IStopCamera(ctrl.strCamName); } - else if (ctrl.m_ctrlType == 3)//软触发一次相机 + else if (ctrl.m_ctrlType == EM_SNAPCAM)//软触发一次相机 { //onSoftTrigerCamera(ctrl.strCamName); m_camDevManager->ISnapImage(QStringList()<ICreateCamera(strSerial, nType); } - virtual bool IOpenCamera(const QString& strSerial) { return m_camDevManager->IOpenCamera(strSerial); } - virtual bool ICloseCamera(const QString& strSerial) { return m_camDevManager->ICloseCamera(strSerial); } - virtual bool IStartCamera(const QString& strSerial) { return m_camDevManager->IStartCamera(strSerial); } - virtual bool IStopCamera(const QString& strSerial) { return m_camDevManager->IStopCamera(strSerial); } + virtual bool IOpenCamera(const QString& strSerial); + virtual bool ICloseCamera(const QString& strSerial); + virtual bool IStartCamera(const QString& strSerial); + virtual bool IStopCamera(const QString& strSerial); virtual bool IDelCamera(const QString& strSerial) { return m_camDevManager->IDelCamera(strSerial); } virtual bool IAddCamera(const QString& strName, const TP_CAMERA_OPTION& camOpt) { return m_camDevManager->IAddCamera(strName, camOpt); } virtual bool IRunAlg(const QString& strSerial, bool bRun);