From 784d9abd0f11e4576a1d6d5a6302072121ad1975 Mon Sep 17 00:00:00 2001 From: lovelyyoung <1002639516@qq.com> Date: Sat, 15 Aug 2020 16:08:47 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=A2=9E=E5=8A=A0USB=E4=BC=A0=E8=BE=93?= =?UTF-8?q?=E8=B6=85=E6=97=B6=E9=80=80=E5=87=BA=E5=8A=9F=E8=83=BD=EF=BC=8C?= =?UTF-8?q?=E4=BB=A5=E9=81=BF=E5=85=8D=E6=9C=BA=E5=99=A8=E9=80=9A=E4=BF=A1?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=EF=BC=8C=E9=A9=B1=E5=8A=A8=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E9=80=80=E5=87=BA=E9=97=AE=E9=A2=98=202.=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E5=9B=BE=E5=83=8F=E5=A4=84=E7=90=86=E9=83=A8=E5=88=86=E6=9E=84?= =?UTF-8?q?=E9=80=A0=E4=BC=A0=E5=8F=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- huagao/Device/GScanO200.cpp | 17 ++++++++++------- huagao/Device/ImageMatQueue.cpp | 2 +- huagao/Device/PublicFunc.cpp | 4 ++++ 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/huagao/Device/GScanO200.cpp b/huagao/Device/GScanO200.cpp index 1de0946a..39f79518 100644 --- a/huagao/Device/GScanO200.cpp +++ b/huagao/Device/GScanO200.cpp @@ -283,7 +283,7 @@ std::string GScanO200::GetFWVersion() std::string GScanO200::GetSerialNum() { - return "G20018000298"; + //return "G20018000298"; if (m_usb.get() && m_usb->is_connected()) { std::lock_guard lck(m_imgLocker); @@ -407,11 +407,6 @@ void GScanO200::Stop_scan() USBCB usbcb = { STOP ,0,0 }; if (m_usb.get() && m_usb->is_connected()) m_usb->write_bulk(&usbcb, sizeof(usbcb)); - -#ifdef G200 - //m_pImages->setscanflags(false); - //devState = DEV_STOP; -#endif // G200 } void GScanO200::ResetScanner() @@ -483,7 +478,7 @@ void GScanO200::usbhotplug(bool isleft) if (isleft) { //std::lock_guard lck(m_Locker); //FileTools:: - ("D:\\1.txt", "usbhotplug left"); + //("D:\\1.txt", "usbhotplug left"); devState = DEV_WRONG; Error_Code = USB_DISCONNECTED; m_pImages->setscanflags(false); @@ -518,6 +513,7 @@ void GScanO200::usbmain() ////FileTools::write_log("D:\\1.txt", "thread usb start"); try { + StopWatch sw; while (devState == DEV_ISRUNNING) { if ((m_usb.get() && !m_usb->is_connected())) { this_thread::sleep_for(chrono::milliseconds(200)); @@ -533,6 +529,12 @@ void GScanO200::usbmain() // continue; // } //} + if (sw.elapsed_ms() > 10000) + { + m_pImages->setscanflags(false); + devState = haveError ? DevState::DEV_WRONG : DevState::DEV_STOP; + return; + } if (gcap.resolution_dst >= 300.0f) { @@ -565,6 +567,7 @@ void GScanO200::usbmain() #endif // LOG m_usb->set_timeout(200); Pop_Image(); + sw.reset(); break; } case STOP_SCAN: diff --git a/huagao/Device/ImageMatQueue.cpp b/huagao/Device/ImageMatQueue.cpp index cd16ff76..0e297021 100644 --- a/huagao/Device/ImageMatQueue.cpp +++ b/huagao/Device/ImageMatQueue.cpp @@ -149,7 +149,7 @@ void ImageMatQueue::setparam(const GScanCap& param) } if (param.is_autodiscradblank_normal || param.is_autodiscradblank_vince) { - m_iaList.push_back(shared_ptr(new CImageApplyDiscardBlank(param.is_autodiscradblank_normal ? true : false))); + m_iaList.push_back(shared_ptr(new CImageApplyDiscardBlank())); //m_iaList.push_back(shared_ptr(new CImageApplyDiscardBlank(param.areanum,param.devnmax))); } diff --git a/huagao/Device/PublicFunc.cpp b/huagao/Device/PublicFunc.cpp index 537dc767..1d58500c 100644 --- a/huagao/Device/PublicFunc.cpp +++ b/huagao/Device/PublicFunc.cpp @@ -435,7 +435,11 @@ CString GetHidedlgPath() { TCHAR szIniFile[MAX_PATH] = { 0 }; SHGetSpecialFolderPath(NULL, szIniFile, CSIDL_WINDOWS, TRUE); +#ifdef MAKEHUAGAO _tcscat(szIniFile, _T("\\twain_32\\HuaGoScan\\hidedlg.exe")); +#else // MAKEHUAGAO + _tcscat(szIniFile, _T("\\twain_32\\ZhibenScan\\hidedlg.exe")); +#endif int iLen = WideCharToMultiByte(CP_ACP, 0, szIniFile, -1, NULL, 0, NULL, NULL); char* chRtn = new char[iLen * sizeof(char)]; WideCharToMultiByte(CP_ACP, 0, szIniFile, -1, chRtn, iLen, NULL, NULL);