2022-05-03 03:56:07 +00:00
|
|
|
|
#include "hg_scanner_200.h"
|
2022-05-30 03:04:26 +00:00
|
|
|
|
#include "../wrapper/hg_log.h"
|
2022-05-03 03:56:07 +00:00
|
|
|
|
|
2022-07-18 08:56:03 +00:00
|
|
|
|
#if defined(WIN32) || defined(_WIN64)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
#include "scanner_manager.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
2022-07-15 08:18:55 +00:00
|
|
|
|
#ifdef OEM_LISICHENG
|
2022-10-11 01:00:46 +00:00
|
|
|
|
static std::string jsontext1("{\"device_type\":\"G100-G200-lsc\",\"option_count\":64,\"1\":{\"category\":\"base\",\"name\":\"restore\",\"title\":\"\\u6062\\u590d\\u9ed8\\u8ba4\\u8bbe\\u7f6e\",\"desc\":\"\\u6062\\u590d\\u9ed8\\u8ba4\\u8bbe\\u7f6e\",\"type\":\"button\",\"cur\":\"button\",\"default\":\"button\",\"size\":0},\"2\":{\"category\":\"advanced\",\"name\":\"help\",\"title\":\"\\u5e2e\\u52a9\",\"desc\":\"\\u663e\\u793a\\u8f6f\\u4ef6\\u5e2e\\u52a9\\u6587\\u6863\",\"type\":\"button\",\"cur\":\"true\",\"default\":\"true\",\"size\":4},\"3\":{\"category\":\"base\",\"name\":\"grp-1\",\"title\":\"\\u57fa\\u672c\\u8bbe\\u7f6e\",\"type\":\"group\"},\"4\":{\"category\":\"base\",\"name\":\"is-multiout\",\"title\":\"\\u591a\\u6d41\\u8f93\\u51fa\",\"desc\":\"\\u540c\\u65f6\\u8f93\\u51fa\\u591a\\u79cd\\u989c\\u8272\\u6a21\\u5f0f\\u7684\\u56fe\\u50cf\",\"type\":\"bool\",\"cur\":false,\"default\":false,\"size\":4},\"5\":{\"category\":\"base\",\"name\":\"multiout-type\",\"title\":\"\\u591a\\u6d41\\u8f93\\u51fa\\u7c7b\\u578b\",\"desc\":\"\\u9009\\u62e9\\u591a\\u6d41\\u8f93\\u51fa\\u7684\\u7c7b\\u578b\",\"type\":\"string\",\"cur\":\"\\u5f69\\u8272+\\u7070\\u5ea6+\\u9ed1\\u767d\",\"default\":\"\\u5f69\\u8272+\\u7070\\u5ea6+\\u9ed1\\u767d\",\"size\":32,\"range\":[\"\\u5f69\\u8272+\\u7070\\u5ea6+\\u9ed1\\u767d\",\"\\u5f69\\u8272+\\u7070\\u5ea6\",\"\\u5f69\\u8272+\\u9ed1\\u767d\",\"\\u7070\\u5ea6+\\u9ed1\\u767d\"],\"depend_or\":[\"4==true\"]},\"6\":{\"category\":\"base\",\"name\":\"mode\",\"title\":\"\\u989c\\u8272\\u6a21\\u5f0f\",\"desc\":\"\\u9009\\u62e9\\u8272\\u5f69\\u6a21\\u5f0f\",\"type\":\"string\",\"cur\":\"24\\u4f4d\\u5f69\\u8272\",\"default\":\"24\\u4f4d\\u5f69\\u8272\",\"size\":32,\"range\":[\"24\\u4f4d\\u5f69\\u8272\",\"256\\u7ea7\\u7070\\u5ea6\",\"\\u9ed1\\u767d\",\"\\u989c\\u8272\\u81ea\\u52a8\\u8bc6\\u522b\"],\"depend_or\":[\"4!=true\"]},\"7\":{\"category\":\"base\",\"name\":\"binary-threshold\",\"title\":\"\\u9ed1\\u767d\\u56fe\\u50cf\\u9608\\u503c\",\"desc\":\"\\u9ad8\\u4e8e\\u8be5\\u9608\\u503c\\u4e3a1\\uff08\\u767d\\uff09\\uff0c\\u4f4e\\u4e8e\\u8be5\\u9608\\u503c\\u4e3a0\\uff08\\u9ed1\\uff09\",\"type\":\"int\",\"cur\":127,\"default\":127,\"size\":4,\"range\":{\"min\":1,\"max\":255},\"depend_or\":[\"4==true\",\"6==\\u9ed1\\u767d\"]},\"8\":{\"category\":\"base\",\"name\":\"reverse-bw\",\"title\":\"\\u9ed1\\u767d\\u56fe\\u50cf\\u53cd\\u8272\\u8f93\\u51fa\",\"desc\":\"\\u8f93\\u51fa\\u7684\\u9ed1\\u767d\\u56fe\\u50cf\\u4ee5\\u201c1\\u201d\\u4ee3\\u8868\\u9ed1\\u8272\\uff0c\\u201c0\\u201d\\u4ee3\\u8868\\u767d\\u8272\",\"type\":\"bool\",\"cur\":false,\"default\":false,\"size\":4,\"depend_or\":[\"4==true\",\"6==\\u9ed1\\u767d\"]},\"9\":{\"category\":\"base\",\"name\":\"filter\",\"title\":\"\\u7070\\u5ea6\\u6216\\u9ed1\\u767d\\u56fe\\u50cf - \\u9664\\u8272\\u4e0e\\u589e\\u5f3a\",\"desc\":\"\\u6d88\\u9664\\u6216\\u589e\\u5f3a\\u6307\\u5b9a\\u8272\\u5f69\",\"type\":\"string\",\"cur\":\"\\u4e0d\\u9664\\u8272\",\"default\":\"\\u4e0d\\u9664\\u8272\",\"size\":24,\"range\":[\"\\u4e0d\\u9664\\u8272\",\"\\u9664\\u7ea2\\u8272\",\"\\u9664\\u7eff\\u8272\",\"\\u9664\\u84dd\\u8272\",\"\\u7ea2\\u8272\\u589e\\u5f3a\",\"\\u7eff\\u8272\\u589e\\u5f3a\",\"\\u84dd\\u8272\\u589e\\u5f3a\"],\"depend_and\":[\"4!=true\",\"6!=24\\u4f4d\\u5f69\\u8272\",\"6!=\\u989c\\u8272\\u81ea\\u52a8\\u8bc6\\u522b\"]},\"10\":{\"category\":\"base\",\"name\":\"is-rid-multiout-red\",\"title\":\"24\\u4f4d\\u5f69\\u8272\\u56fe\\u50cf - \\u591a\\u6d41\\u8f93\\u51fa\\u9664\\u7ea2\",\"desc\":\"\\u540c\\u65f6\\u8f93\\u51fa\\u5f69\\u8272\\u56fe\\u50cf\\u548c\\u7070\\u5ea6\\u9664\\u7ea2\\u56fe\\u50cf\",\"type\":\"bool\",\"cur\":false,\"default\":false,\"size\":4,\"depend_and\":[\"4!=true\",\"6!=256\\u7ea7\\u7070\\u5ea6\",\"6!=\\u9ed1\\u767d\",\"6!=\\u989c\\u8272\\u81ea\\u52a8\\u8bc6\\u522b\"]},\"11\":{\"category\":\"base\",\"name\":\"is-rid-answer-sheet-red\",\"title\":\"24\\u4f4d\\u5f69\\u8272\\u56fe\\u50cf - \\u7b54\\u9898\\u5361\\u9664\\u7ea2\",\"desc\":\"\\u8f93\\u51fa\\u9664\\u7ea2\\u5f69\\u8272\\u56fe\\u50cf\",\"type\":\"bool\",\"cur\":false,\"default\":false,\"size\":4,\"d
|
2022-10-09 03:56:27 +00:00
|
|
|
|
static std::string jsontext2("\":40,\"range\":[\"\\u5355\\u9762\",\"\\u53cc\\u9762\",\"\\u8df3\\u8fc7\\u7a7a\\u767d\\u9875\\uff08\\u901a\\u7528\\uff09\",\"\\u8df3\\u8fc7\\u7a7a\\u767d\\u9875\\uff08\\u53d1\\u7968\\u7eb8\\uff09\",\"\\u5bf9\\u6298\"]},\"27\":{\"category\":\"base\",\"name\":\"blank-sensitivity\",\"title\":\" \\u8df3\\u8fc7\\u7a7a\\u767d\\u9875\\u7075\\u654f\\u5ea6\",\"desc\":\"\\u6570\\u503c\\u8d8a\\u5927\\uff0c\\u5219\\u8d8a\\u5bb9\\u6613\\u8df3\\u8fc7\",\"type\":\"int\",\"cur\":50,\"default\":50,\"size\":4,\"range\":{\"min\":1,\"max\":100},\"depend_or\":[\"26==\\u8df3\\u8fc7\\u7a7a\\u767d\\u9875\\uff08\\u901a\\u7528\\uff09\",\"26==\\u8df3\\u8fc7\\u7a7a\\u767d\\u9875\\uff08\\u53d1\\u7968\\u7eb8\\uff09\"]},\"28\":{\"category\":\"base\",\"name\":\"resolution\",\"title\":\"\\u5206\\u8fa8\\u7387\",\"desc\":\"\\u8bbe\\u7f6e\\u626b\\u63cf\\u56fe\\u50cf\\u7684\\u5206\\u8fa8\\u7387\",\"type\":\"int\",\"cur\":200,\"default\":200,\"size\":4,\"range\":[100,150,200,300,600]},\"29\":{\"category\":\"base\",\"name\":\"is-exchange\",\"title\":\"\\u4ea4\\u6362\\u6b63\\u53cd\\u9762\",\"desc\":\"\\u4ea4\\u6362\\u6bcf\\u5f20\\u6587\\u7a3f\\u7684\\u6b63\\u53cd\\u9762\\u51fa\\u56fe\\u987a\\u5e8f\",\"type\":\"bool\",\"cur\":false,\"default\":false,\"size\":4,\"depend_and\":[\"26!=\\u5355\\u9762\"]},\"30\":{\"category\":\"base\",\"name\":\"grp-2\",\"title\":\"\\u4eae\\u5ea6\",\"type\":\"group\"},\"31\":{\"category\":\"base\",\"name\":\"is-custom-gamma\",\"title\":\"\\u542f\\u7528\\u8272\\u8c03\\u66f2\\u7ebf\",\"desc\":\"\\u81ea\\u5b9a\\u4e49\\u56fe\\u50cf\\u8272\\u8c03\\u6548\\u679c\",\"type\":\"bool\",\"cur\":false,\"default\":false,\"size\":4},\"32\":{\"category\":\"base\",\"name\":\"brightness\",\"title\":\"\\u4eae\\u5ea6\\u503c\",\"desc\":\"\\u8c03\\u6574\\u56fe\\u50cf\\u4eae\\u5ea6\",\"type\":\"int\",\"cur\":128,\"default\":128,\"size\":4,\"range\":{\"min\":1,\"max\":255},\"depend_and\":[\"31==false\"]},\"33\":{\"category\":\"base\",\"name\":\"contrast\",\"title\":\"\\u5bf9\\u6bd4\\u5ea6\",\"desc\":\"\\u8c03\\u6574\\u56fe\\u50cf\\u5bf9\\u6bd4\\u5ea6\",\"type\":\"int\",\"cur\":4,\"default\":4,\"size\":4,\"range\":{\"min\":1,\"max\":7},\"depend_and\":[\"31==false\"]},\"34\":{\"category\":\"base\",\"name\":\"gamma\",\"title\":\"\\u4f3d\\u9a6c\\u503c\",\"desc\":\"\\u8c03\\u6574\\u56fe\\u50cf\\u4f3d\\u739b\\u503c\",\"type\":\"float\",\"cur\":1.000000,\"default\":1.000000,\"size\":4,\"range\":{\"min\":0.010000,\"max\":5.000000},\"depend_and\":[\"31==false\"]},\"35\":{\"category\":\"base\",\"name\":\"grp-3\",\"title\":\"\\u56fe\\u50cf\\u5904\\u7406\",\"type\":\"group\"},\"36\":{\"category\":\"base\",\"name\":\"is-anti-skew\",\"title\":\"\\u81ea\\u52a8\\u7ea0\\u504f\",\"desc\":\"\\u81ea\\u52a8\\u7ea0\\u6b63\\u6b6a\\u659c\\u9001\\u5165\\u7684\\u6587\\u7a3f\\u56fe\\u50cf\",\"type\":\"bool\",\"cur\":true,\"default\":true,\"size\":4,\"depend_or\":[\"26!=\\u5bf9\\u6298\"]},\"37\":{\"category\":\"base\",\"name\":\"is-split\",\"title\":\"\\u56fe\\u50cf\\u62c6\\u5206\",\"desc\":\"\\u81ea\\u52a8\\u62c6\\u5206\\u56fe\\u50cf\",\"type\":\"bool\",\"cur\":false,\"default\":false,\"size\":4,\"depend_or\":[\"26!=\\u5bf9\\u6298\"]},\"38\":{\"category\":\"base\",\"name\":\"is-erase-black-frame\",\"title\":\"\\u6d88\\u9664\\u9ed1\\u6846\",\"desc\":\"\\u6d88\\u9664\\u6587\\u7a3f\\u8303\\u56f4\\u5916\\u7684\\u9ed1\\u8272\\u80cc\\u666f\",\"type\":\"bool\",\"cur\":true,\"default\":true,\"size\":4},\"39\":{\"category\":\"advanced\",\"name\":\"bkg-fill-mode\",\"title\":\"\\u80cc\\u666f\\u586b\\u5145\\u65b9\\u5f0f\",\"desc\":\"\\u9009\\u62e9\\u80cc\\u666f\\u586b\\u5145\\u65b9\\u5f0f\",\"type\":\"string\",\"cur\":\"\\u51f8\\u591a\\u8fb9\\u5f62\",\"default\":\"\\u51f8\\u591a\\u8fb9\\u5f62\",\"size\":40,\"range\":[\"\\u51f8\\u591a\\u8fb9\\u5f62\",\"\\u51f9\\u591a\\u8fb9\\u5f62\"],\"depend_or\":[\"38==true\"]},\"40\":{\"category\":\"base\",\"name\":\"is-fill-color\",\"title\":\"\\u8272\\u5f69\\u586b\\u5145\",\"desc\":\"\\u542f\\u7528\\u540e\\u9ed1\\u6846\\u90e8\\u5206\\u5c06\\u586b\\u5145\\u4e3a\\u6587\\u7a3f\\u5e95\\u8272\",\"type\":\"bool\",\"cur\":false,\"def
|
2022-09-11 15:56:27 +00:00
|
|
|
|
|
2022-07-15 08:18:55 +00:00
|
|
|
|
#else
|
2022-09-11 15:56:27 +00:00
|
|
|
|
|
2022-10-11 01:00:46 +00:00
|
|
|
|
static std::string jsontext1("{\"device_type\":\"G100-G200\",\"option_count\":64,\"1\":{\"category\":\"base\",\"name\":\"restore\",\"title\":\"\\u6062\\u590d\\u9ed8\\u8ba4\\u8bbe\\u7f6e\",\"desc\":\"\\u6062\\u590d\\u9ed8\\u8ba4\\u8bbe\\u7f6e\",\"type\":\"button\",\"cur\":\"button\",\"default\":\"button\",\"size\":0},\"2\":{\"category\":\"advanced\",\"name\":\"help\",\"title\":\"\\u5e2e\\u52a9\",\"desc\":\"\\u663e\\u793a\\u8f6f\\u4ef6\\u5e2e\\u52a9\\u6587\\u6863\",\"type\":\"button\",\"cur\":\"true\",\"default\":\"true\",\"size\":4},\"3\":{\"category\":\"base\",\"name\":\"grp-1\",\"title\":\"\\u57fa\\u672c\\u8bbe\\u7f6e\",\"type\":\"group\"},\"4\":{\"category\":\"base\",\"name\":\"is-multiout\",\"title\":\"\\u591a\\u6d41\\u8f93\\u51fa\",\"desc\":\"\\u540c\\u65f6\\u8f93\\u51fa\\u591a\\u79cd\\u989c\\u8272\\u6a21\\u5f0f\\u7684\\u56fe\\u50cf\",\"type\":\"bool\",\"cur\":false,\"default\":false,\"size\":4},\"5\":{\"category\":\"base\",\"name\":\"multiout-type\",\"title\":\"\\u591a\\u6d41\\u8f93\\u51fa\\u7c7b\\u578b\",\"desc\":\"\\u9009\\u62e9\\u591a\\u6d41\\u8f93\\u51fa\\u7684\\u7c7b\\u578b\",\"type\":\"string\",\"cur\":\"\\u5f69\\u8272+\\u7070\\u5ea6+\\u9ed1\\u767d\",\"default\":\"\\u5f69\\u8272+\\u7070\\u5ea6+\\u9ed1\\u767d\",\"size\":128,\"range\":[\"\\u5f69\\u8272+\\u7070\\u5ea6+\\u9ed1\\u767d\",\"\\u5f69\\u8272+\\u7070\\u5ea6\",\"\\u5f69\\u8272+\\u9ed1\\u767d\",\"\\u7070\\u5ea6+\\u9ed1\\u767d\"],\"depend_or\":[\"4==true\"]},\"6\":{\"category\":\"base\",\"name\":\"mode\",\"title\":\"\\u989c\\u8272\\u6a21\\u5f0f\",\"desc\":\"\\u9009\\u62e9\\u8272\\u5f69\\u6a21\\u5f0f\",\"type\":\"string\",\"cur\":\"24\\u4f4d\\u5f69\\u8272\",\"default\":\"24\\u4f4d\\u5f69\\u8272\",\"size\":32,\"range\":[\"24\\u4f4d\\u5f69\\u8272\",\"256\\u7ea7\\u7070\\u5ea6\",\"\\u9ed1\\u767d\",\"\\u989c\\u8272\\u81ea\\u52a8\\u8bc6\\u522b\"],\"depend_or\":[\"4!=true\"]},\"7\":{\"category\":\"base\",\"name\":\"binary-threshold\",\"title\":\"\\u9ed1\\u767d\\u56fe\\u50cf\\u9608\\u503c\",\"desc\":\"\\u9ad8\\u4e8e\\u8be5\\u9608\\u503c\\u4e3a1\\uff08\\u767d\\uff09\\uff0c\\u4f4e\\u4e8e\\u8be5\\u9608\\u503c\\u4e3a0\\uff08\\u9ed1\\uff09\",\"type\":\"int\",\"cur\":127,\"default\":127,\"size\":4,\"range\":{\"min\":1,\"max\":255},\"depend_or\":[\"4==true\",\"6==\\u9ed1\\u767d\"]},\"8\":{\"category\":\"base\",\"name\":\"reverse-bw\",\"title\":\"\\u9ed1\\u767d\\u56fe\\u50cf\\u53cd\\u8272\\u8f93\\u51fa\",\"desc\":\"\\u8f93\\u51fa\\u7684\\u9ed1\\u767d\\u56fe\\u50cf\\u4ee5\\u201c1\\u201d\\u4ee3\\u8868\\u9ed1\\u8272\\uff0c\\u201c0\\u201d\\u4ee3\\u8868\\u767d\\u8272\",\"type\":\"bool\",\"cur\":false,\"default\":false,\"size\":4,\"depend_or\":[\"4==true\",\"6==\\u9ed1\\u767d\"]},\"9\":{\"category\":\"base\",\"name\":\"filter\",\"title\":\"\\u7070\\u5ea6\\u6216\\u9ed1\\u767d\\u56fe\\u50cf - \\u9664\\u8272\\u4e0e\\u589e\\u5f3a\",\"desc\":\"\\u6d88\\u9664\\u6216\\u589e\\u5f3a\\u6307\\u5b9a\\u8272\\u5f69\",\"type\":\"string\",\"cur\":\"\\u4e0d\\u9664\\u8272\",\"default\":\"\\u4e0d\\u9664\\u8272\",\"size\":24,\"range\":[\"\\u4e0d\\u9664\\u8272\",\"\\u9664\\u7ea2\\u8272\",\"\\u9664\\u7eff\\u8272\",\"\\u9664\\u84dd\\u8272\",\"\\u7ea2\\u8272\\u589e\\u5f3a\",\"\\u7eff\\u8272\\u589e\\u5f3a\",\"\\u84dd\\u8272\\u589e\\u5f3a\"],\"depend_and\":[\"4!=true\",\"6!=24\\u4f4d\\u5f69\\u8272\",\"6!=\\u989c\\u8272\\u81ea\\u52a8\\u8bc6\\u522b\"]},\"10\":{\"category\":\"base\",\"name\":\"is-rid-multiout-red\",\"title\":\"24\\u4f4d\\u5f69\\u8272\\u56fe\\u50cf - \\u591a\\u6d41\\u8f93\\u51fa\\u9664\\u7ea2\",\"desc\":\"\\u540c\\u65f6\\u8f93\\u51fa\\u5f69\\u8272\\u56fe\\u50cf\\u548c\\u7070\\u5ea6\\u9664\\u7ea2\\u56fe\\u50cf\",\"type\":\"bool\",\"cur\":false,\"default\":false,\"size\":4,\"depend_and\":[\"4!=true\",\"6!=256\\u7ea7\\u7070\\u5ea6\",\"6!=\\u9ed1\\u767d\",\"6!=\\u989c\\u8272\\u81ea\\u52a8\\u8bc6\\u522b\"]},\"11\":{\"category\":\"base\",\"name\":\"is-rid-answer-sheet-red\",\"title\":\"24\\u4f4d\\u5f69\\u8272\\u56fe\\u50cf - \\u7b54\\u9898\\u5361\\u9664\\u7ea2\",\"desc\":\"\\u8f93\\u51fa\\u9664\\u7ea2\\u5f69\\u8272\\u56fe\\u50cf\",\"type\":\"bool\",\"cur\":false,\"default\":false,\"size\":4,\"depe
|
2022-10-07 09:50:28 +00:00
|
|
|
|
static std::string jsontext2("\\u8fc7\\u7a7a\\u767d\\u9875\\uff08\\u901a\\u7528\\uff09\",\"\\u8df3\\u8fc7\\u7a7a\\u767d\\u9875\\uff08\\u53d1\\u7968\\u7eb8\\uff09\",\"\\u5bf9\\u6298\"]},\"27\":{\"category\":\"base\",\"name\":\"blank-sensitivity\",\"title\":\" \\u8df3\\u8fc7\\u7a7a\\u767d\\u9875\\u7075\\u654f\\u5ea6\",\"desc\":\"\\u6570\\u503c\\u8d8a\\u5927\\uff0c\\u5219\\u8d8a\\u5bb9\\u6613\\u8df3\\u8fc7\",\"type\":\"int\",\"cur\":50,\"default\":50,\"size\":4,\"range\":{\"min\":1,\"max\":100},\"depend_or\":[\"26==\\u8df3\\u8fc7\\u7a7a\\u767d\\u9875\\uff08\\u901a\\u7528\\uff09\",\"26==\\u8df3\\u8fc7\\u7a7a\\u767d\\u9875\\uff08\\u53d1\\u7968\\u7eb8\\uff09\"]},\"28\":{\"category\":\"base\",\"name\":\"resolution\",\"title\":\"\\u5206\\u8fa8\\u7387\",\"desc\":\"\\u8bbe\\u7f6e\\u626b\\u63cf\\u56fe\\u50cf\\u7684\\u5206\\u8fa8\\u7387\",\"type\":\"int\",\"cur\":200,\"default\":200,\"size\":4,\"range\":[100,150,200,300]},\"29\":{\"category\":\"base\",\"name\":\"is-exchange\",\"title\":\"\\u4ea4\\u6362\\u6b63\\u53cd\\u9762\",\"desc\":\"\\u4ea4\\u6362\\u6bcf\\u5f20\\u6587\\u7a3f\\u7684\\u6b63\\u53cd\\u9762\\u51fa\\u56fe\\u987a\\u5e8f\",\"type\":\"bool\",\"cur\":false,\"default\":false,\"size\":4,\"depend_and\":[\"26!=\\u5355\\u9762\"]},\"30\":{\"category\":\"base\",\"name\":\"grp-2\",\"title\":\"\\u4eae\\u5ea6\",\"type\":\"group\"},\"31\":{\"category\":\"base\",\"name\":\"is-custom-gamma\",\"title\":\"\\u542f\\u7528\\u8272\\u8c03\\u66f2\\u7ebf\",\"desc\":\"\\u81ea\\u5b9a\\u4e49\\u56fe\\u50cf\\u8272\\u8c03\\u6548\\u679c\",\"type\":\"bool\",\"cur\":false,\"default\":false,\"size\":4},\"32\":{\"category\":\"base\",\"name\":\"brightness\",\"title\":\"\\u4eae\\u5ea6\\u503c\",\"desc\":\"\\u8c03\\u6574\\u56fe\\u50cf\\u4eae\\u5ea6\",\"type\":\"int\",\"cur\":128,\"default\":128,\"size\":4,\"range\":{\"min\":1,\"max\":255},\"depend_and\":[\"31==false\"]},\"33\":{\"category\":\"base\",\"name\":\"contrast\",\"title\":\"\\u5bf9\\u6bd4\\u5ea6\",\"desc\":\"\\u8c03\\u6574\\u56fe\\u50cf\\u5bf9\\u6bd4\\u5ea6\",\"type\":\"int\",\"cur\":4,\"default\":4,\"size\":4,\"range\":{\"min\":1,\"max\":7},\"depend_and\":[\"31==false\"]},\"34\":{\"category\":\"base\",\"name\":\"gamma\",\"title\":\"\\u4f3d\\u9a6c\\u503c\",\"desc\":\"\\u8c03\\u6574\\u56fe\\u50cf\\u4f3d\\u739b\\u503c\",\"type\":\"float\",\"cur\":1.000000,\"default\":1.000000,\"size\":4,\"range\":{\"min\":0.010000,\"max\":5.000000},\"depend_and\":[\"31==false\"]},\"35\":{\"category\":\"base\",\"name\":\"grp-3\",\"title\":\"\\u56fe\\u50cf\\u5904\\u7406\",\"type\":\"group\"},\"36\":{\"category\":\"base\",\"name\":\"is-anti-skew\",\"title\":\"\\u81ea\\u52a8\\u7ea0\\u504f\",\"desc\":\"\\u81ea\\u52a8\\u7ea0\\u6b63\\u6b6a\\u659c\\u9001\\u5165\\u7684\\u6587\\u7a3f\\u56fe\\u50cf\",\"type\":\"bool\",\"cur\":true,\"default\":true,\"size\":4,\"depend_or\":[\"26!=\\u5bf9\\u6298\"]},\"37\":{\"category\":\"base\",\"name\":\"is-split\",\"title\":\"\\u56fe\\u50cf\\u62c6\\u5206\",\"desc\":\"\\u81ea\\u52a8\\u62c6\\u5206\\u56fe\\u50cf\",\"type\":\"bool\",\"cur\":false,\"default\":false,\"size\":4,\"depend_or\":[\"26!=\\u5bf9\\u6298\"]},\"38\":{\"category\":\"base\",\"name\":\"is-erase-black-frame\",\"title\":\"\\u6d88\\u9664\\u9ed1\\u6846\",\"desc\":\"\\u6d88\\u9664\\u6587\\u7a3f\\u8303\\u56f4\\u5916\\u7684\\u9ed1\\u8272\\u80cc\\u666f\",\"type\":\"bool\",\"cur\":true,\"default\":true,\"size\":4},\"39\":{\"category\":\"advanced\",\"name\":\"bkg-fill-mode\",\"title\":\"\\u80cc\\u666f\\u586b\\u5145\\u65b9\\u5f0f\",\"desc\":\"\\u9009\\u62e9\\u80cc\\u666f\\u586b\\u5145\\u65b9\\u5f0f\",\"type\":\"string\",\"cur\":\"\\u51f8\\u591a\\u8fb9\\u5f62\",\"default\":\"\\u51f8\\u591a\\u8fb9\\u5f62\",\"size\":40,\"range\":[\"\\u51f8\\u591a\\u8fb9\\u5f62\",\"\\u51f9\\u591a\\u8fb9\\u5f62\"],\"depend_or\":[\"38==true\"]},\"40\":{\"category\":\"base\",\"name\":\"is-fill-color\",\"title\":\"\\u8272\\u5f69\\u586b\\u5145\",\"desc\":\"\\u542f\\u7528\\u540e\\u9ed1\\u6846\\u90e8\\u5206\\u5c06\\u586b\\u5145\\u4e3a\\u6587\\u7a3f\\u5e95\\u8272\",\"type\":\"bool\",\"cur\":false,\"default\":false,\"size\":4,\"depend_and\":[\"38==true\"]},\"41\":{\"cat
|
2022-09-11 15:56:27 +00:00
|
|
|
|
|
2022-07-15 08:18:55 +00:00
|
|
|
|
#endif
|
2022-05-03 03:56:07 +00:00
|
|
|
|
namespace settingsdsp_200
|
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
scanner_err device_status_to_hg_err(int usbdata, bool *fatal)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
scanner_err code = SCANNER_ERR_OK;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
|
|
|
|
|
if (fatal)
|
|
|
|
|
*fatal = true;
|
|
|
|
|
switch (usbdata)
|
|
|
|
|
{
|
2022-10-18 08:23:22 +00:00
|
|
|
|
case setting3288dsp::HAVE_IMAGE:
|
2022-05-17 07:04:55 +00:00
|
|
|
|
code = SCANNER_ERR_OK;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
if (fatal)
|
|
|
|
|
*fatal = false;
|
|
|
|
|
break;
|
2022-10-18 08:23:22 +00:00
|
|
|
|
case setting3288dsp::STOP_SCAN:
|
|
|
|
|
case setting3288dsp::SCAN_STOP:
|
|
|
|
|
case setting3288dsp::USER_STOP:
|
2022-05-03 03:56:07 +00:00
|
|
|
|
if (fatal)
|
|
|
|
|
*fatal = false;
|
2022-05-17 07:04:55 +00:00
|
|
|
|
code = SCANNER_ERR_DEVICE_STOPPED;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
break;
|
2022-10-18 08:23:22 +00:00
|
|
|
|
case setting3288dsp::COUNT_MODE:
|
2022-05-17 07:04:55 +00:00
|
|
|
|
code = SCANNER_ERR_DEVICE_COUNT_MODE;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
break;
|
2022-10-18 08:23:22 +00:00
|
|
|
|
case setting3288dsp::NO_FEED:
|
2022-05-17 07:04:55 +00:00
|
|
|
|
code = SCANNER_ERR_DEVICE_NO_PAPER;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
break;
|
2022-10-18 08:23:22 +00:00
|
|
|
|
case setting3288dsp::OPEN_COVER:
|
2022-05-17 07:04:55 +00:00
|
|
|
|
code = SCANNER_ERR_DEVICE_COVER_OPENNED;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
break;
|
2022-10-18 08:23:22 +00:00
|
|
|
|
case setting3288dsp::FEED_IN_ERROR:
|
2022-05-17 07:04:55 +00:00
|
|
|
|
code = SCANNER_ERR_DEVICE_FEEDING_PAPER;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
break;
|
2022-10-18 08:23:22 +00:00
|
|
|
|
case setting3288dsp::PAPER_JAM:
|
2022-05-17 07:04:55 +00:00
|
|
|
|
code = SCANNER_ERR_DEVICE_PAPER_JAMMED;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
break;
|
2022-10-18 08:23:22 +00:00
|
|
|
|
case setting3288dsp::DETECT_DOUBLE_FEED:
|
2022-05-17 07:04:55 +00:00
|
|
|
|
code = SCANNER_ERR_DEVICE_DOUBLE_FEEDING;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
break;
|
2022-10-18 08:23:22 +00:00
|
|
|
|
case setting3288dsp::DETECT_STAPLE:
|
2022-05-17 07:04:55 +00:00
|
|
|
|
code = SCANNER_ERR_DEVICE_STAPLE_ON;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
break;
|
2022-10-18 08:23:22 +00:00
|
|
|
|
case setting3288dsp::PAPER_SKEW:
|
2022-05-17 07:04:55 +00:00
|
|
|
|
code = SCANNER_ERR_DEVICE_PAPER_SKEW;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
break;
|
2022-10-18 08:23:22 +00:00
|
|
|
|
case setting3288dsp::HARDWARE_ERROR:
|
2022-05-17 07:04:55 +00:00
|
|
|
|
code = SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
break;
|
2022-10-18 08:23:22 +00:00
|
|
|
|
case setting3288dsp::PC_SCAN_BUSY_or_ERROR:
|
2022-05-17 07:04:55 +00:00
|
|
|
|
code = SCANNER_ERR_DEVICE_PC_BUSY;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
break;
|
2022-10-18 08:23:22 +00:00
|
|
|
|
case setting3288dsp::SIZE_ERROR:
|
2022-05-17 07:04:55 +00:00
|
|
|
|
code = SCANNER_ERR_DEVICE_SIZE_CHECK;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
if (fatal)
|
|
|
|
|
*fatal = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return code;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-17 10:15:29 +00:00
|
|
|
|
hg_scanner_200::hg_scanner_200(const char* dev_name,int pid, usb_io* io) : hg_scanner(G100Serial, dev_name, io)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
2022-10-17 10:15:29 +00:00
|
|
|
|
pid_ = pid;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
string fw = get_firmware_version();
|
2022-05-30 03:04:26 +00:00
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "get_firmware_version is: %s\n",fw.c_str());
|
2022-05-06 10:02:06 +00:00
|
|
|
|
initdevice();
|
2022-05-03 03:56:07 +00:00
|
|
|
|
|
|
|
|
|
dsp_config_.value = 0;
|
2022-05-09 08:59:22 +00:00
|
|
|
|
#ifndef MAPPING_FUNCTION_IN_BASE
|
2022-05-03 03:56:07 +00:00
|
|
|
|
init_setting_map(setting_map_, ARRAY_SIZE(setting_map_));//优先初始化
|
2022-05-09 08:59:22 +00:00
|
|
|
|
#endif
|
2022-08-13 01:29:00 +00:00
|
|
|
|
if (init_settings(0x200))
|
2022-09-11 15:56:27 +00:00
|
|
|
|
init_settings((jsontext1 + jsontext2).c_str());
|
2022-05-03 03:56:07 +00:00
|
|
|
|
|
|
|
|
|
printf_devconfig();
|
|
|
|
|
}
|
|
|
|
|
hg_scanner_200::~hg_scanner_200()
|
2022-05-06 07:15:18 +00:00
|
|
|
|
{}
|
2022-05-03 03:56:07 +00:00
|
|
|
|
|
|
|
|
|
void hg_scanner_200::discard_prev(void)
|
|
|
|
|
{
|
2022-05-06 07:15:18 +00:00
|
|
|
|
USBCB usb = { 0 };
|
|
|
|
|
int ret = get_scanner_status(usb),
|
2022-05-03 03:56:07 +00:00
|
|
|
|
imgs = 0,
|
|
|
|
|
packets = 0,
|
|
|
|
|
normal = 0;
|
|
|
|
|
|
2022-05-17 07:04:55 +00:00
|
|
|
|
while (ret == SCANNER_ERR_OK)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
2022-10-18 08:23:22 +00:00
|
|
|
|
if (usb.u32_Data == setting3288dsp::HAVE_IMAGE)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
|
|
|
|
pop_image();
|
|
|
|
|
imgs++;
|
|
|
|
|
normal = 0;
|
|
|
|
|
packets++;
|
|
|
|
|
}
|
2022-10-18 08:23:22 +00:00
|
|
|
|
else if (usb.u32_Data == setting3288dsp::NORMAL)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
|
|
|
|
if(normal++ > 10)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
packets++;
|
2022-05-06 07:15:18 +00:00
|
|
|
|
ret = get_scanner_status(usb);
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
if (imgs || packets)
|
2022-05-30 03:04:26 +00:00
|
|
|
|
VLOG_MINI_2(LOG_LEVEL_DEBUG_INFO, "discard prev-scanning %d packets and %d images.\n", packets, imgs);
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int hg_scanner_200::on_scanner_closing(bool force)
|
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
return SCANNER_ERR_OK;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
void hg_scanner_200::thread_handle_usb_read(void)
|
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
int ret = SCANNER_ERR_OK,
|
|
|
|
|
prev_err = SCANNER_ERR_OK;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
StopWatch sw;
|
|
|
|
|
bool first = true;
|
|
|
|
|
|
|
|
|
|
while (run_)
|
|
|
|
|
{
|
|
|
|
|
if (sw.elapsed_s() > 30)
|
|
|
|
|
{
|
|
|
|
|
// no any data in 30 seconds, we giveup the work ...
|
2022-05-17 07:04:55 +00:00
|
|
|
|
status_ = prev_err != SCANNER_ERR_OK ? prev_err : SCANNER_ERR_TIMEOUT;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-06 07:15:18 +00:00
|
|
|
|
USBCB usb = {0};
|
|
|
|
|
ret = get_scanner_status(usb);
|
2022-05-03 03:56:07 +00:00
|
|
|
|
|
2022-05-17 07:04:55 +00:00
|
|
|
|
if (ret == SCANNER_ERR_DEVICE_NOT_FOUND)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
|
|
|
|
// device left, the work is no meanning ...
|
|
|
|
|
status_ = ret;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2022-10-18 08:23:22 +00:00
|
|
|
|
else if (usb.u32_Data == setting3288dsp::HAVE_IMAGE)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
2022-05-06 07:15:18 +00:00
|
|
|
|
ret = get_img_data(usb.u32_Count);
|
2022-05-23 06:10:18 +00:00
|
|
|
|
if (ret == SCANNER_ERR_INSUFFICIENT_MEMORY)
|
|
|
|
|
{
|
|
|
|
|
status_ = ret;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-03 03:56:07 +00:00
|
|
|
|
io_->set_timeout(200);
|
|
|
|
|
pop_image();
|
|
|
|
|
sw.reset();
|
|
|
|
|
first = false;
|
|
|
|
|
}
|
2022-05-17 07:04:55 +00:00
|
|
|
|
else if (ret == SCANNER_ERR_DEVICE_STOPPED)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
|
|
|
|
status_ = prev_err;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2022-05-17 07:04:55 +00:00
|
|
|
|
else if(ret != SCANNER_ERR_OK)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
if (prev_err == SCANNER_ERR_OK)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
|
|
|
|
if (first)
|
|
|
|
|
{
|
2022-07-23 05:42:34 +00:00
|
|
|
|
SANE_Image_Statu imgst = last_usb_image_statu(ret);
|
|
|
|
|
|
2022-05-03 03:56:07 +00:00
|
|
|
|
// if the error occurs at the 2nd paper, then the first normal paper maybe lost, we delay 2 seconds here ...
|
|
|
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
|
2022-05-06 07:15:18 +00:00
|
|
|
|
get_scanner_status(usb);
|
2022-10-18 08:23:22 +00:00
|
|
|
|
if (usb.u32_Data == setting3288dsp::HAVE_IMAGE)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
2022-07-23 05:42:34 +00:00
|
|
|
|
if(get_img_data(usb.u32_Count, imgst) == SCANNER_ERR_INSUFFICIENT_MEMORY)
|
2022-05-23 06:10:18 +00:00
|
|
|
|
{
|
|
|
|
|
status_ = SCANNER_ERR_INSUFFICIENT_MEMORY;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2022-05-03 03:56:07 +00:00
|
|
|
|
io_->set_timeout(200);
|
|
|
|
|
pop_image();
|
|
|
|
|
sw.reset();
|
|
|
|
|
first = false;
|
|
|
|
|
prev_err = ret;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
status_ = ret;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-05-21 01:19:21 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
2022-05-20 07:18:49 +00:00
|
|
|
|
// notify_ui_working_status(hg_scanner::error_description((scanner_err)prev_err).c_str(), SANE_EVENT_ERROR, prev_err);
|
2022-05-30 03:42:16 +00:00
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_WARNING, "-x-x-x-: USB thread error: %s\n", hg_scanner_err_name(prev_err));
|
2022-05-21 01:19:21 +00:00
|
|
|
|
}
|
2022-05-03 03:56:07 +00:00
|
|
|
|
prev_err = ret;
|
|
|
|
|
}
|
|
|
|
|
this_thread::sleep_for(chrono::milliseconds(2));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int hg_scanner_200::start(void)
|
|
|
|
|
{
|
2022-05-20 09:11:50 +00:00
|
|
|
|
bool handled = false;
|
|
|
|
|
int ret = try_third_app_handle_start(handled),
|
2022-05-03 03:56:07 +00:00
|
|
|
|
count = -1;
|
|
|
|
|
|
2022-05-20 06:46:25 +00:00
|
|
|
|
// for third-sane-app invoking, added on 2022-05-19
|
2022-05-20 09:11:50 +00:00
|
|
|
|
if (handled)
|
|
|
|
|
return ret;
|
2022-05-20 06:46:25 +00:00
|
|
|
|
|
2022-05-06 10:02:06 +00:00
|
|
|
|
//discard_prev();
|
2022-05-03 03:56:07 +00:00
|
|
|
|
user_cancel_ = false;
|
2022-05-06 10:02:06 +00:00
|
|
|
|
//ret = writedown_device_configuration(true);
|
2022-05-17 07:04:55 +00:00
|
|
|
|
if (ret == SCANNER_ERR_OK)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
writedown_image_configuration();
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
status_ = ret;
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
printf_devconfig();
|
|
|
|
|
|
2022-05-06 09:34:17 +00:00
|
|
|
|
//writedown_device_configuration(true);
|
|
|
|
|
// ret = get_scan_is_sleep();
|
2022-05-17 07:04:55 +00:00
|
|
|
|
// if (ret == SCANNER_ERR_DEVICE_SLEEPING)
|
2022-05-06 09:34:17 +00:00
|
|
|
|
// {
|
|
|
|
|
// status_ = ret;
|
2022-05-17 07:04:55 +00:00
|
|
|
|
// notify_ui_working_status(STATU_DESC_SCANNER_ERR_DEVICE_SLEEPING, SANE_EVENT_SCAN_FINISHED, status_);
|
2022-05-30 03:04:26 +00:00
|
|
|
|
// VLOG_MINI_1(LOG_LEVEL_WARNING, "device start status is(%s)\n", STATU_DESC_SCANNER_ERR_DEVICE_SLEEPING);
|
2022-05-06 09:34:17 +00:00
|
|
|
|
// return ret;
|
|
|
|
|
// }
|
2022-05-03 03:56:07 +00:00
|
|
|
|
ret = get_scanner_paperon();
|
2022-05-17 07:04:55 +00:00
|
|
|
|
if (ret == SCANNER_ERR_DEVICE_NO_PAPER)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
|
|
|
|
status_ = ret;
|
2022-05-17 07:04:55 +00:00
|
|
|
|
notify_ui_working_status(STATU_DESC_SCANNER_ERR_DEVICE_NO_PAPER, SANE_EVENT_ERROR, status_);
|
2022-05-30 03:04:26 +00:00
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_WARNING, "device start status is(%s)\n", STATU_DESC_SCANNER_ERR_DEVICE_NO_PAPER);
|
2022-05-03 03:56:07 +00:00
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-18 08:23:22 +00:00
|
|
|
|
USBCB usb = { setting3288dsp::START_COMMAND, img_conf_.scannum, 0 };
|
2022-05-03 03:56:07 +00:00
|
|
|
|
|
|
|
|
|
ret = writeusb(usb);
|
|
|
|
|
io_->set_timeout(500);
|
2022-06-01 09:16:09 +00:00
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_WARNING, "write start command = %s\n", hg_scanner_err_name(ret));
|
2022-05-03 03:56:07 +00:00
|
|
|
|
|
2022-05-17 07:04:55 +00:00
|
|
|
|
if(ret == SCANNER_ERR_OK)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
2022-06-01 09:16:09 +00:00
|
|
|
|
//status_ = SCANNER_ERR_DEVICE_BUSY;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
wait_usb_.notify();
|
|
|
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(300));
|
2022-06-01 09:16:09 +00:00
|
|
|
|
ret = try_third_app_after_start(ret);
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
status_ = ret;
|
2022-06-01 09:16:09 +00:00
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_WARNING, "start result: %s\n", hg_scanner_err_name(ret));
|
2022-05-03 03:56:07 +00:00
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
int hg_scanner_200::stop(void)
|
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
int ret = SCANNER_ERR_OK;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
|
2022-10-18 08:23:22 +00:00
|
|
|
|
USBCB usbcb = { setting3288dsp::STOP, 0, 0};
|
2022-05-03 03:56:07 +00:00
|
|
|
|
ret = writeusb(usbcb);
|
|
|
|
|
|
|
|
|
|
user_cancel_ = true;
|
2022-05-17 07:04:55 +00:00
|
|
|
|
if (ret == SCANNER_ERR_DEVICE_BUSY)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
2022-06-01 03:04:10 +00:00
|
|
|
|
LOG_INFO(LOG_LEVEL_DEBUG_INFO,"stop status is busy\r\n");
|
2022-05-03 03:56:07 +00:00
|
|
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
|
|
|
|
|
}
|
2022-05-17 07:04:55 +00:00
|
|
|
|
else if (ret == SCANNER_ERR_OK)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
status_ = SCANNER_ERR_DEVICE_STOPPED;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
2022-08-04 01:36:46 +00:00
|
|
|
|
//final_imgs_.clear();
|
2022-05-23 03:52:53 +00:00
|
|
|
|
|
2022-05-03 03:56:07 +00:00
|
|
|
|
return status_;
|
|
|
|
|
}
|
|
|
|
|
int hg_scanner_200::writeusb(USBCB &usb)
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> lock(io_lock_);
|
|
|
|
|
|
2022-05-17 07:04:55 +00:00
|
|
|
|
int ret = SCANNER_ERR_OK;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
int len = sizeof(usb);
|
|
|
|
|
|
|
|
|
|
ret = io_->write_bulk(&usb,&len);
|
|
|
|
|
if (ret)
|
|
|
|
|
{
|
|
|
|
|
status_ = ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
2022-05-06 07:15:18 +00:00
|
|
|
|
int hg_scanner_200::readusb(USBCB &usb)
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> lock(io_lock_);
|
|
|
|
|
|
2022-05-17 07:04:55 +00:00
|
|
|
|
int ret = SCANNER_ERR_OK;
|
2022-05-06 07:15:18 +00:00
|
|
|
|
int len = sizeof(USBCB);
|
|
|
|
|
|
|
|
|
|
ret = io_->read_bulk(&usb,&len);
|
|
|
|
|
if (ret)
|
|
|
|
|
{
|
|
|
|
|
status_ = ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
2022-05-03 03:56:07 +00:00
|
|
|
|
int hg_scanner_200::pop_image()
|
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
int ret = SCANNER_ERR_OK;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
|
2022-10-18 08:23:22 +00:00
|
|
|
|
USBCB usbcb = { setting3288dsp::POP_IMAGE, 0, 0 };
|
2022-05-03 03:56:07 +00:00
|
|
|
|
ret = writeusb(usbcb);
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
2022-05-06 07:15:18 +00:00
|
|
|
|
int hg_scanner_200::get_scanner_status(USBCB &usb)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
int ret = SCANNER_ERR_OK;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
|
2022-10-18 08:23:22 +00:00
|
|
|
|
usb = { setting3288dsp::GET_DSP_STATUS, 0, 0 };
|
2022-05-03 03:56:07 +00:00
|
|
|
|
|
2022-05-06 07:15:18 +00:00
|
|
|
|
ret = writeusb(usb);
|
2022-05-17 07:04:55 +00:00
|
|
|
|
if (ret != SCANNER_ERR_OK)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
|
|
io_->set_timeout(500);
|
2022-05-06 07:15:18 +00:00
|
|
|
|
|
|
|
|
|
ret = readusb(usb);
|
2022-05-17 07:04:55 +00:00
|
|
|
|
if (ret != SCANNER_ERR_OK)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
|
|
|
|
status_ = ret;
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-06 07:15:18 +00:00
|
|
|
|
return settingsdsp_200::device_status_to_hg_err(usb.u32_Data, nullptr);
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
2022-07-23 05:42:34 +00:00
|
|
|
|
int hg_scanner_200::get_img_data(unsigned int bytes, SANE_Image_Statu statu)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
2022-05-06 05:37:14 +00:00
|
|
|
|
int total = bytes,
|
2022-05-17 07:04:55 +00:00
|
|
|
|
ret = SCANNER_ERR_OK,
|
2022-05-06 07:15:18 +00:00
|
|
|
|
index = 0,
|
|
|
|
|
block = total;
|
2022-06-01 03:04:10 +00:00
|
|
|
|
std::shared_ptr<tiny_buffer> imagedata(aquire_memory(total));
|
2022-05-03 03:56:07 +00:00
|
|
|
|
|
2022-05-23 06:10:18 +00:00
|
|
|
|
if (!imagedata.get())
|
|
|
|
|
return SCANNER_ERR_INSUFFICIENT_MEMORY;
|
|
|
|
|
|
2022-10-18 08:23:22 +00:00
|
|
|
|
USBCB usb{ setting3288dsp::GET_IMAGE, 0, total };
|
2022-07-23 05:42:34 +00:00
|
|
|
|
|
|
|
|
|
imagedata->set_image_statu(statu);
|
2022-05-03 03:56:07 +00:00
|
|
|
|
ret = writeusb(usb);
|
2022-05-17 07:04:55 +00:00
|
|
|
|
if (ret != SCANNER_ERR_OK)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
|
|
|
|
status_ = ret;
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
2022-05-06 07:15:18 +00:00
|
|
|
|
io_->set_timeout(500);
|
2022-05-03 03:56:07 +00:00
|
|
|
|
|
|
|
|
|
while (total > 0)
|
|
|
|
|
{
|
2022-05-06 07:15:18 +00:00
|
|
|
|
block = 512 * 1024;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
|
2022-05-06 07:15:18 +00:00
|
|
|
|
if (total < block)
|
|
|
|
|
block = total;
|
2022-05-06 05:37:14 +00:00
|
|
|
|
|
2022-06-06 04:03:24 +00:00
|
|
|
|
unsigned int size = block;
|
|
|
|
|
void* buf = imagedata->data(index, &size);
|
|
|
|
|
if (!buf)
|
|
|
|
|
{
|
|
|
|
|
VLOG_MINI_3(LOG_LEVEL_FATAL, "memory(0x%08x + %u) fatal when read USB image %d !!!\n", index, block, usb_img_index_);
|
|
|
|
|
ret = SCANNER_ERR_INSUFFICIENT_MEMORY;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
block = size;
|
|
|
|
|
ret = io_->read_bulk(buf, &block);
|
2022-05-06 07:15:18 +00:00
|
|
|
|
io_->set_timeout(500); //不能删除可能会导致IO超时
|
2022-05-17 07:04:55 +00:00
|
|
|
|
if (ret != SCANNER_ERR_OK)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2022-05-06 07:15:18 +00:00
|
|
|
|
index += block;
|
|
|
|
|
total -= block;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
2022-05-17 07:04:55 +00:00
|
|
|
|
if (ret == SCANNER_ERR_OK)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
|
|
|
|
ret = save_usb_data(imagedata);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-01 03:04:10 +00:00
|
|
|
|
void hg_scanner_200::image_process(std::shared_ptr<tiny_buffer>& buffer)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
int ret = SCANNER_ERR_OK;
|
2022-07-15 08:04:09 +00:00
|
|
|
|
hg_imgproc::HIMGPRC handle = get_image_process_object(pid_);
|
2022-05-03 03:56:07 +00:00
|
|
|
|
hg_imgproc::IMGHEAD ih;
|
2022-05-17 07:04:55 +00:00
|
|
|
|
int err = SCANNER_ERR_OK,
|
2022-05-03 03:56:07 +00:00
|
|
|
|
index = 0;
|
|
|
|
|
void* buf = NULL;
|
|
|
|
|
|
|
|
|
|
hg_imgproc::load_buffer(handle, buffer);
|
|
|
|
|
hg_imgproc::decode(handle,pid_);
|
|
|
|
|
|
2022-09-11 15:56:27 +00:00
|
|
|
|
if (isremove_left_hole || isremove_right_hole || isremove_top_hole || isremove_low_hole)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
2022-09-11 15:56:27 +00:00
|
|
|
|
ret = hg_imgproc::fillhole(handle, isremove_top_hole_threshold, isremove_low_hole_threshold,isremove_left_hole_threshold,isremove_right_hole_threshold);
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////111111111111111111111111111//////////////////////////////////
|
|
|
|
|
ret = hg_imgproc::auto_crop(handle);
|
|
|
|
|
|
|
|
|
|
if (img_conf_.is_autodiscradblank_normal || img_conf_.is_autodiscradblank_vince)
|
|
|
|
|
{
|
|
|
|
|
ret = hg_imgproc::discardBlank(handle);
|
|
|
|
|
//HG_LOGHG_LOG_LEVEL_DEBUG_INFO,"丢弃空白页开启\r\n");
|
|
|
|
|
}
|
|
|
|
|
if(img_conf_.fadeback)
|
|
|
|
|
{
|
2022-10-20 06:58:26 +00:00
|
|
|
|
hg_imgproc::fadeback(handle);
|
2022-05-03 03:56:07 +00:00
|
|
|
|
//HG_LOGHG_LOG_LEVEL_DEBUG_INFO,"背景除色开启\r\n");
|
|
|
|
|
}
|
|
|
|
|
if (img_conf_.resolution_dst != img_conf_.resolution_native)
|
|
|
|
|
{
|
|
|
|
|
hg_imgproc::resolution_change(handle);
|
|
|
|
|
//HG_LOGHG_LOG_LEVEL_DEBUG_INFO,"dpi改变开启\r\n");
|
|
|
|
|
}
|
|
|
|
|
if (img_conf_.cropRect.enable && !img_conf_.is_autocrop)
|
|
|
|
|
{
|
|
|
|
|
hg_imgproc::croprect(handle);
|
2022-05-06 09:34:17 +00:00
|
|
|
|
//printf("手动裁图开启\r\n");
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
if (img_conf_.filter != ColorFilter::FILTER_NONE && (img_conf_.pixtype == COLOR_MODE_BLACK_WHITE || img_conf_.pixtype == COLOR_MODE_256_GRAY))
|
|
|
|
|
{
|
|
|
|
|
hg_imgproc::channel(handle);
|
|
|
|
|
//printf("除色开启\r\n");
|
|
|
|
|
//HG_LOGHG_LOG_LEVEL_DEBUG_INFO,"除色开启\r\n");
|
|
|
|
|
}
|
|
|
|
|
/////////////////////////////////////2222222222222222222222222222222222222//////////////////////////////////
|
2022-07-15 08:04:09 +00:00
|
|
|
|
adjust_color(handle);
|
2022-05-03 03:56:07 +00:00
|
|
|
|
|
|
|
|
|
if (img_conf_.pixtype == COLOR_MODE_24_BITS && img_conf_.hsvcorrect)
|
|
|
|
|
{
|
|
|
|
|
hg_imgproc::answerSheetFilterRed(handle);
|
|
|
|
|
//HG_LOGHG_LOG_LEVEL_DEBUG_INFO,"答题卡出红开启\r\n");
|
|
|
|
|
}
|
|
|
|
|
if (img_conf_.refuseInflow)
|
|
|
|
|
{
|
2022-05-07 07:39:48 +00:00
|
|
|
|
int lv = 5;
|
|
|
|
|
|
|
|
|
|
if (image_prc_param_.bits.is_permeate_lv_ == 0)
|
|
|
|
|
lv = 5;
|
|
|
|
|
else if (image_prc_param_.bits.is_permeate_lv_ == 1)
|
|
|
|
|
lv = 15;
|
|
|
|
|
else if (image_prc_param_.bits.is_permeate_lv_ == 2)
|
|
|
|
|
lv = 25;
|
|
|
|
|
else if (image_prc_param_.bits.is_permeate_lv_ == 3)
|
|
|
|
|
lv = 35;
|
|
|
|
|
else if (image_prc_param_.bits.is_permeate_lv_ == 4)
|
|
|
|
|
lv = 45;
|
|
|
|
|
|
|
|
|
|
hg_imgproc::antiInflow(handle,lv);
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
if (img_conf_.colorCorrection && img_conf_.pixtype != COLOR_MODE_BLACK_WHITE)
|
|
|
|
|
{
|
|
|
|
|
hg_imgproc::colorCorrection(handle);
|
|
|
|
|
//HG_LOGHG_LOG_LEVEL_DEBUG_INFO,"颜色校正开启\r\n");
|
|
|
|
|
}
|
2022-05-11 03:27:11 +00:00
|
|
|
|
if ((img_conf_.imageRotateDegree != TEXT_DIRECTION_0 || img_conf_.is_backrotate180) && (!img_conf_.is_autotext))
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
|
|
|
|
hg_imgproc::orentation(handle);
|
|
|
|
|
//HG_LOGHG_LOG_LEVEL_DEBUG_INFO,"自动旋转开启\r\n");
|
|
|
|
|
}
|
|
|
|
|
if (img_conf_.removeMorr)
|
|
|
|
|
{
|
|
|
|
|
hg_imgproc::textureRemove(handle);
|
|
|
|
|
//HG_LOGHG_LOG_LEVEL_DEBUG_INFO,"除摩尔纹开启\r\n");
|
|
|
|
|
}
|
|
|
|
|
if (img_conf_.detachnoise.is_detachnoise)
|
|
|
|
|
{
|
|
|
|
|
hg_imgproc::nosieDetach(handle);
|
|
|
|
|
//HG_LOGHG_LOG_LEVEL_DEBUG_INFO,"噪点优化开启\r\n");
|
|
|
|
|
}
|
|
|
|
|
if (img_conf_.pixtype == COLOR_MODE_BLACK_WHITE)
|
|
|
|
|
{
|
|
|
|
|
hg_imgproc::errorextention(handle);
|
|
|
|
|
//HG_LOGHG_LOG_LEVEL_DEBUG_INFO,"黑白图处理开启\r\n");
|
|
|
|
|
}
|
|
|
|
|
if (img_conf_.en_fold)
|
|
|
|
|
{
|
|
|
|
|
hg_imgproc::fold(handle);
|
|
|
|
|
//HG_LOGHG_LOG_LEVEL_DEBUG_INFO,"对折开启\r\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////
|
|
|
|
|
|
2022-08-20 03:18:34 +00:00
|
|
|
|
if (img_conf_.multi_output_red && img_conf_.pixtype == COLOR_MODE_24_BITS)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
|
|
|
|
err = hg_imgproc::multi_out_red(handle);
|
|
|
|
|
//HG_LOGHG_LOG_LEVEL_DEBUG_INFO,"多流出红开启\r\n");
|
|
|
|
|
}
|
|
|
|
|
if (img_conf_.sharpen)
|
|
|
|
|
{
|
|
|
|
|
hg_imgproc::sharpenType(handle);
|
|
|
|
|
}
|
2022-08-20 03:18:34 +00:00
|
|
|
|
if (img_conf_.splitImage)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
|
|
|
|
int colormode=1;
|
|
|
|
|
if(img_conf_.filter == RID_COLOR_NONE)
|
|
|
|
|
colormode=img_conf_.pixtype;
|
|
|
|
|
|
2022-10-20 06:58:26 +00:00
|
|
|
|
err = hg_imgproc::split(handle,-1);
|
2022-05-30 03:04:26 +00:00
|
|
|
|
VLOG_MINI_5(LOG_LEVEL_DEBUG_INFO, "img split-> multiOutput is:%d splitImage is:%d multi_output_red is:%d pixtype is:%d is_duplex:%d\r\n"
|
2022-05-03 03:56:07 +00:00
|
|
|
|
,img_conf_.multiOutput
|
|
|
|
|
,img_conf_.splitImage
|
|
|
|
|
,img_conf_.multi_output_red
|
|
|
|
|
,img_conf_.pixtype
|
|
|
|
|
,img_conf_.is_duplex);
|
|
|
|
|
|
|
|
|
|
//HG_LOGHG_LOG_LEVEL_DEBUG_INFO,"图像拆分开启\r\n");
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-20 03:18:34 +00:00
|
|
|
|
if (!img_conf_.splitImage || !img_conf_.multi_output_red || !is_multiout)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
|
|
|
|
if(img_conf_.automaticcolor)
|
|
|
|
|
{
|
|
|
|
|
hg_imgproc::auto_matic_color(handle,img_conf_.automaticcolortype);
|
|
|
|
|
//HG_LOGHG_LOG_LEVEL_DEBUG_INFO,"颜色自动识别开启\r\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-05-11 03:27:11 +00:00
|
|
|
|
if (img_conf_.is_autotext)
|
|
|
|
|
{
|
|
|
|
|
printf("文本方向自动识别\r\n");
|
|
|
|
|
hg_imgproc::ocr_auto_txtdirect(handle);
|
|
|
|
|
}
|
2022-05-21 08:56:14 +00:00
|
|
|
|
//多流输出最后处理
|
|
|
|
|
if (is_multiout)
|
|
|
|
|
{
|
2022-05-23 08:54:55 +00:00
|
|
|
|
int multi_out = image_prc_param_.bits.multi_out;
|
2022-05-21 08:56:14 +00:00
|
|
|
|
err = hg_imgproc::multi_out(handle,multi_out);
|
|
|
|
|
}
|
2022-05-03 03:56:07 +00:00
|
|
|
|
hg_imgproc::final(handle);
|
|
|
|
|
|
2022-08-04 01:36:46 +00:00
|
|
|
|
while (hg_imgproc::get_final_data(handle, &ih, &buf, index++) == SCANNER_ERR_OK)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
2022-05-30 03:04:26 +00:00
|
|
|
|
VLOG_MINI_5(LOG_LEVEL_DEBUG_INFO, "Final picture %d (%d * %d * %d) with %u bytes!\n", index
|
2022-05-03 03:56:07 +00:00
|
|
|
|
, ih.width, ih.height, ih.bits * ih.channels, ih.total_bytes);
|
|
|
|
|
|
|
|
|
|
std::vector<unsigned char>bmpdata;
|
|
|
|
|
if(!img_type_.empty())
|
|
|
|
|
{
|
|
|
|
|
hg_imgproc::imgtypechange(handle, img_type_, buf, bmpdata);
|
|
|
|
|
//cv::imencode(img_type_,*((cv::Mat*)buf),bmpdata);
|
|
|
|
|
if(bmpdata.empty())
|
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
status_ = SCANNER_ERR_NO_DATA;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
buf = bmpdata.data();
|
|
|
|
|
ih.total_bytes = bmpdata.size();
|
|
|
|
|
|
2022-05-30 03:04:26 +00:00
|
|
|
|
VLOG_MINI_6(LOG_LEVEL_DEBUG_INFO, "Set img type is:%s Final picture %d (%d * %d * %d) with %u bytes!\n",img_type_.c_str() ,index
|
2022-05-03 03:56:07 +00:00
|
|
|
|
, ih.width, ih.height, ih.bits * ih.channels, ih.total_bytes);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
save_final_image(&ih, buf);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
hg_imgproc::release(handle);
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-18 08:23:22 +00:00
|
|
|
|
int hg_scanner_200::writedown_device_configuration(bool type,setting_hardware::HGSCANCONF_DSP *d)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
|
|
|
|
if (!type)
|
2022-05-17 07:04:55 +00:00
|
|
|
|
return SCANNER_ERR_OK;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
|
2022-05-17 07:04:55 +00:00
|
|
|
|
int ret = SCANNER_ERR_OK,
|
2022-05-03 03:56:07 +00:00
|
|
|
|
len = 0;
|
|
|
|
|
|
|
|
|
|
if (!d)
|
|
|
|
|
d = &dsp_config_;
|
|
|
|
|
|
2022-10-18 08:23:22 +00:00
|
|
|
|
USBCB usbcb = { setting3288dsp::CONFIGURED_DATA, d->value, 0 };
|
2022-05-03 03:56:07 +00:00
|
|
|
|
len = sizeof(USBCB);
|
|
|
|
|
ret = io_->write_bulk(&usbcb,&len);
|
|
|
|
|
|
2022-05-30 03:42:16 +00:00
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_WARNING, "writedown_device_configuration is .(%s)\n", hg_scanner_err_name(ret));
|
2022-05-03 03:56:07 +00:00
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int hg_scanner_200::on_color_mode_changed(int& color_mode)
|
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
int ret = SCANNER_ERR_OK;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
|
|
|
|
|
if (color_mode == COLOR_MODE_BLACK_WHITE || color_mode == COLOR_MODE_256_GRAY)
|
|
|
|
|
{
|
2022-10-18 08:23:22 +00:00
|
|
|
|
dsp_config_.params_dsp.color = 0;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
else if(color_mode == COLOR_MODE_24_BITS || color_mode == COLOR_MODE_AUTO_MATCH)
|
|
|
|
|
{
|
2022-10-18 08:23:22 +00:00
|
|
|
|
dsp_config_.params_dsp.color = 1;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
int hg_scanner_200::on_paper_changed(int& paper)
|
|
|
|
|
{
|
|
|
|
|
bool exact = true;
|
2022-10-18 08:23:22 +00:00
|
|
|
|
int ind = hgpaper_to_devspaper(paper_map_dsp, ARRAY_SIZE(paper_map_dsp), paper, &exact, &paper_size_),
|
2022-05-17 07:04:55 +00:00
|
|
|
|
ret = exact ? SCANNER_ERR_OK : SCANNER_ERR_NOT_EXACT;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
|
2022-10-18 08:23:22 +00:00
|
|
|
|
if (dsp_config_.params_dsp.paper != paper_map_dsp[ind].dev_value)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
2022-10-18 08:23:22 +00:00
|
|
|
|
int old = dsp_config_.params_dsp.paper;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
|
2022-10-18 08:23:22 +00:00
|
|
|
|
dsp_config_.params_dsp.paper = paper_map_dsp[ind].dev_value;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
ret = writedown_device_configuration();
|
|
|
|
|
if (ret)
|
|
|
|
|
{
|
2022-10-18 08:23:22 +00:00
|
|
|
|
dsp_config_.params_dsp.paper = old;
|
|
|
|
|
for (int i = 0; i < ARRAY_SIZE(paper_map_dsp); ++i)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
2022-10-18 08:23:22 +00:00
|
|
|
|
if (paper_map_dsp[i].dev_value == old)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
2022-10-18 08:23:22 +00:00
|
|
|
|
paper = paper_map_dsp[i].paper;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (!exact)
|
2022-05-17 07:04:55 +00:00
|
|
|
|
ret = SCANNER_ERR_NOT_EXACT;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
int hg_scanner_200::on_paper_check_changed(bool& check)
|
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
int ret = SCANNER_ERR_OK;
|
2022-10-18 08:23:22 +00:00
|
|
|
|
if(dsp_config_.params_dsp.enable_sizecheck ^ check)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
2022-10-18 08:23:22 +00:00
|
|
|
|
dsp_config_.params_dsp.enable_sizecheck = check;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
ret = writedown_device_configuration();
|
|
|
|
|
if (ret)
|
|
|
|
|
{
|
2022-10-18 08:23:22 +00:00
|
|
|
|
dsp_config_.params_dsp.enable_sizecheck = !check;
|
|
|
|
|
check = dsp_config_.params_dsp.enable_sizecheck;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int hg_scanner_200::on_resolution_changed(int& dpi)
|
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
int ret = SCANNER_ERR_OK;
|
2022-10-18 08:23:22 +00:00
|
|
|
|
dsp_config_.params_dsp.dpi = 1;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
ret = writedown_device_configuration();
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int hg_scanner_200::on_ultrasonic_check_changed(bool& check)
|
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
int ret = SCANNER_ERR_OK;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
|
2022-10-18 08:23:22 +00:00
|
|
|
|
if (dsp_config_.params_dsp.double_feed_enbale ^ check)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
2022-10-18 08:23:22 +00:00
|
|
|
|
dsp_config_.params_dsp.double_feed_enbale = check;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
ret = writedown_device_configuration();
|
|
|
|
|
if (ret)
|
|
|
|
|
{
|
2022-10-18 08:23:22 +00:00
|
|
|
|
dsp_config_.params_dsp.double_feed_enbale = !check;
|
|
|
|
|
check = dsp_config_.params_dsp.double_feed_enbale;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int hg_scanner_200::on_staple_check_changed(bool& check)
|
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
int ret = SCANNER_ERR_OK;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
|
2022-10-18 08:23:22 +00:00
|
|
|
|
if (dsp_config_.params_dsp.stable_enbale ^ check)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
2022-10-18 08:23:22 +00:00
|
|
|
|
dsp_config_.params_dsp.stable_enbale = check;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
ret = writedown_device_configuration();
|
|
|
|
|
if (ret)
|
|
|
|
|
{
|
2022-10-18 08:23:22 +00:00
|
|
|
|
dsp_config_.params_dsp.stable_enbale = !check;
|
|
|
|
|
check = dsp_config_.params_dsp.stable_enbale;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
int hg_scanner_200::on_skew_check_changed(bool& check)
|
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
int ret = SCANNER_ERR_OK;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
|
2022-10-18 08:23:22 +00:00
|
|
|
|
if (dsp_config_.params_dsp.screw_detect_enable ^ check)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
2022-10-18 08:23:22 +00:00
|
|
|
|
dsp_config_.params_dsp.screw_detect_enable = check;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
ret = writedown_device_configuration();
|
|
|
|
|
if (ret)
|
|
|
|
|
{
|
2022-10-18 08:23:22 +00:00
|
|
|
|
dsp_config_.params_dsp.screw_detect_enable = !check;
|
|
|
|
|
check = dsp_config_.params_dsp.screw_detect_enable;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
int hg_scanner_200::on_skew_check_level_changed(int& check)
|
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
int ret = SCANNER_ERR_OK,
|
2022-05-03 03:56:07 +00:00
|
|
|
|
val = check,
|
2022-10-18 08:23:22 +00:00
|
|
|
|
old = dsp_config_.params_dsp.screw_detect_level;
|
|
|
|
|
setting_hardware::HGSCANCONF_DSP cf;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
|
2022-10-18 08:23:22 +00:00
|
|
|
|
cf.params_dsp.screw_detect_level = -1;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
|
|
|
|
|
if (val < 0)
|
|
|
|
|
{
|
|
|
|
|
val = 0;
|
2022-05-17 07:04:55 +00:00
|
|
|
|
ret = SCANNER_ERR_NOT_EXACT;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
2022-10-18 08:23:22 +00:00
|
|
|
|
else if (val > cf.params_dsp.screw_detect_level)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
2022-10-18 08:23:22 +00:00
|
|
|
|
val = cf.params_dsp.screw_detect_level;
|
2022-05-17 07:04:55 +00:00
|
|
|
|
ret = SCANNER_ERR_NOT_EXACT;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
2022-10-18 08:23:22 +00:00
|
|
|
|
if (val != dsp_config_.params_dsp.screw_detect_level)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
2022-10-18 08:23:22 +00:00
|
|
|
|
dsp_config_.params_dsp.screw_detect_level = val;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
ret = writedown_device_configuration();
|
|
|
|
|
if (ret)
|
2022-10-18 08:23:22 +00:00
|
|
|
|
check = dsp_config_.params_dsp.screw_detect_level = old;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
2022-05-17 07:04:55 +00:00
|
|
|
|
if (ret == SCANNER_ERR_OK && val != check)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
|
|
|
|
check = val;
|
2022-05-17 07:04:55 +00:00
|
|
|
|
ret = SCANNER_ERR_NOT_EXACT;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
2022-07-23 10:01:44 +00:00
|
|
|
|
int hg_scanner_200::on_set_feedmode(int feedmode)
|
|
|
|
|
{
|
|
|
|
|
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
|
|
|
|
}
|
|
|
|
|
int hg_scanner_200::on_get_feedmode(int &feedmode)
|
|
|
|
|
{
|
|
|
|
|
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
|
|
|
|
}
|
2022-05-03 03:56:07 +00:00
|
|
|
|
int hg_scanner_200::initdevice()
|
|
|
|
|
{
|
2022-10-18 08:23:22 +00:00
|
|
|
|
setting_hardware::HGSCANCONF_DSP ds;
|
|
|
|
|
ds.params_dsp.paper = 0;
|
|
|
|
|
ds.params_dsp.color = 0;
|
|
|
|
|
ds.params_dsp.double_feed_enbale =0;
|
|
|
|
|
ds.params_dsp.dpi = 0;
|
|
|
|
|
ds.params_dsp.enable_sizecheck=0;
|
|
|
|
|
ds.params_dsp.pc_correct=0;
|
|
|
|
|
ds.params_dsp.screw_detect_enable=0;
|
|
|
|
|
ds.params_dsp.screw_detect_level = 0;
|
|
|
|
|
ds.params_dsp.stable_enbale = 0;
|
|
|
|
|
ds.params_dsp.unused_one = 0;
|
|
|
|
|
ds.params_dsp.unused_two = 0;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
writedown_device_configuration(true,&ds);
|
|
|
|
|
printf_devconfig(&ds);
|
|
|
|
|
|
2022-05-17 07:04:55 +00:00
|
|
|
|
return SCANNER_ERR_OK;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
void hg_scanner_200::writedown_image_configuration(void)
|
|
|
|
|
{
|
|
|
|
|
SCANCONF ic;
|
|
|
|
|
|
|
|
|
|
ic.papertype = paper_size_;
|
|
|
|
|
|
|
|
|
|
if (is_lateral(image_prc_param_.bits.paper))
|
|
|
|
|
ic.paperAlign = Rot270;
|
2022-07-01 09:00:50 +00:00
|
|
|
|
// else if (image_prc_param_.bits.text_direction == TEXT_DIRECTION_AUTO)
|
|
|
|
|
// ic.paperAlign = AutoTextOrientation;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
else
|
|
|
|
|
ic.paperAlign = Rot0;
|
|
|
|
|
|
2022-10-18 08:23:22 +00:00
|
|
|
|
ic.en_sizecheck = dsp_config_.params_dsp.enable_sizecheck;
|
2022-05-11 03:27:11 +00:00
|
|
|
|
|
|
|
|
|
if (image_prc_param_.bits.text_direction != TEXT_DIRECTION_AUTO)
|
|
|
|
|
ic.imageRotateDegree = image_prc_param_.bits.text_direction;
|
|
|
|
|
else
|
|
|
|
|
ic.imageRotateDegree = 0;
|
|
|
|
|
|
2022-05-03 03:56:07 +00:00
|
|
|
|
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_RECEIPT || image_prc_param_.bits.page ==PAGE_FOLIO);
|
|
|
|
|
|
|
|
|
|
ic.en_fold = (image_prc_param_.bits.page == PAGE_FOLIO);
|
|
|
|
|
|
|
|
|
|
ic.pixtype = image_prc_param_.bits.color_mode == COLOR_MODE_AUTO_MATCH ? 2 : image_prc_param_.bits.color_mode;
|
|
|
|
|
|
|
|
|
|
ic.automaticcolor = is_auto_matic_color;
|
|
|
|
|
ic.automaticcolortype = 1;// ic.pixtype; //存疑
|
|
|
|
|
ic.resolution_dst = resolution_;
|
|
|
|
|
ic.resolution_native = 200;
|
|
|
|
|
|
|
|
|
|
ic.gamma = (float)gamma_;
|
|
|
|
|
ic.contrast = contrast_ ;
|
|
|
|
|
ic.brightness = bright_ ;
|
|
|
|
|
ic.threshold = threshold_;
|
|
|
|
|
ic.is_autocontrast = 0; //无参数
|
|
|
|
|
ic.is_autocrop = (ic.papertype == TwSS::None || ic.papertype ==TwSS::USStatement);
|
|
|
|
|
ic.is_autodiscradblank_normal = image_prc_param_.bits.page == PAGE_OMIT_EMPTY;
|
2022-10-18 08:23:22 +00:00
|
|
|
|
ic.discardblank_percent = omit_empty_level_; //默认20
|
2022-05-03 03:56:07 +00:00
|
|
|
|
ic.is_autodiscradblank_vince = image_prc_param_.bits.page == PAGE_OMIT_EMPTY_RECEIPT;
|
|
|
|
|
ic.is_switchfrontback = image_prc_param_.bits.exchange;
|
|
|
|
|
ic.autodescrew = image_prc_param_.bits.automatic_skew;
|
2022-08-20 03:18:34 +00:00
|
|
|
|
ic.multi_output_red = image_prc_param_.bits.rid_red;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
ic.hsvcorrect = image_prc_param_.bits.rid_answer_red;
|
|
|
|
|
|
|
|
|
|
ic.sharpen = image_prc_param_.bits.sharpen;
|
|
|
|
|
//ic.enhance_color = image_prc_param_.bits.rid_color;
|
|
|
|
|
ic.fillbackground = image_prc_param_.bits.erase_black_frame;
|
|
|
|
|
ic.is_convex = (image_prc_param_.bits.fill_background == FILL_BKG_CONVEX_POLYGON);
|
|
|
|
|
ic.noise = image_prc_param_.bits.noise_optimize;
|
|
|
|
|
ic.indent = margin_;
|
|
|
|
|
ic.AutoCrop_threshold = threshold_;
|
|
|
|
|
|
|
|
|
|
if (test_1_paper_)
|
|
|
|
|
{
|
2022-05-30 03:04:26 +00:00
|
|
|
|
LOG_INFO(LOG_LEVEL_DEBUG_INFO, "scanning mode: testing ONE paper ...\n");
|
2022-05-04 03:07:55 +00:00
|
|
|
|
ic.scannum = 1;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2022-05-04 03:07:55 +00:00
|
|
|
|
ic.scannum = scan_count_;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-04 03:07:55 +00:00
|
|
|
|
|
2022-05-03 03:56:07 +00:00
|
|
|
|
ic.is_backrotate180 = image_prc_param_.bits.rotate_back_180;
|
|
|
|
|
ic.is_dogeardetection = image_prc_param_.bits.fractate_check;
|
|
|
|
|
|
2022-10-18 08:23:22 +00:00
|
|
|
|
ic.hardwarecaps.en_skrewdetect = dsp_config_.params_dsp.screw_detect_enable;
|
|
|
|
|
ic.hardwarecaps.en_doublefeed = dsp_config_.params_dsp.double_feed_enbale;
|
|
|
|
|
ic.hardwarecaps.en_stapledetect = dsp_config_.params_dsp.stable_enbale;
|
|
|
|
|
ic.hardwarecaps.skrewdetectlevel = dsp_config_.params_dsp.screw_detect_level;
|
|
|
|
|
// ic.hardwarecaps.is_autopaper = dsp_config_.params_dsp.is_autopaper;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
ic.hardwarecaps.capturepixtype = 0; //暂无参数 获取图像类型
|
|
|
|
|
ic.hardwarecaps.lowpowermode = LowPowerMode::Min_None; //暂无参数 设置休眠时间 两个参数3399未使用
|
|
|
|
|
|
|
|
|
|
ic.fillhole.is_fillhole = image_prc_param_.bits.rid_hole;
|
|
|
|
|
ic.fillhole.fillholeratio = rid_hole_range_;
|
2022-09-12 04:27:25 +00:00
|
|
|
|
adjust_filling_hole(&ic);
|
2022-05-03 03:56:07 +00:00
|
|
|
|
|
|
|
|
|
ic.detachnoise.is_detachnoise = image_prc_param_.bits.noise_optimize;
|
|
|
|
|
ic.detachnoise.detachnoise = noise_range_;
|
|
|
|
|
|
|
|
|
|
|
2022-05-11 03:27:11 +00:00
|
|
|
|
ic.is_autotext = image_prc_param_.bits.text_direction == TEXT_DIRECTION_AUTO ? 1 :0;
|
2022-05-20 07:53:40 +00:00
|
|
|
|
ic.isfillcolor = is_color_fill;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
ic.refuseInflow = image_prc_param_.bits.is_permeate;
|
|
|
|
|
ic.colorCorrection = 0;
|
|
|
|
|
ic.removeMorr = image_prc_param_.bits.remove_morr;
|
|
|
|
|
ic.errorExtention = image_prc_param_.bits.error_extention ;//暂无参数
|
|
|
|
|
ic.textureRemove = image_prc_param_.bits.remove_txtture;//暂无参数
|
|
|
|
|
ic.splitImage = image_prc_param_.bits.split;
|
2022-05-06 09:34:17 +00:00
|
|
|
|
|
|
|
|
|
//custom_area_br_x_ *ic.resolution_dst /25.4;
|
|
|
|
|
//custom_area_br_y_ *ic.resolution_dst /25.4;
|
|
|
|
|
|
|
|
|
|
ic.cropRect.enable = custom_area_;
|
|
|
|
|
|
2022-05-16 09:56:07 +00:00
|
|
|
|
int height = (custom_area_br_y_ *ic.resolution_dst) /25.4 - (custom_area_lt_y_ *ic.resolution_dst /25.4);
|
|
|
|
|
int width = (custom_area_br_x_ *ic.resolution_dst) /25.4 - (custom_area_lt_x_ *ic.resolution_dst /25.4);
|
|
|
|
|
ic.cropRect.height = height;
|
|
|
|
|
ic.cropRect.width = width;
|
2022-05-06 09:34:17 +00:00
|
|
|
|
ic.cropRect.x = custom_area_lt_x_ *ic.resolution_dst /25.4;
|
|
|
|
|
ic.cropRect.y = custom_area_lt_y_ *ic.resolution_dst /25.4;
|
|
|
|
|
|
2022-08-20 03:18:34 +00:00
|
|
|
|
ic.multiOutput = (MultiOutput)image_prc_param_.bits.multi_out;
|
|
|
|
|
if (!is_multiout)
|
|
|
|
|
{
|
|
|
|
|
ic.multiOutput = MultiOutput::Unused;
|
|
|
|
|
}
|
2022-05-03 03:56:07 +00:00
|
|
|
|
ic.normalCrop = image_prc_param_.bits.dark_sample;
|
|
|
|
|
ic.dogeardistabce = fractate_level_;
|
|
|
|
|
ic.fadeback = image_prc_param_.bits.erase_bakground;
|
|
|
|
|
ic.fadebackrange = erase_bkg_range_;
|
2022-07-28 06:03:20 +00:00
|
|
|
|
ic.isuoloadexceptionimage = (double_paper_handle_ & DOUBLE_PAPER_SAVE_IMG) == DOUBLE_PAPER_SAVE_IMG;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
|
|
|
|
|
int filter_clr[] = { 3, 0, 1, 2, 5, 6, 7 };
|
|
|
|
|
if(image_prc_param_.bits.color_mode == COLOR_MODE_24_BITS || image_prc_param_.bits.color_mode == COLOR_MODE_AUTO_MATCH)
|
|
|
|
|
ic.filter = 3;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ic.filter = filter_clr[image_prc_param_.bits.rid_color];
|
|
|
|
|
// if(ic.filter != 3)
|
|
|
|
|
// ic.pixtype = 2;
|
|
|
|
|
|
|
|
|
|
ic.hsvcorrect = 0;
|
|
|
|
|
ic.multi_output_red = 0;
|
|
|
|
|
ic.multiOutput = MultiOutput::Unused;
|
|
|
|
|
ic.fadeback = false;
|
|
|
|
|
}
|
2022-06-15 02:35:09 +00:00
|
|
|
|
//多留输出的处理
|
2022-06-02 03:47:44 +00:00
|
|
|
|
if (image_prc_param_.bits.multi_out == MULTI_GRAY_AND_BW && is_multiout)
|
2022-05-16 09:56:07 +00:00
|
|
|
|
{
|
|
|
|
|
ic.pixtype = 1;
|
|
|
|
|
}
|
2022-06-02 03:47:44 +00:00
|
|
|
|
else if ((image_prc_param_.bits.multi_out == MULTI_OUT_ALL ||image_prc_param_.bits.multi_out == MULTI_COLOR_AND_GRAY||image_prc_param_.bits.multi_out == MULTI_COLOR_AND_BW) && is_multiout)
|
|
|
|
|
{
|
|
|
|
|
ic.pixtype = 2;
|
2022-06-15 02:35:09 +00:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (is_multiout)
|
|
|
|
|
{
|
|
|
|
|
ic.hsvcorrect = 0;
|
|
|
|
|
ic.multi_output_red = 0;
|
|
|
|
|
ic.fadeback = false;
|
|
|
|
|
ic.sharpen = 0;
|
|
|
|
|
ic.removeMorr = 0;
|
|
|
|
|
ic.textureRemove = 0;
|
|
|
|
|
|
|
|
|
|
ic.errorExtention = 0;
|
|
|
|
|
ic.detachnoise.is_detachnoise = 0;
|
2022-06-09 08:49:32 +00:00
|
|
|
|
}
|
2022-06-15 02:35:09 +00:00
|
|
|
|
if (ic.pixtype == 0)
|
|
|
|
|
{
|
|
|
|
|
ic.hsvcorrect = 0;
|
|
|
|
|
ic.multi_output_red = 0;
|
|
|
|
|
ic.fadeback = false;
|
|
|
|
|
ic.sharpen = 0;
|
|
|
|
|
ic.removeMorr = 0;
|
|
|
|
|
ic.textureRemove = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//自定义裁切
|
2022-06-09 08:49:32 +00:00
|
|
|
|
if (image_prc_param_.bits.paper == PAPER_AUTO_MATCH
|
|
|
|
|
||image_prc_param_.bits.paper == PAPER_MAX_SIZE
|
|
|
|
|
||image_prc_param_.bits.paper == PAPER_MAX_SIZE_CLIP
|
|
|
|
|
||image_prc_param_.bits.paper == PAPER_TRIGEMINY
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
ic.cropRect.enable = false;
|
2022-06-02 03:47:44 +00:00
|
|
|
|
}
|
2022-05-03 03:56:07 +00:00
|
|
|
|
img_conf_ = ic;
|
|
|
|
|
|
|
|
|
|
agreement();
|
2022-05-30 03:04:26 +00:00
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.pixtype=%d", ic.pixtype);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.papertype=%d", ic.papertype);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.AutoCrop_threshold=%d", ic.AutoCrop_threshold);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.autodescrew=%d", ic.autodescrew);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.automaticcolor=%d", ic.automaticcolor);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.brightness=%f", ic.brightness);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.contrast=%f", ic.contrast);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.en_fold=%d", ic.en_fold);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.en_sizecheck=%d", ic.en_sizecheck);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.enhance_color=%d", ic.enhance_color);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fillbackground=%d", ic.fillbackground);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.filter=%d", ic.filter);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.gamma=%f", ic.gamma);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.hardwarecaps.capturepixtype=%d", ic.hardwarecaps.capturepixtype);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.hardwarecaps.en_doublefeed=%d", ic.hardwarecaps.en_doublefeed);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.hsvcorrect=%d", ic.hsvcorrect);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.imageRotateDegree=%f", ic.imageRotateDegree);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.indent=%d", 5);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autocontrast=%d", ic.is_autocontrast);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autocrop=%d", ic.is_autocrop);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autodiscradblank_normal=%d", ic.is_autodiscradblank_normal);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autodiscradblank_vince=%d", ic.is_autodiscradblank_vince);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_autotext=%d", ic.is_autotext);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_backrotate180=%d", ic.is_backrotate180);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_convex=%d", ic.is_convex);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_duplex=%d", ic.is_duplex);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_switchfrontback=%d", ic.is_switchfrontback);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.is_dogeardetection=%d", ic.is_dogeardetection);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fillhole.multi_output_red=%d", ic.multi_output_red);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.noise=%d", 8);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.resolution_dst=%f", ic.resolution_dst);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.resolution_native=%f", ic.resolution_native);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.scannum=%d", ic.scannum);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.sharpen=%d", ic.sharpen);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.discardblank_percent=%d", ic.discardblank_percent);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.detachnoise.is_detachnoise=%d", ic.detachnoise.is_detachnoise);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.detachnoise.detachnoise=%d\r ", ic.detachnoise.detachnoise);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.detachnoise.refuseInflow=%d\r ", ic.refuseInflow);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.refuseInflow=%d\r ", ic.refuseInflow);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.removeMorr=%d\r ", ic.removeMorr);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.errorExtention=%d\r ", ic.errorExtention);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.textureRemove=%d\r\n ", ic.textureRemove);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fillhole.is_fillhole=%d\r\n ", ic.fillhole.is_fillhole);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.ic.fillhole.fillholeratio=%f\r\n ", ic.fillhole.fillholeratio);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.fadeback=%d\r\n ",ic.fadeback);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.enable=%d\r\n ",ic.cropRect.enable);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.height=%d\r\n ",ic.cropRect.height);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.width=%d\r\n ",ic.cropRect.width);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.x=%d\r\n ",ic.cropRect.x);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\n ic.cropRect.y=%d\r\n ",ic.cropRect.y);
|
2022-05-06 09:34:17 +00:00
|
|
|
|
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
2022-10-18 08:23:22 +00:00
|
|
|
|
void hg_scanner_200::printf_devconfig(setting_hardware::HGSCANCONF_DSP *d)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
|
|
|
|
io_->set_timeout(200);
|
|
|
|
|
if (!d)
|
|
|
|
|
d = &dsp_config_;
|
|
|
|
|
|
2022-10-18 08:23:22 +00:00
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"\r\ndsp_config.params_dsp.color:%d\r\n",d->params_dsp.color);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config_.params_dsp.double_feed_enbale:%d\r\n",d->params_dsp.double_feed_enbale);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config_.params_dsp.dpi:%d\r\n",d->params_dsp.dpi);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config_.params_dsp.enable_sizecheck:%d\r\n",d->params_dsp.enable_sizecheck);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config_.params_dsp.paper:%d\r\n",d->params_dsp.paper);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config_.params_dsp.pc_correct:%d\r\n",d->params_dsp.pc_correct);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config_.params_dsp.screw_detect_enable:%d\r\n",d->params_dsp.screw_detect_enable);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config_.params_dsp.screw_detect_level:%d\r\n",d->params_dsp.screw_detect_level);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config_.params_dsp.stable_enbale:%d\r\n",d->params_dsp.stable_enbale);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config_.params_dsp.unused_one:%d\r\n",d->params_dsp.unused_one);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config_.params_dsp.unused_two:%d\r\n",d->params_dsp.unused_two);
|
|
|
|
|
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO,"dsp_config_.params_dsp.value:%d\r\n",d->value);
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
std::string hg_scanner_200::get_firmware_version()
|
|
|
|
|
{
|
2022-05-06 07:15:18 +00:00
|
|
|
|
char buf[20] = { 0 };
|
2022-05-17 07:04:55 +00:00
|
|
|
|
int ret = SCANNER_ERR_OK,
|
2022-05-03 03:56:07 +00:00
|
|
|
|
len = 8; //协议定义长度为8 300 400 =10
|
2022-10-18 08:23:22 +00:00
|
|
|
|
USBCB cmd = { setting3288dsp::GET_FW_VERSION, len, 0 };
|
2022-05-03 03:56:07 +00:00
|
|
|
|
|
|
|
|
|
ret = writeusb(cmd);
|
2022-05-17 07:04:55 +00:00
|
|
|
|
if(ret == SCANNER_ERR_OK)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> lock(io_lock_);
|
2022-05-06 07:15:18 +00:00
|
|
|
|
ret = io_->read_bulk(buf, &len);
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-06 07:15:18 +00:00
|
|
|
|
return buf;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string hg_scanner_200::get_serial_num()
|
|
|
|
|
{
|
2022-05-06 07:15:18 +00:00
|
|
|
|
char buf[20] = { 0 };
|
2022-05-17 07:04:55 +00:00
|
|
|
|
int ret = SCANNER_ERR_OK,
|
2022-05-03 03:56:07 +00:00
|
|
|
|
len = 12; //协议定义长度为8 300 400 =10
|
2022-10-18 08:23:22 +00:00
|
|
|
|
USBCB cmd = { setting3288dsp::GET_SERIAL, len, 0 };
|
2022-05-03 03:56:07 +00:00
|
|
|
|
|
|
|
|
|
ret = writeusb(cmd);
|
2022-05-17 07:04:55 +00:00
|
|
|
|
if (ret == SCANNER_ERR_OK)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> lock(io_lock_);
|
2022-05-06 07:15:18 +00:00
|
|
|
|
ret = io_->read_bulk(buf, &len);
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-06 07:15:18 +00:00
|
|
|
|
return buf;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int hg_scanner_200::agreement()
|
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
int ret = SCANNER_ERR_OK;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
|
|
|
|
|
|
2022-05-04 03:07:55 +00:00
|
|
|
|
if (image_prc_param_.bits.rid_color != RID_COLOR_NONE)
|
|
|
|
|
{
|
2022-10-18 08:23:22 +00:00
|
|
|
|
dsp_config_.params_dsp.color = 1;
|
2022-05-04 03:07:55 +00:00
|
|
|
|
}
|
2022-05-03 03:56:07 +00:00
|
|
|
|
|
2022-05-04 03:07:55 +00:00
|
|
|
|
ret = writedown_device_configuration(true);
|
|
|
|
|
io_->set_timeout(200);
|
2022-05-03 03:56:07 +00:00
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
int hg_scanner_200::set_leaflet_scan(void)
|
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
int ret = SCANNER_ERR_OK;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
test_1_paper_ = true;
|
|
|
|
|
|
|
|
|
|
ret = start();
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
int hg_scanner_200::get_abuot_info(void)
|
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
int hg_scanner_200::restore_default_setting(void)
|
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
int hg_scanner_200::set_img_format(void)
|
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int hg_scanner_200::get_compression_format(void)
|
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
int hg_scanner_200::set_compression_format(void)
|
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
int hg_scanner_200::set_auto_color_type(void)
|
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int hg_scanner_200::get_device_code(void)
|
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
int hg_scanner_200::get_sleep_time(SANE_Power* getime)
|
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
int ret = SCANNER_ERR_OK,
|
2022-05-03 03:56:07 +00:00
|
|
|
|
len = 0;
|
|
|
|
|
|
2022-10-18 08:23:22 +00:00
|
|
|
|
USBCB usbcb = { setting3288dsp::GET_SLEEP_TIME, 0, 0 };
|
2022-05-03 03:56:07 +00:00
|
|
|
|
ret = writeusb(usbcb);
|
2022-05-17 07:04:55 +00:00
|
|
|
|
if (ret != SCANNER_ERR_OK)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
2022-05-06 07:15:18 +00:00
|
|
|
|
len = sizeof(usbcb);
|
|
|
|
|
ret = io_->read_bulk(&usbcb,&len);
|
|
|
|
|
printf("usbcb.u32_Data = %d\r\n",usbcb.u32_Data);
|
2022-05-17 07:04:55 +00:00
|
|
|
|
if (ret == SCANNER_ERR_OK)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
|
|
|
|
if (getime)
|
|
|
|
|
{
|
2022-05-06 07:15:18 +00:00
|
|
|
|
*getime = (SANE_Power)usbcb.u32_Data;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
2022-05-06 07:15:18 +00:00
|
|
|
|
if (usbcb.u32_Data)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
return SCANNER_ERR_DEVICE_SLEEPING;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
int hg_scanner_200::set_sleep_time(SANE_Power* setime)
|
|
|
|
|
{
|
|
|
|
|
if (!setime)
|
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
return SCANNER_ERR_NO_DATA;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-17 07:04:55 +00:00
|
|
|
|
int ret = SCANNER_ERR_OK,
|
2022-05-03 03:56:07 +00:00
|
|
|
|
time = *setime;
|
2022-10-18 08:23:22 +00:00
|
|
|
|
USBCB usbcb = { setting3288dsp::SET_SLEEP_TIME,time, 0 };
|
2022-05-03 03:56:07 +00:00
|
|
|
|
|
|
|
|
|
ret = writeusb(usbcb);
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int hg_scanner_200::get_dogear_distance(void)
|
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
int hg_scanner_200::set_dogear_distance(void)
|
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
int hg_scanner_200::get_scanner_paperon(SANE_Bool* paperon)
|
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
int ret = SCANNER_ERR_OK,
|
2022-05-03 03:56:07 +00:00
|
|
|
|
len = 0;
|
|
|
|
|
|
2022-10-18 08:23:22 +00:00
|
|
|
|
USBCB usbcb = { setting3288dsp::GET_PAPER_STATUS, 0, 0 };
|
2022-05-03 03:56:07 +00:00
|
|
|
|
len = sizeof(USBCB);
|
|
|
|
|
ret = writeusb(usbcb);
|
|
|
|
|
io_->set_timeout(500);
|
|
|
|
|
|
2022-05-17 07:04:55 +00:00
|
|
|
|
if (ret == SCANNER_ERR_OK)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
2022-05-06 07:15:18 +00:00
|
|
|
|
std::lock_guard<std::mutex> lock(io_lock_);
|
|
|
|
|
ret = io_->read_bulk(&usbcb,&len);
|
|
|
|
|
}
|
2022-05-17 07:04:55 +00:00
|
|
|
|
if (ret != SCANNER_ERR_OK)
|
2022-05-06 07:15:18 +00:00
|
|
|
|
{
|
|
|
|
|
return ret;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
2022-05-06 07:15:18 +00:00
|
|
|
|
if (usbcb.u32_Data == 0)
|
2022-05-17 07:04:55 +00:00
|
|
|
|
ret = SCANNER_ERR_DEVICE_NO_PAPER;
|
2022-05-06 07:15:18 +00:00
|
|
|
|
else
|
2022-05-17 07:04:55 +00:00
|
|
|
|
ret = SCANNER_ERR_OK;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
if (paperon)
|
2022-05-06 07:15:18 +00:00
|
|
|
|
{
|
|
|
|
|
*paperon = usbcb.u32_Data;
|
|
|
|
|
}
|
2022-05-03 03:56:07 +00:00
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
int hg_scanner_200::set_scan_when_paper_on(void)
|
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
int hg_scanner_200::get_scan_when_paper_on(void)
|
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
int hg_scanner_200::get_scan_with_hole(void)
|
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
int hg_scanner_200::set_scan_with_hole(void)
|
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
int hg_scanner_200::get_scan_is_sleep()
|
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
int ret = SCANNER_ERR_OK,
|
2022-05-03 03:56:07 +00:00
|
|
|
|
len = 0;
|
|
|
|
|
|
2022-10-18 08:23:22 +00:00
|
|
|
|
USBCB usbcb = { setting3288dsp::CHECK_IS_SLEEP, 0, 0 };
|
2022-05-06 07:15:18 +00:00
|
|
|
|
len = sizeof(USBCB);
|
2022-05-03 03:56:07 +00:00
|
|
|
|
ret = writeusb(usbcb);
|
|
|
|
|
|
|
|
|
|
io_->set_timeout(200);
|
|
|
|
|
|
2022-05-17 07:04:55 +00:00
|
|
|
|
if (ret == SCANNER_ERR_OK)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
2022-05-06 05:37:14 +00:00
|
|
|
|
std::lock_guard<std::mutex> lock(io_lock_);
|
2022-05-06 07:15:18 +00:00
|
|
|
|
ret = io_->read_bulk(&usbcb,&len);
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
2022-05-17 07:04:55 +00:00
|
|
|
|
if (ret != SCANNER_ERR_OK)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
2022-05-06 07:15:18 +00:00
|
|
|
|
if (usbcb.u32_Data == 0x10)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
return SCANNER_ERR_OK;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
2022-05-06 07:15:18 +00:00
|
|
|
|
else if (usbcb.u32_Data == 0x100)
|
2022-05-03 03:56:07 +00:00
|
|
|
|
{
|
2022-05-17 07:04:55 +00:00
|
|
|
|
return SCANNER_ERR_DEVICE_SLEEPING;
|
2022-05-03 03:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-07-23 10:01:44 +00:00
|
|
|
|
int hg_scanner_200::get_device_log(string &log)
|
|
|
|
|
{
|
2022-07-23 11:08:18 +00:00
|
|
|
|
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
2022-07-23 10:01:44 +00:00
|
|
|
|
}
|
|
|
|
|
int hg_scanner_200::notify_sleep()
|
|
|
|
|
{
|
|
|
|
|
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
|
|
|
|
}
|
2022-05-13 08:39:21 +00:00
|
|
|
|
//int hg_scanner_200::get_roller_num(void)
|
|
|
|
|
//int hg_scanner_200::clear_roller_num(void)
|
|
|
|
|
//{
|
|
|
|
|
// return
|
|
|
|
|
//}
|
|
|
|
|
//int hg_scanner_200::get_history_count(void)
|
|
|
|
|
//{
|
|
|
|
|
// USBCB usbcb = { GET_SCANN_NUM ,0,0 };
|
|
|
|
|
// int len = sizeof(usbcb);
|
|
|
|
|
//
|
|
|
|
|
// {
|
|
|
|
|
// std::lock_guard<std::mutex> lock(io_lock_);
|
2022-05-17 07:04:55 +00:00
|
|
|
|
// if (io_->write_bulk(&usbcb, &len) == SCANNER_ERR_OK)
|
2022-05-13 08:39:21 +00:00
|
|
|
|
// {
|
|
|
|
|
// len = sizeof(usbcb);
|
2022-05-17 07:04:55 +00:00
|
|
|
|
// if (io_->read_bulk(&usbcb, &len) != SCANNER_ERR_OK)
|
2022-05-13 08:39:21 +00:00
|
|
|
|
// usbcb.u32_Count = -1;
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// usbcb.u32_Count = -1;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// return usbcb.u32_Count;
|
|
|
|
|
//}
|