2021.4.13 添加读取json异常处理

This commit is contained in:
masayume 2021-04-13 17:30:05 +08:00
parent 90257df69d
commit a3b3b636ad
16 changed files with 110 additions and 89 deletions

View File

@ -152,7 +152,7 @@ BOOL CBasicPage::OnInitDialog()
m_cmBoxDuplex = (CComboBox*)GetDlgItem(IDC_CMBDUPLEX); m_cmBoxDuplex = (CComboBox*)GetDlgItem(IDC_CMBDUPLEX);
m_Edit_Dpi.SetSlideLink(this, IDC_SLIDERDPI); m_Edit_Dpi.SetSlideLink(this, IDC_SLIDERDPI);
m_Edit_Dpi.SetParams(100, 600, 10); m_Edit_Dpi.SetParams(100, 300, 10);
m_Edit_Dpi.SetValue(200); m_Edit_Dpi.SetValue(200);
for (const CString& colorMode : color_Modes) for (const CString& colorMode : color_Modes)

View File

@ -34,12 +34,14 @@ ${PROJECT_SOURCE_DIR}/../3rdparty/nick
${PROJECT_SOURCE_DIR}/../3rdparty/libtiff/include ${PROJECT_SOURCE_DIR}/../3rdparty/libtiff/include
${PROJECT_SOURCE_DIR}/../3rdparty/gpdf/ ${PROJECT_SOURCE_DIR}/../3rdparty/gpdf/
${PROJECT_SOURCE_DIR}/../3rdparty/opencv/include ${PROJECT_SOURCE_DIR}/../3rdparty/opencv/include
${PROJECT_SOURCE_DIR}/../3rdparty/log4cplus/include
) )
message($ENV{windir}) message($ENV{windir})
link_directories(${PROJECT_SOURCE_DIR}/../3rdparty/opencv/x86/staticlib/ link_directories(${PROJECT_SOURCE_DIR}/../3rdparty/opencv/x86/staticlib/
${PROJECT_SOURCE_DIR}/../3rdparty/libtiff/ ${PROJECT_SOURCE_DIR}/../3rdparty/libtiff/
${PROJECT_SOURCE_DIR}/../3rdparty/log4cplus/lib/
${PROJECT_SOURCE_DIR}/../3rdparty/gpdf/x86/staticlib/ ${PROJECT_SOURCE_DIR}/../3rdparty/gpdf/x86/staticlib/
${PROJECT_SOURCE_DIR}/../3rdparty/gpdf/3rdparty/tesseract/staticlib/x86/ ${PROJECT_SOURCE_DIR}/../3rdparty/gpdf/3rdparty/tesseract/staticlib/x86/
${PROJECT_SOURCE_DIR}/../3rdparty/turbojpeg/x86/lib/) ${PROJECT_SOURCE_DIR}/../3rdparty/turbojpeg/x86/lib/)
@ -87,6 +89,7 @@ ELSEIF (CMAKE_SYSTEM_NAME MATCHES "Windows")
link_libraries(tesseract_viewer) link_libraries(tesseract_viewer)
link_libraries(tesseract_wordrec) link_libraries(tesseract_wordrec)
link_libraries(turbojpeg) link_libraries(turbojpeg)
link_libraries(log4cplusS)
MESSAGE(STATUS "current platform: Windows") MESSAGE(STATUS "current platform: Windows")
ELSEIF (CMAKE_SYSTEM_NAME MATCHES "FreeBSD") ELSEIF (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
MESSAGE(STATUS "current platform: FreeBSD") MESSAGE(STATUS "current platform: FreeBSD")

View File

@ -13,7 +13,7 @@ class CImageProcPage;
class CBasicPage; class CBasicPage;
class CFeedPaperPage; class CFeedPaperPage;
class CBrightnessPage; class CBrightnessPage;
using std::vector;
/*配置文件默认索引号*/ /*配置文件默认索引号*/
#define SUPPORTRESNUMS 6 #define SUPPORTRESNUMS 6
//static int Resolutions[SUPPORTRESNUMS] = {100,150,200,240,300,600}; //static int Resolutions[SUPPORTRESNUMS] = {100,150,200,240,300,600};

View File

@ -10,7 +10,7 @@
#include <functional> #include <functional>
#include "filetools.h" #include "filetools.h"
#include "PublicFunc.h" #include "PublicFunc.h"
using namespace std;
enum tagDevState enum tagDevState
{ {
DEV_STOP = -1, DEV_STOP = -1,

View File

@ -217,7 +217,7 @@ int GScanO200::aquire_bmpdata(std::vector<unsigned char>& bmpdata)
{ {
if (m_pImages->empty()) { if (m_pImages->empty()) {
DoEvents(); DoEvents();
this_thread::sleep_for(chrono::milliseconds(1)); std::this_thread::sleep_for(std::chrono::milliseconds(1));
if (sw.elapsed_s() > 20.00) if (sw.elapsed_s() > 20.00)
{ {
if (m_threadUsb && m_threadUsb->joinable()) { if (m_threadUsb && m_threadUsb->joinable()) {
@ -253,7 +253,7 @@ int GScanO200::aquire_bmpdata(std::vector<unsigned char>& bmpdata)
return 0; return 0;
} }
DoEvents(); DoEvents();
this_thread::sleep_for(chrono::milliseconds(2)); std::this_thread::sleep_for(std::chrono::milliseconds(2));
} }
} }
} }
@ -643,9 +643,6 @@ void GScanO200::usbmain()
{ {
writelog(e.what()); writelog(e.what());
} }
////FileTools::write_log("D:\\1.txt", "thread usb exit");
} }
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////

View File

@ -119,7 +119,7 @@ void GScanVirtual::Scanner_StartScan(UINT16 count)
void GScanVirtual::Stop_scan() void GScanVirtual::Stop_scan()
{ {
std::lock_guard<std::mutex> lck(m_imgLocker); std::lock_guard<std::mutex> lck(m_imgLocker);
fstream fs("D:\\1.txt", ios::out); std::fstream fs("D:\\1.txt", std::ios::out);
fs << 0; fs << 0;
fs.close(); fs.close();
} }
@ -195,7 +195,7 @@ DWORD GScanVirtual::usbmain()
fread(imgData->data(), sizeof(unsigned char), length, file); fread(imgData->data(), sizeof(unsigned char), length, file);
fclose(file); fclose(file);
m_pImages->pushMat(std::shared_ptr<IDecode>(new G400Decode(imgData))); m_pImages->pushMat(std::shared_ptr<IDecode>(new G400Decode(imgData)));
this_thread::sleep_for(std::chrono::milliseconds(1000)); std::this_thread::sleep_for(std::chrono::milliseconds(1000));
} }
} }
} }

