1.修复裁切算法bug(驱动中传入noise默认值不正确);

2.修复红色增强协议bug;
This commit is contained in:
lovelyyoung 2021-06-28 11:58:54 +08:00
parent 75d3cb941b
commit 9ae4e27f3e
9 changed files with 205 additions and 191 deletions

View File

@ -42,7 +42,7 @@ BOOL CAdvancedDLG::OnInitDialog()
CTabPageSSL::OnInitDialog();
m_Edit_noise.SetSlideLink(this, IDC_SLIDER_NOISE);
m_Edit_noise.SetParams(30, 50, 2);
m_Edit_noise.SetParams(5, 50, 2);
m_Edit_noise.SetValue(noise);
m_Edit_indent.SetSlideLink(this, IDC_SLIDER_INDENT);

View File

@ -39,7 +39,7 @@ CImageProcPage::CImageProcPage(CWnd* pParent /*=nullptr*/)
, m_ckbDetachNoise(FALSE)
, m_ckbHSVCorrect(FALSE)
, indent(5)
, noise(40)
, noise(8)
,threshold(40)
,is_bw(false)
{
@ -130,7 +130,7 @@ BOOL CImageProcPage::OnInitDialog()
m_edit_hole.SetValue(0.10);
m_edit_detachnoise.SetSlideLink(this, IDC_SLIDERDETACHNOISE);
m_edit_detachnoise.SetParams(10, 50, 10);
m_edit_detachnoise.SetParams(0, 50, 10);
m_edit_detachnoise.SetValue(detachnoise);
((CButton*)GetDlgItem(IDC_CHECKDETACHNOISE))->SetCheck(is_detachnoise);

View File

@ -752,11 +752,11 @@ USBCB GScanO200::Get_Scanner_Status()
if (m_usb.get() && m_usb->is_connected())
m_usb->read_bulk(&usbcb, sizeof(usbcb));
if (usbcb.u32_CMD != GET_DSP_STATUS)
{
FileTools::writelog(log_ERROR, "get dsp status usb bulk error");
return { NO_COMMAND,USB_BULK_ERROR,0 };
}
//if (usbcb.u32_CMD != GET_DSP_STATUS)
//{
// FileTools::writelog(log_ERROR, "get dsp status usb bulk error");
// return { NO_COMMAND,USB_BULK_ERROR,0 };
//}
return usbcb;
}

View File

@ -424,6 +424,10 @@ void ImageMatQueue::proc()
fwb.Close();
remove(path.c_str());
}
else
{
FileTools::writelog(log_ERROR, "error while opening filename:" + path);
}
}
else
FileTools::writelog(log_ERROR, "open file error filename:" + path);

View File

@ -69,7 +69,7 @@ GScanCap GscanJsonConfig::GetDefaultGscancapValue()
gcap.is_backrotate180 = FALSE;
gcap.AutoCrop_threshold = 40;
gcap.is_convex = TRUE;
gcap.noise = 40;
gcap.noise = 8;
gcap.indent = 5;
gcap.is_dogeardetection = FALSE;
gcap.scannum = -1;//ĬÈÏÁ¬ÐøɨÃè
@ -843,7 +843,7 @@ json GscanJsonConfig::GetDefaultJson()
"dogeardetection": false ,
"bScrewDetect": true ,
"iScrewLevel": 3 ,
"Noise": 40 ,
"Noise": 8 ,
"Indent": 5 ,
"AutoCrop_Threshold": 40 ,
"isConvex": true ,

View File

@ -37,7 +37,7 @@ public:
* noise [in]:noise宽度的背景竖条纹干扰40
* indent [in]:indent像素5
*/
CImageApplyAutoCrop(bool isCrop, bool isDesaskew, bool isFillBlank, const cv::Size& fixedSize, bool isConvex = true, bool isFillColor = false, double threshold = 40, int noise = 40, int indent = 5);
CImageApplyAutoCrop(bool isCrop, bool isDesaskew, bool isFillBlank, const cv::Size& fixedSize, bool isConvex = true, bool isFillColor = false, double threshold = 40, int noise = 8, int indent = 5);
virtual ~CImageApplyAutoCrop();

View File

