Merge branch 'dev' of http://192.168.10.5:8099/sane/code_device into dev
This commit is contained in:
commit
567d030f02
|
@ -113,9 +113,9 @@ bool CImageApplyDiscardBlank::apply(const cv::Mat& pDib, double threshold, int e
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CImageApplyDiscardBlank::apply(int fileSize, const cv::Size& imageSize, FileType flag)
|
bool CImageApplyDiscardBlank::apply(int fileSize, const cv::Size& imageSize, FileType type, double threshold, const char* data)
|
||||||
{
|
{
|
||||||
switch (flag)
|
switch (type)
|
||||||
{
|
{
|
||||||
case JPEG_COLOR:
|
case JPEG_COLOR:
|
||||||
if (static_cast<double>(fileSize) / static_cast<double>(imageSize.width * imageSize.height) > 0.039)
|
if (static_cast<double>(fileSize) / static_cast<double>(imageSize.width * imageSize.height) > 0.039)
|
||||||
|
|
|
@ -21,8 +21,9 @@
|
||||||
2022/11/29 v1.5 增加纸张杂点忽略功能
|
2022/11/29 v1.5 增加纸张杂点忽略功能
|
||||||
2022/12/03 v1.5.1 调整纸张杂点忽略逻辑,避免把细条纹(有效信息)给忽略掉;默认将图像按照灰度图进行识别。
|
2022/12/03 v1.5.1 调整纸张杂点忽略逻辑,避免把细条纹(有效信息)给忽略掉;默认将图像按照灰度图进行识别。
|
||||||
2023/10/12 v1.6 添加新的空白页识别方案。采用JEPG文件大小判断是否为空白页。
|
2023/10/12 v1.6 添加新的空白页识别方案。采用JEPG文件大小判断是否为空白页。
|
||||||
2023/10/20 v1.6.1 优化JEPG文件大小判断空白页
|
2023/10/20 v1.6.1 优化JPEG文件大小判断空白页
|
||||||
* 版本号:v1.6.1
|
2023/10/30 v1.7 调整JPEG文件大小判断空白页的算法接口
|
||||||
|
* 版本号:v1.7
|
||||||
|
|
||||||
* ====================================================
|
* ====================================================
|
||||||
*/
|
*/
|
||||||
|
@ -74,13 +75,15 @@ public:
|
||||||
static bool apply(const cv::Mat& pDib, double threshold = 40, int edge = 50, double devTh = 30, double meanTh = 200, int dilate = 3);
|
static bool apply(const cv::Mat& pDib, double threshold = 40, int edge = 50, double devTh = 30, double meanTh = 200, int dilate = 3);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 空白页识别。根据jpeg文件大小进行判断。
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="fileSize">J文件大小</param>
|
/// <param name="fileSize">JPG文件大小</param>
|
||||||
/// <param name="imageSize">图像大小</param>
|
/// <param name="imageSize">图像大小</param>
|
||||||
/// <param name="flag">0为JPG + 彩色,1为JPG + 灰度,2为PNG + 彩色, 3为PNG + 灰度, 4为PNG + </param>
|
/// <param name="type">0为JPG + 彩色,1为JPG + 灰度,2为PNG + 彩色, 3为PNG + 灰度, 4为PNG + 二值图</param>
|
||||||
/// <returns></returns>
|
/// <param name="threshold">识别灵敏度阈值</param>
|
||||||
static bool apply(int fileSize, const cv::Size& imageSize, FileType type);
|
/// <param name="data">文件数据头指针</param>
|
||||||
|
/// <returns>true为空白页,false为非空白页</returns>
|
||||||
|
static bool apply(int fileSize, const cv::Size& imageSize, FileType type, double threshold, const char* data = nullptr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
double m_threshold;
|
double m_threshold;
|
||||||
|
|
|
@ -69,6 +69,7 @@ g_page[] =
|
||||||
{MAKE_ID_AND_STR(ID_OPTION_VALUE_SMYM_SM), PAGE_DOUBLE},
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_SMYM_SM), PAGE_DOUBLE},
|
||||||
{MAKE_ID_AND_STR(ID_OPTION_VALUE_SMYM_TGKBYTY), PAGE_OMIT_EMPTY},
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_SMYM_TGKBYTY), PAGE_OMIT_EMPTY},
|
||||||
{MAKE_ID_AND_STR(ID_OPTION_VALUE_SMYM_TGKBYFPZ), PAGE_OMIT_EMPTY_RECEIPT},
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_SMYM_TGKBYFPZ), PAGE_OMIT_EMPTY_RECEIPT},
|
||||||
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_SMYM_TGKBYJYWJDX), PAGE_OMIT_EMPTY_FILE_SIZE},
|
||||||
{MAKE_ID_AND_STR(ID_OPTION_VALUE_SMYM_DZ), PAGE_FOLIO}
|
{MAKE_ID_AND_STR(ID_OPTION_VALUE_SMYM_DZ), PAGE_FOLIO}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -173,12 +173,14 @@ bool is_lateral(int paper);
|
||||||
//#define HUAGAO_SETTING_STR_PAGE_DOUBLE "双面"
|
//#define HUAGAO_SETTING_STR_PAGE_DOUBLE "双面"
|
||||||
//#define HUAGAO_SETTING_STR_PAGE_OMIT_EMPTY "跳过空白页(通用)"
|
//#define HUAGAO_SETTING_STR_PAGE_OMIT_EMPTY "跳过空白页(通用)"
|
||||||
//#define HUAGAO_SETTING_STR_PAGE_OMIT_EMPTY_RECEIPT "跳过空白页(发票纸)"
|
//#define HUAGAO_SETTING_STR_PAGE_OMIT_EMPTY_RECEIPT "跳过空白页(发票纸)"
|
||||||
|
//#define HUAGAO_SETTING_STR_PAGE_OMIT_EMPTY_FILE_SIZE "跳过空白页(基于文件大小)"
|
||||||
//#define HUAGAO_SETTING_STR_PAGE_FOLIO "对折"
|
//#define HUAGAO_SETTING_STR_PAGE_FOLIO "对折"
|
||||||
enum {
|
enum {
|
||||||
PAGE_SINGLE = 0,
|
PAGE_SINGLE = 0,
|
||||||
PAGE_DOUBLE,
|
PAGE_DOUBLE,
|
||||||
PAGE_OMIT_EMPTY,
|
PAGE_OMIT_EMPTY,
|
||||||
PAGE_OMIT_EMPTY_RECEIPT,
|
PAGE_OMIT_EMPTY_RECEIPT,
|
||||||
|
PAGE_OMIT_EMPTY_FILE_SIZE,
|
||||||
PAGE_FOLIO,
|
PAGE_FOLIO,
|
||||||
};
|
};
|
||||||
int match_best_page(std::string& val, bool* exact);
|
int match_best_page(std::string& val, bool* exact);
|
||||||
|
@ -619,9 +621,7 @@ typedef struct _scan_conf
|
||||||
int discare_dilate; /**< 调过空白页纸张杂点阈值>*/
|
int discare_dilate; /**< 调过空白页纸张杂点阈值>*/
|
||||||
double discare_meanth; /**< 调过空白页文稿底色阈值>*/
|
double discare_meanth; /**< 调过空白页文稿底色阈值>*/
|
||||||
bool en_contaminationdetection; /**< 脏污检测使能>*/
|
bool en_contaminationdetection; /**< 脏污检测使能>*/
|
||||||
uint8_t contaminationdetection_threshold_1; /**< 脏污检测第一阈值,超过该阈值视为存在脏污>*/
|
bool detect_size_diascard_blank; /**< 基于压缩图像大小跳过空白页使能*/
|
||||||
uint8_t contaminationdetection_threshold_2; /**< 脏污检测第二阈值,配合width使用,超过该阈值且连续宽度达到width视为存在脏污>*/
|
|
||||||
uint32_t contaminationdetection_width; /**< 脏污检测宽度,配合threshold2使用>*/
|
|
||||||
uint32_t reserve[1024]; /**< 预留4096字节做协议扩展*/
|
uint32_t reserve[1024]; /**< 预留4096字节做协议扩展*/
|
||||||
}SCANCONF ,*LPSCANCONF;
|
}SCANCONF ,*LPSCANCONF;
|
||||||
//图像参数设置 -OVER
|
//图像参数设置 -OVER
|
||||||
|
|
|
@ -1454,6 +1454,11 @@ bool hg_scanner::jsn_reorganize()
|
||||||
{
|
{
|
||||||
erase_option(SANE_STD_OPT_NAME_SIZE_CHECK);
|
erase_option(SANE_STD_OPT_NAME_SIZE_CHECK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!firmware_sup_dirty_check)
|
||||||
|
{
|
||||||
|
erase_option(SANE_STD_OPT_NAME_LENS_DIRTY);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
int hg_scanner::hgpaper_to_devspaper(Paper_Map papermap[], int len, int& paper, bool* exact, TwSS* type)
|
int hg_scanner::hgpaper_to_devspaper(Paper_Map papermap[], int len, int& paper, bool* exact, TwSS* type)
|
||||||
|
@ -3055,7 +3060,7 @@ int hg_scanner::on_process_double_paper(bool type)
|
||||||
{
|
{
|
||||||
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
||||||
}
|
}
|
||||||
int hg_scanner::on_detect_lens_dirty(bool type)
|
int hg_scanner::on_detect_lens_dirty(bool &type)
|
||||||
{
|
{
|
||||||
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
||||||
}
|
}
|
||||||
|
@ -3459,9 +3464,22 @@ int hg_scanner::try_third_app_handle_start(bool& handled)
|
||||||
{
|
{
|
||||||
int ret = SCANNER_ERR_OK;
|
int ret = SCANNER_ERR_OK;
|
||||||
|
|
||||||
|
handled = false;
|
||||||
|
return ret;
|
||||||
|
|
||||||
handled = !async_io_;
|
handled = !async_io_;
|
||||||
if (handled)
|
if (handled)
|
||||||
{
|
{
|
||||||
|
if (user_cancel_)
|
||||||
|
{
|
||||||
|
if (status_ != SCANNER_ERR_OK && status_ != SCANNER_ERR_USER_CANCELED) // call stop after exception occurs, start a new scanning ...
|
||||||
|
{
|
||||||
|
handled = false;
|
||||||
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "call start after user cancelled while status is %s, we start a new scanning\n", hg_scanner_err_description(status_));
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
while (wait_usb_result_.try_wait())
|
while (wait_usb_result_.try_wait())
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(3));
|
std::this_thread::sleep_for(std::chrono::milliseconds(3));
|
||||||
|
|
||||||
|
@ -3505,13 +3523,14 @@ int hg_scanner::try_third_app_handle_start(bool& handled)
|
||||||
}
|
}
|
||||||
int hg_scanner::try_third_app_after_start(int err)
|
int hg_scanner::try_third_app_after_start(int err)
|
||||||
{
|
{
|
||||||
if (!async_io_)
|
//if (!async_io_)
|
||||||
{
|
//{
|
||||||
while (wait_img_.is_waiting() && !wait_usb_.is_waiting())
|
// while (wait_img_.is_waiting() && !wait_usb_.is_waiting())
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
// std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||||
if (wait_img_.is_waiting() && wait_usb_.is_waiting())
|
// if (wait_img_.is_waiting() && wait_usb_.is_waiting())
|
||||||
err = status_;
|
// err = status_;
|
||||||
}
|
//
|
||||||
|
//}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -3609,7 +3628,7 @@ int hg_scanner::save_usb_data(std::shared_ptr<tiny_buffer> data)
|
||||||
unsigned int bytes = data->size();
|
unsigned int bytes = data->size();
|
||||||
|
|
||||||
usb_img_index_++;
|
usb_img_index_++;
|
||||||
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "USB read one picture with %u bytes\n", data->size());
|
VLOG_MINI_3(LOG_LEVEL_DEBUG_INFO, "USB packet(%04d) of picture with %u bytes(status: %d)\n", usb_img_index_, data->size(), data->get_image_statu());
|
||||||
if (dump_usb_path_.length()) //这两台设备不是jpg的图 所以不能直接处理
|
if (dump_usb_path_.length()) //这两台设备不是jpg的图 所以不能直接处理
|
||||||
{
|
{
|
||||||
char name[80] = { 0 };
|
char name[80] = { 0 };
|
||||||
|
@ -4081,11 +4100,98 @@ void hg_scanner::on_language_changed(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
int hg_scanner::wait_one_image_from_start(bool& handled)
|
||||||
|
{
|
||||||
|
int ret = SCANNER_ERR_OK;
|
||||||
|
|
||||||
|
handled = false;
|
||||||
|
if (!async_io_) // non-callback
|
||||||
|
{
|
||||||
|
while (is_running() != THREAD_RUNNING_IDLE)
|
||||||
|
{
|
||||||
|
handled = true;
|
||||||
|
if (final_imgs_.size())
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (final_imgs_.size())
|
||||||
|
{
|
||||||
|
IMH head = { 0 };
|
||||||
|
|
||||||
|
handled = true;
|
||||||
|
if (final_imgs_.front(&head))
|
||||||
|
{
|
||||||
|
if (head.statu & IMG_STATUS_DOUBLE)
|
||||||
|
ret = SCANNER_ERR_DEVICE_DOUBLE_FEEDING;
|
||||||
|
else if (head.statu & IMG_STATUS_JAM)
|
||||||
|
ret = SCANNER_ERR_DEVICE_PAPER_JAMMED;
|
||||||
|
else if (head.statu & IMG_STATUS_STAPLE)
|
||||||
|
ret = SCANNER_ERR_DEVICE_STAPLE_ON;
|
||||||
|
else if (head.statu & IMG_STATUS_SIZE_ERR)
|
||||||
|
ret = SCANNER_ERR_DEVICE_SIZE_CHECK;
|
||||||
|
else if (head.statu & IMG_STATUS_DOGEAR)
|
||||||
|
ret = SCANNER_ERR_DEVICE_DOGEAR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (handled) // overed normal or exception
|
||||||
|
{
|
||||||
|
if (status_ == SCANNER_ERR_OK
|
||||||
|
|| status_ == SCANNER_ERR_DEVICE_DOUBLE_FEEDING) // 双张特殊处理,视为成功
|
||||||
|
{
|
||||||
|
SANE_Bool has_paper = SANE_FALSE;
|
||||||
|
|
||||||
|
get_scanner_paperon(has_paper);
|
||||||
|
if (has_paper == SANE_TRUE)
|
||||||
|
handled = false;
|
||||||
|
else
|
||||||
|
ret = SCANNER_ERR_DEVICE_NO_PAPER;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ret = status_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
int hg_scanner::start(void)
|
int hg_scanner::start(void)
|
||||||
{
|
{
|
||||||
user_cancel_ = false;
|
int ret = SCANNER_ERR_OK;
|
||||||
|
bool handled = false;
|
||||||
|
|
||||||
return status_;
|
if (user_cancel_)
|
||||||
|
{
|
||||||
|
user_cancel_ = false; // stopped by user, reset flag and starting a new scanning ...
|
||||||
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "start after user stopped just now while with %d image(s) in queue, a new scanning will to be started ...\n", final_imgs_.size());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret = wait_one_image_from_start(handled);
|
||||||
|
if (handled)
|
||||||
|
{
|
||||||
|
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "start in previous scanning and result is %s, image count %d\n", hg_scanner_err_description(ret), final_imgs_.size());
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// clear ...
|
||||||
|
imgs_.Clear();
|
||||||
|
final_imgs_.clear();
|
||||||
|
usb_img_index_ = final_img_index_ = 0;
|
||||||
|
status_ = SCANNER_ERR_OK;
|
||||||
|
|
||||||
|
// start ...
|
||||||
|
ret = do_start();
|
||||||
|
|
||||||
|
if (ret == SCANNER_ERR_OK)
|
||||||
|
{
|
||||||
|
// wait ONE picture or stopped
|
||||||
|
ret = wait_one_image_from_start(handled);
|
||||||
|
}
|
||||||
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "start scanning result = %s\n", hg_scanner_err_description(ret));
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
int hg_scanner::get_image_info(SANE_Parameters* ii, int len)
|
int hg_scanner::get_image_info(SANE_Parameters* ii, int len)
|
||||||
{
|
{
|
||||||
|
@ -4197,9 +4303,21 @@ int hg_scanner::read_image_data(unsigned char* buf, int* len)
|
||||||
}
|
}
|
||||||
int hg_scanner::stop(void)
|
int hg_scanner::stop(void)
|
||||||
{
|
{
|
||||||
user_cancel_ = true;
|
int ret = SCANNER_ERR_OK;
|
||||||
|
|
||||||
return status_;
|
user_cancel_ = true;
|
||||||
|
ret = do_stop();
|
||||||
|
|
||||||
|
// wait until really stopped ...
|
||||||
|
if (ret == SCANNER_ERR_OK)
|
||||||
|
{
|
||||||
|
while (is_running() != THREAD_RUNNING_IDLE)
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(3));
|
||||||
|
ret = status_;
|
||||||
|
}
|
||||||
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "user stopped result = %s\n", hg_scanner_err_description(ret));
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
int hg_scanner::reset(void)
|
int hg_scanner::reset(void)
|
||||||
{
|
{
|
||||||
|
@ -5296,6 +5414,7 @@ int hg_scanner::image_configuration(SCANCONF& ic)
|
||||||
ic.is_duplex = (image_prc_param_.bits.page == PAGE_DOUBLE
|
ic.is_duplex = (image_prc_param_.bits.page == PAGE_DOUBLE
|
||||||
|| image_prc_param_.bits.page == PAGE_OMIT_EMPTY
|
|| image_prc_param_.bits.page == PAGE_OMIT_EMPTY
|
||||||
|| image_prc_param_.bits.page == PAGE_OMIT_EMPTY_RECEIPT
|
|| image_prc_param_.bits.page == PAGE_OMIT_EMPTY_RECEIPT
|
||||||
|
|| image_prc_param_.bits.page == PAGE_OMIT_EMPTY_FILE_SIZE
|
||||||
|| image_prc_param_.bits.page == PAGE_FOLIO);
|
|| image_prc_param_.bits.page == PAGE_FOLIO);
|
||||||
|
|
||||||
if (is_dpi_color_check)
|
if (is_dpi_color_check)
|
||||||
|
@ -5334,6 +5453,7 @@ int hg_scanner::image_configuration(SCANCONF& ic)
|
||||||
ic.is_autodiscradblank_normal = image_prc_param_.bits.page == PAGE_OMIT_EMPTY || is_discardblank;
|
ic.is_autodiscradblank_normal = image_prc_param_.bits.page == PAGE_OMIT_EMPTY || is_discardblank;
|
||||||
ic.discardblank_percent = omit_empty_level_;
|
ic.discardblank_percent = omit_empty_level_;
|
||||||
ic.is_autodiscradblank_vince = image_prc_param_.bits.page == PAGE_OMIT_EMPTY_RECEIPT;
|
ic.is_autodiscradblank_vince = image_prc_param_.bits.page == PAGE_OMIT_EMPTY_RECEIPT;
|
||||||
|
ic.detect_size_diascard_blank = image_prc_param_.bits.page == PAGE_OMIT_EMPTY_FILE_SIZE;
|
||||||
ic.is_switchfrontback = image_prc_param_.bits.exchange;
|
ic.is_switchfrontback = image_prc_param_.bits.exchange;
|
||||||
ic.autodescrew = image_prc_param_.bits.automatic_skew;
|
ic.autodescrew = image_prc_param_.bits.automatic_skew;
|
||||||
ic.multi_output_red = image_prc_param_.bits.rid_red; //之前加上可能导致超时,或者未知错误不可描述。
|
ic.multi_output_red = image_prc_param_.bits.rid_red; //之前加上可能导致超时,或者未知错误不可描述。
|
||||||
|
@ -5404,7 +5524,7 @@ int hg_scanner::image_configuration(SCANCONF& ic)
|
||||||
ic.dogeardistabce = fractate_level_;
|
ic.dogeardistabce = fractate_level_;
|
||||||
ic.fadeback = image_prc_param_.bits.erase_bakground;
|
ic.fadeback = image_prc_param_.bits.erase_bakground;
|
||||||
ic.fadebackrange = erase_bkg_range_;
|
ic.fadebackrange = erase_bkg_range_;
|
||||||
ic.isuoloadexceptionimage = pid_ == 0x0439 ? false : (double_paper_handle_ & DOUBLE_PAPER_SAVE_IMG) == DOUBLE_PAPER_SAVE_IMG;
|
ic.isuoloadexceptionimage = (double_paper_handle_ == DOUBLE_PAPEAR_STOP) ? false : true;
|
||||||
adjust_filling_hole(&ic);
|
adjust_filling_hole(&ic);
|
||||||
|
|
||||||
ic.fold_concatmode = fold_type_;
|
ic.fold_concatmode = fold_type_;
|
||||||
|
|
|
@ -264,7 +264,7 @@ protected:
|
||||||
virtual int on_is_auto_paper(bool isautopaper) = 0; //待纸扫描
|
virtual int on_is_auto_paper(bool isautopaper) = 0; //待纸扫描
|
||||||
virtual int on_cis_get_image(bool type) = 0;
|
virtual int on_cis_get_image(bool type) = 0;
|
||||||
virtual int on_process_double_paper(bool type) = 0; //双张图像校验
|
virtual int on_process_double_paper(bool type) = 0; //双张图像校验
|
||||||
virtual int on_detect_lens_dirty(bool type); //检测镜头脏污
|
virtual int on_detect_lens_dirty(bool &type); //检测镜头脏污
|
||||||
virtual int on_set_period(int val); //PWM占空比
|
virtual int on_set_period(int val); //PWM占空比
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@ -393,8 +393,8 @@ protected:
|
||||||
bool firmware_sup_morr_; //固件支持 摩尔纹 139 239-3C0518
|
bool firmware_sup_morr_; //固件支持 摩尔纹 139 239-3C0518
|
||||||
bool firmware_sup_color_fill_; //固件支持 色彩填充 139 239 439 -3C
|
bool firmware_sup_color_fill_; //固件支持 色彩填充 139 239 439 -3C
|
||||||
bool firmware_sup_history_cnt; //固件支持 清除历史张数 3288 G300 220303
|
bool firmware_sup_history_cnt; //固件支持 清除历史张数 3288 G300 220303
|
||||||
bool firmware_sup_double_check; //固件支持 双张校验 231021
|
bool firmware_sup_double_check; //固件支持 双张校验 231027
|
||||||
bool firmware_sup_dirty_check; //固件支持 脏污检测 231021
|
bool firmware_sup_dirty_check; //固件支持 脏污检测 231027
|
||||||
bool firmware_sup_backup_restore; //固件支持 备份还原 231021
|
bool firmware_sup_backup_restore; //固件支持 备份还原 231021
|
||||||
bool firmware_sup_boardTime; //固件支持 板级时间校验 231021
|
bool firmware_sup_boardTime; //固件支持 板级时间校验 231021
|
||||||
bool firmware_sup_device_7010; //G300 设备但是7010 2023/9/21
|
bool firmware_sup_device_7010; //G300 设备但是7010 2023/9/21
|
||||||
|
@ -439,6 +439,7 @@ protected:
|
||||||
int save_final_image(hg_imgproc::LPIMGHEAD head, void* buf, uint32_t id = -1);
|
int save_final_image(hg_imgproc::LPIMGHEAD head, void* buf, uint32_t id = -1);
|
||||||
|
|
||||||
void adjust_filling_hole(LPSCANCONF conf);
|
void adjust_filling_hole(LPSCANCONF conf);
|
||||||
|
int wait_one_image_from_start(bool& handled);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////
|
||||||
// 新增自定义伽玛曲线及扫描区域属性 - 2022-05-05
|
// 新增自定义伽玛曲线及扫描区域属性 - 2022-05-05
|
||||||
|
@ -461,6 +462,9 @@ protected:
|
||||||
bool is_white_0_; // 是否‘0’代表白色
|
bool is_white_0_; // 是否‘0’代表白色
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
int start(void);
|
||||||
|
int stop(void);
|
||||||
|
|
||||||
void set_ui_callback(sane_callback cb, bool enable_async_io);
|
void set_ui_callback(sane_callback cb, bool enable_async_io);
|
||||||
void set_dev_family(const char* family);
|
void set_dev_family(const char* family);
|
||||||
void set_read_over_with_no_data(bool no_data);
|
void set_read_over_with_no_data(bool no_data);
|
||||||
|
@ -487,10 +491,10 @@ public:
|
||||||
int is_running(void); // return thread_running
|
int is_running(void); // return thread_running
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual int start(void);
|
virtual int do_start(void) = 0;
|
||||||
|
virtual int do_stop(void) = 0;
|
||||||
virtual int get_image_info(SANE_Parameters* ii, int len);
|
virtual int get_image_info(SANE_Parameters* ii, int len);
|
||||||
virtual int read_image_data(unsigned char* buf, int* len);
|
virtual int read_image_data(unsigned char* buf, int* len);
|
||||||
virtual int stop(void);
|
|
||||||
virtual int reset(void);
|
virtual int reset(void);
|
||||||
virtual int device_io_control(unsigned long code, void* data, unsigned* len);
|
virtual int device_io_control(unsigned long code, void* data, unsigned* len);
|
||||||
virtual int discard_all_images(void) = 0;
|
virtual int discard_all_images(void) = 0;
|
||||||
|
|
|
@ -265,7 +265,7 @@ void hg_scanner_200::thread_handle_usb_read(void)
|
||||||
}
|
}
|
||||||
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "USB thread exit with code: %s, status = %s\n", hg_scanner_err_name(ret), hg_scanner_err_description(status_));
|
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "USB thread exit with code: %s, status = %s\n", hg_scanner_err_name(ret), hg_scanner_err_description(status_));
|
||||||
}
|
}
|
||||||
int hg_scanner_200::start(void)
|
int hg_scanner_200::do_start(void)
|
||||||
{
|
{
|
||||||
bool handled = false;
|
bool handled = false;
|
||||||
int ret = try_third_app_handle_start(handled),
|
int ret = try_third_app_handle_start(handled),
|
||||||
|
@ -318,7 +318,7 @@ int hg_scanner_200::start(void)
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
int hg_scanner_200::stop(void)
|
int hg_scanner_200::do_stop(void)
|
||||||
{
|
{
|
||||||
int ret = SCANNER_ERR_OK;
|
int ret = SCANNER_ERR_OK;
|
||||||
|
|
||||||
|
@ -337,7 +337,8 @@ int hg_scanner_200::stop(void)
|
||||||
{
|
{
|
||||||
status_ = SCANNER_ERR_DEVICE_STOPPED;
|
status_ = SCANNER_ERR_DEVICE_STOPPED;
|
||||||
}
|
}
|
||||||
return status_;
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
int hg_scanner_200::writeusb(USBCB &usb)
|
int hg_scanner_200::writeusb(USBCB &usb)
|
||||||
{
|
{
|
||||||
|
|
|
@ -50,8 +50,8 @@ public:
|
||||||
~hg_scanner_200();
|
~hg_scanner_200();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual int start(void)override;
|
virtual int do_start(void) override;
|
||||||
virtual int stop(void)override;
|
virtual int do_stop(void) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int initdevice();
|
int initdevice();
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -76,7 +76,7 @@ protected:
|
||||||
virtual int on_is_auto_paper(bool isautopaper)override; //待纸扫描
|
virtual int on_is_auto_paper(bool isautopaper)override; //待纸扫描
|
||||||
virtual int on_cis_get_image(bool isautopaper) override; //cis 原图获取
|
virtual int on_cis_get_image(bool isautopaper) override; //cis 原图获取
|
||||||
virtual int on_process_double_paper(bool type) override; //双张图像校验
|
virtual int on_process_double_paper(bool type) override; //双张图像校验
|
||||||
virtual int on_detect_lens_dirty(bool type) override; //检测镜头脏污
|
virtual int on_detect_lens_dirty(bool &type) override; //检测镜头脏污
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -86,8 +86,8 @@ public:
|
||||||
public:
|
public:
|
||||||
//virtual int get_image_info(IMG_PARAM* ii) override;
|
//virtual int get_image_info(IMG_PARAM* ii) override;
|
||||||
//virtual int read_image_data(unsigned char* buf, int* len) override;
|
//virtual int read_image_data(unsigned char* buf, int* len) override;
|
||||||
virtual int start(void) override;
|
virtual int do_start(void) override;
|
||||||
virtual int stop(void) override;
|
virtual int do_stop(void) override;
|
||||||
virtual int reset(void) override;
|
virtual int reset(void) override;
|
||||||
virtual int device_io_control(unsigned long code, void* data, unsigned* len) override;
|
virtual int device_io_control(unsigned long code, void* data, unsigned* len) override;
|
||||||
virtual int get_roller_life(void) override;
|
virtual int get_roller_life(void) override;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -45,14 +45,15 @@ protected:
|
||||||
virtual int on_is_auto_paper(bool isautopaper)override; //待纸扫描
|
virtual int on_is_auto_paper(bool isautopaper)override; //待纸扫描
|
||||||
virtual int on_cis_get_image(bool isautopaper) override; //cis 原图获取
|
virtual int on_cis_get_image(bool isautopaper) override; //cis 原图获取
|
||||||
virtual int on_process_double_paper(bool type) override; //双张图像校验
|
virtual int on_process_double_paper(bool type) override; //双张图像校验
|
||||||
virtual int on_detect_lens_dirty(bool type) override; //检测镜头脏污
|
virtual int on_detect_lens_dirty(bool &type) override; //检测镜头脏污
|
||||||
|
|
||||||
public:
|
public:
|
||||||
hg_scanner_300(const char* dev_name,int pid, usb_io* io);
|
hg_scanner_300(const char* dev_name,int pid, usb_io* io);
|
||||||
~hg_scanner_300();
|
~hg_scanner_300();
|
||||||
public:
|
public:
|
||||||
virtual int start(void)override;
|
virtual int do_start(void) override;
|
||||||
virtual int stop(void)override;
|
virtual int do_stop(void) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int set_kernelsnap_ver();
|
int set_kernelsnap_ver();
|
||||||
int agreement(TwSS tw,int align);
|
int agreement(TwSS tw,int align);
|
||||||
|
|
|
@ -1020,7 +1020,7 @@ void hg_scanner_302::thread_handle_usb_read(void)
|
||||||
VLOG_MINI_1(LOG_LEVEL_FATAL, "V4L2 error: %d\n", info->Code);
|
VLOG_MINI_1(LOG_LEVEL_FATAL, "V4L2 error: %d\n", info->Code);
|
||||||
{
|
{
|
||||||
bool cancel = user_cancel_;
|
bool cancel = user_cancel_;
|
||||||
stop();
|
do_stop();
|
||||||
user_cancel_ = cancel;
|
user_cancel_ = cancel;
|
||||||
go = false;
|
go = false;
|
||||||
}
|
}
|
||||||
|
@ -1052,7 +1052,7 @@ void hg_scanner_302::thread_handle_usb_read(void)
|
||||||
}
|
}
|
||||||
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "USB thread exit with code: %s, status = %s\n", hg_scanner_err_name(ret), hg_scanner_err_name(status_));
|
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "USB thread exit with code: %s, status = %s\n", hg_scanner_err_name(ret), hg_scanner_err_name(status_));
|
||||||
}
|
}
|
||||||
int hg_scanner_302::start(void)
|
int hg_scanner_302::do_start(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
bool handled = false;
|
bool handled = false;
|
||||||
|
@ -1129,7 +1129,7 @@ int hg_scanner_302::start(void)
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
int hg_scanner_302::stop(void)
|
int hg_scanner_302::do_stop(void)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(io_lock_);
|
std::lock_guard<std::mutex> lock(io_lock_);
|
||||||
int ret = SCANNER_ERR_OK;
|
int ret = SCANNER_ERR_OK;
|
||||||
|
@ -1139,7 +1139,7 @@ int hg_scanner_302::stop(void)
|
||||||
// io_->set_timeout(500);
|
// io_->set_timeout(500);
|
||||||
//final_imgs_.clear();
|
//final_imgs_.clear();
|
||||||
|
|
||||||
return status_;
|
return ret;
|
||||||
}
|
}
|
||||||
int hg_scanner_302::reset(void)
|
int hg_scanner_302::reset(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -83,10 +83,9 @@ public:
|
||||||
~hg_scanner_302();
|
~hg_scanner_302();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual int start(void) override;
|
virtual int do_start(void) override;
|
||||||
//virtual int get_image_info(IMG_PARAM* ii) override;
|
virtual int do_stop(void) override;
|
||||||
//virtual int read_image_data(unsigned char* buf, int* len) override;
|
|
||||||
virtual int stop(void) override;
|
|
||||||
virtual int reset(void) override;
|
virtual int reset(void) override;
|
||||||
virtual int device_io_control(unsigned long code, void* data, unsigned* len) override;
|
virtual int device_io_control(unsigned long code, void* data, unsigned* len) override;
|
||||||
|
|
||||||
|
|
|
@ -293,7 +293,7 @@ int hg_scanner_306::get_roller_life(void)
|
||||||
{
|
{
|
||||||
return pid_ == 300 ? 150000 : 200000;
|
return pid_ == 300 ? 150000 : 200000;
|
||||||
}
|
}
|
||||||
int hg_scanner_306::start(void)
|
int hg_scanner_306::do_start(void)
|
||||||
{
|
{
|
||||||
bool handled = false;
|
bool handled = false;
|
||||||
int ret = try_third_app_handle_start(handled), //sane调用是每次都会调用一次start和stop
|
int ret = try_third_app_handle_start(handled), //sane调用是每次都会调用一次start和stop
|
||||||
|
@ -367,7 +367,7 @@ int hg_scanner_306::start(void)
|
||||||
VLOG_MINI_1(LOG_LEVEL_WARNING, "----------Main start scan status : %s----------\n", hg_scanner_err_description(ret));
|
VLOG_MINI_1(LOG_LEVEL_WARNING, "----------Main start scan status : %s----------\n", hg_scanner_err_description(ret));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
int hg_scanner_306::stop(void)
|
int hg_scanner_306::do_stop(void)
|
||||||
{
|
{
|
||||||
int ret = SCANNER_ERR_OK;
|
int ret = SCANNER_ERR_OK;
|
||||||
|
|
||||||
|
@ -390,7 +390,7 @@ int hg_scanner_306::stop(void)
|
||||||
}
|
}
|
||||||
//final_imgs_.clear();
|
//final_imgs_.clear();
|
||||||
|
|
||||||
return status_;
|
return ret;
|
||||||
}
|
}
|
||||||
int hg_scanner_306::writeusb(USBCB &usb)
|
int hg_scanner_306::writeusb(USBCB &usb)
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,8 +52,9 @@ public:
|
||||||
hg_scanner_306(const char* dev_name,int pid, usb_io* io);
|
hg_scanner_306(const char* dev_name,int pid, usb_io* io);
|
||||||
~hg_scanner_306();
|
~hg_scanner_306();
|
||||||
public:
|
public:
|
||||||
virtual int start(void)override;
|
virtual int do_start(void) override;
|
||||||
virtual int stop(void)override;
|
virtual int do_stop(void) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int set_kernelsnap_ver();
|
int set_kernelsnap_ver();
|
||||||
int agreement(TwSS tw,int align);
|
int agreement(TwSS tw,int align);
|
||||||
|
|
Loading…
Reference in New Issue