2020-06-20 03:07:40 +00:00
|
|
|
|
#include "GscanJsonConfig.h"
|
|
|
|
|
#include <iostream>
|
|
|
|
|
#include <fstream>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <sstream>
|
2021-05-13 10:13:08 +00:00
|
|
|
|
#include "Device/filetools.h"
|
2020-06-20 03:07:40 +00:00
|
|
|
|
#include "Device/CJsonObject.hpp"
|
|
|
|
|
|
2021-01-22 07:37:46 +00:00
|
|
|
|
|
|
|
|
|
|
2020-06-20 03:07:40 +00:00
|
|
|
|
GscanJsonConfig::GscanJsonConfig()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GscanJsonConfig::~GscanJsonConfig()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GScanCap GscanJsonConfig::GetDefaultGscancapValue()
|
|
|
|
|
{
|
|
|
|
|
GScanCap gcap;
|
2021-07-19 10:36:34 +00:00
|
|
|
|
gcap = JsonToGscancap(GetDefaultJson());
|
2020-06-20 03:07:40 +00:00
|
|
|
|
return gcap;
|
2021-07-19 10:36:34 +00:00
|
|
|
|
// /*< basic page setting*/
|
|
|
|
|
// gcap.pixtype = 2;//Ĭ<>ϲ<EFBFBD>ɫ
|
|
|
|
|
// gcap.automaticcolor = FALSE;
|
|
|
|
|
// gcap.automaticcolortype = 1;
|
|
|
|
|
// gcap.paperAlign = PaperAlign::Rot0;
|
|
|
|
|
// gcap.papertype = 0;//TwSS::NONE
|
|
|
|
|
// gcap.en_sizecheck = FALSE;
|
|
|
|
|
//
|
|
|
|
|
//#ifdef UV
|
|
|
|
|
// gcap.hardwarecaps.en_uv = FALSE;
|
|
|
|
|
//#endif
|
|
|
|
|
// gcap.is_autocrop = TRUE;//Ĭ<><C4AC><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
// gcap.is_duplex = TRUE;
|
|
|
|
|
// gcap.is_autodiscradblank_normal = FALSE;
|
|
|
|
|
// gcap.is_autodiscradblank_vince = FALSE;
|
|
|
|
|
// gcap.discardblank_percent = 20;
|
|
|
|
|
// gcap.is_switchfrontback = FALSE;
|
|
|
|
|
// gcap.resolution_dst = 200.0f;
|
|
|
|
|
// gcap.resolution_native = 200.0f;
|
|
|
|
|
//
|
|
|
|
|
// /*< brightness setting*/
|
|
|
|
|
// gcap.brightness = 0.0f;//Ĭ<><C4AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ0
|
|
|
|
|
// gcap.contrast = 0.0f;//Ĭ<>϶Աȶ<D4B1>Ϊ0
|
|
|
|
|
// gcap.threshold = 128;
|
|
|
|
|
// gcap.gamma = 1.0;
|
|
|
|
|
// gcap.is_autocontrast = FALSE;//Ĭ<>ϲ<EFBFBD><CFB2>Զ<EFBFBD><D4B6>Աȶ<D4B1>
|
|
|
|
|
//
|
|
|
|
|
// /*< image proecss setting*/
|
|
|
|
|
// gcap.autodescrew = TRUE;//<2F>Զ<EFBFBD><D4B6><EFBFBD>ƫ <20><><EFBFBD><EFBFBD>
|
|
|
|
|
// gcap.enhance_color = EnchaceColor::Enhance_None;//Ĭ<>ϲ<EFBFBD><CFB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB>ǿ
|
|
|
|
|
// gcap.en_fold = FALSE;//Ĭ<>ϲ<EFBFBD><CFB2><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
// gcap.fillbackground = true;//Ĭ<>ϲ<EFBFBD><CFB2><EFBFBD><EFBFBD>ڿ<EFBFBD>
|
|
|
|
|
// gcap.fillhole.is_fillhole = FALSE;
|
|
|
|
|
// gcap.fillhole.fillholeratio = 10;
|
|
|
|
|
// gcap.detachnoise.detachnoise = 30;
|
|
|
|
|
// gcap.detachnoise.is_detachnoise = FALSE;
|
|
|
|
|
// gcap.filter = 3;//<2F><>ӦFilter::None
|
|
|
|
|
// gcap.multi_output_red = FALSE;
|
|
|
|
|
// gcap.sharpen = SharpenBlur::Sharpen_None;
|
|
|
|
|
// gcap.hsvcorrect = FALSE;//Ĭ<>ϲ<EFBFBD><CFB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2BFA8><EFBFBD><EFBFBD>
|
|
|
|
|
//
|
|
|
|
|
// /*< feeder setting*/
|
|
|
|
|
// gcap.hardwarecaps.en_doublefeed = TRUE;//Ĭ<>Ͽ<EFBFBD><CFBF><EFBFBD>˫<EFBFBD><CBAB>
|
|
|
|
|
// gcap.hardwarecaps.en_skrewdetect = TRUE;//Ĭ<>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><D0B1><EFBFBD><EFBFBD>
|
|
|
|
|
// gcap.hardwarecaps.en_stapledetect = FALSE;//Ĭ<>ϲ<EFBFBD><CFB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
// gcap.hardwarecaps.skrewdetectlevel = 3;//Ĭ<>ϴ<EFBFBD><CFB4><EFBFBD>3<EFBFBD><33>
|
|
|
|
|
// gcap.hardwarecaps.capturepixtype = 2;//<2F><>ɫģʽ
|
|
|
|
|
// gcap.imageRotateDegree = 0.0f;//Ĭ<>ϲ<EFBFBD><CFB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת
|
|
|
|
|
// gcap.is_autotext = FALSE;
|
|
|
|
|
// gcap.is_backrotate180 = FALSE;
|
|
|
|
|
// gcap.AutoCrop_threshold = 40;
|
|
|
|
|
// gcap.is_convex = TRUE;
|
|
|
|
|
// gcap.noise = 8;
|
|
|
|
|
// gcap.indent = 5;
|
|
|
|
|
// gcap.is_dogeardetection = FALSE;
|
|
|
|
|
// gcap.scannum = -1;//Ĭ<><C4AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɨ<EFBFBD><C9A8>
|
|
|
|
|
// gcap.hardwarecaps.lowpowermode = (LowPowerMode)4;
|
|
|
|
|
// //gcap.scanrect = { 0 };
|
|
|
|
|
//
|
|
|
|
|
// return gcap;
|
2020-06-20 03:07:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GscanJsonConfig::SaveGscanCapConfig(const GScanCap & gcap, const std::string path)
|
|
|
|
|
{
|
|
|
|
|
neb::CJsonObject outJson;
|
|
|
|
|
|
|
|
|
|
outJson.AddEmptySubObject("Config");//header
|
|
|
|
|
outJson["Config"].Add(PIXTYPE, (int)gcap.pixtype);
|
2020-12-17 09:02:33 +00:00
|
|
|
|
outJson["Config"].Add(AUTOMATICCOLOR, (bool)gcap.automaticcolor,false);
|
|
|
|
|
outJson["Config"].Add(AUTOMATICCOLORTYPR, (int)gcap.automaticcolortype);
|
2020-06-20 03:07:40 +00:00
|
|
|
|
outJson["Config"].Add(PAPARSIZE, (int)(gcap.papertype));
|
|
|
|
|
outJson["Config"].Add(PAPERALIGN, (int)(gcap.paperAlign));
|
2020-12-10 02:01:22 +00:00
|
|
|
|
outJson["Config"].Add(ENSIZECHECK, (bool)(gcap.en_sizecheck), false);
|
2022-05-24 12:05:47 +00:00
|
|
|
|
outJson["Config"].Add(ENFIXEDPAPER, (bool)(gcap.en_fixedpaper), false);
|
2020-06-20 03:07:40 +00:00
|
|
|
|
outJson["Config"].Add(AUTOCROP, (bool)(gcap.is_autocrop), false);
|
2022-05-24 12:05:47 +00:00
|
|
|
|
outJson["Config"].Add(HIGH_IMAGE_QUALITY, (bool)(gcap.is_high_imagequality), false);
|
2020-06-20 03:07:40 +00:00
|
|
|
|
outJson["Config"].Add(RESOLUTION, (int)(gcap.resolution_dst));
|
|
|
|
|
outJson["Config"].Add(DUPLEX, (bool)(gcap.is_duplex),false);
|
|
|
|
|
outJson["Config"].Add(DISCARBLANK, (bool)(gcap.is_autodiscradblank_normal), false);
|
|
|
|
|
outJson["Config"].Add(DISCARBLANKVINCE, (bool)(gcap.is_autodiscradblank_vince), false);
|
2022-11-28 08:16:20 +00:00
|
|
|
|
outJson["Config"].Add(DISCARBLANK_VALUE, (int)gcap.discardblank_percent);
|
2020-06-20 03:07:40 +00:00
|
|
|
|
//outJson["Config"].Add(DB_AREANUM, (int)(pConfigItem->DBlank_AreaNum));
|
|
|
|
|
//outJson["Config"].Add(DB_DEVNMAX, (int)(pConfigItem->DBlank_DevnMax));
|
|
|
|
|
outJson["Config"].Add(FLOD, (bool)(gcap.en_fold), false);
|
|
|
|
|
outJson["Config"].Add(SWITCHFRONTBACK, (bool)(gcap.is_switchfrontback), false);
|
2021-12-16 08:21:35 +00:00
|
|
|
|
outJson["Config"].Add(SPLIT, gcap.is_split, false);
|
2021-06-30 13:58:13 +00:00
|
|
|
|
|
|
|
|
|
#ifdef UV
|
|
|
|
|
outJson["Config"].Add(ENUVMODEL, (bool)(gcap.hardwarecaps.en_uv), false);
|
|
|
|
|
#endif
|
2021-09-23 01:19:47 +00:00
|
|
|
|
outJson["Config"].Add(BRIGHTNESS, (double)(gcap.brightness));
|
2020-06-20 03:07:40 +00:00
|
|
|
|
outJson["Config"].Add(AUTOCONTRAST, (bool)(gcap.is_autocontrast), false);
|
2021-09-23 01:19:47 +00:00
|
|
|
|
outJson["Config"].Add(CONTRAST, (double)(gcap.contrast));
|
2020-07-11 10:43:17 +00:00
|
|
|
|
outJson["Config"].Add(GAMMA_, (double)(gcap.gamma));
|
2022-11-28 08:16:20 +00:00
|
|
|
|
|
2020-06-20 03:07:40 +00:00
|
|
|
|
outJson["Config"].Add(FILTERTYPE, (int)(gcap.filter));
|
2020-07-11 10:43:17 +00:00
|
|
|
|
outJson["Config"].Add(ENHANCECOLOR,((int)gcap.enhance_color));
|
2020-06-20 03:07:40 +00:00
|
|
|
|
outJson["Config"].Add(SHARPENTYPE, (int)(gcap.sharpen));
|
|
|
|
|
outJson["Config"].Add(AUTODESCREW, (bool)(gcap.autodescrew), false);
|
|
|
|
|
outJson["Config"].Add(FILLBLACK, (bool)(gcap.fillbackground), false);
|
|
|
|
|
outJson["Config"].Add(MULTIOUTPUT, (bool)(gcap.multi_output_red), false);
|
2022-05-24 12:05:47 +00:00
|
|
|
|
outJson["Config"].Add(EN_MULTIOUT, (bool)(gcap.en_multi_output), false);
|
|
|
|
|
outJson["Config"].Add(MULTIOUTTYPE, (int)(gcap.multioutput));
|
2020-06-20 03:07:40 +00:00
|
|
|
|
outJson["Config"].Add(OUTHOLE, (bool)(gcap.fillhole.is_fillhole), false);
|
|
|
|
|
outJson["Config"].Add(OUTHOLERATIO, (int)(gcap.fillhole.fillholeratio));
|
2022-09-20 01:08:11 +00:00
|
|
|
|
outJson["Config"].Add(OUTHOLERATIOUP, (int)(gcap.fillholeratio_up));
|
|
|
|
|
outJson["Config"].Add(OUTHOLERATIODOWN, (int)(gcap.fillholeratio_down));
|
|
|
|
|
outJson["Config"].Add(OUTHOLERATIOLEFT, (int)(gcap.fillholeratio_left));
|
|
|
|
|
outJson["Config"].Add(OUTHOLERATIORIGHT, (int)(gcap.fillholeratio_right));
|
|
|
|
|
outJson["Config"].Add(EN_OUTHOLERATIOUP, (bool)(gcap.fillholeratio_up),true);
|
|
|
|
|
outJson["Config"].Add(EN_OUTHOLERATIODOWN, (bool)(gcap.fillholeratio_down), true);
|
|
|
|
|
outJson["Config"].Add(EN_OUTHOLERATIOLEFT, (bool)(gcap.fillholeratio_left), true);
|
|
|
|
|
outJson["Config"].Add(EN_OUTHOLERATIORIGHT, (bool)(gcap.fillholeratio_right), true);
|
|
|
|
|
|
2020-12-09 08:02:51 +00:00
|
|
|
|
outJson["Config"].Add(DETACHNOISE, (bool)(gcap.detachnoise.is_detachnoise), false);
|
|
|
|
|
outJson["Config"].Add(DETACHNOISEVALUE, (int)(gcap.detachnoise.detachnoise));
|
2022-02-14 02:30:19 +00:00
|
|
|
|
outJson["Config"].Add(FADEBACK, (bool)(gcap.fadeback), false);
|
|
|
|
|
outJson["Config"].Add(FADEBACKRANGE, (int)(gcap.fadeback_range));
|
2020-07-11 10:43:17 +00:00
|
|
|
|
outJson["Config"].Add(HSVCORRECT, (bool)(gcap.hsvcorrect),false);
|
2022-11-18 05:56:31 +00:00
|
|
|
|
outJson["Config"].Add(ANSWERSHEETFILTER, (int)(gcap.hsvFilter));
|
2020-06-20 03:07:40 +00:00
|
|
|
|
|
|
|
|
|
outJson["Config"].Add(ULTRADETECT, (bool)(gcap.hardwarecaps.en_doublefeed), false);
|
|
|
|
|
outJson["Config"].Add(BINDINGDETECT, (bool)(gcap.hardwarecaps.en_stapledetect), false);
|
2021-12-16 08:21:35 +00:00
|
|
|
|
outJson["Config"].Add(AUTOPAPER, (bool)(gcap.hardwarecaps.is_autopaper), false);
|
2022-10-20 02:40:25 +00:00
|
|
|
|
outJson["Config"].Add(AUTOPAPERTIMEOUT, (int)(gcap.autopaper_timeout));
|
2020-06-20 03:07:40 +00:00
|
|
|
|
outJson["Config"].Add(SCANCOUNT, (int)(gcap.scannum));
|
2020-07-11 10:43:17 +00:00
|
|
|
|
outJson["Config"].Add(DOCORIENTATION, (int)(gcap.imageRotateDegree));
|
|
|
|
|
outJson["Config"].Add(AUTO_TEXT, (bool)(gcap.is_autotext),false);
|
2020-06-20 03:07:40 +00:00
|
|
|
|
outJson["Config"].Add(BACKROTATE180, (bool)(gcap.is_backrotate180), false);
|
2021-09-23 01:19:47 +00:00
|
|
|
|
outJson["Config"].Add(NOISE, (int)(gcap.noise));
|
2020-12-09 08:02:51 +00:00
|
|
|
|
outJson["Config"].Add(ISCONVEX, (bool)(gcap.is_convex), false);
|
2021-09-23 01:19:47 +00:00
|
|
|
|
outJson["Config"].Add(INDENT, (int)(gcap.indent));
|
|
|
|
|
outJson["Config"].Add(AUTOCROP_THRESHOLD, (int)(gcap.AutoCrop_threshold));
|
2020-11-16 10:05:04 +00:00
|
|
|
|
outJson["Config"].Add(DOGEAR_DETECTION, (bool)(gcap.is_dogeardetection), false);
|
2021-11-20 03:09:04 +00:00
|
|
|
|
outJson["Config"].Add(DOGEAR_DISTANCE, (uint32_t)(gcap.dogeardistance));
|
2020-07-11 10:43:17 +00:00
|
|
|
|
outJson["Config"].Add(SCREWDETECT, (bool)(gcap.hardwarecaps.en_skrewdetect), false);
|
2020-06-20 03:07:40 +00:00
|
|
|
|
outJson["Config"].Add(SCREWLEVEL, (int)(gcap.hardwarecaps.skrewdetectlevel));
|
|
|
|
|
outJson["Config"].Add(ITEMCAPTION, (string)(gcap.Caption));
|
|
|
|
|
outJson["Config"].Add(SAVEPATH, (string)(gcap.SavePath));
|
|
|
|
|
std::ofstream os;
|
|
|
|
|
os.open(path.c_str());
|
|
|
|
|
os << outJson.ToFormattedString();
|
|
|
|
|
os.close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void GscanJsonConfig::WriteJsonArrayToFile(std::vector<GScanCap> cfgArray, const std::string filename)
|
|
|
|
|
{
|
|
|
|
|
neb::CJsonObject root;
|
|
|
|
|
root.AddEmptySubObject("Config");
|
|
|
|
|
/*< basic setting*/
|
|
|
|
|
root["Config"].AddEmptySubArray(PIXTYPE);
|
2020-12-17 09:02:33 +00:00
|
|
|
|
root["Config"].AddEmptySubArray(AUTOMATICCOLOR);
|
|
|
|
|
root["Config"].AddEmptySubArray(AUTOMATICCOLORTYPR);
|
2020-06-20 03:07:40 +00:00
|
|
|
|
root["Config"].AddEmptySubArray(PAPARSIZE);
|
|
|
|
|
root["Config"].AddEmptySubArray(PAPERALIGN);
|
2020-12-10 02:01:22 +00:00
|
|
|
|
root["Config"].AddEmptySubArray(ENSIZECHECK);
|
2020-06-20 03:07:40 +00:00
|
|
|
|
root["Config"].AddEmptySubArray(AUTOCROP);
|
|
|
|
|
root["Config"].AddEmptySubArray(RESOLUTION);
|
|
|
|
|
root["Config"].AddEmptySubArray(DUPLEX);
|
|
|
|
|
root["Config"].AddEmptySubArray(DISCARBLANK);
|
|
|
|
|
root["Config"].AddEmptySubArray(DISCARBLANKVINCE);
|
2020-12-09 08:02:51 +00:00
|
|
|
|
root["Config"].AddEmptySubArray(DISCARBLANK_VALUE);
|
2021-06-30 13:58:13 +00:00
|
|
|
|
#ifdef UV
|
|
|
|
|
root["Config"].AddEmptySubArray(ENUVMODEL);
|
|
|
|
|
#endif
|
2020-06-20 03:07:40 +00:00
|
|
|
|
//root["Config"].AddEmptySubArray(DB_AREANUM);
|
|
|
|
|
//root["Config"].AddEmptySubArray(DB_DEVNMAX);
|
|
|
|
|
root["Config"].AddEmptySubArray(FLOD);
|
|
|
|
|
root["Config"].AddEmptySubArray(SWITCHFRONTBACK);
|
2020-12-09 08:02:51 +00:00
|
|
|
|
root["Config"].AddEmptySubArray(DETACHNOISE);
|
|
|
|
|
root["Config"].AddEmptySubArray(DETACHNOISEVALUE);
|
2022-02-14 02:30:19 +00:00
|
|
|
|
root["Config"].AddEmptySubArray(FADEBACK);
|
|
|
|
|
root["Config"].AddEmptySubArray(FADEBACKRANGE);
|
2020-06-20 03:07:40 +00:00
|
|
|
|
/*< brightness setting*/
|
|
|
|
|
root["Config"].AddEmptySubArray(BRIGHTNESS);
|
|
|
|
|
root["Config"].AddEmptySubArray(AUTOCONTRAST);
|
|
|
|
|
root["Config"].AddEmptySubArray(CONTRAST);
|
|
|
|
|
root["Config"].AddEmptySubArray(GAMMA_);
|
|
|
|
|
|
|
|
|
|
/*< image process settings*/
|
|
|
|
|
root["Config"].AddEmptySubArray(FILTERTYPE);
|
|
|
|
|
root["Config"].AddEmptySubArray(ENHANCECOLOR);
|
|
|
|
|
root["Config"].AddEmptySubArray(SHARPENTYPE);
|
|
|
|
|
root["Config"].AddEmptySubArray(AUTODESCREW);
|
|
|
|
|
root["Config"].AddEmptySubArray(FILLBLACK);
|
|
|
|
|
root["Config"].AddEmptySubArray(MULTIOUTPUT);
|
|
|
|
|
root["Config"].AddEmptySubArray(OUTHOLE);
|
|
|
|
|
root["Config"].AddEmptySubArray(OUTHOLERATIO);
|
2022-09-20 01:08:11 +00:00
|
|
|
|
root["Config"].AddEmptySubArray(OUTHOLERATIOUP);
|
|
|
|
|
root["Config"].AddEmptySubArray(OUTHOLERATIODOWN);
|
|
|
|
|
root["Config"].AddEmptySubArray(OUTHOLERATIOLEFT);
|
|
|
|
|
root["Config"].AddEmptySubArray(OUTHOLERATIORIGHT);
|
|
|
|
|
root["Config"].AddEmptySubArray(EN_OUTHOLERATIOUP);
|
|
|
|
|
root["Config"].AddEmptySubArray(EN_OUTHOLERATIODOWN);
|
|
|
|
|
root["Config"].AddEmptySubArray(EN_OUTHOLERATIOLEFT);
|
|
|
|
|
root["Config"].AddEmptySubArray(EN_OUTHOLERATIORIGHT);
|
2020-06-23 09:31:43 +00:00
|
|
|
|
root["Config"].AddEmptySubArray(HSVCORRECT);
|
2022-11-18 05:56:31 +00:00
|
|
|
|
root["Config"].AddEmptySubArray(ANSWERSHEETFILTER);
|
|
|
|
|
|
2020-06-20 03:07:40 +00:00
|
|
|
|
/*< feeder settings*/
|
|
|
|
|
root["Config"].AddEmptySubArray(ULTRADETECT);
|
|
|
|
|
root["Config"].AddEmptySubArray(BINDINGDETECT);
|
|
|
|
|
root["Config"].AddEmptySubArray(SCANCOUNT);
|
|
|
|
|
root["Config"].AddEmptySubArray(DOCORIENTATION);
|
|
|
|
|
root["Config"].AddEmptySubArray(AUTO_TEXT);
|
|
|
|
|
root["Config"].AddEmptySubArray(BACKROTATE180);
|
2020-11-16 10:05:04 +00:00
|
|
|
|
root["Config"].AddEmptySubArray(DOGEAR_DETECTION);
|
2020-06-20 03:07:40 +00:00
|
|
|
|
root["Config"].AddEmptySubArray(SCREWDETECT);
|
|
|
|
|
root["Config"].AddEmptySubArray(SCREWLEVEL);
|
2020-12-09 08:02:51 +00:00
|
|
|
|
root["Config"].AddEmptySubArray(NOISE);
|
|
|
|
|
root["Config"].AddEmptySubArray(INDENT);
|
|
|
|
|
root["Config"].AddEmptySubArray(AUTOCROP_THRESHOLD);
|
|
|
|
|
root["Config"].AddEmptySubArray(ISCONVEX);
|
2021-11-20 03:09:04 +00:00
|
|
|
|
root["Config"].AddEmptySubArray(DOGEAR_DISTANCE);
|
2020-06-20 03:07:40 +00:00
|
|
|
|
|
|
|
|
|
/*< other settings*/
|
|
|
|
|
root["Config"].AddEmptySubArray(ITEMCAPTION);
|
|
|
|
|
root["Config"].AddEmptySubArray(SAVEPATH);
|
|
|
|
|
for (int i = 0; i < cfgArray.size(); i++)
|
|
|
|
|
{
|
|
|
|
|
root["Config"][PIXTYPE].Add((int)cfgArray[i].pixtype);
|
2020-12-17 09:02:33 +00:00
|
|
|
|
root["Config"][AUTOMATICCOLOR].Add(i,(bool)cfgArray[i].automaticcolor);
|
|
|
|
|
root["Config"][AUTOMATICCOLORTYPR].Add((int)cfgArray[i].automaticcolortype);
|
2020-06-20 03:07:40 +00:00
|
|
|
|
root["Config"][PAPARSIZE].Add((int)cfgArray[i].papertype);
|
|
|
|
|
root["Config"][PAPERALIGN].Add((int)cfgArray[i].paperAlign);
|
2020-12-10 02:01:22 +00:00
|
|
|
|
root["Config"][ENSIZECHECK].Add(i, (bool)cfgArray[i].en_sizecheck);
|
2022-05-24 12:05:47 +00:00
|
|
|
|
root["Config"][ENFIXEDPAPER].Add(i, (bool)cfgArray[i].en_fixedpaper);
|
2020-06-20 03:07:40 +00:00
|
|
|
|
root["Config"][AUTOCROP].Add(i, (bool)cfgArray[i].is_autocrop);
|
2022-05-24 12:05:47 +00:00
|
|
|
|
root["Config"][HIGH_IMAGE_QUALITY].Add(i, (bool)cfgArray[i].is_high_imagequality);
|
2020-07-11 10:43:17 +00:00
|
|
|
|
root["Config"][RESOLUTION].Add((int)cfgArray[i].resolution_dst);
|
2020-06-20 03:07:40 +00:00
|
|
|
|
root["Config"][DUPLEX].Add(i,(bool)cfgArray[i].is_duplex);
|
|
|
|
|
root["Config"][DISCARBLANK].Add(i, (bool)cfgArray[i].is_autodiscradblank_normal);
|
|
|
|
|
root["Config"][DISCARBLANKVINCE].Add(i, (bool)cfgArray[i].is_autodiscradblank_vince);
|
2020-12-09 08:02:51 +00:00
|
|
|
|
root["Config"][DISCARBLANK_VALUE].Add((int)cfgArray[i].discardblank_percent);
|
2020-06-20 03:07:40 +00:00
|
|
|
|
//root["Config"][DB_AREANUM].Add(cfgArray[i].DBlank_AreaNum);
|
|
|
|
|
//root["Config"][DB_DEVNMAX].Add(cfgArray[i].DBlank_DevnMax);
|
|
|
|
|
root["Config"][FLOD].Add(i, (bool)cfgArray[i].en_fold);
|
|
|
|
|
root["Config"][SWITCHFRONTBACK].Add(i,(bool)cfgArray[i].is_switchfrontback);
|
2021-12-16 08:21:35 +00:00
|
|
|
|
root["Config"][SPLIT].Add(i, cfgArray[i].is_split);
|
2021-06-30 13:58:13 +00:00
|
|
|
|
#ifdef UV
|
|
|
|
|
root["Config"][ENUVMODEL].Add(i, cfgArray[i].hardwarecaps.en_uv);
|
|
|
|
|
#endif
|
2020-07-11 10:43:17 +00:00
|
|
|
|
root["Config"][BRIGHTNESS].Add((int)cfgArray[i].brightness);
|
2020-06-20 03:07:40 +00:00
|
|
|
|
root["Config"][AUTOCONTRAST].Add(i, (bool)cfgArray[i].is_autocontrast);
|
2020-07-11 10:43:17 +00:00
|
|
|
|
root["Config"][CONTRAST].Add((int)cfgArray[i].contrast);
|
|
|
|
|
root["Config"][GAMMA_].Add((double)cfgArray[i].gamma);
|
2020-06-20 03:07:40 +00:00
|
|
|
|
|
|
|
|
|
root["Config"][FILTERTYPE].Add((int)cfgArray[i].filter);
|
|
|
|
|
root["Config"][ENHANCECOLOR].Add((int)cfgArray[i].enhance_color);
|
|
|
|
|
root["Config"][SHARPENTYPE].Add((int)cfgArray[i].sharpen);
|
|
|
|
|
root["Config"][AUTODESCREW].Add(i, (bool)cfgArray[i].autodescrew);
|
|
|
|
|
root["Config"][FILLBLACK].Add(i, (bool)cfgArray[i].fillbackground);
|
|
|
|
|
root["Config"][MULTIOUTPUT].Add(i, (bool)cfgArray[i].multi_output_red);
|
2022-05-24 12:05:47 +00:00
|
|
|
|
root["Config"][EN_MULTIOUT].Add(i, (bool)cfgArray[i].en_multi_output);
|
|
|
|
|
root["Config"][MULTIOUTTYPE].Add((int)cfgArray[i].multioutput);
|
2020-06-20 03:07:40 +00:00
|
|
|
|
root["Config"][OUTHOLE].Add(i, (bool)cfgArray[i].fillhole.is_fillhole);
|
2020-07-11 10:43:17 +00:00
|
|
|
|
root["Config"][OUTHOLERATIO].Add((int)cfgArray[i].fillhole.fillholeratio);
|
2022-09-20 01:08:11 +00:00
|
|
|
|
root["Config"][OUTHOLERATIOUP].Add ((int)(cfgArray[i].fillholeratio_up));
|
|
|
|
|
root["Config"][OUTHOLERATIODOWN].Add((int)(cfgArray[i].fillholeratio_down));
|
|
|
|
|
root["Config"][OUTHOLERATIOLEFT].Add((int)(cfgArray[i].fillholeratio_left));
|
|
|
|
|
root["Config"][OUTHOLERATIORIGHT].Add((int)(cfgArray[i].fillholeratio_right));
|
|
|
|
|
root["Config"][EN_OUTHOLERATIOUP].Add((int)(cfgArray[i].en_fillholeratio_up));
|
|
|
|
|
root["Config"][EN_OUTHOLERATIODOWN].Add((int)(cfgArray[i].en_fillholeratio_down));
|
|
|
|
|
root["Config"][EN_OUTHOLERATIOLEFT].Add((int)(cfgArray[i].en_fillholeratio_left));
|
|
|
|
|
root["Config"][EN_OUTHOLERATIORIGHT].Add((int)(cfgArray[i].en_fillholeratio_right));
|
|
|
|
|
|
2020-12-09 08:02:51 +00:00
|
|
|
|
root["Config"][DETACHNOISE].Add(i, (bool)cfgArray[i].detachnoise.is_detachnoise);
|
|
|
|
|
root["Config"][DETACHNOISEVALUE].Add((int)cfgArray[i].detachnoise.detachnoise);
|
2022-02-14 02:30:19 +00:00
|
|
|
|
root["Config"][FADEBACK].Add(i, (bool)cfgArray[i].fadeback);
|
|
|
|
|
root["Config"][FADEBACKRANGE].Add((int)cfgArray[i].fadeback_range);
|
2020-06-23 09:31:43 +00:00
|
|
|
|
root["Config"][HSVCORRECT].Add(i, (bool)cfgArray[i].hsvcorrect);
|
2022-11-18 05:56:31 +00:00
|
|
|
|
root["Config"][ANSWERSHEETFILTER].Add((int)cfgArray[i].hsvFilter);
|
|
|
|
|
|
2020-06-20 03:07:40 +00:00
|
|
|
|
root["Config"][ULTRADETECT].Add(i, (bool)cfgArray[i].hardwarecaps.en_doublefeed);
|
|
|
|
|
root["Config"][BINDINGDETECT].Add(i, (bool)cfgArray[i].hardwarecaps.en_stapledetect);
|
2021-12-16 08:21:35 +00:00
|
|
|
|
root["Config"][AUTOPAPER].Add(i, (bool)cfgArray[i].hardwarecaps.is_autopaper);
|
2022-10-20 02:40:25 +00:00
|
|
|
|
root["Config"][AUTOPAPERTIMEOUT].Add((int)cfgArray[i].autopaper_timeout);
|
2020-06-20 03:07:40 +00:00
|
|
|
|
root["Config"][SCANCOUNT].Add((int)cfgArray[i].scannum);
|
2020-07-11 10:43:17 +00:00
|
|
|
|
root["Config"][DOCORIENTATION].Add((int)cfgArray[i].imageRotateDegree);
|
2020-06-20 03:07:40 +00:00
|
|
|
|
root["Config"][AUTO_TEXT].Add(i, (bool)cfgArray[i].is_autotext);
|
|
|
|
|
root["Config"][BACKROTATE180].Add(i, (bool)cfgArray[i].is_backrotate180);
|
2020-12-09 08:02:51 +00:00
|
|
|
|
root["Config"][NOISE].Add((int)cfgArray[i].noise);
|
|
|
|
|
root["Config"][INDENT].Add((int)cfgArray[i].indent);
|
|
|
|
|
root["Config"][ISCONVEX].Add(i, (bool)cfgArray[i].is_convex);
|
|
|
|
|
root["Config"][AUTOCROP_THRESHOLD].Add((int)cfgArray[i].AutoCrop_threshold);
|
2020-11-16 10:05:04 +00:00
|
|
|
|
root["Config"][DOGEAR_DETECTION].Add(i, (bool)cfgArray[i].is_dogeardetection);
|
2021-11-20 03:09:04 +00:00
|
|
|
|
root["Config"][DOGEAR_DISTANCE].Add((int)cfgArray[i].dogeardistance);
|
2020-06-20 03:07:40 +00:00
|
|
|
|
root["Config"][SCREWDETECT].Add(i, (bool)cfgArray[i].hardwarecaps.en_skrewdetect);
|
2020-07-11 10:43:17 +00:00
|
|
|
|
root["Config"][SCREWLEVEL].Add((int)cfgArray[i].hardwarecaps.skrewdetectlevel);
|
2020-06-20 03:07:40 +00:00
|
|
|
|
|
|
|
|
|
if (cfgArray[i].Caption.c_str() != NULL)
|
|
|
|
|
{
|
|
|
|
|
root["Config"][ITEMCAPTION].Add(cfgArray[i].Caption);
|
|
|
|
|
}
|
|
|
|
|
if (cfgArray[i].SavePath.c_str() != NULL)
|
|
|
|
|
{
|
|
|
|
|
root["Config"][SAVEPATH].Add(cfgArray[i].SavePath);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
std::ofstream os;
|
|
|
|
|
os.open(filename.c_str());
|
|
|
|
|
os << root.ToFormattedString();
|
|
|
|
|
os.close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GScanCap GscanJsonConfig::ReadGscanCap()
|
|
|
|
|
{
|
|
|
|
|
TCHAR szIniFile[MAX_PATH] = { 0 };
|
|
|
|
|
SHGetSpecialFolderPath(NULL, szIniFile, CSIDL_LOCAL_APPDATA, TRUE);
|
|
|
|
|
_tcscat(szIniFile, HUAGAO_SCAN);
|
|
|
|
|
_tcscat(szIniFile, TWAIN_INIPATH);
|
|
|
|
|
_tcscat(szIniFile, TEXT("\\"));
|
|
|
|
|
std::string dirpath = TCHAR2STRING(szIniFile);
|
2021-01-22 07:37:46 +00:00
|
|
|
|
bool is_exist = isFileExist(dirpath+ TCHAR2STRING(TWAIN_JSON_NAME));
|
2021-04-13 09:30:05 +00:00
|
|
|
|
try {
|
|
|
|
|
if (is_exist)
|
2021-01-22 07:37:46 +00:00
|
|
|
|
return JsonToGscancap(Readjson(dirpath + TCHAR2STRING(TWAIN_JSON_NAME)));
|
2021-04-13 09:30:05 +00:00
|
|
|
|
else {
|
|
|
|
|
throw std::exception();
|
|
|
|
|
}
|
2020-06-20 03:07:40 +00:00
|
|
|
|
}
|
2021-04-13 09:30:05 +00:00
|
|
|
|
catch (...){
|
2021-05-13 10:13:08 +00:00
|
|
|
|
FileTools::writelog(log_ERROR, "ReadGscanCap Error");
|
2021-04-13 09:30:05 +00:00
|
|
|
|
remove((dirpath + TCHAR2STRING(TWAIN_JSON_NAME)).c_str());
|
|
|
|
|
createDirectory((char*)dirpath.c_str());
|
|
|
|
|
SaveGscancapJson(JsonToGscancap(GetDefaultJson()), dirpath + TCHAR2STRING(TWAIN_JSON_NAME));
|
|
|
|
|
return JsonToGscancap(Readjson(dirpath + TCHAR2STRING(TWAIN_JSON_NAME)));
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-22 07:37:46 +00:00
|
|
|
|
//if (!is_exist) {
|
|
|
|
|
// createDirectory((char*)dirpath.c_str());
|
|
|
|
|
|
|
|
|
|
// _tcscat(szIniFile, TWAIN_JSON_NAME);
|
|
|
|
|
// std::string dstpath = TCHAR2STRING(szIniFile);
|
|
|
|
|
// vector<GScanCap> vc;
|
|
|
|
|
// vc.push_back(GetDefaultGscancapValue());
|
|
|
|
|
// WriteJsonArrayToFile(vc, dstpath);
|
|
|
|
|
// return vc[0];
|
|
|
|
|
//}
|
|
|
|
|
//_tcscat(szIniFile, TWAIN_JSON_NAME);
|
|
|
|
|
//std::string s_default = TCHAR2STRING(szIniFile);
|
|
|
|
|
|
|
|
|
|
//vector<GScanCap> vc;
|
|
|
|
|
//vc = ReadGscanCapsVector(s_default.c_str());
|
|
|
|
|
//if (vc.size() != 0)
|
|
|
|
|
//{
|
|
|
|
|
// return vc[0];
|
|
|
|
|
//}
|
|
|
|
|
//return GetDefaultGscancapValue();
|
2020-06-20 03:07:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::vector<GScanCap> GscanJsonConfig::ReadGscanCapsVector(const std::string gcapsfilepath)
|
|
|
|
|
{
|
|
|
|
|
std::vector<GScanCap> re;
|
|
|
|
|
FILE* file = fopen(gcapsfilepath.c_str(), "rb");
|
|
|
|
|
if (!file)
|
|
|
|
|
{
|
|
|
|
|
return re;
|
|
|
|
|
}
|
|
|
|
|
fseek(file, 0, SEEK_END);
|
|
|
|
|
long size = ftell(file);
|
|
|
|
|
fseek(file, 0, SEEK_SET);
|
|
|
|
|
std::string text;
|
|
|
|
|
char* buffer = new char[size + 1];
|
|
|
|
|
buffer[size] = 0;
|
|
|
|
|
if (!fread(buffer, 1, size, file) == (unsigned long)size)
|
|
|
|
|
{
|
|
|
|
|
return re;
|
|
|
|
|
}
|
|
|
|
|
text = buffer;
|
|
|
|
|
fclose(file);
|
|
|
|
|
delete[]buffer;
|
|
|
|
|
re = parseJsonFromString(text);
|
|
|
|
|
return re;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool GscanJsonConfig::DeleteJsonFile(std::string path)
|
|
|
|
|
{
|
|
|
|
|
return remove(path.c_str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::vector<GScanCap> GscanJsonConfig::parseJsonFromString(const std::string str)
|
|
|
|
|
{
|
|
|
|
|
neb::CJsonObject root(str);
|
|
|
|
|
vector<GScanCap> vcConfig;
|
|
|
|
|
int size = 0;
|
|
|
|
|
neb::CJsonObject itmPaparSize;
|
|
|
|
|
root["Config"].Get(PAPARSIZE, itmPaparSize);
|
|
|
|
|
size = itmPaparSize.GetArraySize();
|
|
|
|
|
if (size > 0)
|
|
|
|
|
{
|
|
|
|
|
neb::CJsonObject itmPixType;
|
|
|
|
|
root["Config"].Get(PIXTYPE, itmPixType);
|
2020-12-17 09:02:33 +00:00
|
|
|
|
neb::CJsonObject itmautomaticcolor;
|
|
|
|
|
root["Config"].Get(AUTOMATICCOLOR, itmautomaticcolor);
|
|
|
|
|
neb::CJsonObject itmautomaticcolortype;
|
|
|
|
|
root["Config"].Get(AUTOMATICCOLORTYPR, itmautomaticcolortype);
|
2020-06-20 03:07:40 +00:00
|
|
|
|
neb::CJsonObject itmAutoCrop;
|
|
|
|
|
root["Config"].Get(AUTOCROP, itmAutoCrop);
|
2022-05-24 12:05:47 +00:00
|
|
|
|
neb::CJsonObject itmImageQuality;
|
|
|
|
|
root["Config"].Get(HIGH_IMAGE_QUALITY, itmImageQuality);
|
2020-06-20 03:07:40 +00:00
|
|
|
|
neb::CJsonObject itmPaperAlign;
|
|
|
|
|
root["Config"].Get(PAPERALIGN, itmPaperAlign);
|
2020-12-10 02:01:22 +00:00
|
|
|
|
neb::CJsonObject itmSizeCheck;
|
|
|
|
|
root["Config"].Get(ENSIZECHECK, itmSizeCheck);
|
2022-05-24 12:05:47 +00:00
|
|
|
|
neb::CJsonObject itmFixedPaper;
|
|
|
|
|
root["Config"].Get(ENFIXEDPAPER, itmFixedPaper);
|
2020-06-20 03:07:40 +00:00
|
|
|
|
neb::CJsonObject itmRes;
|
|
|
|
|
root["Config"].Get(RESOLUTION, itmRes);
|
|
|
|
|
neb::CJsonObject itmDulpex;
|
|
|
|
|
root["Config"].Get(DUPLEX, itmDulpex);
|
|
|
|
|
neb::CJsonObject itmDiscardBlk;
|
|
|
|
|
root["Config"].Get(DISCARBLANK, itmDiscardBlk);
|
|
|
|
|
neb::CJsonObject itmDiscardBlkVince;
|
|
|
|
|
root["Config"].Get(DISCARBLANKVINCE, itmDiscardBlkVince);
|
2020-07-11 10:43:17 +00:00
|
|
|
|
//neb::CJsonObject itmDBAreaNum;
|
|
|
|
|
//root["Config"].Get(DB_AREANUM, itmDBAreaNum);
|
|
|
|
|
//neb::CJsonObject itmDBDevnMax;
|
|
|
|
|
//root["Config"].Get(DB_DEVNMAX, itmDBDevnMax);
|
2020-06-20 03:07:40 +00:00
|
|
|
|
neb::CJsonObject itmEnFlod;
|
|
|
|
|
root["Config"].Get(FLOD, itmEnFlod);
|
|
|
|
|
neb::CJsonObject itmEnSwitchFrontBack;
|
|
|
|
|
root["Config"].Get(SWITCHFRONTBACK, itmEnSwitchFrontBack);
|
2021-12-16 08:21:35 +00:00
|
|
|
|
neb::CJsonObject itmEnSplit;
|
|
|
|
|
root["Config"].Get(SPLIT, itmEnSplit);
|
|
|
|
|
|
2020-12-09 08:02:51 +00:00
|
|
|
|
neb::CJsonObject itmdiscarbrank_value;
|
|
|
|
|
root["Config"].Get(DISCARBLANK_VALUE, itmdiscarbrank_value);
|
2021-06-30 13:58:13 +00:00
|
|
|
|
#ifdef UV
|
|
|
|
|
neb::CJsonObject itmEnUV;
|
|
|
|
|
root["Config"].Get(ENUVMODEL, itmEnUV);
|
|
|
|
|
#endif
|
2020-06-20 03:07:40 +00:00
|
|
|
|
neb::CJsonObject itmBrtnes;
|
|
|
|
|
root["Config"].Get(BRIGHTNESS, itmBrtnes);
|
|
|
|
|
neb::CJsonObject itmAutoCrnt;
|
|
|
|
|
root["Config"].Get(AUTOCONTRAST, itmAutoCrnt);
|
|
|
|
|
neb::CJsonObject itmContrast;
|
|
|
|
|
root["Config"].Get(CONTRAST, itmContrast);
|
|
|
|
|
neb::CJsonObject itmGamma;
|
|
|
|
|
root["Config"].Get(GAMMA_, itmGamma);
|
|
|
|
|
|
|
|
|
|
neb::CJsonObject itmFilter;
|
|
|
|
|
root["Config"].Get(FILTERTYPE, itmFilter);
|
|
|
|
|
neb::CJsonObject itmEnchace;
|
|
|
|
|
root["Config"].Get(ENHANCECOLOR, itmEnchace);
|
|
|
|
|
neb::CJsonObject itmSharpen;
|
|
|
|
|
root["Config"].Get(SHARPENTYPE, itmSharpen);
|
|
|
|
|
neb::CJsonObject itmAutoDescrew;
|
|
|
|
|
root["Config"].Get(AUTODESCREW, itmAutoDescrew);
|
|
|
|
|
neb::CJsonObject itmFillBlack;
|
|
|
|
|
root["Config"].Get(FILLBLACK, itmFillBlack);
|
|
|
|
|
neb::CJsonObject itmMultiOutput;
|
|
|
|
|
root["Config"].Get(MULTIOUTPUT, itmMultiOutput);
|
2022-05-24 12:05:47 +00:00
|
|
|
|
neb::CJsonObject itmEnMultiOut;
|
|
|
|
|
root["Config"].Get(EN_MULTIOUT, itmEnMultiOut);
|
|
|
|
|
neb::CJsonObject itmMultiOutType;
|
|
|
|
|
root["Config"].Get(MULTIOUTTYPE, itmMultiOutType);
|
2020-06-20 03:07:40 +00:00
|
|
|
|
neb::CJsonObject itmOutHole;
|
|
|
|
|
root["Config"].Get(OUTHOLE, itmOutHole);
|
|
|
|
|
neb::CJsonObject itmOutHoleRatio;
|
|
|
|
|
root["Config"].Get(OUTHOLERATIO, itmOutHoleRatio);
|
2022-09-20 01:08:11 +00:00
|
|
|
|
|
|
|
|
|
neb::CJsonObject itmOutHoleRatioUp;
|
|
|
|
|
root["Config"].Get(OUTHOLERATIOUP, itmOutHoleRatioUp);
|
|
|
|
|
neb::CJsonObject itmOutHoleRatioDown;
|
|
|
|
|
root["Config"].Get(OUTHOLERATIODOWN, itmOutHoleRatioDown);
|
|
|
|
|
neb::CJsonObject itmOutHoleRatioLeft;
|
|
|
|
|
root["Config"].Get(OUTHOLERATIOLEFT, itmOutHoleRatioLeft);
|
|
|
|
|
neb::CJsonObject itmOutHoleRatioRight;
|
|
|
|
|
root["Config"].Get(OUTHOLERATIORIGHT, itmOutHoleRatioRight);
|
|
|
|
|
neb::CJsonObject itmEnOutHoleRatioUp;
|
|
|
|
|
root["Config"].Get(EN_OUTHOLERATIOUP, itmEnOutHoleRatioUp);
|
|
|
|
|
neb::CJsonObject itmEnOutHoleRatioDown;
|
|
|
|
|
root["Config"].Get(EN_OUTHOLERATIODOWN, itmEnOutHoleRatioDown);
|
|
|
|
|
neb::CJsonObject itmEnOutHoleRatioLeft;
|
|
|
|
|
root["Config"].Get(EN_OUTHOLERATIOLEFT, itmEnOutHoleRatioLeft);
|
|
|
|
|
neb::CJsonObject itmENOutHoleRatioRight;
|
|
|
|
|
root["Config"].Get(EN_OUTHOLERATIORIGHT, itmENOutHoleRatioRight);
|
|
|
|
|
|
2020-12-09 08:02:51 +00:00
|
|
|
|
neb::CJsonObject itmDetachNoise;
|
|
|
|
|
root["Config"].Get(DETACHNOISE, itmDetachNoise);
|
|
|
|
|
neb::CJsonObject itmDetachNoiseValue;
|
|
|
|
|
root["Config"].Get(DETACHNOISEVALUE, itmDetachNoiseValue);
|
2022-02-14 02:30:19 +00:00
|
|
|
|
|
|
|
|
|
neb::CJsonObject itmFadeBack;
|
|
|
|
|
root["Config"].Get(FADEBACK, itmFadeBack);
|
|
|
|
|
neb::CJsonObject itmFadeBackValue;
|
|
|
|
|
root["Config"].Get(FADEBACKRANGE, itmFadeBackValue);
|
2020-06-23 09:31:43 +00:00
|
|
|
|
neb::CJsonObject itmHsvCorrect;
|
|
|
|
|
root["Config"].Get(HSVCORRECT, itmHsvCorrect);
|
2022-11-18 05:56:31 +00:00
|
|
|
|
neb::CJsonObject itmHsvfilter;
|
|
|
|
|
root["Config"].Get(ANSWERSHEETFILTER, itmHsvfilter);
|
|
|
|
|
|
2020-06-20 03:07:40 +00:00
|
|
|
|
|
|
|
|
|
neb::CJsonObject itmUltDetect;
|
|
|
|
|
root["Config"].Get(ULTRADETECT, itmUltDetect);
|
|
|
|
|
neb::CJsonObject itmBingdingDetect;
|
|
|
|
|
root["Config"].Get(BINDINGDETECT, itmBingdingDetect);
|
2021-12-16 08:21:35 +00:00
|
|
|
|
neb::CJsonObject itmAutoPaper;
|
|
|
|
|
root["Config"].Get(AUTOPAPER, itmAutoPaper);
|
2022-10-20 02:40:25 +00:00
|
|
|
|
neb::CJsonObject itmAutoPaperTimeOut;
|
|
|
|
|
root["Config"].Get(AUTOPAPERTIMEOUT, itmAutoPaperTimeOut);
|
2020-06-20 03:07:40 +00:00
|
|
|
|
neb::CJsonObject itmScanCount;
|
|
|
|
|
root["Config"].Get(SCANCOUNT, itmScanCount);
|
|
|
|
|
neb::CJsonObject itmDocOrientation;
|
|
|
|
|
root["Config"].Get(DOCORIENTATION, itmDocOrientation);
|
|
|
|
|
neb::CJsonObject itmAutotext;
|
|
|
|
|
root["Config"].Get(AUTO_TEXT, itmAutotext);
|
|
|
|
|
neb::CJsonObject itmBackRotate;
|
|
|
|
|
root["Config"].Get(BACKROTATE180, itmBackRotate);
|
2020-12-09 08:02:51 +00:00
|
|
|
|
neb::CJsonObject itmNoise;
|
|
|
|
|
root["Config"].Get(NOISE, itmNoise);
|
|
|
|
|
neb::CJsonObject itmIndent;
|
|
|
|
|
root["Config"].Get(INDENT, itmIndent);
|
|
|
|
|
neb::CJsonObject itmisConvex;
|
|
|
|
|
root["Config"].Get(ISCONVEX, itmisConvex);
|
|
|
|
|
neb::CJsonObject itmAutoCrop_t;
|
|
|
|
|
root["Config"].Get(AUTOCROP_THRESHOLD, itmAutoCrop_t);
|
2020-11-16 10:05:04 +00:00
|
|
|
|
neb::CJsonObject itmdogeardetection;
|
|
|
|
|
root["Config"].Get(DOGEAR_DETECTION, itmdogeardetection);
|
2021-11-20 03:09:04 +00:00
|
|
|
|
neb::CJsonObject itmdogdistance;
|
|
|
|
|
root["Config"].Get(DOGEAR_DISTANCE, itmdogdistance);
|
2020-06-20 03:07:40 +00:00
|
|
|
|
neb::CJsonObject itmScrewDetct;
|
|
|
|
|
root["Config"].Get(SCREWDETECT, itmScrewDetct);
|
|
|
|
|
neb::CJsonObject itmScrewLevel;
|
|
|
|
|
root["Config"].Get(SCREWLEVEL, itmScrewLevel);
|
|
|
|
|
|
|
|
|
|
neb::CJsonObject itmCaption;
|
|
|
|
|
if (!root["Config"][ITEMCAPTION].IsEmpty())
|
|
|
|
|
{
|
|
|
|
|
root["Config"].Get(ITEMCAPTION, itmCaption);
|
|
|
|
|
}
|
|
|
|
|
neb::CJsonObject itmSavePtah;
|
|
|
|
|
if (!root["Config"][SAVEPATH].IsEmpty())
|
|
|
|
|
{
|
|
|
|
|
root["Config"].Get(SAVEPATH, itmSavePtah);
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i < size; i++)
|
|
|
|
|
{
|
|
|
|
|
GScanCap cfp;
|
|
|
|
|
int i_value;
|
|
|
|
|
double f_value;
|
|
|
|
|
bool b_value;
|
|
|
|
|
std::string s_value;
|
|
|
|
|
|
|
|
|
|
itmPixType.Get(i, i_value);
|
|
|
|
|
cfp.pixtype = i_value;
|
2020-12-17 09:02:33 +00:00
|
|
|
|
itmautomaticcolor.Get(i, b_value);
|
|
|
|
|
cfp.automaticcolor = b_value;
|
|
|
|
|
itmautomaticcolortype.Get(i, i_value);
|
|
|
|
|
cfp.automaticcolortype = i_value;
|
2020-06-20 03:07:40 +00:00
|
|
|
|
itmPaparSize.Get(i, i_value);
|
|
|
|
|
cfp.papertype = (byte)i_value;
|
|
|
|
|
itmPaperAlign.Get(i, i_value);
|
|
|
|
|
cfp.paperAlign = (PaperAlign)i_value;
|
2020-12-10 02:01:22 +00:00
|
|
|
|
itmSizeCheck.Get(i, b_value);
|
|
|
|
|
cfp.en_sizecheck = b_value ? 1 : 0;
|
2022-05-24 12:05:47 +00:00
|
|
|
|
itmFixedPaper.Get(i, b_value);
|
|
|
|
|
cfp.en_fixedpaper = b_value ? 1 : 0;
|
2020-06-20 03:07:40 +00:00
|
|
|
|
itmAutoCrop.Get(i, b_value);
|
|
|
|
|
cfp.is_autocrop = b_value ? 1 : 0;
|
2022-05-24 12:05:47 +00:00
|
|
|
|
itmImageQuality.Get(i, b_value);
|
|
|
|
|
cfp.is_high_imagequality = b_value ? 1 : 0;
|
2020-06-20 03:07:40 +00:00
|
|
|
|
itmRes.Get(i, i_value);
|
|
|
|
|
cfp.resolution_dst = i_value;
|
|
|
|
|
itmDulpex.Get(i, b_value);
|
|
|
|
|
cfp.is_duplex = b_value ? 1 : 0;
|
2020-12-09 08:02:51 +00:00
|
|
|
|
itmdiscarbrank_value.Get(i, i_value);
|
|
|
|
|
cfp.discardblank_percent = i_value;
|
2020-06-20 03:07:40 +00:00
|
|
|
|
itmDiscardBlk.Get(i, b_value);
|
|
|
|
|
cfp.is_autodiscradblank_normal = b_value ? 1 : 0;
|
|
|
|
|
itmDiscardBlkVince.Get(i, b_value);
|
|
|
|
|
cfp.is_autodiscradblank_vince = b_value ? 1 : 0;
|
|
|
|
|
//itmDBAreaNum.Get(i, i_value);
|
|
|
|
|
//cfp.DBlank_AreaNum = i_value;
|
|
|
|
|
//itmDBDevnMax.Get(i, i_value);
|
|
|
|
|
//cfp.DBlank_DevnMax = i_value;
|
|
|
|
|
itmEnFlod.Get(i, b_value);
|
|
|
|
|
cfp.en_fold = b_value ? 1 : 0;
|
|
|
|
|
itmEnSwitchFrontBack.Get(i, b_value);
|
|
|
|
|
cfp.is_switchfrontback = b_value ? 1 : 0;
|
2021-12-16 08:21:35 +00:00
|
|
|
|
itmEnSplit.Get(i, b_value);
|
|
|
|
|
cfp.is_split = b_value ? 1 : 0;
|
2021-06-30 13:58:13 +00:00
|
|
|
|
#ifdef UV
|
2021-07-02 03:29:24 +00:00
|
|
|
|
itmEnUV.Get(i, b_value);
|
2021-06-30 13:58:13 +00:00
|
|
|
|
cfp.hardwarecaps.en_uv = b_value ? 1 : 0;
|
|
|
|
|
#endif
|
2022-02-14 02:30:19 +00:00
|
|
|
|
itmBrtnes.Get(i, i_value);
|
|
|
|
|
cfp.brightness = i_value;
|
2020-06-20 03:07:40 +00:00
|
|
|
|
itmAutoCrnt.Get(i, b_value);
|
|
|
|
|
cfp.is_autocontrast = b_value ? 1 : 0;
|
2020-07-11 10:43:17 +00:00
|
|
|
|
itmContrast.Get(i, i_value);
|
|
|
|
|
cfp.contrast = i_value;
|
2020-07-07 03:19:18 +00:00
|
|
|
|
itmGamma.Get(i, f_value);
|
|
|
|
|
cfp.gamma = f_value;
|
2020-06-20 03:07:40 +00:00
|
|
|
|
|
|
|
|
|
itmFilter.Get(i, i_value);
|
|
|
|
|
cfp.filter = i_value;
|
|
|
|
|
itmEnchace.Get(i, i_value);
|
|
|
|
|
cfp.enhance_color = i_value;
|
|
|
|
|
itmSharpen.Get(i, i_value);
|
|
|
|
|
cfp.sharpen = i_value;
|
|
|
|
|
itmAutoDescrew.Get(i, b_value);
|
|
|
|
|
cfp.autodescrew = b_value ? 1 : 0;
|
|
|
|
|
itmFillBlack.Get(i, b_value);
|
|
|
|
|
cfp.fillbackground = b_value ? 1 : 0;
|
|
|
|
|
itmMultiOutput.Get(i, b_value);
|
|
|
|
|
cfp.multi_output_red = b_value ? 1 : 0;
|
2022-05-24 12:05:47 +00:00
|
|
|
|
itmEnMultiOut.Get(i, b_value);
|
|
|
|
|
cfp.en_multi_output = b_value ? 1 : 0;
|
|
|
|
|
itmMultiOutType.Get(i, i_value);
|
|
|
|
|
cfp.multioutput = i_value;
|
2020-06-20 03:07:40 +00:00
|
|
|
|
itmOutHole.Get(i, b_value);
|
|
|
|
|
cfp.fillhole.is_fillhole = b_value ? 1 : 0;
|
|
|
|
|
itmOutHoleRatio.Get(i, i_value);
|
|
|
|
|
cfp.fillhole.fillholeratio = i_value;
|
2022-09-20 01:08:11 +00:00
|
|
|
|
itmOutHoleRatioUp.Get(i, i_value);
|
|
|
|
|
cfp.fillholeratio_up = i_value;
|
|
|
|
|
itmOutHoleRatioDown.Get(i, i_value);
|
|
|
|
|
cfp.fillholeratio_down = i_value;
|
|
|
|
|
itmOutHoleRatioLeft.Get(i, i_value);
|
|
|
|
|
cfp.fillholeratio_left = i_value;
|
|
|
|
|
itmOutHoleRatioRight.Get(i, i_value);
|
|
|
|
|
cfp.fillholeratio_right = i_value;
|
|
|
|
|
itmEnOutHoleRatioUp.Get(i, b_value);
|
|
|
|
|
cfp.en_fillholeratio_up = b_value ? 1 : 0;
|
|
|
|
|
itmEnOutHoleRatioDown.Get(i, b_value);
|
|
|
|
|
cfp.en_fillholeratio_down = b_value ? 1 : 0;
|
|
|
|
|
itmEnOutHoleRatioLeft.Get(i, b_value);
|
|
|
|
|
cfp.en_fillholeratio_left = b_value ? 1 : 0;
|
|
|
|
|
itmENOutHoleRatioRight.Get(i, b_value);
|
|
|
|
|
cfp.en_fillholeratio_right = b_value ? 1 : 0;
|
|
|
|
|
|
2020-12-09 08:02:51 +00:00
|
|
|
|
itmDetachNoise.Get(i, b_value);
|
|
|
|
|
cfp.detachnoise.is_detachnoise = b_value ? 1 : 0;
|
|
|
|
|
itmDetachNoiseValue.Get(i, i_value);
|
|
|
|
|
cfp.detachnoise.detachnoise = i_value;
|
2022-02-14 02:30:19 +00:00
|
|
|
|
itmFadeBack.Get(i, b_value);
|
|
|
|
|
cfp.fadeback = b_value ? 1 : 0;
|
|
|
|
|
itmFadeBackValue.Get(i, i_value);
|
|
|
|
|
cfp.fadeback_range = i_value;
|
2020-06-23 09:31:43 +00:00
|
|
|
|
itmHsvCorrect.Get(i, b_value);
|
|
|
|
|
cfp.hsvcorrect = b_value ? 1 : 0;
|
2022-11-18 05:56:31 +00:00
|
|
|
|
itmHsvfilter.Get(i, i_value);
|
|
|
|
|
cfp.hsvFilter = i_value;
|
2020-06-20 03:07:40 +00:00
|
|
|
|
|
|
|
|
|
itmUltDetect.Get(i, b_value);
|
|
|
|
|
cfp.hardwarecaps.en_doublefeed = b_value ? 1 : 0;
|
|
|
|
|
itmBingdingDetect.Get(i, b_value);
|
|
|
|
|
cfp.hardwarecaps.en_stapledetect = b_value ? 1 : 0;
|
2021-12-16 08:21:35 +00:00
|
|
|
|
itmAutoPaper.Get(i, b_value);
|
|
|
|
|
cfp.hardwarecaps.is_autopaper = b_value ? 1 : 0;
|
2022-10-20 02:40:25 +00:00
|
|
|
|
itmAutoPaperTimeOut.Get(i, i_value);
|
|
|
|
|
cfp.autopaper_timeout = i_value;
|
2020-06-20 03:07:40 +00:00
|
|
|
|
itmScanCount.Get(i, i_value);
|
|
|
|
|
cfp.scannum = i_value;
|
2020-07-11 10:43:17 +00:00
|
|
|
|
itmDocOrientation.Get(i, i_value);
|
|
|
|
|
cfp.imageRotateDegree = i_value;
|
2020-12-09 08:02:51 +00:00
|
|
|
|
itmAutoCrop_t.Get(i, i_value);
|
|
|
|
|
cfp.AutoCrop_threshold = i_value;
|
|
|
|
|
itmNoise.Get(i, i_value);
|
|
|
|
|
cfp.noise = i_value;
|
|
|
|
|
itmIndent.Get(i, i_value);
|
|
|
|
|
cfp.indent = i_value;
|
2020-06-20 03:07:40 +00:00
|
|
|
|
itmAutotext.Get(i, b_value);
|
|
|
|
|
cfp.is_autotext = b_value?1:0;
|
|
|
|
|
itmBackRotate.Get(i, b_value);
|
|
|
|
|
cfp.is_backrotate180 = b_value ? 1 : 0;
|
2020-12-09 08:02:51 +00:00
|
|
|
|
itmisConvex.Get(i, b_value);
|
|
|
|
|
cfp.is_convex = b_value ? 1 : 0;
|
2020-11-16 10:05:04 +00:00
|
|
|
|
itmdogeardetection.Get(i, b_value);
|
|
|
|
|
cfp.is_dogeardetection = b_value ? 1 : 0;
|
2021-11-20 03:09:04 +00:00
|
|
|
|
itmdogdistance.Get(i, i_value);
|
|
|
|
|
cfp.dogeardistance = i_value;
|
2020-06-20 03:07:40 +00:00
|
|
|
|
itmScrewDetct.Get(i, b_value);
|
|
|
|
|
cfp.hardwarecaps.en_skrewdetect = b_value ? 1 : 0;
|
|
|
|
|
itmScrewLevel.Get(i, i_value);
|
2020-07-07 01:53:32 +00:00
|
|
|
|
cfp.hardwarecaps.skrewdetectlevel = i_value;
|
2020-06-20 03:07:40 +00:00
|
|
|
|
|
|
|
|
|
if (!root["Config"][ITEMCAPTION].IsEmpty())
|
|
|
|
|
{
|
|
|
|
|
itmCaption.Get(i, s_value);
|
|
|
|
|
cfp.Caption = s_value;
|
|
|
|
|
}
|
|
|
|
|
if (!root["Config"][SAVEPATH].IsEmpty())
|
|
|
|
|
{
|
|
|
|
|
itmSavePtah.Get(i, s_value);
|
|
|
|
|
cfp.SavePath = s_value;
|
|
|
|
|
}
|
|
|
|
|
vcConfig.push_back(cfp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
GScanCap cfp;
|
|
|
|
|
int index;
|
|
|
|
|
bool bvalue;
|
2020-07-11 10:43:17 +00:00
|
|
|
|
double fvalue;
|
2020-06-20 03:07:40 +00:00
|
|
|
|
std::string svalue;
|
|
|
|
|
|
|
|
|
|
root["Config"].Get(PIXTYPE, index);
|
|
|
|
|
cfp.pixtype = index;
|
2020-12-17 09:02:33 +00:00
|
|
|
|
root["Config"].Get(AUTOMATICCOLOR, bvalue);
|
|
|
|
|
cfp.automaticcolor = bvalue;
|
|
|
|
|
root["Config"].Get(AUTOMATICCOLORTYPR, index);
|
|
|
|
|
cfp.automaticcolortype = index;
|
2020-06-20 03:07:40 +00:00
|
|
|
|
root["Config"].Get(PAPARSIZE, index);
|
|
|
|
|
cfp.papertype = index;
|
|
|
|
|
root["Config"].Get(PAPERALIGN, index);
|
|
|
|
|
cfp.paperAlign =(PaperAlign) index;
|
2020-12-10 02:01:22 +00:00
|
|
|
|
root["Config"].Get(ENSIZECHECK, bvalue);
|
|
|
|
|
cfp.en_sizecheck = bvalue ? 1 : 0;
|
2022-05-24 12:05:47 +00:00
|
|
|
|
root["Config"].Get(ENFIXEDPAPER, bvalue);
|
|
|
|
|
cfp.en_fixedpaper = bvalue ? 1 : 0;
|
2020-06-20 03:07:40 +00:00
|
|
|
|
root["Config"].Get(AUTOCROP, bvalue);
|
|
|
|
|
cfp.is_autocrop = bvalue?1:0;
|
2022-05-24 12:05:47 +00:00
|
|
|
|
root["Config"].Get(HIGH_IMAGE_QUALITY, bvalue);
|
|
|
|
|
cfp.is_high_imagequality = bvalue ? 1 : 0;
|
2020-06-20 03:07:40 +00:00
|
|
|
|
root["Config"].Get(RESOLUTION, index);
|
|
|
|
|
cfp.resolution_dst = index;
|
|
|
|
|
root["Config"].Get(DUPLEX, bvalue);
|
|
|
|
|
cfp.is_duplex = bvalue?1:0;
|
|
|
|
|
root["Config"].Get(DISCARBLANK, bvalue);
|
|
|
|
|
cfp.is_autodiscradblank_normal = bvalue?1:0;
|
|
|
|
|
root["Config"].Get(DISCARBLANKVINCE, bvalue);
|
|
|
|
|
cfp.is_autodiscradblank_vince = bvalue?1:0;
|
2020-12-09 08:02:51 +00:00
|
|
|
|
root["Config"].Get(DISCARBLANK_VALUE, index);
|
|
|
|
|
cfp.discardblank_percent = index ;
|
2021-07-02 03:29:24 +00:00
|
|
|
|
|
2020-06-20 03:07:40 +00:00
|
|
|
|
root["Config"].Get(FLOD, bvalue);
|
|
|
|
|
cfp.en_fold = bvalue?1:0;
|
|
|
|
|
root["Config"].Get(SWITCHFRONTBACK, bvalue);
|
|
|
|
|
cfp.is_switchfrontback = bvalue?1:0;
|
2021-12-16 08:21:35 +00:00
|
|
|
|
root["Config"].Get(SPLIT, bvalue);
|
|
|
|
|
cfp.is_split = bvalue ? 1 : 0;
|
2021-07-02 03:29:24 +00:00
|
|
|
|
#ifdef UV
|
|
|
|
|
root["Config"].Get(ENUVMODEL, bvalue);
|
|
|
|
|
cfp.hardwarecaps.en_uv = bvalue ? 1 : 0;
|
|
|
|
|
#endif
|
2021-12-16 08:21:35 +00:00
|
|
|
|
root["Config"].Get(BRIGHTNESS, fvalue);
|
|
|
|
|
cfp.brightness = fvalue;
|
2020-06-20 03:07:40 +00:00
|
|
|
|
root["Config"].Get(AUTOCONTRAST, bvalue);
|
|
|
|
|
cfp.is_autocontrast = bvalue?1:0;
|
|
|
|
|
root["Config"].Get(CONTRAST, index);
|
2020-07-11 10:43:17 +00:00
|
|
|
|
cfp.contrast = index;
|
|
|
|
|
root["Config"].Get(GAMMA_, fvalue);
|
|
|
|
|
cfp.gamma = fvalue;
|
2020-06-20 03:07:40 +00:00
|
|
|
|
|
|
|
|
|
root["Config"].Get(FILTERTYPE, index);
|
|
|
|
|
cfp.filter = (byte)index;
|
|
|
|
|
root["Config"].Get(ENHANCECOLOR, index);
|
|
|
|
|
cfp.enhance_color =(byte) index;
|
|
|
|
|
root["config"].Get(SHARPENTYPE, index);
|
|
|
|
|
cfp.sharpen = (byte)index;
|
|
|
|
|
root["Config"].Get(AUTODESCREW, bvalue);
|
|
|
|
|
cfp.autodescrew = bvalue?1:0;
|
|
|
|
|
root["Config"].Get(FILLBLACK, bvalue);
|
|
|
|
|
cfp.fillbackground = bvalue?1:0;
|
|
|
|
|
root["Config"].Get(MULTIOUTPUT, bvalue);
|
|
|
|
|
cfp.multi_output_red = bvalue?1:0;
|
2022-05-24 12:05:47 +00:00
|
|
|
|
root["Config"].Get(EN_MULTIOUT, bvalue);
|
|
|
|
|
cfp.en_multi_output = bvalue ? 1 : 0;
|
|
|
|
|
root["Config"].Get(MULTIOUTTYPE, index);
|
|
|
|
|
cfp.multioutput = index;
|
2020-06-20 03:07:40 +00:00
|
|
|
|
root["Config"].Get(OUTHOLE, bvalue);
|
|
|
|
|
cfp.fillhole.is_fillhole = bvalue?1:0;
|
|
|
|
|
root["Config"].Get(OUTHOLERATIO, index);
|
|
|
|
|
cfp.fillhole.fillholeratio = index;
|
2022-09-20 01:08:11 +00:00
|
|
|
|
root["Config"].Get(OUTHOLERATIOUP, index);
|
|
|
|
|
cfp.fillholeratio_up = index;
|
|
|
|
|
root["Config"].Get(OUTHOLERATIODOWN, index);
|
|
|
|
|
cfp.fillholeratio_down = index;
|
|
|
|
|
root["Config"].Get(OUTHOLERATIOLEFT, index);
|
|
|
|
|
cfp.fillholeratio_left = index;
|
|
|
|
|
root["Config"].Get(OUTHOLERATIORIGHT, index);
|
|
|
|
|
cfp.fillholeratio_right = index;
|
|
|
|
|
root["Config"].Get(EN_OUTHOLERATIOUP, bvalue);
|
|
|
|
|
cfp.en_fillholeratio_up = bvalue ? 1 : 0;
|
|
|
|
|
root["Config"].Get(EN_OUTHOLERATIODOWN, bvalue);
|
|
|
|
|
cfp.en_fillholeratio_down = bvalue ? 1 : 0;
|
|
|
|
|
root["Config"].Get(EN_OUTHOLERATIOLEFT, bvalue);
|
|
|
|
|
cfp.en_fillholeratio_left = bvalue ? 1 : 0;
|
|
|
|
|
root["Config"].Get(EN_OUTHOLERATIORIGHT, bvalue);
|
|
|
|
|
cfp.en_fillholeratio_right = bvalue ? 1 : 0;
|
2020-12-09 08:02:51 +00:00
|
|
|
|
root["Config"].Get(DETACHNOISE, bvalue);
|
|
|
|
|
cfp.detachnoise.is_detachnoise = bvalue ? 1 : 0;
|
|
|
|
|
root["Config"].Get(DETACHNOISEVALUE, index);
|
|
|
|
|
cfp.detachnoise.detachnoise = index;
|
2022-02-14 02:30:19 +00:00
|
|
|
|
root["Config"].Get(FADEBACK, bvalue);
|
|
|
|
|
cfp.fadeback = bvalue ? 1 : 0;
|
|
|
|
|
root["Config"].Get(FADEBACKRANGE, index);
|
|
|
|
|
cfp.fadeback_range = index;
|
2020-06-23 09:31:43 +00:00
|
|
|
|
root["Config"].Get(HSVCORRECT, bvalue);
|
|
|
|
|
cfp.hsvcorrect = bvalue ? 1 : 0;
|
2022-11-18 05:56:31 +00:00
|
|
|
|
root["Config"].Get(ANSWERSHEETFILTER, index);
|
|
|
|
|
cfp.hsvFilter = index;
|
|
|
|
|
|
|
|
|
|
|
2020-12-09 08:02:51 +00:00
|
|
|
|
root["Config"].Get(NOISE, index);
|
|
|
|
|
cfp.noise = index;
|
|
|
|
|
root["Config"].Get(INDENT, index);
|
|
|
|
|
cfp.indent = index;
|
|
|
|
|
root["Config"].Get(AUTOCROP_THRESHOLD, index);
|
|
|
|
|
cfp.AutoCrop_threshold = index;
|
2020-06-20 03:07:40 +00:00
|
|
|
|
|
|
|
|
|
root["Config"].Get(ULTRADETECT, bvalue);
|
|
|
|
|
cfp.hardwarecaps.en_doublefeed = bvalue?1:0;
|
|
|
|
|
root["Config"].Get(BINDINGDETECT, bvalue);
|
|
|
|
|
cfp.hardwarecaps.en_stapledetect = bvalue ? 1 : 0;
|
2021-12-16 08:21:35 +00:00
|
|
|
|
root["Config"].Get(AUTOPAPER, bvalue);
|
|
|
|
|
cfp.hardwarecaps.is_autopaper = bvalue ? 1 : 0;
|
2022-10-20 02:40:25 +00:00
|
|
|
|
root["Config"].Get(AUTOPAPERTIMEOUT, index);
|
|
|
|
|
cfp.autopaper_timeout = index;
|
2020-06-20 03:07:40 +00:00
|
|
|
|
root["Config"].Get(SCANCOUNT, index);
|
|
|
|
|
cfp.scannum = index;
|
|
|
|
|
root["Config"].Get(DOCORIENTATION, index);
|
2020-07-11 10:43:17 +00:00
|
|
|
|
cfp.imageRotateDegree = index;
|
2020-06-20 03:07:40 +00:00
|
|
|
|
root["Config"].Get(AUTO_TEXT, bvalue);
|
|
|
|
|
cfp.is_autotext = bvalue?1:0;
|
|
|
|
|
root["Config"].Get(BACKROTATE180, bvalue);
|
|
|
|
|
cfp.is_backrotate180 = bvalue ? 1 : 0;
|
2020-12-09 08:02:51 +00:00
|
|
|
|
root["Config"].Get(ISCONVEX, bvalue);
|
|
|
|
|
cfp.is_convex = bvalue ? 1 : 0;
|
2020-11-16 10:05:04 +00:00
|
|
|
|
root["Config"].Get(DOGEAR_DETECTION, bvalue);
|
|
|
|
|
cfp.is_dogeardetection = bvalue ? 1 : 0;
|
2021-11-20 03:09:04 +00:00
|
|
|
|
root["Config"].Get(DOGEAR_DISTANCE, index);
|
|
|
|
|
cfp.dogeardistance = index;
|
2020-06-20 03:07:40 +00:00
|
|
|
|
root["Config"].Get(SCREWDETECT, bvalue);
|
|
|
|
|
cfp.hardwarecaps.en_skrewdetect = bvalue ? 1 : 0;
|
|
|
|
|
root["Config"].Get(SCREWLEVEL, index);
|
|
|
|
|
cfp.hardwarecaps.skrewdetectlevel = index;
|
|
|
|
|
|
|
|
|
|
if (!root["Config"][ITEMCAPTION].IsEmpty())
|
|
|
|
|
{
|
|
|
|
|
root["Config"].Get(ITEMCAPTION, svalue);
|
|
|
|
|
cfp.Caption = svalue;
|
|
|
|
|
}
|
|
|
|
|
if (!root["Config"][SAVEPATH].IsEmpty())
|
|
|
|
|
{
|
|
|
|
|
root["Config"].Get(SAVEPATH, svalue);
|
|
|
|
|
cfp.SavePath = svalue;
|
|
|
|
|
}
|
|
|
|
|
vcConfig.push_back(cfp);
|
|
|
|
|
}
|
|
|
|
|
return vcConfig;
|
|
|
|
|
}
|
2021-01-22 07:37:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void GscanJsonConfig::SaveGscancapJson(GScanCap cap, std::string path)
|
|
|
|
|
{
|
2021-06-21 11:38:36 +00:00
|
|
|
|
cap.SavePath = cap.Caption = "";
|
2021-01-22 07:37:46 +00:00
|
|
|
|
json js = GscancapToJson(cap);
|
|
|
|
|
std::ofstream of;
|
|
|
|
|
try {
|
2021-06-21 11:38:36 +00:00
|
|
|
|
of.open(path, std::ios::out|std::ios::binary);
|
|
|
|
|
of.write(js.dump().data(), js.dump().size());
|
2021-01-22 07:37:46 +00:00
|
|
|
|
of.close();
|
|
|
|
|
}
|
2021-06-21 11:38:36 +00:00
|
|
|
|
catch (std::exception &e) {
|
2021-01-22 07:37:46 +00:00
|
|
|
|
if (of.is_open())
|
|
|
|
|
of.close();
|
2021-06-21 11:38:36 +00:00
|
|
|
|
FileTools::writelog(log_ERROR, "save json error :"+std::string(e.what()));
|
2021-01-22 07:37:46 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
json GscanJsonConfig::GscancapToJson(GScanCap& cap)
|
|
|
|
|
{
|
|
|
|
|
auto js = GetDefaultJson();
|
|
|
|
|
js[CONFIG][PIXTYPE] = cap.pixtype;
|
|
|
|
|
js[CONFIG][AUTOMATICCOLOR] = cap.automaticcolor;
|
|
|
|
|
js[CONFIG][AUTOMATICCOLORTYPR] = cap.automaticcolortype;
|
|
|
|
|
js[CONFIG][PAPARSIZE] = cap.papertype;
|
|
|
|
|
js[CONFIG][PAPERALIGN] = cap.paperAlign;
|
|
|
|
|
js[CONFIG][ENSIZECHECK] = cap.en_sizecheck;
|
2022-05-24 12:05:47 +00:00
|
|
|
|
js[CONFIG][ENFIXEDPAPER] = cap.en_fixedpaper;
|
2021-01-22 07:37:46 +00:00
|
|
|
|
js[CONFIG][AUTOCROP] = cap.is_autocrop;
|
2022-05-24 12:05:47 +00:00
|
|
|
|
js[CONFIG][HIGH_IMAGE_QUALITY] = cap.is_high_imagequality;
|
2021-01-22 07:37:46 +00:00
|
|
|
|
js[CONFIG][RESOLUTION] = cap.resolution_dst;
|
|
|
|
|
js[CONFIG][DUPLEX] = cap.is_duplex;
|
|
|
|
|
js[CONFIG][DISCARBLANK] = cap.is_autodiscradblank_normal;
|
|
|
|
|
js[CONFIG][DISCARBLANKVINCE] = cap.is_autodiscradblank_vince;
|
|
|
|
|
js[CONFIG][DISCARBLANK_VALUE] = cap.discardblank_percent;
|
|
|
|
|
js[CONFIG][FLOD] = cap.en_fold;
|
|
|
|
|
js[CONFIG][SWITCHFRONTBACK] = cap.is_switchfrontback;
|
2021-12-16 08:21:35 +00:00
|
|
|
|
js[CONFIG][SPLIT] = cap.is_split;
|
2021-07-02 03:29:24 +00:00
|
|
|
|
#ifdef UV
|
|
|
|
|
js[CONFIG][ENUVMODEL] = cap.hardwarecaps.en_uv;
|
|
|
|
|
#endif
|
2021-01-22 07:37:46 +00:00
|
|
|
|
js[CONFIG][DETACHNOISE] = cap.detachnoise.is_detachnoise;
|
|
|
|
|
js[CONFIG][DETACHNOISEVALUE] = cap.detachnoise.detachnoise;
|
2022-02-14 02:30:19 +00:00
|
|
|
|
js[CONFIG][FADEBACK] = cap.fadeback;
|
|
|
|
|
js[CONFIG][FADEBACKRANGE] = cap.fadeback_range;
|
2021-01-22 07:37:46 +00:00
|
|
|
|
js[CONFIG][BRIGHTNESS] = cap.brightness;
|
|
|
|
|
js[CONFIG][AUTOCONTRAST] = cap.is_autocontrast;
|
|
|
|
|
js[CONFIG][CONTRAST] = cap.contrast;
|
|
|
|
|
js[CONFIG][GAMMA_] = cap.gamma;
|
2021-08-03 03:55:10 +00:00
|
|
|
|
js[CONFIG][CROPMODEL] = cap.normalCrop;
|
2021-01-22 07:37:46 +00:00
|
|
|
|
js[CONFIG][FILTERTYPE] = cap.filter;
|
|
|
|
|
js[CONFIG][ENHANCECOLOR] = cap.enhance_color;
|
|
|
|
|
js[CONFIG][SHARPENTYPE] = cap.sharpen;
|
|
|
|
|
js[CONFIG][AUTODESCREW] = cap.autodescrew;
|
|
|
|
|
js[CONFIG][FILLBLACK] = cap.fillbackground;
|
|
|
|
|
js[CONFIG][MULTIOUTPUT] = cap.multi_output_red;
|
2022-05-24 12:05:47 +00:00
|
|
|
|
js[CONFIG][EN_MULTIOUT] = cap.en_multi_output;
|
|
|
|
|
js[CONFIG][MULTIOUTTYPE] = cap.multioutput;
|
2021-01-22 07:37:46 +00:00
|
|
|
|
js[CONFIG][OUTHOLE] = cap.fillhole.is_fillhole;
|
|
|
|
|
js[CONFIG][OUTHOLERATIO] = cap.fillhole.fillholeratio;
|
2022-09-20 01:08:11 +00:00
|
|
|
|
js[CONFIG][OUTHOLERATIOUP] = cap.fillholeratio_up;
|
|
|
|
|
js[CONFIG][OUTHOLERATIODOWN] = cap.fillholeratio_down;
|
|
|
|
|
js[CONFIG][OUTHOLERATIOLEFT] = cap.fillholeratio_left;
|
|
|
|
|
js[CONFIG][OUTHOLERATIORIGHT] = cap.fillholeratio_right;
|
|
|
|
|
js[CONFIG][EN_OUTHOLERATIOUP] = cap.en_fillholeratio_up;
|
|
|
|
|
js[CONFIG][EN_OUTHOLERATIODOWN] = cap.en_fillholeratio_down;
|
|
|
|
|
js[CONFIG][EN_OUTHOLERATIOLEFT] = cap.en_fillholeratio_left;
|
|
|
|
|
js[CONFIG][EN_OUTHOLERATIORIGHT] = cap.en_fillholeratio_right;
|
2021-01-22 07:37:46 +00:00
|
|
|
|
js[CONFIG][HSVCORRECT] = cap.hsvcorrect;
|
|
|
|
|
js[CONFIG][ULTRADETECT] = cap.hardwarecaps.en_doublefeed;
|
|
|
|
|
js[CONFIG][BINDINGDETECT] = cap.hardwarecaps.en_stapledetect;
|
2021-12-16 08:21:35 +00:00
|
|
|
|
js[CONFIG][AUTOPAPER] = cap.hardwarecaps.is_autopaper;
|
2022-10-20 02:40:25 +00:00
|
|
|
|
js[CONFIG][AUTOPAPERTIMEOUT] = cap.autopaper_timeout;
|
2021-01-22 07:37:46 +00:00
|
|
|
|
js[CONFIG][SCANCOUNT] = cap.scannum;
|
|
|
|
|
js[CONFIG][DOCORIENTATION] = cap.imageRotateDegree;
|
|
|
|
|
js[CONFIG][AUTO_TEXT] = cap.is_autotext;
|
|
|
|
|
js[CONFIG][BACKROTATE180] = cap.is_backrotate180;
|
|
|
|
|
js[CONFIG][DOGEAR_DETECTION] = cap.is_dogeardetection;
|
2021-11-20 03:09:04 +00:00
|
|
|
|
js[CONFIG][DOGEAR_DISTANCE] = cap.dogeardistance;
|
2021-01-22 07:37:46 +00:00
|
|
|
|
js[CONFIG][SCREWDETECT] = cap.hardwarecaps.en_skrewdetect;
|
|
|
|
|
js[CONFIG][SCREWLEVEL] = cap.hardwarecaps.skrewdetectlevel;
|
|
|
|
|
js[CONFIG][NOISE] = cap.noise;
|
|
|
|
|
js[CONFIG][INDENT] = cap.indent;
|
2021-01-28 10:48:35 +00:00
|
|
|
|
js[CONFIG][AUTOCROP_THRESHOLD] = cap.AutoCrop_threshold;
|
2021-01-22 07:37:46 +00:00
|
|
|
|
js[CONFIG][ISCONVEX] = cap.is_convex;
|
|
|
|
|
js[CONFIG][ITEMCAPTION] = cap.Caption;
|
2021-06-21 11:38:36 +00:00
|
|
|
|
js[CONFIG][SAVEPATH] = cap.SavePath.c_str();
|
2021-02-03 10:21:45 +00:00
|
|
|
|
js[CONFIG][LOWPOWERMODE] = cap.hardwarecaps.lowpowermode;
|
2022-11-15 03:55:44 +00:00
|
|
|
|
js[CONFIG][ANSWERSHEETFILTER] = cap.hsvFilter;
|
2021-01-22 07:37:46 +00:00
|
|
|
|
return js;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GScanCap GscanJsonConfig::JsonToGscancap(json& js)
|
|
|
|
|
{
|
2021-01-28 10:48:35 +00:00
|
|
|
|
|
2021-01-22 07:37:46 +00:00
|
|
|
|
if (!js.is_object())
|
|
|
|
|
js = GetDefaultJson();
|
|
|
|
|
GScanCap cap{ 0 };
|
|
|
|
|
cap.pixtype = json_cast(js[CONFIG][PIXTYPE]).to_int();
|
|
|
|
|
cap.automaticcolor = json_cast(js[CONFIG][AUTOMATICCOLOR]).to_int();
|
|
|
|
|
cap.automaticcolortype = json_cast(js[CONFIG][AUTOMATICCOLORTYPR]).to_int();
|
|
|
|
|
cap.papertype = json_cast(js[CONFIG][PAPARSIZE]).to_int();
|
|
|
|
|
cap.paperAlign = static_cast<PaperAlign>(json_cast(js[CONFIG][PAPERALIGN]).to_uint8());
|
|
|
|
|
cap.en_sizecheck = json_cast(js[CONFIG][ENSIZECHECK]).to_int();
|
2022-05-24 12:05:47 +00:00
|
|
|
|
cap.en_fixedpaper = json_cast(js[CONFIG][ENFIXEDPAPER]).to_bool();
|
2021-01-22 07:37:46 +00:00
|
|
|
|
cap.is_autocrop = json_cast(js[CONFIG][AUTOCROP]).to_int();
|
2022-05-24 12:05:47 +00:00
|
|
|
|
cap.is_high_imagequality =json_cast(js[CONFIG][HIGH_IMAGE_QUALITY]).to_bool();
|
2021-01-22 07:37:46 +00:00
|
|
|
|
cap.resolution_dst = json_cast(js[CONFIG][RESOLUTION]).to_float();
|
|
|
|
|
cap.is_duplex = json_cast(js[CONFIG][DUPLEX]).to_int();
|
|
|
|
|
cap.is_autodiscradblank_normal = json_cast(js[CONFIG][DISCARBLANK]).to_int();
|
|
|
|
|
cap.is_autodiscradblank_vince = json_cast(js[CONFIG][DISCARBLANKVINCE]).to_int();
|
|
|
|
|
cap.discardblank_percent = json_cast(js[CONFIG][DISCARBLANK_VALUE]).to_int();
|
|
|
|
|
cap.en_fold = json_cast(js[CONFIG][FLOD]).to_int();
|
|
|
|
|
cap.is_switchfrontback = json_cast(js[CONFIG][SWITCHFRONTBACK]).to_int();
|
2021-12-16 08:21:35 +00:00
|
|
|
|
cap.is_split = json_cast(js[CONFIG][SPLIT]).to_int();
|
2021-07-02 03:29:24 +00:00
|
|
|
|
#ifdef UV
|
|
|
|
|
cap.hardwarecaps.en_uv = json_cast(js[CONFIG][ENUVMODEL]).to_int();
|
|
|
|
|
#endif // UV
|
2021-08-03 03:55:10 +00:00
|
|
|
|
cap.normalCrop = json_cast(js[CONFIG][CROPMODEL]).to_bool();
|
2021-01-22 07:37:46 +00:00
|
|
|
|
cap.detachnoise.is_detachnoise = json_cast(js[CONFIG][DETACHNOISE]).to_int();
|
|
|
|
|
cap.detachnoise.detachnoise = json_cast(js[CONFIG][DETACHNOISEVALUE]).to_int();
|
2022-02-14 02:30:19 +00:00
|
|
|
|
|
|
|
|
|
cap.fadeback = json_cast(js[CONFIG][FADEBACK]).to_bool();
|
|
|
|
|
cap.fadeback_range = json_cast(js[CONFIG][FADEBACKRANGE]).to_int();
|
2021-01-22 07:37:46 +00:00
|
|
|
|
cap.brightness = json_cast(js[CONFIG][BRIGHTNESS]).to_float();
|
|
|
|
|
cap.is_autocontrast = json_cast(js[CONFIG][AUTOCONTRAST]).to_int();
|
|
|
|
|
cap.contrast = json_cast(js[CONFIG][CONTRAST]).to_float();
|
|
|
|
|
cap.gamma = json_cast(js[CONFIG][GAMMA_]).to_float();
|
|
|
|
|
cap.filter = json_cast(js[CONFIG][FILTERTYPE]).to_int();
|
|
|
|
|
cap.enhance_color = json_cast(js[CONFIG][ENHANCECOLOR]).to_int();
|
|
|
|
|
cap.sharpen = json_cast(js[CONFIG][SHARPENTYPE]).to_int();
|
|
|
|
|
cap.autodescrew = json_cast(js[CONFIG][AUTODESCREW]).to_int();
|
|
|
|
|
cap.fillbackground = json_cast(js[CONFIG][FILLBLACK]).to_int();
|
|
|
|
|
cap.multi_output_red = json_cast(js[CONFIG][MULTIOUTPUT]).to_int();
|
2022-05-24 12:05:47 +00:00
|
|
|
|
cap.en_multi_output = json_cast(js[CONFIG][EN_MULTIOUT]).to_bool();
|
|
|
|
|
cap.multioutput = json_cast(js[CONFIG][MULTIOUTTYPE]).to_int();
|
2021-01-22 07:37:46 +00:00
|
|
|
|
cap.fillhole.is_fillhole = json_cast(js[CONFIG][OUTHOLE]).to_int();
|
|
|
|
|
cap.fillhole.fillholeratio = json_cast(js[CONFIG][OUTHOLERATIO]).to_int();
|
2022-09-20 01:08:11 +00:00
|
|
|
|
cap.fillholeratio_up = json_cast(js[CONFIG][OUTHOLERATIOUP]).to_int();
|
|
|
|
|
cap.fillholeratio_down = json_cast(js[CONFIG][OUTHOLERATIODOWN]).to_int();
|
|
|
|
|
cap.fillholeratio_left = json_cast(js[CONFIG][OUTHOLERATIOLEFT]).to_int();
|
|
|
|
|
cap.fillholeratio_right = json_cast(js[CONFIG][OUTHOLERATIORIGHT]).to_int();
|
|
|
|
|
cap.en_fillholeratio_up = json_cast(js[CONFIG][EN_OUTHOLERATIOUP]).to_bool();
|
|
|
|
|
cap.en_fillholeratio_down = json_cast(js[CONFIG][EN_OUTHOLERATIODOWN]).to_bool();
|
|
|
|
|
cap.en_fillholeratio_left = json_cast(js[CONFIG][EN_OUTHOLERATIOLEFT]).to_bool();
|
|
|
|
|
cap.en_fillholeratio_right = json_cast(js[CONFIG][EN_OUTHOLERATIORIGHT]).to_bool();
|
2021-01-22 07:37:46 +00:00
|
|
|
|
cap.hsvcorrect = json_cast(js[CONFIG][HSVCORRECT]).to_int();
|
|
|
|
|
cap.hardwarecaps.en_doublefeed = json_cast(js[CONFIG][ULTRADETECT]).to_int();
|
|
|
|
|
cap.hardwarecaps.en_stapledetect = json_cast(js[CONFIG][BINDINGDETECT]).to_int();
|
2021-12-16 08:21:35 +00:00
|
|
|
|
cap.hardwarecaps.is_autopaper = json_cast(js[CONFIG][AUTOPAPER]).to_int();
|
2022-10-20 02:40:25 +00:00
|
|
|
|
cap.autopaper_timeout = json_cast(js[CONFIG][AUTOPAPERTIMEOUT]).to_int();
|
2021-01-22 07:37:46 +00:00
|
|
|
|
cap.scannum = json_cast(js[CONFIG][SCANCOUNT]).to_int();
|
|
|
|
|
cap.imageRotateDegree = json_cast(js[CONFIG][DOCORIENTATION]).to_int();
|
|
|
|
|
cap.is_autotext = json_cast(js[CONFIG][AUTO_TEXT]).to_int();
|
|
|
|
|
cap.is_backrotate180 = json_cast(js[CONFIG][BACKROTATE180]).to_int();
|
|
|
|
|
cap.is_dogeardetection = json_cast(js[CONFIG][DOGEAR_DETECTION]).to_int();
|
2021-11-20 03:09:04 +00:00
|
|
|
|
cap.dogeardistance = json_cast(js[CONFIG][DOGEAR_DISTANCE]).to_uint32();
|
2021-01-22 07:37:46 +00:00
|
|
|
|
cap.hardwarecaps.en_skrewdetect = json_cast(js[CONFIG][SCREWDETECT]).to_int();
|
|
|
|
|
cap.hardwarecaps.skrewdetectlevel = json_cast(js[CONFIG][SCREWLEVEL]).to_int();
|
|
|
|
|
cap.noise = json_cast(js[CONFIG][NOISE]).to_int();
|
|
|
|
|
cap.indent = json_cast(js[CONFIG][INDENT]).to_int();
|
|
|
|
|
cap.AutoCrop_threshold = json_cast(js[CONFIG][AUTOCROP_THRESHOLD]).to_int();
|
2021-02-03 10:21:45 +00:00
|
|
|
|
cap.hardwarecaps.lowpowermode = (LowPowerMode)json_cast(js[CONFIG][LOWPOWERMODE]).to_int();
|
2022-11-15 03:55:44 +00:00
|
|
|
|
cap.hsvFilter = json_cast(js[CONFIG][ANSWERSHEETFILTER]).to_int();
|
2021-01-22 07:37:46 +00:00
|
|
|
|
cap.is_convex = json_cast(js[CONFIG][ISCONVEX]).to_int();
|
|
|
|
|
cap.Caption = json_cast(js[CONFIG][ITEMCAPTION]).to_string();
|
|
|
|
|
cap.SavePath = json_cast(js[CONFIG][SAVEPATH]).to_string();
|
|
|
|
|
return cap;
|
|
|
|
|
}
|
|
|
|
|
json GscanJsonConfig::GetDefaultJson()
|
|
|
|
|
{
|
2021-07-02 03:29:24 +00:00
|
|
|
|
#ifdef UV
|
|
|
|
|
return json::parse(R"({
|
|
|
|
|
"Config": {
|
|
|
|
|
"iPixType": 2 ,
|
|
|
|
|
"bAutoMaticColorDetece": false ,
|
|
|
|
|
"iAutoMaticColorDeteceType": 1 ,
|
|
|
|
|
"iPaparSize": 0 ,
|
|
|
|
|
"iPaperAlign": 0 ,
|
|
|
|
|
"iEnSizeCheck": false ,
|
2022-05-24 12:05:47 +00:00
|
|
|
|
"bEnFixedPaper": false,
|
2021-07-02 03:29:24 +00:00
|
|
|
|
"bAuotCrop": true ,
|
2022-05-24 12:05:47 +00:00
|
|
|
|
"bHighimagequality" : false,
|
2021-08-03 03:55:10 +00:00
|
|
|
|
"bcropmodel": false,
|
2021-07-02 03:29:24 +00:00
|
|
|
|
"iResolution": 200 ,
|
|
|
|
|
"iDuplex": true ,
|
|
|
|
|
"bDiscardBlank": false ,
|
|
|
|
|
"bDiscardBlankVince": false ,
|
|
|
|
|
"discardblank_percent": 20 ,
|
|
|
|
|
"bFlod": false ,
|
|
|
|
|
"bSwitchFrontBack": false ,
|
2021-12-16 08:21:35 +00:00
|
|
|
|
"bSplit": false ,
|
2021-07-02 03:29:24 +00:00
|
|
|
|
"bUVmodel": false,
|
|
|
|
|
"detachnoise": false ,
|
2022-05-24 12:05:47 +00:00
|
|
|
|
"detachnoisevalue": 10 ,
|
2022-02-14 02:30:19 +00:00
|
|
|
|
"bfadeback": false ,
|
|
|
|
|
"fadebackvalue": 40,
|
2021-07-02 03:29:24 +00:00
|
|
|
|
"iBrightness": 0 ,
|
|
|
|
|
"bAutoContrast": false ,
|
|
|
|
|
"iContrast": 0 ,
|
|
|
|
|
"dGamma": 1 ,
|
|
|
|
|
"iFilter": 3 ,
|
|
|
|
|
"iEnhance": 0 ,
|
|
|
|
|
"iSharpen": 0 ,
|
|
|
|
|
"bAutoDescrew": true ,
|
|
|
|
|
"bFillBlcak": true ,
|
|
|
|
|
"iMultiOutPut": false ,
|
2022-05-24 12:05:47 +00:00
|
|
|
|
"bMultiOut": false ,
|
|
|
|
|
"iMultiOut": 0 ,
|
2021-07-02 03:29:24 +00:00
|
|
|
|
"bOutHole": false ,
|
|
|
|
|
"iOutHoleRatio": 10 ,
|
2022-09-20 01:08:11 +00:00
|
|
|
|
"iOutHoleRatioup": 10 ,
|
|
|
|
|
"iOutHoleRatiodown": 10 ,
|
|
|
|
|
"iOutHoleRatioleft": 10 ,
|
|
|
|
|
"iOutHoleRatioright": 10 ,
|
|
|
|
|
"bOutHoleRatioup": true ,
|
|
|
|
|
"bOutHoleRatiodown": true ,
|
|
|
|
|
"bOutHoleRatioleft": true ,
|
|
|
|
|
"bOutHoleRatioright": true ,
|
2021-07-02 03:29:24 +00:00
|
|
|
|
"bHsvCorrect": false ,
|
|
|
|
|
"bUltrasonicDetect": true ,
|
|
|
|
|
"bBindingDetect": false ,
|
2021-12-16 08:21:35 +00:00
|
|
|
|
"bautopaper": false ,
|
2022-10-20 02:40:25 +00:00
|
|
|
|
"iautopapertimeout" : 15 ,
|
2021-07-02 03:29:24 +00:00
|
|
|
|
"ScanCount": 65535 ,
|
|
|
|
|
"bOrientation": 0 ,
|
|
|
|
|
"bAutoText": false ,
|
|
|
|
|
"iBackRotate180": false ,
|
|
|
|
|
"dogeardetection": false ,
|
2022-05-24 12:05:47 +00:00
|
|
|
|
"idogeardistance": 70 ,
|
2021-07-02 03:29:24 +00:00
|
|
|
|
"bScrewDetect": true ,
|
|
|
|
|
"iScrewLevel": 3 ,
|
|
|
|
|
"Noise": 8 ,
|
|
|
|
|
"Indent": 5 ,
|
|
|
|
|
"AutoCrop_Threshold": 40 ,
|
|
|
|
|
"isConvex": true ,
|
|
|
|
|
"ilowpowermode": 4,
|
2022-11-15 03:55:44 +00:00
|
|
|
|
"iAnswersheetFilter": 0,
|
2021-07-02 03:29:24 +00:00
|
|
|
|
"Caption": "" ,
|
|
|
|
|
"SavePath": ""
|
|
|
|
|
}
|
|
|
|
|
})");
|
|
|
|
|
#else
|
2021-01-22 07:37:46 +00:00
|
|
|
|
return json::parse(R"({
|
|
|
|
|
"Config": {
|
|
|
|
|
"iPixType": 2 ,
|
2021-04-13 09:30:05 +00:00
|
|
|
|
"bAutoMaticColorDetece": false ,
|
|
|
|
|
"iAutoMaticColorDeteceType": 1 ,
|
2021-01-22 07:37:46 +00:00
|
|
|
|
"iPaparSize": 0 ,
|
|
|
|
|
"iPaperAlign": 0 ,
|
|
|
|
|
"iEnSizeCheck": false ,
|
2022-05-24 12:05:47 +00:00
|
|
|
|
"bEnFixedPaper": false,
|
2021-01-22 07:37:46 +00:00
|
|
|
|
"bAuotCrop": true ,
|
2022-05-24 12:05:47 +00:00
|
|
|
|
"bHighimagequality" : false,
|
2021-08-03 03:55:10 +00:00
|
|
|
|
"bcropmodel": false,
|
2021-01-22 07:37:46 +00:00
|
|
|
|
"iResolution": 200 ,
|
|
|
|
|
"iDuplex": true ,
|
|
|
|
|
"bDiscardBlank": false ,
|
|
|
|
|
"bDiscardBlankVince": false ,
|
|
|
|
|
"discardblank_percent": 20 ,
|
|
|
|
|
"bFlod": false ,
|
|
|
|
|
"bSwitchFrontBack": false ,
|
2021-12-16 08:21:35 +00:00
|
|
|
|
"bSplit": false ,
|
2021-01-22 07:37:46 +00:00
|
|
|
|
"detachnoise": false ,
|
2022-05-24 12:05:47 +00:00
|
|
|
|
"detachnoisevalue": 10 ,
|
2022-02-14 02:30:19 +00:00
|
|
|
|
"bfadeback": false ,
|
|
|
|
|
"fadebackvalue": 40,
|
2021-01-22 07:37:46 +00:00
|
|
|
|
"iBrightness": 0 ,
|
|
|
|
|
"bAutoContrast": false ,
|
|
|
|
|
"iContrast": 0 ,
|
|
|
|
|
"dGamma": 1 ,
|
|
|
|
|
"iFilter": 3 ,
|
|
|
|
|
"iEnhance": 0 ,
|
|
|
|
|
"iSharpen": 0 ,
|
|
|
|
|
"bAutoDescrew": true ,
|
|
|
|
|
"bFillBlcak": true ,
|
|
|
|
|
"iMultiOutPut": false ,
|
2022-05-24 12:05:47 +00:00
|
|
|
|
"bMultiOut": false ,
|
|
|
|
|
"iMultiOut": 0 ,
|
2021-01-22 07:37:46 +00:00
|
|
|
|
"bOutHole": false ,
|
|
|
|
|
"iOutHoleRatio": 10 ,
|
2022-09-20 01:08:11 +00:00
|
|
|
|
"iOutHoleRatioup": 10 ,
|
|
|
|
|
"iOutHoleRatiodown": 10 ,
|
|
|
|
|
"iOutHoleRatioleft": 10 ,
|
|
|
|
|
"iOutHoleRatioright": 10 ,
|
|
|
|
|
"bOutHoleRatioup": true ,
|
|
|
|
|
"bOutHoleRatiodown": true ,
|
|
|
|
|
"bOutHoleRatioleft": true ,
|
|
|
|
|
"bOutHoleRatioright": true ,
|
2021-01-22 07:37:46 +00:00
|
|
|
|
"bHsvCorrect": false ,
|
|
|
|
|
"bUltrasonicDetect": true ,
|
|
|
|
|
"bBindingDetect": false ,
|
2021-12-16 08:21:35 +00:00
|
|
|
|
"bautopaper": false ,
|
2022-10-20 02:40:25 +00:00
|
|
|
|
"iautopapertimeout" : 15 ,
|
2021-01-22 07:37:46 +00:00
|
|
|
|
"ScanCount": 65535 ,
|
|
|
|
|
"bOrientation": 0 ,
|
|
|
|
|
"bAutoText": false ,
|
|
|
|
|
"iBackRotate180": false ,
|
|
|
|
|
"dogeardetection": false ,
|
2022-05-24 12:05:47 +00:00
|
|
|
|
"idogeardistance": 70 ,
|
2021-01-22 07:37:46 +00:00
|
|
|
|
"bScrewDetect": true ,
|
|
|
|
|
"iScrewLevel": 3 ,
|
2021-06-28 03:58:54 +00:00
|
|
|
|
"Noise": 8 ,
|
2021-01-22 07:37:46 +00:00
|
|
|
|
"Indent": 5 ,
|
|
|
|
|
"AutoCrop_Threshold": 40 ,
|
|
|
|
|
"isConvex": true ,
|
2021-02-03 10:21:45 +00:00
|
|
|
|
"ilowpowermode": 4,
|
2022-11-15 03:55:44 +00:00
|
|
|
|
"iAnswersheetFilter": 0,
|
2021-01-22 07:37:46 +00:00
|
|
|
|
"Caption": "" ,
|
|
|
|
|
"SavePath": ""
|
|
|
|
|
}
|
|
|
|
|
})");
|
2021-07-02 03:29:24 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
2021-01-22 07:37:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
json GscanJsonConfig::Readjson(std::string path)
|
|
|
|
|
{
|
|
|
|
|
std::ifstream f;
|
2021-06-21 11:38:36 +00:00
|
|
|
|
f.open(path, std::ios::in|std::ios::binary);
|
2021-01-22 07:37:46 +00:00
|
|
|
|
json js;
|
|
|
|
|
try {
|
2021-01-28 10:48:35 +00:00
|
|
|
|
if(f.is_open()){
|
|
|
|
|
std::string text = (std::ostringstream() << f.rdbuf()).str();
|
|
|
|
|
js = json::parse(text);
|
|
|
|
|
f.close();
|
|
|
|
|
}
|
|
|
|
|
return js.is_object() ? js: throw std::exception("js pares error");
|
2021-01-22 07:37:46 +00:00
|
|
|
|
}
|
|
|
|
|
catch (...)
|
|
|
|
|
{
|
2021-05-13 10:13:08 +00:00
|
|
|
|
FileTools::writelog(log_ERROR, "read json error");
|
2021-01-22 07:37:46 +00:00
|
|
|
|
f.is_open() ? f.close() : void();
|
|
|
|
|
return GetDefaultJson();
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-11-20 03:09:04 +00:00
|
|
|
|
|
|
|
|
|
Twain_config::Twain_config()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Twain_config::~Twain_config()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int Twain_config::getrollermsgdate()
|
|
|
|
|
{
|
|
|
|
|
loadjson(GetTwainInIPath() + TCHAR2STRING(TWAIN_CONFIG_JSON));
|
|
|
|
|
if (m_json[ROLLERMSGDATE].is_null())
|
|
|
|
|
return 0;
|
|
|
|
|
int date = 0;
|
|
|
|
|
m_json[ROLLERMSGDATE].get_to(date);
|
|
|
|
|
return date;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Twain_config::GetOrSetPintfCapability(int& value,bool is_get)
|
|
|
|
|
{
|
|
|
|
|
loadjson(GetTwainInIPath() + TCHAR2STRING(TWAIN_CONFIG_JSON));
|
|
|
|
|
if (is_get) {
|
|
|
|
|
if (m_json[PRINTFCAPABILITY].is_null()) {
|
|
|
|
|
value = 0;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
m_json[PRINTFCAPABILITY].get_to(value);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
m_json[PRINTFCAPABILITY] = value;
|
|
|
|
|
savejson(m_json, GetTwainInIPath() + TCHAR2STRING(TWAIN_CONFIG_JSON));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Twain_config::setrollermsgdata(int value)
|
|
|
|
|
{
|
|
|
|
|
loadjson(GetTwainInIPath() + TCHAR2STRING(TWAIN_CONFIG_JSON));
|
|
|
|
|
m_json[ROLLERMSGDATE] = value;
|
|
|
|
|
savejson(m_json, GetTwainInIPath() + TCHAR2STRING(TWAIN_CONFIG_JSON));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string Twain_config::GetTwainInIPath()
|
|
|
|
|
{
|
|
|
|
|
TCHAR szIniFile[MAX_PATH] = { 0 };
|
|
|
|
|
SHGetSpecialFolderPath(NULL, szIniFile, CSIDL_LOCAL_APPDATA, TRUE);
|
|
|
|
|
_tcscat(szIniFile, HUAGAO_SCAN);
|
|
|
|
|
_tcscat(szIniFile, TWAIN_INIPATH);
|
|
|
|
|
_tcscat(szIniFile, TEXT("\\"));
|
|
|
|
|
return TCHAR2STRING(szIniFile);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Twain_config::savejson(json js, std::string path)
|
|
|
|
|
{
|
|
|
|
|
std::ofstream of(path);
|
|
|
|
|
if(of.is_open())
|
|
|
|
|
{
|
|
|
|
|
of.write(js.dump().data(), js.dump().size());
|
|
|
|
|
of.close();
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
FileTools::writelog(log_ERROR, "save json error ");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
json Twain_config::loadjson(std::string path)
|
|
|
|
|
{
|
|
|
|
|
std::ifstream f;
|
|
|
|
|
f.open(path, std::ios::in | std::ios::binary);
|
|
|
|
|
json js;
|
|
|
|
|
try {
|
|
|
|
|
if (f.is_open()) {
|
|
|
|
|
std::string text = (std::ostringstream() << f.rdbuf()).str();
|
|
|
|
|
js = json::parse(text);
|
|
|
|
|
f.close();
|
|
|
|
|
}
|
|
|
|
|
m_json = js;
|
|
|
|
|
return js.is_object() ? js : throw std::exception("js pares error");
|
|
|
|
|
}
|
|
|
|
|
catch (...)
|
|
|
|
|
{
|
|
|
|
|
FileTools::writelog(log_ERROR, "read json error");
|
|
|
|
|
f.is_open() ? f.close() : void();
|
|
|
|
|
m_json = defaultjson();
|
2022-05-24 12:05:47 +00:00
|
|
|
|
savejson(defaultjson(), GetTwainInIPath() + TCHAR2STRING(TWAIN_CONFIG_JSON));
|
2021-11-20 03:09:04 +00:00
|
|
|
|
return m_json;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
json Twain_config::defaultjson()
|
|
|
|
|
{
|
|
|
|
|
json tmp;
|
|
|
|
|
tmp[ROLLERMSGDATE] = 0;
|
|
|
|
|
tmp[PRINTFCAPABILITY] = 0;
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|