View File

@ -2,6 +2,7 @@
#include "GScan.h" #include "GScan.h"
#include <memory> #include <memory>
using namespace std;
class GScanVirtual : public IScanner class GScanVirtual : public IScanner
{ {

View File

@ -91,7 +91,7 @@ static std::map<float, unsigned int> SupResolutions = {
}; };
static std::map<byte, byte> secrewMaps = { static std::map<BYTE, BYTE> secrewMaps = {
{1,0}, {1,0},
{2,1}, {2,1},
{3,2}, {3,2},

View File

@ -9,7 +9,7 @@
//#include "threadpool.hpp" //#include "threadpool.hpp"
#include "PaperSize.h" #include "PaperSize.h"
#include "filetools.h" #include "filetools.h"
using namespace std;
class IMat2Bmp { class IMat2Bmp {
public: public:
virtual ~IMat2Bmp() {} virtual ~IMat2Bmp() {}

View File

@ -28,7 +28,7 @@ namespace Device {
papersize.insert({ USStatement,CSize(297,420 * 1.5) }); papersize.insert({ USStatement,CSize(297,420 * 1.5) });
papersize.insert({ USLetter,CSize(216,279) }); papersize.insert({ USLetter,CSize(216,279) });
papersize.insert({ USLegal,CSize(216,356) }); papersize.insert({ USLegal,CSize(216,356) });
papersize.insert({ USLedger,CSize(297,432) }); papersize.insert({ USLedger,CSize(279,432) });
papersize.insert({ None,CSize(297,420) }); papersize.insert({ None,CSize(297,420) });
papersize.insert({ K8,CSize(270,390) }); papersize.insert({ K8,CSize(270,390) });
papersize.insert({ K16,CSize(190,270) }); papersize.insert({ K16,CSize(190,270) });

View File

@ -13,7 +13,9 @@
#define BYTES_PERLINE_ALIGN4(width, bpp) (((((int)(width)*(bpp))+31)/32)*4) #define BYTES_PERLINE_ALIGN4(width, bpp) (((((int)(width)*(bpp))+31)/32)*4)
#define BYTES_PERLINE(width, bpp) ((((int)(width)*(bpp))+7)/8) #define BYTES_PERLINE(width, bpp) ((((int)(width)*(bpp))+7)/8)
using namespace std; using byte = unsigned char;
using std::string;
/************************************ /************************************
**json格式保存参数名称** **json格式保存参数名称**
@ -24,8 +26,8 @@ using namespace std;
const std::string CONFIG = "Config"; const std::string CONFIG = "Config";
//<!基本选项卡 //<!基本选项卡
const std::string PIXTYPE = "iPixType"; const std::string PIXTYPE = "iPixType";
const std::string AUTOMATICCOLOR = "iautomaticcolor"; const std::string AUTOMATICCOLOR = "bAutoMaticColorDetece";
const std::string AUTOMATICCOLORTYPR = "iautomaticcolortype"; const std::string AUTOMATICCOLORTYPR = "iAutoMaticColorDeteceType";
const std::string PAPARSIZE = "iPaparSize"; const std::string PAPARSIZE = "iPaparSize";
const std::string ENSIZECHECK = "iEnSizeCheck"; const std::string ENSIZECHECK = "iEnSizeCheck";
const std::string PAPERALIGN = "iPaperAlign"; const std::string PAPERALIGN = "iPaperAlign";

View File

@ -3,8 +3,18 @@
#include <io.h> #include <io.h>
#include <fstream> #include <fstream>
#include <time.h> #include <time.h>
//#include <log4cplus/log4cplus.h>
#include "PublicFunc.h" #include "PublicFunc.h"
enum log_lv :int {
log_TRACE = 0,
log_DEBUG = 10000,
log_INFO = 20000,
log_WARN = 30000,
log_ERROR = 40000,
log_FATAL = 50000,
};
class FileTools class FileTools
{ {
public: public:
@ -40,10 +50,10 @@ public:
p=localtime(&timp); p=localtime(&timp);
ofs << p->tm_year+1900 << "/" << p->tm_mon+1 << "/" << p->tm_mday << " " << p->tm_hour << ":" << p->tm_min << ":" << p->tm_sec << " "<<log << std::endl; ofs << p->tm_year+1900 << "/" << p->tm_mon+1 << "/" << p->tm_mday << " " << p->tm_hour << ":" << p->tm_min << ":" << p->tm_sec << " "<<log << std::endl;
} }
//static void writelog(std::string log) //static void writelog(std::wstring path, int lv, std::string log)
//{ //{
// log4cplus::SharedAppenderPtr rf(new log4cplus::RollingFileAppender( // log4cplus::SharedAppenderPtr rf(new log4cplus::RollingFileAppender(
// LOG4CPLUS_TEXT("log.txt"), // path,
// 200 * 1024, // 200 * 1024,
// 5 // 5
// )); // ));
@ -52,12 +62,11 @@ public:
// rf->setLayout(std::unique_ptr<log4cplus::Layout>(new log4cplus::PatternLayout(pattern))); // rf->setLayout(std::unique_ptr<log4cplus::Layout>(new log4cplus::PatternLayout(pattern)));
// log4cplus::Logger logger = log4cplus::Logger::getInstance(LOG4CPLUS_TEXT("hglog")); // log4cplus::Logger logger = log4cplus::Logger::getInstance(LOG4CPLUS_TEXT("hglog"));
// logger.setLogLevel(log4cplus::INFO_LOG_LEVEL); // logger.setLogLevel(lv);
// logger.addAppender(rf); // logger.addAppender(rf);
// LOG4CPLUS_WARN(logger, log.c_str()); // LOG4CPLUS_WARN(logger, log.c_str());
// logger.removeAllAppenders(); // logger.removeAllAppenders();
//} //}
private: private:
static void getFiles(std::string path, std::vector<std::string>& files) static void getFiles(std::string path, std::vector<std::string>& files)
{ {

View File

@ -270,13 +270,20 @@ GScanCap GscanJsonConfig::ReadGscanCap()
_tcscat(szIniFile, TEXT("\\")); _tcscat(szIniFile, TEXT("\\"));
std::string dirpath = TCHAR2STRING(szIniFile); std::string dirpath = TCHAR2STRING(szIniFile);
bool is_exist = isFileExist(dirpath+ TCHAR2STRING(TWAIN_JSON_NAME)); bool is_exist = isFileExist(dirpath+ TCHAR2STRING(TWAIN_JSON_NAME));
try {
if (is_exist) if (is_exist)
return JsonToGscancap(Readjson(dirpath + TCHAR2STRING(TWAIN_JSON_NAME))); return JsonToGscancap(Readjson(dirpath + TCHAR2STRING(TWAIN_JSON_NAME)));
else { else {
throw std::exception();
}
}
catch (...){
remove((dirpath + TCHAR2STRING(TWAIN_JSON_NAME)).c_str());
createDirectory((char*)dirpath.c_str()); createDirectory((char*)dirpath.c_str());
SaveGscancapJson(JsonToGscancap(GetDefaultJson()), dirpath + TCHAR2STRING(TWAIN_JSON_NAME)); SaveGscancapJson(JsonToGscancap(GetDefaultJson()), dirpath + TCHAR2STRING(TWAIN_JSON_NAME));
return JsonToGscancap(Readjson(dirpath + TCHAR2STRING(TWAIN_JSON_NAME))); return JsonToGscancap(Readjson(dirpath + TCHAR2STRING(TWAIN_JSON_NAME)));
} }
//if (!is_exist) { //if (!is_exist) {
// createDirectory((char*)dirpath.c_str()); // createDirectory((char*)dirpath.c_str());
@ -795,8 +802,8 @@ json GscanJsonConfig::GetDefaultJson()
return json::parse(R"({ return json::parse(R"({
"Config": { "Config": {
"iPixType": 2 , "iPixType": 2 ,
"iautomaticcolor": false , "bAutoMaticColorDetece": false ,
"iautomaticcolortype": 1 , "iAutoMaticColorDeteceType": 1 ,
"iPaparSize": 0 , "iPaparSize": 0 ,
"iPaperAlign": 0 , "iPaperAlign": 0 ,
"iEnSizeCheck": false , "iEnSizeCheck": false ,

View File

@ -4,6 +4,7 @@
#include <Device/json.hpp> #include <Device/json.hpp>
using json = nlohmann::json; using json = nlohmann::json;
using std::vector;
struct json_cast struct json_cast
{ {
json_cast(json s) :m_json(s) { if (s.is_null()) throw std::bad_alloc(); } json_cast(json s) :m_json(s) { if (s.is_null()) throw std::bad_alloc(); }

View File

@ -91,7 +91,7 @@ void CImageApplyRotation::apply(cv::Mat & pDib, int side)
if (m_rotation == RotationType::Rotate_90_clockwise || m_rotation == RotationType::Rotate_90_anti_clockwise) //90<39><30> -90<39><30> if (m_rotation == RotationType::Rotate_90_clockwise || m_rotation == RotationType::Rotate_90_anti_clockwise) //90<39><30> -90<39><30>
{ {
transpose(pDib, pDib); transpose(pDib, pDib);
flip(pDib, pDib, m_rotation == RotationType::Rotate_90_clockwise ? 0 : 1); flip(pDib, pDib, m_rotation == RotationType::Rotate_90_clockwise ? 1 : 0);
} }
else else
{ {

View File

@ -26,7 +26,7 @@
#ifdef WIN32 #ifdef WIN32
#include <Psapi.h> #include <Psapi.h>
#endif // WIN32 #endif // WIN32
using namespace std;
//custom define caps enum //custom define caps enum
enum class CapTypeEx : unsigned short { enum class CapTypeEx : unsigned short {
@ -266,6 +266,7 @@ HuagaoDs::HuagaoDs()
,bmpData(new std::vector<unsigned char>) ,bmpData(new std::vector<unsigned char>)
, hMutex(NULL) , hMutex(NULL)
{ {
//log4cplus::Initializer initializer;
/*string ss1= getOSInfo(); /*string ss1= getOSInfo();
string ss2=getManufactureID(); string ss2=getManufactureID();
string ss3=getCpuType(); string ss3=getCpuType();
@ -862,8 +863,8 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
{ {
m_scanparam->pixtype = (int)mech; m_scanparam->pixtype = (int)mech;
if (m_scanparam->pixtype == (int)PixelType::Rgb){ if (m_scanparam->pixtype == (int)PixelType::Rgb){
m_scanparam->filter = (byte)Filter::None; m_scanparam->filter = (BYTE)Filter::None;
m_scanparam->enhance_color = (byte)Enchace_Color::Enhance_None; m_scanparam->enhance_color = (BYTE)Enchace_Color::Enhance_None;
m_scanparam->automaticcolor = FALSE; m_scanparam->automaticcolor = FALSE;
} }
else{ else{
@ -874,8 +875,8 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
{ {
if (m_scanparam->filter == 3 && m_scanparam->enhance_color == 0) if (m_scanparam->filter == 3 && m_scanparam->enhance_color == 0)
{ {
m_scanparam->filter = (byte)Filter::None; m_scanparam->filter = (BYTE)Filter::None;
m_scanparam->enhance_color = (byte)Enchace_Color::Enhance_Red; m_scanparam->enhance_color = (BYTE)Enchace_Color::Enhance_Red;
} }
} }
} }
@ -894,8 +895,8 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
auto mech = data.currentItem<CapType::IAutomaticColorEnabled>(); auto mech = data.currentItem<CapType::IAutomaticColorEnabled>();
if (mech){ if (mech){
m_scanparam->automaticcolor = TRUE; m_scanparam->automaticcolor = TRUE;
m_scanparam->filter = (byte)Filter::None; m_scanparam->filter = (BYTE)Filter::None;
m_scanparam->enhance_color = (byte)Enchace_Color::Enhance_None; m_scanparam->enhance_color = (BYTE)Enchace_Color::Enhance_None;
m_scanparam->pixtype = (int)PixelType::Rgb; m_scanparam->pixtype = (int)PixelType::Rgb;
} }
else else
@ -955,7 +956,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_caps[CapType::IXResolution] = [this](Msg msg, Capability& data) { m_caps[CapType::IXResolution] = [this](Msg msg, Capability& data) {
switch (msg) { switch (msg) {
case Msg::Get: case Msg::Get:
data = Capability::createRange<CapType::IXResolution>(Fix32(100.0f), Fix32(600.0f), Fix32(1.0f), Fix32(m_scanparam->resolution_dst), Fix32(200.0)); data = Capability::createRange<CapType::IXResolution>(Fix32(100.0f), Fix32(300.0f), Fix32(1.0f), Fix32(m_scanparam->resolution_dst), Fix32(200.0));
return success(); return success();
case Msg::GetCurrent: case Msg::GetCurrent:
data = Capability::createOneValue<CapType::IXResolution>(Fix32(m_scanparam->resolution_dst)); data = Capability::createOneValue<CapType::IXResolution>(Fix32(m_scanparam->resolution_dst));
@ -967,7 +968,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
return success(); return success();
case Msg::Set: { case Msg::Set: {
auto mech = data.currentItem<CapType::IXResolution>(); auto mech = data.currentItem<CapType::IXResolution>();
if (mech < 100.0f || mech > 600.0f) if (mech < 100.0f || mech > 300.0f)
return badValue(); return badValue();
m_scanparam->resolution_dst = (float)mech; m_scanparam->resolution_dst = (float)mech;
return success(); return success();
@ -995,25 +996,25 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
if (std::distance(paperSizeList.begin(), std::find(paperSizeList.begin(), paperSizeList.end(), paper)) == paperSizeList.size()) if (std::distance(paperSizeList.begin(), std::find(paperSizeList.begin(), paperSizeList.end(), paper)) == paperSizeList.size())
return badValue(); return badValue();
else { else {
m_scanparam->papertype = (byte)paper; 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->paperAlign = PaperAlign::Rot0;
m_scanparam->en_sizecheck = 0; m_scanparam->en_sizecheck = 0;
} }
if (paper == (byte)PaperSize::UsStatement){ if (paper == (BYTE)PaperSize::UsStatement){
m_autosize = (UInt16)AutoSize::None; m_autosize = (UInt16)AutoSize::None;
m_autoboarderdetcet = false; m_autoboarderdetcet = false;
m_scanparam->is_autocrop = 0; m_scanparam->is_autocrop = 0;
} }
else{ else{
m_autosize = (paper == (byte)PaperSize::None) ? (UInt16)AutoSize::Auto : (UInt16)AutoSize::None; m_autosize = (paper == (BYTE)PaperSize::None) ? (UInt16)AutoSize::Auto : (UInt16)AutoSize::None;
m_autoboarderdetcet = paper == (byte)PaperSize::None; m_autoboarderdetcet = paper == (BYTE)PaperSize::None;
m_scanparam->is_autocrop = paper == (byte)PaperSize::None ? 1 : 0; m_scanparam->is_autocrop = paper == (BYTE)PaperSize::None ? 1 : 0;
} }
return success(); return success();
} }
} }
return CapSupGetAllReset<byte, PaperSize, CapType::ISupportedSizes>(msg, data, { PaperSize::A4,PaperSize::A5,PaperSize::A6, return CapSupGetAllReset<BYTE, PaperSize, CapType::ISupportedSizes>(msg, data, { PaperSize::A4,PaperSize::A5,PaperSize::A6,
PaperSize::IsoB5,PaperSize::IsoB6,PaperSize::UsLetter, PaperSize::IsoB5,PaperSize::IsoB6,PaperSize::UsLetter,
PaperSize::UsLegal,PaperSize::None,(PaperSize)PaperSizeEx::K16 PaperSize::UsLegal,PaperSize::None,(PaperSize)PaperSizeEx::K16
#ifndef G300 #ifndef G300
@ -1040,7 +1041,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_scanparam->en_sizecheck = mech; m_scanparam->en_sizecheck = mech;
return success(); 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 // !ISG100
#endif // G200 #endif // G200
@ -1155,7 +1156,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_scanparam->is_autodiscradblank_normal = m_scanparam->is_autodiscradblank_vince = m_scanparam->en_fold = 0; m_scanparam->is_autodiscradblank_normal = m_scanparam->is_autodiscradblank_vince = m_scanparam->en_fold = 0;
return success(); return success();
} }
return CapSupGetAllReset<byte, Bool, CapType::DuplexEnabled>(msg, data, m_scanparam->is_duplex, Bool(true)); return CapSupGetAllReset<BYTE, Bool, CapType::DuplexEnabled>(msg, data, m_scanparam->is_duplex, Bool(true));
}; };
m_query[CapType::AutoFeed] = msgSupportGetAllSetReset; m_query[CapType::AutoFeed] = msgSupportGetAllSetReset;
@ -1192,7 +1193,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_scanparam->autodescrew = (bool)atuodsw; m_scanparam->autodescrew = (bool)atuodsw;
return success(); 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; m_query[(CapType)(CapTypeEx::TwEx_SwitchFrontBack)] = msgSupportGetAllSetReset;
@ -1202,7 +1203,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_scanparam->is_switchfrontback = mech; m_scanparam->is_switchfrontback = mech;
return success(); return success();
} }
return CapSupGetAllResetEx<byte, Bool, (CapType)CapTypeEx::TwEx_SwitchFrontBack>(msg, data, { FALSE,TRUE }, m_scanparam->is_switchfrontback, (Bool)false, m_scanparam->is_switchfrontback ? 1 : 0, 0); return CapSupGetAllResetEx<BYTE, Bool, (CapType)CapTypeEx::TwEx_SwitchFrontBack>(msg, data, { FALSE,TRUE }, m_scanparam->is_switchfrontback, (Bool)false, m_scanparam->is_switchfrontback ? 1 : 0, 0);
}; };
m_query[CapType::IAutomaticRotate] = msgSupportGetAllSetReset; m_query[CapType::IAutomaticRotate] = msgSupportGetAllSetReset;
@ -1214,12 +1215,12 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_scanparam->imageRotateDegree = 0.0f; m_scanparam->imageRotateDegree = 0.0f;
return success(); return success();
} }
return CapSupGetAllReset<byte, bool, CapType::IAutomaticRotate>(msg, data, m_scanparam->is_autotext, false); return CapSupGetAllReset<BYTE, bool, CapType::IAutomaticRotate>(msg, data, m_scanparam->is_autotext, false);
}; };
m_query[CapType::IAutomaticCropUsesFrame] = msgSupportGetAll; m_query[CapType::IAutomaticCropUsesFrame] = msgSupportGetAll;
m_caps[CapType::IAutomaticCropUsesFrame] = [this](Msg msg, Capability& data)->Result { m_caps[CapType::IAutomaticCropUsesFrame] = [this](Msg msg, Capability& data)->Result {
return CapSupGetAll<byte, bool, CapType::IAutomaticCropUsesFrame>(msg, data, m_scanparam->is_autocrop, false); return CapSupGetAll<BYTE, bool, CapType::IAutomaticCropUsesFrame>(msg, data, m_scanparam->is_autocrop, false);
}; };
m_query[CapType::AutoScan] = msgSupportGetAllSetReset; m_query[CapType::AutoScan] = msgSupportGetAllSetReset;
@ -1238,13 +1239,13 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
if (Msg::Set == msg) { if (Msg::Set == msg) {
auto autosize = data.currentItem<CapType::IAutoSize>(); auto autosize = data.currentItem<CapType::IAutoSize>();
if (autosize == AutoSize::Auto){ if (autosize == AutoSize::Auto){
if(m_scanparam->papertype==(byte)PaperSize::UsStatement){ if(m_scanparam->papertype==(BYTE)PaperSize::UsStatement){
m_scanparam->is_autocrop = 0; m_scanparam->is_autocrop = 0;
m_autoboarderdetcet = false; m_autoboarderdetcet = false;
} }
else{ else{
m_scanparam->is_autocrop = 1; m_scanparam->is_autocrop = 1;
m_scanparam->papertype = (byte)Twpp::PaperSize::None; m_scanparam->papertype = (BYTE)Twpp::PaperSize::None;
m_scanparam->paperAlign = PaperAlign::Rot0; m_scanparam->paperAlign = PaperAlign::Rot0;
m_autoboarderdetcet = true; m_autoboarderdetcet = true;
} }
@ -1264,9 +1265,9 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
if (Msg::Set == msg) { if (Msg::Set == msg) {
auto autodetectborder = data.currentItem<CapType::IAutomaticBorderDetection>(); auto autodetectborder = data.currentItem<CapType::IAutomaticBorderDetection>();
if (autodetectborder){ if (autodetectborder){
if(m_scanparam->papertype!=(byte)PaperSize::UsStatement){ if(m_scanparam->papertype!=(BYTE)PaperSize::UsStatement){
m_scanparam->is_autocrop = true; m_scanparam->is_autocrop = true;
m_scanparam->papertype = (byte)Twpp::PaperSize::None; m_scanparam->papertype = (BYTE)Twpp::PaperSize::None;
m_scanparam->paperAlign = PaperAlign::Rot0; m_scanparam->paperAlign = PaperAlign::Rot0;
m_autosize = (UInt16)AutoSize::Auto; m_autosize = (UInt16)AutoSize::Auto;
} }
@ -1284,7 +1285,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
//m_caps[CapType::IImageMerge] = [this](Msg msg, Capability& data)->Result { //m_caps[CapType::IImageMerge] = [this](Msg msg, Capability& data)->Result {
// if (Msg::Set == msg) { // if (Msg::Set == msg) {
// auto autocrop = data.currentItem<CapType::IImageMerge>(); // auto autocrop = data.currentItem<CapType::IImageMerge>();
// m_scanparam->en_fold = (byte)autocrop; // m_scanparam->en_fold = (BYTE)autocrop;
// if ((UInt16)autocrop != 0){ // if ((UInt16)autocrop != 0){
// m_scanparam->is_duplex = 1; // m_scanparam->is_duplex = 1;
// m_scanparam->autodescrew = 1;//合并可用时 默认自动纠偏 // m_scanparam->autodescrew = 1;//合并可用时 默认自动纠偏
@ -1292,7 +1293,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
// } // }
// return success(); // return success();
// } // }
// return CapSupGetAllResetEx<byte, UInt16, CapType::IImageMerge>(msg, data, m_scanparam->en_fold, 0); // return CapSupGetAllResetEx<BYTE, UInt16, CapType::IImageMerge>(msg, data, m_scanparam->en_fold, 0);
//}; //};
m_query[CapType(CapTypeEx::TwEx_EnFold)] = msgSupportGetAllSetReset; m_query[CapType(CapTypeEx::TwEx_EnFold)] = msgSupportGetAllSetReset;
@ -1307,7 +1308,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
} }
return success(); 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_query[CapType::IAutoDiscardBlankPages] = msgSupportGetAllSetReset;
@ -1347,7 +1348,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_scanparam->is_autodiscradblank_normal = 0; m_scanparam->is_autodiscradblank_normal = 0;
return success(); return success();
} }
return CapSupGetAllResetEx<byte, Bool, (CapType)CapTypeEx::TwEx_IAutoDiscardBlankVince>(msg, data, { FALSE,TRUE }, m_scanparam->is_autodiscradblank_normal, Bool(false), m_scanparam->is_autodiscradblank_normal ? 1 : 0, 0); return CapSupGetAllResetEx<BYTE, Bool, (CapType)CapTypeEx::TwEx_IAutoDiscardBlankVince>(msg, data, { FALSE,TRUE }, m_scanparam->is_autodiscradblank_normal, Bool(false), m_scanparam->is_autodiscradblank_normal ? 1 : 0, 0);
}; };
m_query[(CapType)(CapTypeEx::TwEx_IBackRotate180)] = msgSupportGetAllSetReset; m_query[(CapType)(CapTypeEx::TwEx_IBackRotate180)] = msgSupportGetAllSetReset;
@ -1359,7 +1360,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_scanparam->is_duplex = 1; m_scanparam->is_duplex = 1;
return success(); return success();
} }
return CapSupGetAllResetEx<byte, Bool, (CapType)CapTypeEx::TwEx_IBackRotate180>(msg, data, { FALSE,TRUE }, m_scanparam->is_backrotate180, Bool(false), m_scanparam->is_backrotate180 ? 1 : 0, 0); return CapSupGetAllResetEx<BYTE, Bool, (CapType)CapTypeEx::TwEx_IBackRotate180>(msg, data, { FALSE,TRUE }, m_scanparam->is_backrotate180, Bool(false), m_scanparam->is_backrotate180 ? 1 : 0, 0);
}; };
//填黑框 //填黑框
@ -1370,7 +1371,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_scanparam->fillbackground = mech; m_scanparam->fillbackground = mech;
return success(); return success();
} }
return CapSupGetAllResetEx<byte, Bool, (CapType)CapTypeEx::TwEx_IFillBackground>(msg, data, { FALSE,TRUE }, m_scanparam->fillbackground, Bool(true), m_scanparam->fillbackground ? 1 : 0, 1); return CapSupGetAllResetEx<BYTE, Bool, (CapType)CapTypeEx::TwEx_IFillBackground>(msg, data, { FALSE,TRUE }, m_scanparam->fillbackground, Bool(true), m_scanparam->fillbackground ? 1 : 0, 1);
}; };
//裁剪纠偏轮廓缩进像素 //裁剪纠偏轮廓缩进像素
m_query[(CapType)(CapTypeEx::TwEx_CroporDesaskewIndent)] = msgSupportGetAllSetReset; m_query[(CapType)(CapTypeEx::TwEx_CroporDesaskewIndent)] = msgSupportGetAllSetReset;
@ -1427,7 +1428,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_scanparam->fillhole.is_fillhole = mech; m_scanparam->fillhole.is_fillhole = mech;
return success(); return success();
} }
return CapSupGetAllResetEx<byte, Bool, (CapType)CapTypeEx::TwEx_IFillHole>(msg, data, { FALSE,TRUE }, m_scanparam->fillhole.is_fillhole, Bool(true), m_scanparam->fillhole.is_fillhole ? 1 : 0, 0); return CapSupGetAllResetEx<BYTE, Bool, (CapType)CapTypeEx::TwEx_IFillHole>(msg, data, { FALSE,TRUE }, m_scanparam->fillhole.is_fillhole, Bool(true), m_scanparam->fillhole.is_fillhole ? 1 : 0, 0);
}; };
m_query[(CapType)(CapTypeEx::TwEx_IFillHoleRatio)] = msgSupportGetAllSetReset; m_query[(CapType)(CapTypeEx::TwEx_IFillHoleRatio)] = msgSupportGetAllSetReset;
@ -1452,7 +1453,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_scanparam->detachnoise.is_detachnoise = mech; m_scanparam->detachnoise.is_detachnoise = mech;
return success(); return success();
} }
return CapSupGetAllResetEx<byte, Bool, (CapType)CapTypeEx::TwEx_IDetachNoise>(msg, data, { FALSE,TRUE }, m_scanparam->detachnoise.is_detachnoise, FALSE, m_scanparam->detachnoise.is_detachnoise ? 1 : 0, 0); return CapSupGetAllResetEx<BYTE, Bool, (CapType)CapTypeEx::TwEx_IDetachNoise>(msg, data, { FALSE,TRUE }, m_scanparam->detachnoise.is_detachnoise, FALSE, m_scanparam->detachnoise.is_detachnoise ? 1 : 0, 0);
}; };
m_query[(CapType)(CapTypeEx::TwEx_IDetachNoiseValue)] = msgSupportGetAllSetReset; m_query[(CapType)(CapTypeEx::TwEx_IDetachNoiseValue)] = msgSupportGetAllSetReset;
@ -1472,13 +1473,13 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_caps[(CapType)(CapTypeEx::TwEx_IMultiOutputRed)] = [this](Msg msg, Capability& data)->Result { m_caps[(CapType)(CapTypeEx::TwEx_IMultiOutputRed)] = [this](Msg msg, Capability& data)->Result {
if (Msg::Set == msg) { if (Msg::Set == msg) {
auto mech = data.currentItem<Bool>(); auto mech = data.currentItem<Bool>();
if (m_scanparam->pixtype == (byte)PixelType::Rgb) if (m_scanparam->pixtype == (BYTE)PixelType::Rgb)
m_scanparam->multi_output_red = mech; m_scanparam->multi_output_red = mech;
else else
m_scanparam->multi_output_red = 0;//非彩色 不能使用多流除红 m_scanparam->multi_output_red = 0;//非彩色 不能使用多流除红
return success(); return success();
} }
return CapSupGetAllResetEx<byte, Bool, (CapType)CapTypeEx::TwEx_IMultiOutputRed>(msg, data, { FALSE,TRUE }, m_scanparam->multi_output_red, FALSE, m_scanparam->multi_output_red ? 1 : 0, 0); return CapSupGetAllResetEx<BYTE, Bool, (CapType)CapTypeEx::TwEx_IMultiOutputRed>(msg, data, { FALSE,TRUE }, m_scanparam->multi_output_red, FALSE, m_scanparam->multi_output_red ? 1 : 0, 0);
}; };
//答题卡除红 //答题卡除红
m_query[(CapType)(CapTypeEx::TwEx_HsvCorrect)] = msgSupportGetAllSetReset; m_query[(CapType)(CapTypeEx::TwEx_HsvCorrect)] = msgSupportGetAllSetReset;
@ -1488,7 +1489,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_scanparam->hsvcorrect = mech; m_scanparam->hsvcorrect = mech;
return success(); return success();
} }
return CapSupGetAllResetEx<byte, Bool, (CapType)CapTypeEx::TwEx_HsvCorrect>(msg, data, { FALSE,TRUE }, m_scanparam->hsvcorrect, FALSE, m_scanparam->hsvcorrect ? 1 : 0, 0); return CapSupGetAllResetEx<BYTE, Bool, (CapType)CapTypeEx::TwEx_HsvCorrect>(msg, data, { FALSE,TRUE }, m_scanparam->hsvcorrect, FALSE, m_scanparam->hsvcorrect ? 1 : 0, 0);
}; };
m_query[CapType::IFilter] = msgSupportGetAllSetReset; m_query[CapType::IFilter] = msgSupportGetAllSetReset;
@ -1496,15 +1497,15 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
if (Msg::Set == msg) { if (Msg::Set == msg) {
auto mech = data.currentItem<CapType::IFilter>(); auto mech = data.currentItem<CapType::IFilter>();
if (mech == Filter::None || mech == Filter::Red || mech == Filter::Green || mech == Filter::Blue) { if (mech == Filter::None || mech == Filter::Red || mech == Filter::Green || mech == Filter::Blue) {
m_scanparam->filter = (byte)mech; m_scanparam->filter = (BYTE)mech;
if (mech != Filter::None){ if (mech != Filter::None){
m_scanparam->enhance_color = (byte)Enchace_Color::Enhance_None; m_scanparam->enhance_color = (BYTE)Enchace_Color::Enhance_None;
} }
return success(); return success();
} }
return badValue(); return badValue();
} }
return CapSupGetAllReset<byte, Filter, CapType::IFilter>(msg, data, { Filter::Red,Filter::Green,Filter::Blue,Filter::None }, m_scanparam->filter, Filter::None, m_scanparam->filter, 3); return CapSupGetAllReset<BYTE, Filter, CapType::IFilter>(msg, data, { Filter::Red,Filter::Green,Filter::Blue,Filter::None }, m_scanparam->filter, Filter::None, m_scanparam->filter, 3);
}; };
//颜色增强 //颜色增强
@ -1512,22 +1513,22 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_caps[(CapType)(CapTypeEx::TwEx_IEnhanceColor)] = [this](Msg msg, Capability& data)->Result { m_caps[(CapType)(CapTypeEx::TwEx_IEnhanceColor)] = [this](Msg msg, Capability& data)->Result {
if (Msg::Set == msg) { if (Msg::Set == msg) {
auto mech = data.currentItem<Int16>(); auto mech = data.currentItem<Int16>();
if (m_scanparam->pixtype == (byte)PixelType::Rgb){ if (m_scanparam->pixtype == (BYTE)PixelType::Rgb){
m_scanparam->enhance_color = (byte)Enchace_Color::Enhance_None; m_scanparam->enhance_color = (BYTE)Enchace_Color::Enhance_None;
} }
else{ else{
if (mech == Enchace_Color::Enhance_None || mech == Enchace_Color::Enhance_Red || mech == Enchace_Color::Enhance_Green || mech == Enchace_Color::Enhance_Blue) 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; m_scanparam->enhance_color = (BYTE)mech;
if (mech != (byte)Enchace_Color::Enhance_None) if (mech != (BYTE)Enchace_Color::Enhance_None)
m_scanparam->filter = (byte)Filter::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->filter == (BYTE)Filter::None && m_scanparam->enhance_color == (BYTE)Enchace_Color::Enhance_None)
{ {
m_scanparam->filter = (byte)Filter::None; m_scanparam->filter = (BYTE)Filter::None;
m_scanparam->enhance_color = (byte)Enchace_Color::Enhance_Red; m_scanparam->enhance_color = (BYTE)Enchace_Color::Enhance_Red;
} }
} }
return success(); return success();
@ -1535,7 +1536,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
} }
return badValue(); 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); 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);
}; };
m_query[(CapType)(CapTypeEx::TwEx_Sharpen)] = msgSupportGetAllSetReset; m_query[(CapType)(CapTypeEx::TwEx_Sharpen)] = msgSupportGetAllSetReset;
@ -1544,10 +1545,10 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
auto mech = data.currentItem<Int16>(); auto mech = data.currentItem<Int16>();
if (m_scanparam->pixtype == (int)PixelType::BlackWhite) if (m_scanparam->pixtype == (int)PixelType::BlackWhite)
return badValue(); return badValue();
m_scanparam->sharpen = (byte)mech; m_scanparam->sharpen = (BYTE)mech;
return success(); return success();
} }
return CapSupGetAllResetEx<byte, SharpenBlur, (CapType)CapTypeEx::TwEx_Sharpen>(msg, data, { SharpenBlur::Sharpen_None,SharpenBlur::Sharpen_Normal,SharpenBlur::Sharpen_More,SharpenBlur::Sharpen_Blur,SharpenBlur::Sharpen_Blur_More }, m_scanparam->sharpen, SharpenBlur::Sharpen_None, m_scanparam->sharpen, 0); return CapSupGetAllResetEx<BYTE, SharpenBlur, (CapType)CapTypeEx::TwEx_Sharpen>(msg, data, { SharpenBlur::Sharpen_None,SharpenBlur::Sharpen_Normal,SharpenBlur::Sharpen_More,SharpenBlur::Sharpen_Blur,SharpenBlur::Sharpen_Blur_More }, m_scanparam->sharpen, SharpenBlur::Sharpen_None, m_scanparam->sharpen, 0);
}; };
/*亮度 对比度 gamma range类型 Range 类型*/ /*亮度 对比度 gamma range类型 Range 类型*/
@ -1691,7 +1692,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_scanparam->hardwarecaps.en_skrewdetect = mech; m_scanparam->hardwarecaps.en_skrewdetect = mech;
return success(); return success();
} }
return CapSupGetAllResetEx<byte, Bool, (CapType)CapTypeEx::TwEx_ScrewDetectEnable>(msg, data, { FALSE,TRUE }, m_scanparam->sharpen, TRUE, m_scanparam->hardwarecaps.en_skrewdetect ? 1 : 0, 1); return CapSupGetAllResetEx<BYTE, Bool, (CapType)CapTypeEx::TwEx_ScrewDetectEnable>(msg, data, { FALSE,TRUE }, m_scanparam->sharpen, TRUE, m_scanparam->hardwarecaps.en_skrewdetect ? 1 : 0, 1);
}; };
m_query[(CapType)(CapTypeEx::TwEx_ScrewLevel)] = msgSupportGetAllSetReset; m_query[(CapType)(CapTypeEx::TwEx_ScrewLevel)] = msgSupportGetAllSetReset;
@ -1704,7 +1705,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
} }
return badValue(); return badValue();
} }
return CapSupGetAllResetEx<byte, UInt8, (CapType)CapTypeEx::TwEx_ScrewLevel>(msg, data, m_scanparam->hardwarecaps.skrewdetectlevel, 3); return CapSupGetAllResetEx<BYTE, UInt8, (CapType)CapTypeEx::TwEx_ScrewLevel>(msg, data, m_scanparam->hardwarecaps.skrewdetectlevel, 3);
}; };
//装订检测 //装订检测
m_query[(CapType)(CapTypeEx::TwEx_StableDetectEnable)] = msgSupportGetAllSetReset; m_query[(CapType)(CapTypeEx::TwEx_StableDetectEnable)] = msgSupportGetAllSetReset;
@ -1714,7 +1715,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_scanparam->hardwarecaps.en_stapledetect = mech; m_scanparam->hardwarecaps.en_stapledetect = mech;
return success(); return success();
} }
return CapSupGetAllResetEx<byte, UInt8, (CapType)CapTypeEx::TwEx_StableDetectEnable>(msg, data, { FALSE,TRUE }, m_scanparam->hardwarecaps.en_stapledetect, FALSE, m_scanparam->hardwarecaps.en_stapledetect ? 1 : 0, 0); return CapSupGetAllResetEx<BYTE, UInt8, (CapType)CapTypeEx::TwEx_StableDetectEnable>(msg, data, { FALSE,TRUE }, m_scanparam->hardwarecaps.en_stapledetect, FALSE, m_scanparam->hardwarecaps.en_stapledetect ? 1 : 0, 0);
}; };
m_query[(CapType)(CapTypeEx::TwEx_DogEarDelection)] = msgSupportGetAllSetReset; m_query[(CapType)(CapTypeEx::TwEx_DogEarDelection)] = msgSupportGetAllSetReset;
@ -1724,7 +1725,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_scanparam->is_dogeardetection= mech; m_scanparam->is_dogeardetection= mech;
return success(); return success();
} }
return CapSupGetAllResetEx<byte, Bool, (CapType)CapTypeEx::TwEx_DogEarDelection>(msg, data, m_scanparam->is_dogeardetection, FALSE); return CapSupGetAllResetEx<BYTE, Bool, (CapType)CapTypeEx::TwEx_DogEarDelection>(msg, data, m_scanparam->is_dogeardetection, FALSE);
}; };
//双张检测 与官方标准定义有所差异 此协议修改为bool型 //双张检测 与官方标准定义有所差异 此协议修改为bool型
m_query[CapType::DoubleFeedDetection] = msgSupportGetAllSetReset; m_query[CapType::DoubleFeedDetection] = msgSupportGetAllSetReset;
@ -1734,7 +1735,7 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_scanparam->hardwarecaps.en_doublefeed = mech; m_scanparam->hardwarecaps.en_doublefeed = mech;
return success(); return success();
} }
return CapSupGetAllResetEx<byte, Bool, CapType::DoubleFeedDetection>(msg, data, m_scanparam->hardwarecaps.en_doublefeed, TRUE); return CapSupGetAllResetEx<BYTE, Bool, CapType::DoubleFeedDetection>(msg, data, m_scanparam->hardwarecaps.en_doublefeed, TRUE);
}; };
#ifdef G200 #ifdef G200
@ -1742,13 +1743,13 @@ Result HuagaoDs::identityOpenDs(const Identity&) {
m_query[(CapType)(CapTypeEx::TwEx_LowPowerMode)] = msgSupportGetAllSetReset; m_query[(CapType)(CapTypeEx::TwEx_LowPowerMode)] = msgSupportGetAllSetReset;
m_caps[(CapType)(CapTypeEx::TwEx_LowPowerMode)] = [this](Msg msg, Capability& data)->Result { m_caps[(CapType)(CapTypeEx::TwEx_LowPowerMode)] = [this](Msg msg, Capability& data)->Result {
if (Msg::Set == msg) { if (Msg::Set == msg) {
auto mech = data.currentItem<byte>(); auto mech = data.currentItem<BYTE>();
m_scanparam->hardwarecaps.lowpowermode = (LowPowerMode)mech; m_scanparam->hardwarecaps.lowpowermode = (LowPowerMode)mech;
return success(); 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 }, { 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 #endif // LANXUM
return success(); return success();