diff --git a/changelog.txt b/changelog.txt index c4c227b6..5445fdc0 100644 --- a/changelog.txt +++ b/changelog.txt @@ -84,4 +84,6 @@ 5.UI开放色偏校正,增加色偏校正协议 --23.01.05 6.除背景色二值化阈值调整为50(100-50) --23.02.21 7.添加3288 linux待纸扫描功能 --23.03.08 - 8.添加安卓设备锁定协议支持 --23.03.13 \ No newline at end of file + 8.添加安卓设备锁定协议支持 --23.03.13 + 9.适配卓育云ODM厂商 --23.04.24 + 10.对接爱云校做协议适配 --23.04.24 \ No newline at end of file diff --git a/huagao/CAboutDlg.cpp b/huagao/CAboutDlg.cpp index 44f0d28d..072bc17a 100644 --- a/huagao/CAboutDlg.cpp +++ b/huagao/CAboutDlg.cpp @@ -65,12 +65,14 @@ BOOL CAboutDlg::OnInitDialog() HBITMAP hBitmap = ::LoadBitmap(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_BITMAP5)); #elif defined CUMTENN HBITMAP hBitmap = ::LoadBitmap(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_BITMAP7)); +#elif defined ZHUOYUYUN + HBITMAP hBitmap = ::LoadBitmap(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_BITMAP8)); #else HBITMAP hBitmap = ::LoadBitmap(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_BMPABOUTDLG)); #endif pStatic->ModifyStyle(0xF, SS_BITMAP | SS_CENTERIMAGE); pStatic->SetBitmap(hBitmap); -#if defined MAKEHUAGAO || defined LANXUM || defined HANVON || defined AUGE ||defined MAKERIGHTWAY || defined CUMTENN +#if defined MAKEHUAGAO || defined LANXUM || defined HANVON || defined AUGE ||defined MAKERIGHTWAY || defined CUMTENN || defined ZHUOYUYUN GetDlgItem(IDC_PICABOUTHUAGO)->ShowWindow(TRUE); #else GetDlgItem(IDC_PICABOUTHUAGO)->ShowWindow(FALSE); diff --git a/huagao/CAdvancedDLG.cpp b/huagao/CAdvancedDLG.cpp index c94a1e28..f50bbbfe 100644 --- a/huagao/CAdvancedDLG.cpp +++ b/huagao/CAdvancedDLG.cpp @@ -42,7 +42,7 @@ BOOL CAdvancedDLG::OnInitDialog() CTabPageSSL::OnInitDialog(); m_Edit_noise.SetSlideLink(this, IDC_SLIDER_NOISE); - m_Edit_noise.SetParams(1, 20, 1); + m_Edit_noise.SetParams(2, 20, 1); m_Edit_noise.SetValue(noise); m_Edit_indent.SetSlideLink(this, IDC_SLIDER_INDENT); diff --git a/huagao/CTwainMutex.cpp b/huagao/CTwainMutex.cpp index dce9b07c..1827299a 100644 --- a/huagao/CTwainMutex.cpp +++ b/huagao/CTwainMutex.cpp @@ -116,7 +116,7 @@ BOOL CTwainMutex::CloseTwainMutex() if (!b_ret) { - MessageBox(NULL, TEXT("ͷԴʧ"), 0, MB_ICONWARNING); + MessageBox(NULL, TEXT("Դͷʧ"), 0, MB_ICONWARNING); } m_hTwainMutex=NULL; return b_ret; diff --git a/huagao/CTwainUI.cpp b/huagao/CTwainUI.cpp index eebd9c56..67bfec17 100644 --- a/huagao/CTwainUI.cpp +++ b/huagao/CTwainUI.cpp @@ -135,7 +135,7 @@ BOOL CTwainUI::OnInitDialog() else { - if (atoi(m_hardwareVersion.substr(4, 6).c_str()) >= 220401) + if (atoi(m_hardwareVersion.substr(4, 6).c_str()) >= 230130) { setvisable_size(true); } @@ -152,7 +152,7 @@ BOOL CTwainUI::OnInitDialog() ((CButton*)m_pageBasic->GetDlgItem(IDC_RDSPEEDPRIORITY))->ShowWindow(SW_SHOW); } #elif defined(G300) - if (atoi(m_hardwareVersion.substr(4, 6).c_str()) >= 221106) + if (atoi(m_hardwareVersion.substr(4, 6).c_str()) >= 230130) { ((CButton*)m_pageBasic->GetDlgItem(IDC_RDQUALITYPRIORITY))->ShowWindow(SW_SHOW); ((CButton*)m_pageBasic->GetDlgItem(IDC_RDSPEEDPRIORITY))->ShowWindow(SW_SHOW); diff --git a/huagao/Device/GScanO1003399.cpp b/huagao/Device/GScanO1003399.cpp index b6233680..25776b37 100644 --- a/huagao/Device/GScanO1003399.cpp +++ b/huagao/Device/GScanO1003399.cpp @@ -894,6 +894,8 @@ void GScanO1003399::imgproce(std::shared_ptr>& buff) _tcscat(szIniFile, _T("\\twain_32\\CumTennScan\\tessdata\\osd.traineddata")); #elif defined NOLOGO _tcscat(szIniFile, _T("\\twain_32\\Scan\\tessdata\\osd.traineddata")); +#elif defiend ZHUOYUYUN + _tcscat(szIniFile, _T("\\twain_32\\ZhuoYuYunScan\\tessdata\\osd.traineddata")); #else _tcscat(szIniFile, _T("\\twain_32\\HuaGoScan\\tessdata\\osd.traineddata")); #endif // diff --git a/huagao/Device/GScanO400.cpp b/huagao/Device/GScanO400.cpp index 2152c057..b83f74e2 100644 --- a/huagao/Device/GScanO400.cpp +++ b/huagao/Device/GScanO400.cpp @@ -414,7 +414,7 @@ void GScanO400::config_params(GScanCap& params) else params.resolution_native = 200.0f; #elif defined(G300) - if (atoi(fw.substr(4, 6).c_str()) >= 221106) + if (atoi(fw.substr(4, 6).c_str()) >= 230130) { int dpi = 1; if (params.is_high_imagequality) diff --git a/huagao/Device/ImageMatQueue.cpp b/huagao/Device/ImageMatQueue.cpp index bbd157dd..25e454d1 100644 --- a/huagao/Device/ImageMatQueue.cpp +++ b/huagao/Device/ImageMatQueue.cpp @@ -312,6 +312,8 @@ void ImageMatQueue::setparam(const GScanCap& param) _tcscat(szIniFile, _T("\\twain_32\\Scan\\tessdata\\osd.traineddata")); #elif defined CUMTENN _tcscat(szIniFile, _T("\\twain_32\\CumTennScan\\tessdata\\osd.traineddata")); +#elif defined ZHUOYUYUN + _tcscat(szIniFile, _T("\\twain_32\\ZhuoYuYunScan\\tessdata\\osd.traineddata")); #else _tcscat(szIniFile, _T("\\twain_32\\HuaGoScan\\tessdata\\osd.traineddata")); #endif // diff --git a/huagao/Device/PublicFunc.cpp b/huagao/Device/PublicFunc.cpp index fb7b5e67..dc47e912 100644 --- a/huagao/Device/PublicFunc.cpp +++ b/huagao/Device/PublicFunc.cpp @@ -473,6 +473,8 @@ CString GetHidedlgPath() _tcscat(szIniFile, _T("\\twain_32\\RIGHTWAYSCAN\\hidedlg.exe")); #elif defined NOLOGO _tcscat(szIniFile, _T("\\twain_32\\Scan\\hidedlg.exe")); +#elif defiend ZHUOYUYUN + _tcscat(szIniFile, _T("\\twain_32\\ZhuoYuYunScan\\hidedlg.exe")); #else // MAKEHUAGAO _tcscat(szIniFile, _T("\\twain_32\\ZhibenScan\\hidedlg.exe")); #endif diff --git a/huagao/Device/PublicFunc.h b/huagao/Device/PublicFunc.h index 09b06b1c..e4789515 100644 --- a/huagao/Device/PublicFunc.h +++ b/huagao/Device/PublicFunc.h @@ -107,6 +107,7 @@ const std::string ANSWERSHEETFILTER = "iAnswersheetFilter"; //twain õȲ const std::string ROLLERMSGDATE = "RollerMsgDate"; const std::string PRINTFCAPABILITY = "PrintfCapability"; +const std::string CONFIG_DOUBLEFEEDDETECTION = "Config_DoubleFeedDetection"; #pragma pack(push) #pragma pack(4) /****************** diff --git a/huagao/Device/filetools.h b/huagao/Device/filetools.h index a3f37cb7..100b206e 100644 --- a/huagao/Device/filetools.h +++ b/huagao/Device/filetools.h @@ -7,6 +7,8 @@ #include #include #include +#include +#include #include #include "PublicFunc.h" @@ -25,6 +27,17 @@ enum log_lv :int { class FileTools { public: + + + static std::string GetProcessName() + { + char Path[_MAX_PATH]{ 0 }; + char name[_MAX_PATH]{ 0 }; + ::GetModuleFileNameA(NULL, Path, _MAX_PATH); + ::_splitpath(Path, NULL, NULL, name, NULL); + return name; + } + static std::vector getFiles(std::string path) { std::vector files; @@ -235,6 +248,62 @@ public: return retval; } + static std::string to_web_utf(const std::wstring& unic) + { + std::string webu(""); + char buf[20] = { 0 }; + + for (size_t i = 0; i < unic.length(); ++i) + { + wchar_t v = unic[i]; + //if (v <= 0x7f) + // webu.append(1, (char)v); + //else + { + sprintf_s(buf, _countof(buf) - 1, "%04X", v); + webu += buf; + } + } + + return webu; + } + + static std::wstring String2Wstring(std::string wstr) + { + std::wstring res; + int len = MultiByteToWideChar(CP_ACP, 0, wstr.c_str(), wstr.size(), nullptr, 0); + if (len < 0) { + return res; + } + wchar_t* buffer = new wchar_t[len + 1]; + if (buffer == nullptr) { + return res; + } + MultiByteToWideChar(CP_ACP, 0, wstr.c_str(), wstr.size(), buffer, len); + buffer[len] = '\0'; + res.append(buffer); + delete[] buffer; + return res; + } + + + static std::string utf82str(std::string str) + { + std::string u8; + std::wstring_convert, char32_t> converter; + for (size_t i = 0; i < str.length();) + { + char32_t c = strtol(str.substr(i, 4).c_str(), nullptr, 16); + u8 += converter.to_bytes(c); + i += 4; + } + return u8; + } + + //stringתwstring + + + private: static void getFiles(std::string path, std::vector& files) { diff --git a/huagao/GscanJsonConfig.cpp b/huagao/GscanJsonConfig.cpp index 294b29da..8f8296bb 100644 --- a/huagao/GscanJsonConfig.cpp +++ b/huagao/GscanJsonConfig.cpp @@ -1257,6 +1257,24 @@ void Twain_config::GetOrSetPintfCapability(int& value,bool is_get) } } +void Twain_config::GetOrSetDoubleNames(std::vector& v, bool is_get) +{ + loadjson(GetTwainInIPath() + TCHAR2STRING(TWAIN_CONFIG_JSON)); + if (is_get) { + if (!m_json[CONFIG_DOUBLEFEEDDETECTION].is_array()) { + savejson(defaultjson(), GetTwainInIPath() + TCHAR2STRING(TWAIN_CONFIG_JSON)); + return; + } + m_json[CONFIG_DOUBLEFEEDDETECTION].get_to(v); + //for (auto& node : v) + // node = FileTools::utf82str(node); + } + else { + m_json[CONFIG_DOUBLEFEEDDETECTION] = v; + savejson(m_json, GetTwainInIPath() + TCHAR2STRING(TWAIN_CONFIG_JSON)); + } +} + void Twain_config::setrollermsgdata(int value) { loadjson(GetTwainInIPath() + TCHAR2STRING(TWAIN_CONFIG_JSON)); @@ -1315,5 +1333,7 @@ json Twain_config::defaultjson() json tmp; tmp[ROLLERMSGDATE] = 0; tmp[PRINTFCAPABILITY] = 0; + std::string str = FileTools::to_web_utf(FileTools::String2Wstring("÷ľɨ")); + tmp[CONFIG_DOUBLEFEEDDETECTION] = {str}; return tmp; } \ No newline at end of file diff --git a/huagao/GscanJsonConfig.h b/huagao/GscanJsonConfig.h index daac2c24..b23ba56f 100644 --- a/huagao/GscanJsonConfig.h +++ b/huagao/GscanJsonConfig.h @@ -108,6 +108,7 @@ public: int getrollermsgdate(); void setrollermsgdata(int value); void GetOrSetPintfCapability(int& value,bool is_get); + void GetOrSetDoubleNames(std::vector& v, bool is_get); private: std::string GetTwainInIPath(); diff --git a/huagao/ImageProcess/ImageApplyAutoCrop.cpp b/huagao/ImageProcess/ImageApplyAutoCrop.cpp index 923f9128..24500f9c 100644 --- a/huagao/ImageProcess/ImageApplyAutoCrop.cpp +++ b/huagao/ImageProcess/ImageApplyAutoCrop.cpp @@ -176,7 +176,7 @@ void autoCrop_desaskew_fillBlank(const cv::Mat& src, cv::Mat& dst, bool isAutoCr hg::threshold_Mat(resizeMat, thre, threshold); if (noise > 0) - cv::morphologyEx(thre, thre, cv::MORPH_OPEN, getStructuringElement(cv::MORPH_RECT, cv::Size(noise * FX_FY, 1)), + cv::morphologyEx(thre, thre, cv::MORPH_OPEN, getStructuringElement(cv::MORPH_RECT, cv::Size(std::ceil(noise * FX_FY), 1)), cv::Point(-1, -1), 1, cv::BORDER_CONSTANT, cv::Scalar::all(0)); std::vector hierarchy; diff --git a/huagao/huagaods.cpp b/huagao/huagaods.cpp index 163f84e4..28a8ea26 100644 --- a/huagao/huagaods.cpp +++ b/huagao/huagaods.cpp @@ -113,6 +113,8 @@ static constexpr const Identity srcIdent( "AUGE", #elif defined LANXUM "LANXUM", +#elif defiend ZHUOYUYUN + "ZHUOYUYUN", #elif defined CUMTENN "CUMTENN", #elif defined MAKERIGHTWAY @@ -129,6 +131,8 @@ static constexpr const Identity srcIdent( "G62S Series", #elif defined HANVON "HW-8000", + #elif defiend ZHUOYUYUN + "ZY-2100S", #else // ISG100 "G100 Series", #endif @@ -137,6 +141,8 @@ static constexpr const Identity srcIdent( "G73S Series", #elif defined HANVON "HW-9000", + #elif defiend ZHUOYUYUN + "ZY-2100S", #elif defined CUMTENN "CTS A3", #else // ISG100 @@ -148,6 +154,8 @@ static constexpr const Identity srcIdent( "G42S Series", #elif defined CUMTENN "CTS A4", + #elif defiend ZHUOYUYUN + "ZY-2100S", #elif defined HANVON #ifdef ANDROIDSERIAL "HW-1000", @@ -161,6 +169,8 @@ static constexpr const Identity srcIdent( #elif defined(G400) // G200 #ifdef LANXUM "G52S Series", + #elif defiend ZHUOYUYUN + "ZY-2100S", #elif defined HANVON #ifdef ANDROIDSERIAL "HW-7000", @@ -181,6 +191,8 @@ static constexpr const Identity srcIdent( "Scan G100 TWAIN" #elif defined AUGE "AUGESCAN G100 TWAIN" + #elif defiend ZHUOYUYUN + "ZHUOYUYUNSCAN G100 TWAIN" #elif defined HANVON "Hanvon HW-8000 TAWIN" #elif defined LANXUM //!LANXUM @@ -191,6 +203,8 @@ static constexpr const Identity srcIdent( #else // ISG100 #ifdef MAKEHUAGAO "HUAGOSCAN G200 TWAIN" + #elif defiend ZHUOYUYUN + "ZHUOYUYUNSCAN G200 TWAIN" #elif defined NOLOGO "Scan G200 TWAIN" #elif defined CUMTENN @@ -222,6 +236,8 @@ static constexpr const Identity srcIdent( #endif // ANDROIDSERIES #elif defined NOLOGO "Scan G300 TWAIN" +#elif defiend ZHUOYUYUN + "ZHUOYUYUNSCAN G300 TWAIN" #elif defined CUMTENN "CUMTENN CTS A4 TWAIN" #elif defined LANXUM //!LANXUM @@ -244,6 +260,8 @@ static constexpr const Identity srcIdent( #endif // ANDROIDSERIES #elif defined LANXUM //!LANXUM "LANXUMSCAN G52S TWAIN" + #elif defiend ZHUOYUYUN + "ZHUOYUYUNSCAN G400 TWAIN" #elif defined NOLOGO "Scan G400 TWAIN" #else // !MAKEHUAGAO @@ -351,6 +369,11 @@ static std::vector DeviceID{ #endif // ISG100 }; +#elif defiend ZHUOYUYUN +static std::vector DeviceID{ + {0x3072,0x2100}, +}; + #elif defined AUGE static std::vector DeviceID{ {0x3072,0x0130}, @@ -966,7 +989,7 @@ void HuagaoDs::dogear_callback(int indexpaper) onDeviceEvent(DOG_EAR); } -Result HuagaoDs::identityOpenDs(const Identity&) { +Result HuagaoDs::identityOpenDs(const Identity& origin) { #ifdef G400 hMutex = CreateMutex(NULL, FALSE, _T("LookitApp_4")); #elif defined G300 @@ -984,6 +1007,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) { return { ReturnCode::Failure, ConditionCode::CapBadOperation }; } Twain_config().GetOrSetPintfCapability(is_printfcapability, true); + auto usblist = UsbScan_List::find_all_usb(); if (!usblist.empty()) { @@ -998,7 +1022,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) { if (!scanner.get()) { #ifdef G200 if (pid == 0x139 || pid == 0x239 || pid == 0x8739 || pid == 0x8629 || pid == 0x130 ||pid == 0x8000 || pid == 0x9000 || - pid == 0x138 || pid == 0x238) + pid == 0x138 || pid == 0x238 || pid == 0x2100) scanner.reset(new GScanO1003399()); else scanner.reset(new GScanO200()); @@ -1828,7 +1852,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) { CapabilityPrintf(msg, enum2str(CapTypeEx::TwEx_CropNoise), msg == Msg::Set ? to_string((int)data.currentItem()) : ""); if (Msg::Set == msg) { auto mech = data.currentItem(); - if ((mech > 20 || mech < 0) && ((bool)m_scanparam->is_autocrop == true)) + if ((mech > 20 || mech < 1) && ((bool)m_scanparam->is_autocrop == true)) return badValue(); m_scanparam->noise = mech; return success(); @@ -2219,38 +2243,46 @@ Result HuagaoDs::identityOpenDs(const Identity&) { } return CapSupGetAllResetEx(msg, data, m_scanparam->dogeardistance, 70); }; - //˫ż ٷ׼ Э޸Ϊbool Уʹboolͣʹñ׼twainЭ m_query[CapType::DoubleFeedDetection] = msgSupportGetAllSetReset; m_caps[CapType::DoubleFeedDetection] = [this](Msg msg, Capability& data)->Result { CapabilityPrintf(msg, enum2str(CapType::DoubleFeedDetection), msg == Msg::Set ? to_string((float)data.currentItem()) : ""); - switch (msg) { - case Msg::Get: - data = Capability::createEnumeration(CapType::DoubleFeedDetection, { 0 ,1}, m_scanparam->hardwarecaps.en_doublefeed ? 0 : 1, 0); - return { ReturnCode::Success, ConditionCode::Success }; - case Msg::GetCurrent: - data = Capability::createOneValue(CapType::DoubleFeedDetection, (UInt16)m_scanparam->hardwarecaps.en_doublefeed ? 0 : 1); - return { ReturnCode::Success, ConditionCode::Success }; - case Msg::Reset: - case Msg::GetDefault: - m_scanparam->hardwarecaps.en_doublefeed = 1; - data = Capability::createOneValue(CapType::DoubleFeedDetection, 0); - return { ReturnCode::Success, ConditionCode::Success }; - case Msg::Set: { - auto mech = data.currentItem(); - m_scanparam->hardwarecaps.en_doublefeed = mech ? 0 : 1; - return success(); - } + std::vector names; + Twain_config().GetOrSetDoubleNames(names,true); + FileTools::writelog(log_INFO, " DoubleFeedDetection "+ FileTools::GetProcessName()); + if (std::find(names.begin(), names.end(), FileTools::to_web_utf(FileTools::String2Wstring(FileTools::GetProcessName()))) == names.end()) { + FileTools::writelog(log_INFO, " DoubleFeedDetection 11111 "); + switch (msg) { + case Msg::Get: + data = Capability::createEnumeration(CapType::DoubleFeedDetection, { 0 ,1 }, m_scanparam->hardwarecaps.en_doublefeed ? 0 : 1, 0); + return { ReturnCode::Success, ConditionCode::Success }; + case Msg::GetCurrent: + data = Capability::createOneValue(CapType::DoubleFeedDetection, (UInt16)m_scanparam->hardwarecaps.en_doublefeed ? 0 : 1); + return { ReturnCode::Success, ConditionCode::Success }; + case Msg::Reset: + case Msg::GetDefault: + m_scanparam->hardwarecaps.en_doublefeed = 1; + data = Capability::createOneValue(CapType::DoubleFeedDetection, 0); + return { ReturnCode::Success, ConditionCode::Success }; + case Msg::Set: { + auto mech = data.currentItem(); + m_scanparam->hardwarecaps.en_doublefeed = mech ? 0 : 1; + return success(); + } - default: - return { ReturnCode::Failure, ConditionCode::CapBadOperation }; + default: + return { ReturnCode::Failure, ConditionCode::CapBadOperation }; + } + } + else{ + FileTools::writelog(log_INFO, " DoubleFeedDetection 22222 "); + if (Msg::Set == msg) { + auto mech = data.currentItem(); + m_scanparam->hardwarecaps.en_doublefeed = mech ? 1 : 0; + return success(); + } + return CapSupGetAllResetEx(msg, data, m_scanparam->hardwarecaps.en_doublefeed, TRUE); } - //if (Msg::Set == msg) { - // auto mech = data.currentItem(); - // m_scanparam->hardwarecaps.en_doublefeed = mech ? 1 : 0; - // return success(); - //} - //return CapSupGetAllResetEx(msg, data, m_scanparam->hardwarecaps.en_doublefeed, TRUE); }; #ifdef G200 diff --git a/huagao/huagaotwds.rc b/huagao/huagaotwds.rc index c032819a..0b8300eb 100644 Binary files a/huagao/huagaotwds.rc and b/huagao/huagaotwds.rc differ diff --git a/huagao/logoZhuoYuYun.bmp b/huagao/logoZhuoYuYun.bmp new file mode 100644 index 00000000..6a7ca5e6 Binary files /dev/null and b/huagao/logoZhuoYuYun.bmp differ diff --git a/huagao/resource.h b/huagao/resource.h index 100d7e26..b3c41c13 100644 Binary files a/huagao/resource.h and b/huagao/resource.h differ diff --git a/huagao/stdafx.h b/huagao/stdafx.h index 09645252..26d8a9c5 100644 Binary files a/huagao/stdafx.h and b/huagao/stdafx.h differ