@ -19,7 +19,15 @@
class CImageApplyDetachNoise : public CImageApply
{
public:
CImageApplyDetachNoise(int noise = 1);
CImageApplyDetachNoise(int
= 1);
inline int getNoise() { return m_noise; }

View File

@ -12,7 +12,7 @@
#include "resource.h"
#include "CTwainUI.h"
#include "CIndicatorDlg.h"
#include "Cmsgbox.h"
//#include "Cmsgbox.h"
#include "Device/PublicFunc.h"
#include "Device/GScanO200.h"
#include "Device/GScanO400.h"
@ -45,7 +45,7 @@ enum class CapTypeEx : unsigned short {
TwEx_Sharpen = 0x8022,
TwEx_DBAreaNum = 0x8027,
TwEx_DBDevnMax = 0x8028,
TwEx_EnFold=0x8037,
TwEx_EnFold = 0x8037,
TwEx_StableDetectEnable = 0x8090,
TwEx_UVModel = 0x8093,
TwEx_SwitchFrontBack = 0x8094,
@ -53,13 +53,13 @@ enum class CapTypeEx : unsigned short {
TwEx_DogEarDelection = 0x8096,
TwEx_FillBackgroundMode = 0x8097,
TwEx_CroporDesaskewIndent = 0x8098,
TwEx_CropNoise=0x8099,
TwEx_CroporDesaskewThreshold=0x8100,
TwEx_CropNoise = 0x8099,
TwEx_CroporDesaskewThreshold = 0x8100,
TwEx_IDetachNoise = 0x8101,
TwEx_IDetachNoiseValue = 0x8102,
TwEx_SizeDetect=0x8103,
TwEx_LowPowerMode=0x8104,
TwEx_ENCODE=0x8105,
TwEx_SizeDetect = 0x8103,
TwEx_LowPowerMode = 0x8104,
TwEx_ENCODE = 0x8105,
};
enum class PaperSizeEx : unsigned short {
@ -98,69 +98,69 @@ static constexpr const Identity srcIdent(
#endif
#ifdef G200
#ifdef ISG100
#ifdef LANXUM
"G62S Series",
#else // ISG100
"G100 Series",
#endif
#else // ISG100
#ifdef LANXUM
"G73S Series",
#else // ISG100
"G200 Series",
#endif
#endif
#ifdef ISG100
#ifdef LANXUM
"G62S Series",
#else // ISG100
"G100 Series",
#endif
#else // ISG100
#ifdef LANXUM
"G73S Series",
#else // ISG100
"G200 Series",
#endif
#endif
#elif defined(G300) // G200
#ifdef LANXUM
"G42S Series",
#else // ISG100
"G300 Series",
#endif
#ifdef LANXUM
"G42S Series",
#else // ISG100
"G300 Series",
#endif
#elif defined(G400) // G200
#ifdef LANXUM
"G52S Series",
#else // ISG100
"G400 Series",
#endif
#ifdef LANXUM
"G52S Series",
#else // ISG100
"G400 Series",
#endif
#endif
#ifdef G200
#ifdef ISG100
#ifdef MAKEHUAGAO
"HUAGOSCAN G100 TWAIN"
#elif defined LANXUM //!LANXUM
"LANXUMSCAN G62S TWAIN"
#else // !MAKEHUAGAO
"ZhibenScan G100 TWAIN"
#endif
#else // ISG100
#ifdef MAKEHUAGAO
"HUAGOSCAN G200 TWAIN"
#elif defined LANXUM //!LANXUM
"LANXUMSCAN G73S TWAIN"
#else // !MAKEHUAGAO
"ZhibenScan G200 TWAIN"
#endif
#ifdef ISG100
#ifdef MAKEHUAGAO
"HUAGOSCAN G100 TWAIN"
#elif defined LANXUM //!LANXUM
"LANXUMSCAN G62S TWAIN"
#else // !MAKEHUAGAO
"ZhibenScan G100 TWAIN"
#endif
#else // ISG100
#ifdef MAKEHUAGAO
"HUAGOSCAN G200 TWAIN"
#elif defined LANXUM //!LANXUM
"LANXUMSCAN G73S TWAIN"
#else // !MAKEHUAGAO
"ZhibenScan G200 TWAIN"
#endif
#endif
#elif defined G300 // G200
#ifdef MAKEHUAGAO
"HUAGOSCAN G300 TWAIN"
#elif defined LANXUM //!LANXUM
"LANXUMSCAN G42S TWAIN"
#else // !MAKEHUAGAO
"ZhibenScan G300 TWAIN"
#endif
#ifdef MAKEHUAGAO
"HUAGOSCAN G300 TWAIN"
#elif defined LANXUM //!LANXUM
"LANXUMSCAN G42S TWAIN"
#else // !MAKEHUAGAO
"ZhibenScan G300 TWAIN"
#endif
#elif defined(G400) // G200
#ifdef MAKEHUAGAO
"HUAGOSCAN G400 TWAIN"
#elif defined LANXUM //!LANXUM
"LANXUMSCAN G52S TWAIN"
#else // !MAKEHUAGAO
"ZhibenScan G400 TWAIN"
#endif
#ifdef MAKEHUAGAO
"HUAGOSCAN G400 TWAIN"
#elif defined LANXUM //!LANXUM
"LANXUMSCAN G52S TWAIN"
#else // !MAKEHUAGAO
"ZhibenScan G400 TWAIN"
#endif
#endif
#if defined(_MSC_VER)
@ -273,20 +273,20 @@ static std::map<WORD, WORD> DeviceID{
static void DeleteWnd(CDialog* pWnd) {
if (pWnd && pWnd->GetSafeHwnd()) {
if(pWnd->m_hWnd)
if (pWnd->m_hWnd)
DestroyWindow(pWnd->m_hWnd);
}
}
static std::unique_ptr<CTwainUI, void(*)(CDialog*)> guiTwain(nullptr, DeleteWnd);
static std::unique_ptr<Cmsgbox> msgbox;
//static std::unique_ptr<Cmsgbox> msgbox;
#if TWPP_DETAIL_OS_WIN
static std::unique_ptr<CDialog, void(*)(CDialog*)> guiBridge(nullptr, DeleteWnd);
#endif
//static std::unique_ptr<CIndicatorDlg, void(*)(CDialog*)> guiIndicator(nullptr, DeleteWnd);
static CIndicatorDlg* guiIndicator =NULL;
static CIndicatorDlg* guiIndicator = NULL;
//#define HG_VIRTUAL
#ifndef HG_VIRTUAL
static std::unique_ptr<IScanner> scanner; //(new GScanO200());
@ -302,7 +302,7 @@ static std::unique_ptr<IScanner> scanner(new GScanVirtual());
static std::once_flag oc;
HuagaoDs::HuagaoDs()
: m_scanparam(new GScanCap)
,bmpData(new std::vector<unsigned char>)
, bmpData(new std::vector<unsigned char>)
, hMutex(NULL)
{
std::call_once(oc, [&]() { log4cplus::Initializer(); });
@ -345,7 +345,7 @@ void HuagaoDs::showmsg(std::string caption, std::string text, int retcode)
if ((retcode == 64 || retcode == 8 || retcode == 16) && losemun > 0)
losemun--;
if (!(m_scanparam->is_autodiscradblank_normal || m_scanparam->is_autodiscradblank_vince))
{
{
if (m_scanparam->is_duplex && m_scanparam->en_fold && m_scanparam->multi_output_red)
num = scanner->get_aquire_image_count() * 2 - scanner->get_updata_image_count();
else if (m_scanparam->is_duplex && m_scanparam->en_fold)
@ -360,23 +360,23 @@ void HuagaoDs::showmsg(std::string caption, std::string text, int retcode)
num = scanner->get_aquire_image_count() * 2 - scanner->get_updata_image_count();
}
if ((losemun != 0) || (num != 0)) {
text += "进纸"+to_string(scanner->get_lose_image_num()+scanner->get_aquire_image_count())+
",扫描"+to_string(scanner->get_aquire_image_count()) +",上传"+to_string(scanner->get_updata_image_count())+
",扫描相差"+to_string(losemun) + "份文件,上传相差"+to_string(num)+"份文件!";
text += "进纸" + to_string(scanner->get_lose_image_num() + scanner->get_aquire_image_count()) +
",扫描" + to_string(scanner->get_aquire_image_count()) + ",上传" + to_string(scanner->get_updata_image_count()) +
",扫描相差" + to_string(losemun) + "份文件,上传相差" + to_string(num) + "份文件!";
scanner->set_lose_image_num(0);
}
}
ShellExecute(NULL, TEXT("open"), GetHidedlgPath(), CString((text+" "+caption).c_str()), NULL, SW_HIDE);
ShellExecute(NULL, TEXT("open"), GetHidedlgPath(), CString((text + " " + caption).c_str()), NULL, SW_HIDE);
}
HuagaoDs::~HuagaoDs()
{
if (memoryinfo.get()){
if (memoryinfo.get()) {
m_memoryfalg = false;
if (memoryinfo->joinable())
memoryinfo->join();
}
if(scanner.get())
if (scanner.get())
scanner.reset();
}
@ -392,7 +392,7 @@ Result HuagaoDs::call(const Identity& origin, DataGroup dg, Dat dat, Msg msg, vo
return Base::call(origin, dg, dat, msg, data);
}
catch (const CapabilityException& e) {
FileTools::writelog(log_ERROR,e.what());
FileTools::writelog(log_ERROR, e.what());
return badValue();
}
}
@ -582,8 +582,8 @@ Result CapSupGetAll(Msg msg, Capability& data, std::initializer_list<T> values,
case Msg::Get:
data = Capability::createEnumeration<cap>((T2)values, currindex, defaultindex);
return { ReturnCode::Success, ConditionCode::Success };
case Msg::GetCurrent:
case Msg::GetDefault:
case Msg::GetCurrent:
case Msg::GetDefault:
data = Capability::createOneValue(values[defaultindex]);
return { ReturnCode::Success, ConditionCode::Success };
default:
@ -632,7 +632,7 @@ Result CapSupGetAllReset(Msg msg, Capability& data, std::initializer_list<T2> va
return { ReturnCode::Failure, ConditionCode::CapBadOperation };
}
}
template<typename T1,typename T2 ,Twpp::CapType cap>
template<typename T1, typename T2, Twpp::CapType cap>
Result CapSupGetAllReset(Msg msg, Capability& data, T1& currvalue, T2 defaultvalue) {
switch (msg) {
case Msg::Get:
@ -655,12 +655,12 @@ Result CapSupGetAllResetEx(Msg msg, Capability& data, std::initializer_list<T2>
data = Capability::createEnumeration<T2>(cap, values, currindex, defaultindex);
return { ReturnCode::Success, ConditionCode::Success };
case Msg::GetCurrent:
data = Capability::createOneValue<T2>(cap,(T2)currvalue);
data = Capability::createOneValue<T2>(cap, (T2)currvalue);
return { ReturnCode::Success, ConditionCode::Success };
case Msg::Reset:
case Msg::GetDefault:
currvalue = (T1)defaultvalue;
data = Capability::createOneValue<T2>(cap,defaultvalue);
data = Capability::createOneValue<T2>(cap, defaultvalue);
return { ReturnCode::Success, ConditionCode::Success };
default:
return { ReturnCode::Failure, ConditionCode::CapBadOperation };
@ -671,12 +671,12 @@ Result CapSupGetAllResetEx(Msg msg, Capability& data, T1& currvalue, T2 defaultv
switch (msg) {
case Msg::Get:
case Msg::GetCurrent:
data = Capability::createOneValue<T2>(cap,(T2)currvalue);
data = Capability::createOneValue<T2>(cap, (T2)currvalue);
return { ReturnCode::Success, ConditionCode::Success };
case Msg::Reset:
case Msg::GetDefault:
currvalue = (T1)defaultvalue;
data = Capability::createOneValue<T2>(cap,defaultvalue);
data = Capability::createOneValue<T2>(cap, defaultvalue);
return { ReturnCode::Success, ConditionCode::Success };
default:
return { ReturnCode::Failure, ConditionCode::CapBadOperation };
@ -714,7 +714,7 @@ Result HuagaoDs::eventProcess(const Identity&, Event& event) {
//if (inState(DsState::XferReady))
// event.setMessage(Msg::XferReady);
//else
event.setMessage(Msg::Null);
event.setMessage(Msg::Null);
return { ReturnCode::NotDsEvent, ConditionCode::Success };
}
@ -762,7 +762,7 @@ void HuagaoDs::dogear_callback(int indexpaper)
CString text;
text.Format(_T("74 %d"), indexpaper);
//ShellExecute(NULL, TEXT("open"), GetHidedlgPath(), text, NULL, SW_HIDE);
showmsg("警告",""+to_string(indexpaper)+"检测到折角!");
showmsg("警告", "" + to_string(indexpaper) + "检测到折角!");
scanner->Stop_scan();
//scanner->reset();
scanner->ResetScanner();
@ -779,7 +779,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
showmsg("警告", msgs[(UsbSupported)202]);
return { ReturnCode::Failure, ConditionCode::CapBadOperation };
}
auto usblist= UsbScan_List::find_all_usb();
auto usblist = UsbScan_List::find_all_usb();
if (!usblist.empty())
{
for each (auto & usb in usblist)
@ -799,7 +799,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
}
}
}
FileTools::writelog(log_INFO, "open ds find device vid="+to_string(vid)+"\tpid="+to_string(pid));
FileTools::writelog(log_INFO, "open ds find device vid=" + to_string(vid) + "\tpid=" + to_string(pid));
m_haveError = false;
updataGscanCap();
bmpData->resize(sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER));
@ -842,7 +842,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
// caps -> has handler for each specific cap
m_query[CapType::SupportedCaps] = msgSupportGetAll;
m_caps[CapType::SupportedCaps] = [this](Msg msg, Capability& data) {
if ((msg == Msg::Get) || (Msg::GetCurrent == msg) || (Msg::GetDefault == msg)){
if ((msg == Msg::Get) || (Msg::GetCurrent == msg) || (Msg::GetDefault == msg)) {
data = Capability::createArray<CapType::SupportedCaps>(m_caps.size());
auto arr = data.array<CapType::SupportedCaps>();
UInt32 i = 0;
@ -878,7 +878,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_caps[CapType::XferCount] = [this](Msg msg, Capability& data) -> Result {
if (msg == Msg::Set) {
auto item = data.currentItem<Int16>();
if (item > 65535 || item < -1||item == 0) {
if (item > 65535 || item < -1 || item == 0) {
return badValue();
}
m_scanparam->scannum = item;
@ -903,7 +903,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_compression = mech;
return success();
}
else
else
return badValue();
}
return CapSupGetAllReset<Compression, Compression, CapType::ICompression>(msg, data, { Compression::None, Compression::Group4 }, m_compression, Compression::None, m_compression == Compression::None ? 0 : 1, 0);
@ -911,12 +911,12 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_query[CapType::IBitDepth] = msgSupportGetAllSetReset;
m_caps[CapType::IBitDepth] = [this](Msg msg, Capability& data) -> Result {
if( Msg::Set==msg) {
if (Msg::Set == msg) {
auto mech = data.currentItem<CapType::IBitDepth>();
if (((mech == 1) && (m_scanparam->pixtype == 0))|| ((mech == 8) && (m_scanparam->pixtype == 1)) || ((mech == 24) && (m_scanparam->pixtype == 2))) {
if (((mech == 1) && (m_scanparam->pixtype == 0)) || ((mech == 8) && (m_scanparam->pixtype == 1)) || ((mech == 24) && (m_scanparam->pixtype == 2))) {
m_iBitdepth = (UINT16)mech;
return success();
}
}
return badValue();
}
return CapSupGetAllReset<UINT16, UINT16, CapType::IBitDepth>(msg, data, m_iBitdepth, 24);
@ -939,43 +939,43 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_query[CapType::IPixelType] = msgSupportGetAllSetReset;
m_caps[CapType::IPixelType] = [this](Msg msg, Capability& data) -> Result {
if( Msg::Set==msg) {
auto mech = data.currentItem<CapType::IPixelType>();
if (mech == PixelType::Rgb || mech == PixelType::Gray || mech == PixelType::BlackWhite)
{
m_scanparam->pixtype = (int)mech;
if (m_scanparam->pixtype == (int)PixelType::Rgb){
m_scanparam->filter = (BYTE)Filter::None;
m_scanparam->enhance_color = (BYTE)Enchace_Color::Enhance_None;
m_scanparam->automaticcolor = FALSE;
}
else{
m_scanparam->multi_output_red = 0;//非彩色模式下多流输出不可用
//if (m_scanparam->pixtype == (int)PixelType::BlackWhite)
// m_scanparam->sharpen = SharpenBlur::Sharpen_None;
if (m_scanparam->pixtype == (int)PixelType::BlackWhite)
{
if (m_scanparam->filter == 3 && m_scanparam->enhance_color == 0)
if (Msg::Set == msg) {
auto mech = data.currentItem<CapType::IPixelType>();
if (mech == PixelType::Rgb || mech == PixelType::Gray || mech == PixelType::BlackWhite)
{
m_scanparam->pixtype = (int)mech;
if (m_scanparam->pixtype == (int)PixelType::Rgb) {
m_scanparam->filter = (BYTE)Filter::None;
m_scanparam->enhance_color = (BYTE)Enchace_Color::Enhance_None;
m_scanparam->automaticcolor = FALSE;
}
else {
m_scanparam->multi_output_red = 0;//非彩色模式下多流输出不可用
//if (m_scanparam->pixtype == (int)PixelType::BlackWhite)
// m_scanparam->sharpen = SharpenBlur::Sharpen_None;
if (m_scanparam->pixtype == (int)PixelType::BlackWhite)
{
m_scanparam->filter = (BYTE)Filter::None;
m_scanparam->enhance_color = (BYTE)Enchace_Color::Enhance_Red;
if (m_scanparam->filter == 3 && m_scanparam->enhance_color == 0)
{
m_scanparam->filter = (BYTE)Filter::None;
m_scanparam->enhance_color = (BYTE)Enchace_Color::Enhance_Red;
}
}
}
m_iBitdepth = mech == PixelType::Rgb ? 24 : (mech == PixelType::Gray ? 8 : 1);
return success();
}
m_iBitdepth = mech == PixelType::Rgb ? 24 : (mech == PixelType::Gray ? 8 : 1);
return success();
return badValue();
}
return badValue();
}
return CapSupGetAllReset<int, PixelType, CapType::IPixelType>(msg, data, { PixelType::BlackWhite,PixelType::Gray,PixelType::Rgb }, m_scanparam->pixtype, PixelType::Rgb,
m_scanparam->pixtype == (int)PixelType::Rgb ? 2 : (m_scanparam->pixtype == (int)PixelType::Gray ? 1 : 0), 2);
return CapSupGetAllReset<int, PixelType, CapType::IPixelType>(msg, data, { PixelType::BlackWhite,PixelType::Gray,PixelType::Rgb }, m_scanparam->pixtype, PixelType::Rgb,
m_scanparam->pixtype == (int)PixelType::Rgb ? 2 : (m_scanparam->pixtype == (int)PixelType::Gray ? 1 : 0), 2);
};
m_query[CapType::IAutomaticColorEnabled] = msgSupportGetAllSetReset;
m_caps[CapType::IAutomaticColorEnabled] = [this](Msg msg, Capability& data)->Result {
if (Msg::Set == msg) {
auto mech = data.currentItem<CapType::IAutomaticColorEnabled>();
if (mech){
if (mech) {
m_scanparam->automaticcolor = TRUE;
m_scanparam->filter = (BYTE)Filter::None;
m_scanparam->enhance_color = (BYTE)Enchace_Color::Enhance_None;
@ -993,12 +993,12 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_caps[CapType::IAutomaticColorNonColorPixelType] = [this](Msg msg, Capability& data)->Result {
if (msg == Msg::Set) {
auto mech = data.currentItem<CapType::IAutomaticColorNonColorPixelType>();
if (m_scanparam->automaticcolor == TRUE){
if ((UInt16)mech == 0 || (UInt16)mech == 1){
if (m_scanparam->automaticcolor == TRUE) {
if ((UInt16)mech == 0 || (UInt16)mech == 1) {
m_scanparam->automaticcolortype = (UInt16)mech;
return success();
}
}
}
return seqError();
}
return CapSupGetAllReset<int, PixelType, CapType::IAutomaticColorNonColorPixelType>(msg, data, { PixelType::BlackWhite, PixelType::Gray }, m_scanparam->automaticcolortype, PixelType::Gray, m_scanparam->automaticcolortype, 1);
@ -1072,23 +1072,23 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_query[CapType::ISupportedSizes] = msgSupportGetAllSetReset;
m_caps[CapType::ISupportedSizes] = [this](Msg msg, Capability& data) {
if (Msg::Set == msg) {
if(m_scanparam->is_autocrop)
if (m_scanparam->is_autocrop)
return success();
auto paper = data.currentItem<UInt16>();
if (std::distance(paperSizeList.begin(), std::find(paperSizeList.begin(), paperSizeList.end(), paper)) == paperSizeList.size())
return badValue();
else {
m_scanparam->papertype = (BYTE)paper;
if (paper == (BYTE)PaperSize::None || paper == (BYTE)PaperSize::UsStatement){
if (paper == (BYTE)PaperSize::None || paper == (BYTE)PaperSize::UsStatement) {
m_scanparam->paperAlign = PaperAlign::Rot0;
m_scanparam->en_sizecheck = 0;
}
if (paper == (BYTE)PaperSize::UsStatement){
if (paper == (BYTE)PaperSize::UsStatement) {
m_autosize = (UInt16)AutoSize::None;
m_autoboarderdetcet = false;
m_scanparam->is_autocrop = 0;
}
else{
else {
m_autosize = (paper == (BYTE)PaperSize::None) ? (UInt16)AutoSize::Auto : (UInt16)AutoSize::None;
m_autoboarderdetcet = paper == (BYTE)PaperSize::None;
m_scanparam->is_autocrop = paper == (BYTE)PaperSize::None ? 1 : 0;
@ -1108,9 +1108,9 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
(PaperSize)PaperSizeEx::K8,(PaperSize)PaperSizeEx::K16,(PaperSize)PaperSizeEx::Trigeminy
#endif
#endif //
},m_scanparam->papertype, PaperSize::None,
}, m_scanparam->papertype, PaperSize::None,
std::distance(paperSizeList.begin(), std::find(paperSizeList.begin(), paperSizeList.end(), m_scanparam->papertype)) == paperSizeList.size() ? 0 : std::distance(paperSizeList.begin(),
std::find(paperSizeList.begin(), paperSizeList.end(), m_scanparam->papertype)),
std::find(paperSizeList.begin(), paperSizeList.end(), m_scanparam->papertype)),
std::distance(paperSizeList.begin(), std::find(paperSizeList.begin(), paperSizeList.end(), 0)));
};
@ -1118,19 +1118,19 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
#ifndef ISG100
m_query[(CapType)(CapTypeEx::TwEx_SizeDetect)] = msgSupportGetAllSetReset;
m_caps[(CapType)(CapTypeEx::TwEx_SizeDetect)] = [this](Msg msg, Capability& data)->Result {
if( Msg::Set == msg) {
if (Msg::Set == msg) {
auto mech = data.currentItem<Bool>();
m_scanparam->en_sizecheck = mech;
return success();
}
return CapSupGetAllResetEx<BYTE, Bool, CapType(CapTypeEx::TwEx_SizeDetect)>(msg, data, { FALSE,TRUE }, m_scanparam->en_sizecheck, false, m_scanparam->en_sizecheck, 0);
return CapSupGetAllResetEx<BYTE, Bool, CapType(CapTypeEx::TwEx_SizeDetect)>(msg, data, { FALSE,TRUE }, m_scanparam->en_sizecheck, false, m_scanparam->en_sizecheck, 0);
};
#endif // !ISG100
#endif // G200
m_query[CapType::IOrientation] = msgSupportGetAllSetReset;
m_caps[CapType::IOrientation] = [this](Msg msg, Capability& data) -> Result {
if( Msg::Set == msg) {
if (Msg::Set == msg) {
auto mech = data.currentItem<CapType::IOrientation>();
if (mech == Orientation::Landscape || mech == Orientation::Portrait) {
m_scanparam->paperAlign = (PaperAlign)mech;
@ -1143,11 +1143,11 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_query[CapType::IRotation] = msgSupportGetAllSetReset;
m_caps[CapType::IRotation] = [this](Msg msg, Capability& data) -> Result {
if( Msg::Set == msg){
if (Msg::Set == msg) {
auto res = data.currentItem<Fix32>();
if (std::distance(imageRotateList.begin(), std::find(imageRotateList.begin(), imageRotateList.end(), res)) == imageRotateList.size())
return badValue();
else{
else {
m_scanparam->imageRotateDegree = (float)res;
if (res != 0.0f)
m_scanparam->is_autotext = 0;
@ -1155,7 +1155,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
}
}
return CapSupGetAllReset<float, Fix32, CapType::IRotation>(msg, data, { Fix32(0.0f),Fix32(90.0f),Fix32(180.0f),Fix32(270.0f) }, m_scanparam->imageRotateDegree, Fix32(0.0),
std::distance(imageRotateList.begin(), std::find(imageRotateList.begin(), imageRotateList.end(), m_scanparam->imageRotateDegree)),0);
std::distance(imageRotateList.begin(), std::find(imageRotateList.begin(), imageRotateList.end(), m_scanparam->imageRotateDegree)), 0);
};
#ifndef G200
@ -1184,7 +1184,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
//m_caps[(CapType)(CapTypeEx::TwEx_HardwareVersion)] = std::bind(oneValGetString, _1, _2, scanner->GetFWVersion());
m_caps[(CapType)(CapTypeEx::TwEx_ENCODE)] = [this](Msg msg, Capability& data)->Result {
Str255 str;
str.setData(scanner->get_scannercode().c_str(),32);
str.setData(scanner->get_scannercode().c_str(), 32);
return CapSupGetAllEx<Str255, (CapType)CapTypeEx::TwEx_ENCODE>(msg, data, str, str);
};
#endif
@ -1195,7 +1195,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_query[CapType::Indicators] = msgSupportGetAllSetReset;
m_caps[CapType::Indicators] = [this](Msg msg, Capability& data) -> Result {
if (Msg::Set == msg){
if (Msg::Set == msg) {
auto show = data.currentItem<CapType::Indicators>();
m_bIndicator = show;
return success();
@ -1252,7 +1252,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
};
m_query[CapType::IImageFileFormat] = msgSupportGetAllSetReset;
m_caps[CapType::IImageFileFormat] = [this](Msg msg, Capability& data) -> Result {
if (Msg::Set == msg){
if (Msg::Set == msg) {
auto mech = data.currentItem<CapType::IImageFileFormat>();
if (mech == ImageFileFormat::Bmp ||
mech == ImageFileFormat::Tiff ||
@ -1263,8 +1263,8 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
else
return badValue();
}
return CapSupGetAllReset < ImageFileFormat, ImageFileFormat , CapType::IImageFileFormat> (msg, data, { ImageFileFormat::Bmp, ImageFileFormat::Tiff,ImageFileFormat::Jfif },
m_capImageFileFormat, ImageFileFormat::Bmp,m_capImageFileFormat == ImageFileFormat::Bmp ? 0 : (m_capImageFileFormat == ImageFileFormat::Tiff ? 1 : 2), 0);
return CapSupGetAllReset < ImageFileFormat, ImageFileFormat, CapType::IImageFileFormat>(msg, data, { ImageFileFormat::Bmp, ImageFileFormat::Tiff,ImageFileFormat::Jfif },
m_capImageFileFormat, ImageFileFormat::Bmp, m_capImageFileFormat == ImageFileFormat::Bmp ? 0 : (m_capImageFileFormat == ImageFileFormat::Tiff ? 1 : 2), 0);
};
//custom define
@ -1275,7 +1275,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_scanparam->autodescrew = (bool)atuodsw;
return success();
}
return CapSupGetAllReset<BYTE, bool, CapType::IAutomaticDeskew>(msg,data, m_scanparam->autodescrew,true);
return CapSupGetAllReset<BYTE, bool, CapType::IAutomaticDeskew>(msg, data, m_scanparam->autodescrew, true);
};
m_query[(CapType)(CapTypeEx::TwEx_SwitchFrontBack)] = msgSupportGetAllSetReset;
@ -1320,19 +1320,19 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_caps[CapType::IAutoSize] = [this](Msg msg, Capability& data)->Result {
if (Msg::Set == msg) {
auto autosize = data.currentItem<CapType::IAutoSize>();
if (autosize == AutoSize::Auto){
if(m_scanparam->papertype==(BYTE)PaperSize::UsStatement){
if (autosize == AutoSize::Auto) {
if (m_scanparam->papertype == (BYTE)PaperSize::UsStatement) {
m_scanparam->is_autocrop = 0;
m_autoboarderdetcet = false;
}
else{
else {
m_scanparam->is_autocrop = 1;
m_scanparam->papertype = (BYTE)Twpp::PaperSize::None;
m_scanparam->paperAlign = PaperAlign::Rot0;
m_autoboarderdetcet = true;
}
}
else{
else {
m_autoboarderdetcet = false;
m_scanparam->is_autocrop = 0;
}
@ -1346,15 +1346,15 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_caps[CapType::IAutomaticBorderDetection] = [this](Msg msg, Capability& data)->Result {
if (Msg::Set == msg) {
auto autodetectborder = data.currentItem<CapType::IAutomaticBorderDetection>();
if (autodetectborder){
if(m_scanparam->papertype!=(BYTE)PaperSize::UsStatement){
if (autodetectborder) {
if (m_scanparam->papertype != (BYTE)PaperSize::UsStatement) {
m_scanparam->is_autocrop = true;
m_scanparam->papertype = (BYTE)Twpp::PaperSize::None;
m_scanparam->paperAlign = PaperAlign::Rot0;
m_autosize = (UInt16)AutoSize::Auto;
}
}
else{
else {
m_autosize = (UInt16)AutoSize::None;
}
m_autoboarderdetcet = autodetectborder;
@ -1383,18 +1383,18 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
if (Msg::Set == msg) {
auto autocrop = data.currentItem<Int32>();
m_scanparam->en_fold = (Int32)autocrop;
if ((UInt16)autocrop != 0){
if ((UInt16)autocrop != 0) {
m_scanparam->is_duplex = 1;
m_scanparam->autodescrew = 1;//合并可用时 默认自动纠偏
m_scanparam->is_autodiscradblank_normal = m_scanparam->is_autodiscradblank_vince = 0;
}
return success();
}
return CapSupGetAllResetEx<BYTE, Int32, (CapType)CapTypeEx::TwEx_EnFold>(msg, data, { 0,1 }, m_scanparam->en_fold, 0,m_scanparam->en_fold ? 1 : 0, 0);
return CapSupGetAllResetEx<BYTE, Int32, (CapType)CapTypeEx::TwEx_EnFold>(msg, data, { 0,1 }, m_scanparam->en_fold, 0, m_scanparam->en_fold ? 1 : 0, 0);
};
m_query[CapType::IAutoDiscardBlankPages] = msgSupportGetAllSetReset;
m_caps[CapType::IAutoDiscardBlankPages] = [this](Msg msg, Capability& data)->Result {
m_caps[CapType::IAutoDiscardBlankPages] = [this](Msg msg, Capability& data)->Result {
if (Msg::Set == msg) {
auto mech = data.currentItem<CapType::IAutoDiscardBlankPages>();
if ((mech != DiscardBlankPages::Auto) || (mech != DiscardBlankPages::Disabled))
@ -1459,17 +1459,17 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_query[(CapType)(CapTypeEx::TwEx_CroporDesaskewIndent)] = msgSupportGetAllSetReset;
m_caps[(CapType)(CapTypeEx::TwEx_CroporDesaskewIndent)] = [this](Msg msg, Capability& data)->Result {
if (Msg::Set == msg) {
auto mech = data.currentItem<UInt8>();
auto mech = data.currentItem<UInt8>();
if ((mech > 30 || mech < 5) && ((bool)m_scanparam->is_autocrop == true))
return badValue();
m_scanparam->indent = mech;
m_scanparam->indent = mech;
return success();
}
return CapSupGetAllResetEx<int, UInt8, (CapType)CapTypeEx::TwEx_CroporDesaskewIndent>(msg, data, m_scanparam->indent, 5);
};
//自动裁剪降噪像素
m_query[(CapType)(CapTypeEx::TwEx_CropNoise)] = msgSupportGetAllSetReset;
m_caps[(CapType)(CapTypeEx::TwEx_CropNoise)] = [this](Msg msg, Capability& data)->Result {
m_caps[(CapType)(CapTypeEx::TwEx_CropNoise)] = [this](Msg msg, Capability& data)->Result {
if (Msg::Set == msg) {
auto mech = data.currentItem<UInt8>();
if ((mech > 50 || mech < 30) && ((bool)m_scanparam->is_autocrop == true))
@ -1477,7 +1477,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_scanparam->noise = mech;
return success();
}
return CapSupGetAllResetEx<int, UInt8, (CapType)CapTypeEx::TwEx_CropNoise>(msg, data, m_scanparam->noise, 40);
return CapSupGetAllResetEx<int, UInt8, (CapType)CapTypeEx::TwEx_CropNoise>(msg, data, m_scanparam->noise, 8);
};
//自动裁切和纠偏的二值化阀值
m_query[(CapType)(CapTypeEx::TwEx_CroporDesaskewThreshold)] = msgSupportGetAllSetReset;
@ -1580,7 +1580,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
auto mech = data.currentItem<CapType::IFilter>();
if (mech == Filter::None || mech == Filter::Red || mech == Filter::Green || mech == Filter::Blue) {
m_scanparam->filter = (BYTE)mech;
if (mech != Filter::None){
if (mech != Filter::None) {
m_scanparam->enhance_color = (BYTE)Enchace_Color::Enhance_None;
}
return success();
@ -1595,28 +1595,30 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_caps[(CapType)(CapTypeEx::TwEx_IEnhanceColor)] = [this](Msg msg, Capability& data)->Result {
if (Msg::Set == msg) {
auto mech = data.currentItem<Int16>();
if (m_scanparam->pixtype == (BYTE)PixelType::Rgb){
if (m_scanparam->pixtype == (int)PixelType::Rgb)
{
m_scanparam->enhance_color = (BYTE)Enchace_Color::Enhance_None;
m_scanparam->filter = (BYTE)Filter::None;
return badValue();
}
else{
else
{
if (mech == Enchace_Color::Enhance_None || mech == Enchace_Color::Enhance_Red || mech == Enchace_Color::Enhance_Green || mech == Enchace_Color::Enhance_Blue)
{
m_scanparam->enhance_color = (BYTE)mech;
if (mech != (BYTE)Enchace_Color::Enhance_None)
m_scanparam->filter = (BYTE)Filter::None;
if (m_scanparam->pixtype == (int)PixelType::BlackWhite)
if (m_scanparam->pixtype == (int)PixelType::BlackWhite)//黑白默认开启红色增强 其他增强不生效
{
if (m_scanparam->filter == (BYTE)Filter::None && m_scanparam->enhance_color == (BYTE)Enchace_Color::Enhance_None)
if (m_scanparam->enhance_color == (BYTE)Enchace_Color::Enhance_None)
{
m_scanparam->filter = (BYTE)Filter::None;
m_scanparam->enhance_color = (BYTE)Enchace_Color::Enhance_Red;
}
}
return success();
}
}
return badValue();
}
return CapSupGetAllResetEx<BYTE, Enchace_Color, (CapType)CapTypeEx::TwEx_IEnhanceColor>(msg, data, { Enchace_Color::Enhance_None,Enchace_Color::Enhance_Red,Enchace_Color::Enhance_Green,Enchace_Color::Enhance_Blue }, m_scanparam->enhance_color, Enchace_Color::Enhance_None, m_scanparam->enhance_color, 0);
};
@ -1768,7 +1770,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
//};
/*以下为硬件协议*/
m_query[(CapType)(CapTypeEx::TwEx_ScrewDetectEnable)] = msgSupportGetAllSetReset;
m_caps[(CapType)(CapTypeEx::TwEx_ScrewDetectEnable)] = [this](Msg msg, Capability& data)->Result {
m_caps[(CapType)(CapTypeEx::TwEx_ScrewDetectEnable)] = [this](Msg msg, Capability& data)->Result {
if (Msg::Set == msg) {
auto mech = data.currentItem<Bool>();
m_scanparam->hardwarecaps.en_skrewdetect = mech;
@ -1804,7 +1806,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_caps[(CapType)(CapTypeEx::TwEx_DogEarDelection)] = [this](Msg msg, Capability& data)->Result {
if (Msg::Set == msg) {
auto mech = data.currentItem<Bool>();
m_scanparam->is_dogeardetection= mech;
m_scanparam->is_dogeardetection = mech;
return success();
}
return CapSupGetAllResetEx<BYTE, Bool, (CapType)CapTypeEx::TwEx_DogEarDelection>(msg, data, m_scanparam->is_dogeardetection, FALSE);
@ -1821,7 +1823,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
return { ReturnCode::Success, ConditionCode::Success };
case Msg::Reset:
case Msg::GetDefault:
m_scanparam->hardwarecaps.en_doublefeed = 1;
m_scanparam->hardwarecaps.en_doublefeed = 1;
data = Capability::createOneValue<UInt16>(CapType::DoubleFeedDetection, 0);
return { ReturnCode::Success, ConditionCode::Success };
case Msg::Set: {
@ -1839,7 +1841,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
return success();
}
return CapSupGetAllResetEx<BYTE, UInt16, CapType::DoubleFeedDetection>(msg, data, m_scanparam->hardwarecaps.en_doublefeed, TRUE);*/
};
};
#ifdef G200
//低功耗模式
@ -1850,9 +1852,9 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_scanparam->hardwarecaps.lowpowermode = (LowPowerMode)mech;
return success();
}
return CapSupGetAllResetEx<LowPowerMode, BYTE, (CapType)CapTypeEx::TwEx_LowPowerMode>(msg, data,
return CapSupGetAllResetEx<LowPowerMode, BYTE, (CapType)CapTypeEx::TwEx_LowPowerMode>(msg, data,
{ LowPowerMode::Min_None,LowPowerMode::Min_5,LowPowerMode::Min_10,LowPowerMode::Min_20, LowPowerMode::Min_30, LowPowerMode::Min_60, LowPowerMode::Min_120, LowPowerMode::Min_240 },
m_scanparam->hardwarecaps.lowpowermode, LowPowerMode::Min_30,(BYTE)m_scanparam->hardwarecaps.lowpowermode, 4);
m_scanparam->hardwarecaps.lowpowermode, LowPowerMode::Min_30, (BYTE)m_scanparam->hardwarecaps.lowpowermode, 4);
};
#endif // LANXUM
return success();
@ -1900,7 +1902,7 @@ Result HuagaoDs::pendingXfersEnd(const Identity&, PendingXfers& data) {
if (guiIndicator->GetSafeHwnd())
guiIndicator->ShowWindow(SW_HIDE);
if (ret != -1) {
showmsg("警告", msgs[(UsbSupported)ret],ret);
showmsg("警告", msgs[(UsbSupported)ret], ret);
FileTools::writelog(log_ERROR, msgs[(UsbSupported)ret]);
#ifndef G200
scanner->clear_hwerror();
@ -1968,11 +1970,11 @@ Result HuagaoDs::setupMemXferGet(const Identity&, SetupMemXfer& data) {
}
Result HuagaoDs::userInterfaceDisable(const Identity&, UserInterface& ui) {
if(guiTwain.get())
if (guiTwain.get())
guiTwain.reset();
#if TWPP_DETAIL_OS_WIN
if(guiBridge.get())
if (guiBridge.get())
guiBridge.reset();
#endif
@ -1993,7 +1995,7 @@ Result HuagaoDs::userInterfaceEnable(const Identity&, UserInterface& ui) {
if (MessageBox(NULL, L"检测到无纸,请添加纸张", L"提示", MB_YESNO | MB_SYSTEMMODAL) == IDNO)
return seqError();
}
//#endif // !G200
//#endif // !G200
auto ret = startScan();
@ -2001,10 +2003,10 @@ Result HuagaoDs::userInterfaceEnable(const Identity&, UserInterface& ui) {
// return ret;
if (ret == success()) {
m_pendingXfers = 1;
}
}
else {
m_pendingXfers = 0;
return seqError();
m_pendingXfers = 0;
return seqError();
}
return success();
}
@ -2018,7 +2020,7 @@ Result HuagaoDs::userInterfaceEnableUiOnly(const Identity&, UserInterface& ui) {
Result HuagaoDs::imageInfoGet(const Identity&, ImageInfo& data) {
// our image does not change
if (m_pendingXfers == 0|| bmpData->size()==0)
if (m_pendingXfers == 0 || bmpData->size() == 0)
return success();
auto dib = header();
data.setBitsPerPixel(static_cast<Int16>(dib->biBitCount));
@ -2102,14 +2104,14 @@ Result HuagaoDs::imageMemXferGet(const Identity& origin, ImageMemXfer& data) {
if (m_compression == Compression::Group4)
{
mat = cv::imdecode(*bmpData.get(), cv::IMREAD_GRAYSCALE);
G4Tiff gt(mat,G4Tiff::Mode::MemoryMode,"",120,m_scanparam->resolution_dst);
G4Tiff gt(mat, G4Tiff::Mode::MemoryMode, "", 120, m_scanparam->resolution_dst);
gt.GetCompressedData(cmpdata);
}
data.setBytesPerRow(bpl);
data.setColumns(static_cast<UInt32>(dib->biWidth));
data.setRows(rows);
data.setBytesWritten(m_compression==Compression::None?bpl*rows: cmpdata.size());
data.setBytesWritten(m_compression == Compression::None ? bpl * rows : cmpdata.size());
data.setXOffset(0);
data.setYOffset(m_memXferYOff);
data.setCompression(m_compression);
@ -2172,7 +2174,7 @@ Result HuagaoDs::imageNativeXferGet(const Identity& id, ImageNativeXfer& data) {
bmpData.reset(new std::vector<unsigned char>);
//FileTools::write_log("正在上传图片 ===> Twain transfered num of " + to_string(++xtfer) + " images");
FileTools::writelog(log_INFO,"正在上传图片 ===> Twain transfered num of " + to_string(++xtfer) + " images");
FileTools::writelog(log_INFO, "正在上传图片 ===> Twain transfered num of " + to_string(++xtfer) + " images");
return { ReturnCode::XferDone, ConditionCode::Success };
}
@ -2259,7 +2261,7 @@ Twpp::Result HuagaoDs::imageFileXferGet(const Twpp::Identity& origin)
cv::Mat ims = cv::imdecode(*bmpData.get(), decodetype);
if (m_compression == Compression::Group4&& m_fileXfer.format()==ImageFileFormat::Tiff)
if (m_compression == Compression::Group4 && m_fileXfer.format() == ImageFileFormat::Tiff)
{
if (!ims.empty() && ims.channels() == 3)
cvtColor(ims, ims, cv::COLOR_BGR2GRAY);
@ -2469,7 +2471,7 @@ Twpp::Result HuagaoDs::startScan()
//info += "\n\t m_scanparam->AutoCrop_threshold :" + to_string(m_scanparam->AutoCrop_threshold);
//info += "\n\t m_scanparam->is_convex :" + to_string(m_scanparam->is_convex);
//FileTools::write_log("D:\\1.txt",info);
FileTools::writelog(log_INFO,"start scan");
FileTools::writelog(log_INFO, "start scan");
#ifndef G200
scanner->notifyscan();
scanner->clear_hwerror();
@ -2477,11 +2479,11 @@ Twpp::Result HuagaoDs::startScan()
#endif //
scanner->config_params(*m_scanparam);
if (m_bIndicator) {
//!< cancel button push
auto stopFunc = [this]() {
if(scanner.get())
if (scanner.get())
scanner->Stop_scan();
//guiIndicator.reset();//取消扫描 关闭进度指示器
if (guiTwain.get()) {
@ -2530,7 +2532,7 @@ Twpp::Result HuagaoDs::startScan()
((CTwainUI*)(guiTwain.get()))->EnableID_OKorID_Cancel(true);
}
if (retCode == 2)
return { ReturnCode::Failure, ConditionCode::NoMedia};//无纸
return { ReturnCode::Failure, ConditionCode::NoMedia };//无纸
return seqError();
}

Binary file not shown.