2022-05-03 03:56:07 +00:00
# include " hg_scanner_300.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
2023-01-17 07:07:58 +00:00
//G300
2023-02-16 02:57:18 +00:00
static std : : string jsontext1 ( " { \" global \" :{ \" device_type \" : \" G300 \" , \" option_count \" :64}, \" restore \" :{ \" category \" : \" base \" , \" title \" : \" \\ u6062 \\ u590d \\ u9ed8 \\ u8ba4 \\ u8bbe \\ u7f6e \" , \" desc \" : \" \\ u6062 \\ u590d \\ u9ed8 \\ u8ba4 \\ u8bbe \\ u7f6e \" , \" type \" : \" button \" , \" cur \" : \" button \" , \" default \" : \" button \" , \" size \" :0}, \" help \" :{ \" category \" : \" advanced \" , \" title \" : \" \\ u5e2e \\ u52a9 \" , \" desc \" : \" \\ u663e \\ u793a \\ u8f6f \\ u4ef6 \\ u5e2e \\ u52a9 \\ u6587 \\ u6863 \" , \" type \" : \" button \" , \" cur \" : \" true \" , \" default \" : \" true \" , \" size \" :4}, \" grp-1 \" :{ \" category \" : \" base \" , \" title \" : \" \\ u57fa \\ u672c \\ u8bbe \\ u7f6e \" , \" type \" : \" group \" }, \" is-multiout \" :{ \" category \" : \" base \" , \" 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}, \" multiout-type \" :{ \" category \" : \" base \" , \" 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 \" :[ \" is-multiout==true \" ]}, \" mode \" :{ \" category \" : \" base \" , \" 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 \" :[ \" is-multiout==false \" ]}, \" binary-threshold \" :{ \" category \" : \" base \" , \" 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 \" :0, \" max \" :255, \" step \" :1}, \" depend_or \" :[ \" is-multiout==true \" , \" mode== \\ u9ed1 \\ u767d \" ]}, \" reverse-bw \" :{ \" category \" : \" base \" , \" 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 \" :[ \" is-multiout==true \" , \" mode== \\ u9ed1 \\ u767d \" ]}, \" filter \" :{ \" category \" : \" base \" , \" 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 \" :[ \" is-multiout!=true \" , \" mode!=24 \\ u4f4d \\ u5f69 \\ u8272 \" , \" != \\ u989c \\ u8272 \\ u81ea \\ u52a8 \\ u8bc6 \\ u522b \" ]}, \" is-rid-multiout-red \" :{ \" category \" : \" base \" , \" 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 \" :[ \" is-multiout!=true \" , \" mode!=256 \\ u7ea7 \\ u7070 \\ u5ea6 \" , \" != \\ u9ed1 \\ u767d \" , \" != \\ u989c \\ u8272 \\ u81ea \\ u52a8 \\ u8bc6 \\ u522b \" ]}, \" is-rid-answer-sheet-red \" :{ \" category \" : \" base \" , \" 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, \" depend_and \" :[ \" is-multiout!=true \" , \" mode!=256 \\ u7ea7 \\ u7070 \\ u5ea6 \" , \" != \\ u9ed1 \
2023-02-13 08:38:05 +00:00
static std : : string jsontext2 ( " 7f6e \\ u9875 \\ u9762 \\ u626b \\ u63cf \\ u65b9 \\ u5f0f \" , \" type \" : \" string \" , \" cur \" : \" \\ u53cc \\ u9762 \" , \" default \" : \" \\ u53cc \\ u9762 \" , \" size \" :50, \" 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 \" ]}, \" blank-sensitivity \" :{ \" category \" : \" base \" , \" 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, \" step \" :1}, \" depend_or \" :[ \" page== \\ u8df3 \\ u8fc7 \\ u7a7a \\ u767d \\ u9875 \\ uff08 \\ u901a \\ u7528 \\ uff09 \" , \" == \\ u8df3 \\ u8fc7 \\ u7a7a \\ u767d \\ u9875 \\ uff08 \\ u53d1 \\ u7968 \\ u7eb8 \\ uff09 \" ]}, \" fold-type \" :{ \" category \" : \" base \" , \" title \" : \" \\ u5bf9 \\ u6298 \\ u6a21 \\ u5f0f \" , \" desc \" : \" \" , \" type \" : \" string \" , \" cur \" : \" \\ u5de6 \\ u53f3 \\ u5bf9 \\ u6298 \" , \" default \" : \" \\ u5de6 \\ u53f3 \\ u5bf9 \\ u6298 \" , \" size \" :50, \" range \" :[ \" \\ u5de6 \\ u53f3 \\ u5bf9 \\ u6298 \" , \" \\ u4e0a \\ u4e0b \\ u5bf9 \\ u6298 \" , \" \\ u81ea \\ u52a8 \\ u5bf9 \\ u6298 \" ], \" depend_or \" :[ \" page== \\ u5bf9 \\ u6298 \" ]}, \" resolution \" :{ \" category \" : \" base \" , \" title \" : \" \\ u5206 \\ u8fa8 \\ u7387 \" , \" desc \" : \" \\ u8bbe \\ u7f6e \\ u626b \\ u63cf \\ u56fe \\ u50cf \\ u7684 \\ u5206 \\ u8fa8 \\ u7387 \" , \" type \" : \" int \" , \" cur \" :200, \" default \" :200, \" size \" :4, \" range \" :{ \" min \" :100, \" max \" :600, \" step \" :1}}, \" image-quality \" :{ \" category \" : \" base \" , \" title \" : \" \\ u753b \\ u8d28 \" , \" desc \" : \" \\ u9009 \\ u62e9 \\ u626b \\ u63cf \\ u4eea \\ u7684 \\ u753b \\ u8d28 \\ u6a21 \\ u5f0f \" , \" type \" : \" string \" , \" cur \" : \" \\ u753b \\ u8d28 \\ u4f18 \\ u5148 \" , \" default \" : \" \\ u753b \\ u8d28 \\ u4f18 \\ u5148 \" , \" size \" :200, \" range \" :[ \" \\ u901f \\ u5ea6 \\ u4f18 \\ u5148 \" , \" \\ u753b \\ u8d28 \\ u4f18 \\ u5148 \" ], \" depend_or \" :[ \" resolution>=300 \" ]}, \" is-exchange \" :{ \" category \" : \" base \" , \" 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 \" :[ \" page!= \\ u5355 \\ u9762 \" ]}, \" grp-2 \" :{ \" category \" : \" base \" , \" title \" : \" \\ u4eae \\ u5ea6 \" , \" type \" : \" group \" }, \" is-custom-gamma \" :{ \" category \" : \" base \" , \" 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}, \" brightness \" :{ \" category \" : \" base \" , \" title \" : \" \\ u4eae \\ u5ea6 \\ u503c \" , \" desc \" : \" \\ u8c03 \\ u6574 \\ u56fe \\ u50cf \\ u4eae \\ u5ea6 \" , \" type \" : \" int \" , \" cur \" :128, \" default \" :128, \" size \" :4, \" range \" :{ \" min \" :1, \" max \" :255, \" step \" :1}, \" depend_and \" :[ \" is-custom-gamma==false \" ]}, \" contrast \" :{ \" category \" : \" base \" , \" 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, \" step \" :1}, \" depend_and \" :[ \" is-custom-gamma==false \" ]}, \" gamma \" :{ \" category \" : \" base \" , \" 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, \" step \" :0.499000}, \" depend_and \" :[ \" is-custom-gamma==false \" ]}, \" grp-3 \" :{ \" category \" : \" base \" , \" title \" : \" \\ u56fe \\ u50cf \\ u5904 \\ u7406 \" , \" type \" : \" group \" }, \" is-anti-skew \" :{ \" category \" : \" base \" , \" 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 \" :[ \" page!= \\ u5bf9 \\ u6298 \" ]}, \" is-split \" :{ \" category \" : \" base \" , \" title \" : \" \\ u56fe \\ u50cf \\ u62c6 \\ u5206 \" , \" desc \" : \" \\ u81ea \\ u52a8 \\ u62c6 \\ u5206 \\ u56fe \\ u50cf \" , \" type \" : \" bool \" , \" cur \" :false, \" default \" :false, \" size \" :4, \" depend_or \" :[ \" page!= \\ u5bf9 \\ u6298 \" ]}, \" is-erase-black-frame \" :{ \" category \" : \" base \" , \" title \" : \" \\ u6d88 \\ u9664 \\ u9ed1 \\ u6846 \" , \" desc \" : \" \\ u6d88 \\ u96
2023-01-17 07:07:58 +00:00
//G400
2023-02-13 08:38:05 +00:00
static std : : string jsontext3 ( " { \" global \" :{ \" device_type \" : \" G400 \" , \" option_count \" :63}, \" restore \" :{ \" category \" : \" base \" , \" title \" : \" \\ u6062 \\ u590d \\ u9ed8 \\ u8ba4 \\ u8bbe \\ u7f6e \" , \" desc \" : \" \\ u6062 \\ u590d \\ u9ed8 \\ u8ba4 \\ u8bbe \\ u7f6e \" , \" type \" : \" button \" , \" cur \" : \" button \" , \" default \" : \" button \" , \" size \" :0}, \" help \" :{ \" category \" : \" advanced \" , \" title \" : \" \\ u5e2e \\ u52a9 \" , \" desc \" : \" \\ u663e \\ u793a \\ u8f6f \\ u4ef6 \\ u5e2e \\ u52a9 \\ u6587 \\ u6863 \" , \" type \" : \" button \" , \" cur \" : \" true \" , \" default \" : \" true \" , \" size \" :4}, \" grp-1 \" :{ \" category \" : \" base \" , \" title \" : \" \\ u57fa \\ u672c \\ u8bbe \\ u7f6e \" , \" type \" : \" group \" }, \" is-multiout \" :{ \" category \" : \" base \" , \" 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}, \" multiout-type \" :{ \" category \" : \" base \" , \" 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 \" :[ \" is-multiout==true \" ]}, \" mode \" :{ \" category \" : \" base \" , \" 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 \" :[ \" is-multiout==false \" ]}, \" binary-threshold \" :{ \" category \" : \" base \" , \" 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 \" :0, \" max \" :255, \" step \" :1}, \" depend_or \" :[ \" is-multiout==true \" , \" mode== \\ u9ed1 \\ u767d \" ]}, \" reverse-bw \" :{ \" category \" : \" base \" , \" 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 \" :[ \" is-multiout==true \" , \" mode== \\ u9ed1 \\ u767d \" ]}, \" filter \" :{ \" category \" : \" base \" , \" 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 \" :[ \" is-multiout!=true \" , \" mode!=24 \\ u4f4d \\ u5f69 \\ u8272 \" , \" != \\ u989c \\ u8272 \\ u81ea \\ u52a8 \\ u8bc6 \\ u522b \" ]}, \" is-rid-multiout-red \" :{ \" category \" : \" base \" , \" 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 \" :[ \" is-multiout!=true \" , \" mode!=256 \\ u7ea7 \\ u7070 \\ u5ea6 \" , \" != \\ u9ed1 \\ u767d \" , \" != \\ u989c \\ u8272 \\ u81ea \\ u52a8 \\ u8bc6 \\ u522b \" ]}, \" is-rid-answer-sheet-red \" :{ \" category \" : \" base \" , \" 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, \" depend_and \" :[ \" is-multiout!=true \" , \" mode!=256 \\ u7ea7 \\ u7070 \\ u5ea6 \" , \" != \\ u9ed1 \
static std : : string jsontext4 ( " 0000, \" size \" :4, \" range \" :{ \" min \" :0.000000, \" max \" :297.000000, \" step \" :29.700000}, \" depend_and \" :[ \" is-custom-area==true \" ]}, \" page \" :{ \" category \" : \" base \" , \" title \" : \" \\ u626b \\ u63cf \\ u9875 \\ u9762 \" , \" desc \" : \" \\ u8bbe \\ u7f6e \\ u9875 \\ u9762 \\ u626b \\ u63cf \\ u65b9 \\ u5f0f \" , \" type \" : \" string \" , \" cur \" : \" \\ u53cc \\ u9762 \" , \" default \" : \" \\ u53cc \\ u9762 \" , \" size \" :50, \" 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 \" ]}, \" blank-sensitivity \" :{ \" category \" : \" base \" , \" 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, \" step \" :1}, \" depend_or \" :[ \" page== \\ u8df3 \\ u8fc7 \\ u7a7a \\ u767d \\ u9875 \\ uff08 \\ u53d1 \\ u7968 \\ u7eb8 \\ uff09 \" , \" == \\ u8df3 \\ u8fc7 \\ u7a7a \\ u767d \\ u9875 \\ uff08 \\ u901a \\ u7528 \\ uff09 \" ]}, \" fold-type \" :{ \" category \" : \" base \" , \" title \" : \" \\ u5bf9 \\ u6298 \\ u6a21 \\ u5f0f \" , \" desc \" : \" \" , \" type \" : \" string \" , \" cur \" : \" \\ u4e0a \\ u4e0b \\ u5bf9 \\ u6298 \" , \" default \" : \" \\ u4e0a \\ u4e0b \\ u5bf9 \\ u6298 \" , \" size \" :200, \" range \" :[ \" \\ u5de6 \\ u53f3 \\ u5bf9 \\ u6298 \" , \" \\ u4e0a \\ u4e0b \\ u5bf9 \\ u6298 \" , \" \\ u81ea \\ u52a8 \\ u5bf9 \\ u6298 \" ], \" depend_or \" :[ \" page== \\ u5bf9 \\ u6298 \" ]}, \" resolution \" :{ \" category \" : \" base \" , \" title \" : \" \\ u5206 \\ u8fa8 \\ u7387 \" , \" desc \" : \" \\ u8bbe \\ u7f6e \\ u626b \\ u63cf \\ u56fe \\ u50cf \\ u7684 \\ u5206 \\ u8fa8 \\ u7387 \" , \" type \" : \" int \" , \" cur \" :200, \" default \" :200, \" size \" :4, \" range \" :{ \" min \" :100, \" max \" :600, \" step \" :1}}, \" image-quality \" :{ \" category \" : \" base \" , \" title \" : \" \\ u753b \\ u8d28 \" , \" desc \" : \" \" , \" type \" : \" string \" , \" cur \" : \" \\ u753b \\ u8d28 \\ u4f18 \\ u5148 \" , \" default \" : \" \\ u753b \\ u8d28 \\ u4f18 \\ u5148 \" , \" size \" :200, \" range \" :[ \" \\ u901f \\ u5ea6 \\ u4f18 \\ u5148 \" , \" \\ u753b \\ u8d28 \\ u4f18 \\ u5148 \" ], \" depend_or \" :[]}, \" is-exchange \" :{ \" category \" : \" base \" , \" 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 \" :[ \" page!= \\ u5355 \\ u9762 \" ]}, \" grp-2 \" :{ \" category \" : \" base \" , \" title \" : \" \\ u4eae \\ u5ea6 \" , \" type \" : \" group \" }, \" is-custom-gamma \" :{ \" category \" : \" base \" , \" 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}, \" brightness \" :{ \" category \" : \" base \" , \" title \" : \" \\ u4eae \\ u5ea6 \\ u503c \" , \" desc \" : \" \\ u8c03 \\ u6574 \\ u56fe \\ u50cf \\ u4eae \\ u5ea6 \" , \" type \" : \" int \" , \" cur \" :128, \" default \" :128, \" size \" :4, \" range \" :{ \" min \" :1, \" max \" :255, \" step \" :1}}, \" contrast \" :{ \" category \" : \" base \" , \" 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, \" step \" :1}}, \" gamma \" :{ \" category \" : \" base \" , \" 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, \" step \" :0.499000}}, \" grp-3 \" :{ \" category \" : \" base \" , \" title \" : \" \\ u56fe \\ u50cf \\ u5904 \\ u7406 \" , \" type \" : \" group \" }, \" is-anti-skew \" :{ \" category \" : \" base \" , \" 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 \" :[ \" page!= \\ u5bf9 \\ u6298 \" ]}, \" is-split \" :{ \" category \" : \" base \" , \" title \" : \" \\ u56fe \\ u50cf \\ u62c6 \\ u5206 \" , \" desc \" : \" \\ u81ea \\ u52a8 \\ u62c6 \\ u5206 \\ u56fe \\ u50cf \" , \" type \" : \" bool \" , \" cur \" :false, \" default \" :false, \" size \" :4, \" depend_or \" :[ \" page!= \\ u5bf9 \\ u6298 \" ]}, \" is-erase-black-frame \" :{ \" category \" : \" base \" , \" title \" : \" \\ u6d88 \\ u9664 \\ u9ed1 \\ u6846 \" , \" desc \" : \" \\ u6d88 \\ u
2022-10-28 10:42:22 +00:00
2022-05-03 03:56:07 +00:00
namespace settingsdsp_300
{
2022-05-17 07:04:55 +00:00
scanner_err device_status_to_hg_err ( int usbdata )
2022-05-03 03:56:07 +00:00
{
2022-05-17 07:04:55 +00:00
scanner_err code = SCANNER_ERR_NO_DATA ;
2022-05-03 03:56:07 +00:00
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
break ;
2022-10-18 08:23:22 +00:00
case setting3288dsp : : STOP_SCAN :
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 ;
2022-12-29 16:05:43 +00:00
case setting3288dsp : : AUTO_FLAT_FINISHED :
code = SCANNER_ERR_DEVICE_AUTO_FAIL_OVER ;
break ;
case setting3288dsp : : AUTO_FLATTING :
code = SCANNER_ERR_DEVICE_AUTO_FAIL_INFO ;
break ;
2023-02-21 09:52:18 +00:00
case setting3288dsp : : HAVE_HOLE :
code = SCANNER_ERR_DEVICE_MAYBE_IS_HOLE ;
break ;
2022-05-03 03:56:07 +00:00
default :
2022-05-17 07:04:55 +00:00
code = SCANNER_ERR_NO_DATA ;
2022-12-29 16:05:43 +00:00
break ;
2022-05-03 03:56:07 +00:00
}
return code ;
}
}
2023-02-28 06:00:27 +00:00
hg_scanner_300 : : hg_scanner_300 ( const char * dev_name , int pid , usb_io * io ) : hg_scanner ( G100Serial , dev_name , io , pid ) , papersize ( pid ) , is_devs_sleep_ ( false )
2022-05-03 03:56:07 +00:00
{
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
2023-02-28 06:00:27 +00:00
initdevice ( ) ;
2023-01-17 07:07:58 +00:00
if ( init_settings ( pid_ ) )
{
if ( pid_ = = 0x300 )
init_settings ( ( jsontext1 + jsontext2 ) . c_str ( ) ) ;
else
init_settings ( ( jsontext3 + jsontext4 ) . c_str ( ) ) ;
}
2023-02-28 06:00:27 +00:00
int val = 0 ;
int ret = get_scan_is_sleep ( val ) ;
if ( ! val & & ret = = SCANNER_ERR_OK )
{
is_devs_sleep_ = status_ = SCANNER_ERR_DEVICE_SLEEPING ;
VLOG_MINI_1 ( LOG_LEVEL_WARNING , " init device start status is(%s) \n " , hg_log : : lang_load ( ID_STATU_DESC_SCANNER_ERR_DEVICE_SLEEPING ) ) ;
}
if ( pid_ = = 0x400 | | is_devs_sleep_ )
return ;
//目前300才做处理
set_kernelsnap_ver ( ) ;
is_devs_sleep_ = false ;
2022-05-03 03:56:07 +00:00
}
hg_scanner_300 : : ~ hg_scanner_300 ( )
{ }
int hg_scanner_300 : : 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_300 : : thread_handle_usb_read ( void )
{
2022-07-23 05:42:34 +00:00
int ret = SCANNER_ERR_OK ,
status = SCANNER_ERR_OK ;
StopWatch sw ;
2023-02-17 07:16:22 +00:00
sw . reset ( ) ;
2022-07-23 05:42:34 +00:00
SANE_Image_Statu statu = SANE_Image_Statu_OK ;
2023-02-17 07:16:22 +00:00
int img_num = 0 ;
2022-07-23 05:42:34 +00:00
savestatus_ . clear ( ) ;
2023-02-15 07:06:36 +00:00
VLOG_MINI_1 ( LOG_LEVEL_WARNING , " thread_handle_usb_read run is:%d \n " , run_ ) ;
2022-05-03 03:56:07 +00:00
while ( run_ )
{
USBCB usb = { 0 } ;
ret = get_scanner_status ( usb ) ;
//printf("usb.u32_Data = %d ret = %d\r\n",usb.u32_Data,ret);
2023-02-28 07:33:50 +00:00
//如果设备出现卡纸 或者双张等设备信息问题, 需要等到设备进行发送stop才能停止。 所以始终以 "停止" 消息为结束信号
//如果有图的情况下,并且卡纸或双张等,设备会先发送卡纸双张信息。所以接受到错误信息之后,仍需要把图像取出来。
2022-05-17 07:04:55 +00:00
if ( ret = = SCANNER_ERR_DEVICE_STOPPED )
2022-05-03 03:56:07 +00:00
{
2022-12-02 08:44:52 +00:00
status_ = ! savestatus_ . empty ( ) ? savestatus_ [ 0 ] : SCANNER_ERR_OK ; //以第一个消息为准
2022-05-03 03:56:07 +00:00
savestatus_ . clear ( ) ;
2023-02-15 07:06:36 +00:00
if ( user_cancel_ )
{
if ( status_ & & status_ ! = SCANNER_ERR_DEVICE_STOPPED ) // thread_handle_image_process maybe call stop() when insufficient memory occurs .
ret = status_ ;
else
status_ = ret = SCANNER_ERR_USER_CANCELED ;
VLOG_MINI_2 ( LOG_LEVEL_DEBUG_INFO , " %s:%s \n " , hg_log : : lang_load ( ID_STATU_DESC_SCANNER_ERR_DEVICE_GET_USER_CANCEL_SCAN ) , hg_scanner_err_name ( status_ ) ) ;
}
VLOG_MINI_2 ( LOG_LEVEL_DEBUG_INFO , " %s:%s \n " , " 'STOPSCAN' message in usb thread \n " , hg_scanner_err_name ( status_ ) ) ;
2022-05-03 03:56:07 +00:00
break ;
}
2023-01-17 07:07:58 +00:00
if ( ret ! = SCANNER_ERR_OK & &
ret ! = SCANNER_ERR_DEVICE_STOPPED & &
ret ! = SCANNER_ERR_NO_DATA & &
ret ! = SCANNER_ERR_DEVICE_AUTO_FAIL_INFO & &
ret ! = SCANNER_ERR_DEVICE_AUTO_FAIL_OVER )
2022-05-03 03:56:07 +00:00
{
2023-01-17 07:07:58 +00:00
//statu = last_usb_image_statu(ret);
2022-05-03 03:56:07 +00:00
savestatus_ . push_back ( ret ) ;
}
2023-01-17 07:07:58 +00:00
else if ( ret ! = SCANNER_ERR_NO_DATA & &
ret ! = SCANNER_ERR_DEVICE_AUTO_FAIL_OVER & &
ret ! = SCANNER_ERR_DEVICE_AUTO_FAIL_INFO )
2022-12-30 09:14:49 +00:00
{
statu = SANE_Image_Statu_OK ;
}
2022-12-29 16:05:43 +00:00
else if ( ret = = SCANNER_ERR_DEVICE_AUTO_FAIL_OVER )
{
2022-12-30 10:16:40 +00:00
is_auto_falt = false ;
2022-12-30 09:14:49 +00:00
status_ = ret ;
2022-12-29 16:05:43 +00:00
std : : string msg ;
int count = usb . u32_Count ;
2022-12-30 09:14:49 +00:00
msg . resize ( count ) ;
ret = io_ - > read_bulk ( & msg [ 0 ] , & count ) ;
if ( ret = = SCANNER_ERR_OK )
notify_ui_working_status ( msg . c_str ( ) , SANE_EVENT_STATUS , status_ ) ;
else
status_ = ret ;
2022-12-29 16:05:43 +00:00
break ;
}
else if ( ret = = SCANNER_ERR_DEVICE_AUTO_FAIL_INFO )
2022-12-29 10:05:59 +00:00
{
2022-12-30 09:14:49 +00:00
sw . reset ( ) ;
status_ = ret ;
2022-12-29 16:05:43 +00:00
std : : string msg ;
int count = usb . u32_Count ;
2022-12-30 09:14:49 +00:00
msg . resize ( count ) ;
ret = io_ - > read_bulk ( & msg [ 0 ] , & count ) ;
if ( ret = = SCANNER_ERR_OK )
{
2022-12-30 09:54:27 +00:00
status_ = ret = SCANNER_ERR_DEVICE_AUTO_FAIL_INFO ;
2022-12-30 09:14:49 +00:00
char buf [ 1024 ] ;
strcpy ( buf , msg . c_str ( ) ) ;
2022-12-30 09:54:27 +00:00
notify_ui_working_status ( buf , SANE_EVENT_STATUS , status_ ) ;
2023-01-17 07:07:58 +00:00
msg . clear ( ) ;
2022-12-30 09:14:49 +00:00
}
else
{
status_ = ret ;
break ;
}
2022-12-29 10:05:59 +00:00
}
2023-02-15 07:06:36 +00:00
else if ( ret = = SCANNER_ERR_IO )
2022-12-29 10:05:59 +00:00
{
2023-02-15 07:06:36 +00:00
status_ = ret ;
VLOG_MINI_1 ( LOG_LEVEL_DEBUG_INFO , " %s \n " , hg_scanner_err_name ( status_ ) ) ;
2022-05-03 03:56:07 +00:00
break ;
}
2023-02-21 01:07:29 +00:00
if ( sw . elapsed_ms ( ) > 30000 & & img_conf_ . resolution_dst ! = 600 ) //防止状态信息一直取不上来导致卡死
2023-02-15 07:06:36 +00:00
{
2023-02-21 10:02:46 +00:00
if ( ( img_conf_ . papertype = = TwSS : : MaxSize | | img_conf_ . papertype = = TwSS : : USStatement ) & & pid_ = = 0x0300 & & is_kernelsnap3288_230210_ )
2023-02-15 07:06:36 +00:00
{
2023-02-17 07:16:22 +00:00
hg_log : : log ( LOG_LEVEL_WARNING , " while 30S \n " ) ;
2023-02-15 07:06:36 +00:00
}
else
{
2023-02-28 07:33:50 +00:00
if ( ! savestatus_ . empty ( ) ) //以第一个消息为准
{
status_ = savestatus_ [ 0 ] ;
}
2023-02-15 07:06:36 +00:00
savestatus_ . clear ( ) ;
2023-02-28 07:33:50 +00:00
hg_log : : log ( LOG_LEVEL_WARNING , " Get Status TimeOut,get image out 30S \n " ) ;
notify_ui_working_status ( hg_log : : lang_load ( ID_STATU_DESC_SCANNER_ERR_DEVICE_GET_IMAGE_OUTTIME ) , SANE_EVENT_ERROR , status_ ) ; // 取图通信超时
2023-02-15 07:06:36 +00:00
break ;
}
}
2023-02-17 07:16:22 +00:00
if ( sw . elapsed_ms ( ) > 60000 )
{
2023-02-28 07:33:50 +00:00
if ( ! savestatus_ . empty ( ) ) //以第一个消息为准
{
status_ = savestatus_ [ 0 ] ;
}
2023-02-17 07:16:22 +00:00
savestatus_ . clear ( ) ;
2023-02-28 07:33:50 +00:00
hg_log : : log ( LOG_LEVEL_WARNING , " MaxSize TimeOut,Get Image 60S \n " ) ;
notify_ui_working_status ( hg_log : : lang_load ( ID_STATU_DESC_SCANNER_ERR_DEVICE_GET_IMAGE_OUTTIME ) , SANE_EVENT_ERROR , status_ ) ; // 取图通信超时
2023-02-17 07:16:22 +00:00
break ;
}
2022-05-17 07:04:55 +00:00
if ( ret = = SCANNER_ERR_OK & & usb . u32_Count > 0 )
2022-05-03 03:56:07 +00:00
{
2022-08-04 03:36:37 +00:00
int totalNum = usb . u32_Count & 0x3fffffff ; // 2022-08-04: 兼容Android, 默认图片大小均在1GB以内
2023-02-17 07:16:22 +00:00
VLOG_MINI_2 ( LOG_LEVEL_WARNING , " Get Scaner Image Size:%d bytes,Image Num[%d] \n " , totalNum , img_num ) ;
img_num + + ;
2022-08-04 03:36:37 +00:00
if ( totalNum )
2022-05-23 06:10:18 +00:00
{
2022-08-04 03:36:37 +00:00
std : : shared_ptr < tiny_buffer > imagedata ( aquire_memory ( totalNum ) ) ;
2022-05-03 03:56:07 +00:00
2022-08-04 03:36:37 +00:00
if ( ! imagedata . get ( ) )
{
status_ = SCANNER_ERR_INSUFFICIENT_MEMORY ;
break ;
}
2022-05-03 03:56:07 +00:00
2022-08-04 03:36:37 +00:00
imagedata - > set_image_statu ( statu ) ;
ret = get_img_data ( imagedata ) ;
//io_->set_timeout(200);
if ( ret = = SCANNER_ERR_OK )
{
ret = pop_image ( ) ;
sw . reset ( ) ;
if ( ret ! = SCANNER_ERR_OK )
{
status_ = ret ;
break ;
}
}
else
2022-05-03 03:56:07 +00:00
{
status_ = ret ;
break ;
}
}
}
this_thread : : sleep_for ( chrono : : milliseconds ( 10 ) ) ;
}
}
2023-01-17 07:07:58 +00:00
int hg_scanner_300 : : start ( void )
{
2022-05-20 09:11:50 +00:00
bool handled = false ;
int ret = try_third_app_handle_start ( handled ) ,
2022-12-22 10:37:53 +00:00
count = - 1 ,
val = 1 ;
2022-05-20 09:11:50 +00:00
user_cancel_ = false ;
2022-05-03 03:56:07 +00:00
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-12-22 10:37:53 +00:00
ret = get_scan_is_sleep ( val ) ;
2023-02-13 08:38:05 +00:00
if ( ! val & & ret = = SCANNER_ERR_OK )
2022-05-03 03:56:07 +00:00
{
2022-12-22 10:37:53 +00:00
status_ = SCANNER_ERR_DEVICE_SLEEPING ;
2023-01-10 01:36:22 +00:00
//notify_ui_working_status(STATU_DESC_SCANNER_ERR_DEVICE_SLEEPING, SANE_EVENT_ERROR, status_);
//notify_ui_working_status(STATU_DESC_SCANNER_ERR_DEVICE_NOTIFY_SLEEP, SANE_EVENT_ERROR, status_);
2023-01-18 10:08:47 +00:00
VLOG_MINI_1 ( LOG_LEVEL_WARNING , " device start status is(%s) \n " , hg_log : : lang_load ( ID_STATU_DESC_SCANNER_ERR_DEVICE_SLEEPING ) ) ;
2022-12-22 10:37:53 +00:00
return status_ ;
2022-05-03 03:56:07 +00:00
}
2023-02-13 08:38:05 +00:00
ret = get_scanner_paperon ( val ) ;
if ( ! val & & ret = = SCANNER_ERR_OK )
{
status_ = SCANNER_ERR_DEVICE_NO_PAPER ;
notify_ui_working_status ( STATU_DESC_SCANNER_ERR_DEVICE_NO_PAPER , SANE_EVENT_ERROR , status_ ) ;
VLOG_MINI_1 ( LOG_LEVEL_WARNING , " device start status is(%s) \n " , STATU_DESC_SCANNER_ERR_DEVICE_NO_PAPER ) ;
return status_ ;
}
if ( ret ! = SCANNER_ERR_OK )
{
return ret ;
}
2023-02-28 06:00:27 +00:00
if ( is_devs_sleep_ ) //设备在睡眠的状态当中获取固件是失败的,所以在这个地方进行标志位设置。(总感觉不保险)
{
is_devs_sleep_ = false ;
set_kernelsnap_ver ( ) ;
int paper = image_prc_param_ . bits . paper ;
on_paper_changed ( paper ) ;
int dpi = resolution_ ;
on_resolution_changed ( dpi ) ;
}
ret = writedown_device_configuration ( true ) ;
if ( ret = = SCANNER_ERR_OK )
writedown_image_configuration ( ) ;
else
{
status_ = ret ;
return ret ;
}
2023-02-16 07:57:49 +00:00
//printf_devconfig();
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 ) ;
2022-08-04 03:36:37 +00:00
//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-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
2022-06-01 09:16:09 +00:00
status_ = ret ;
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 ;
2023-01-17 07:07:58 +00:00
}
2022-05-03 03:56:07 +00:00
int hg_scanner_300 : : 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 ) ;
2022-05-17 07:04:55 +00:00
if ( status_ = = SCANNER_ERR_DEVICE_BUSY )
2022-05-03 03:56:07 +00:00
{
2022-05-30 03:04:26 +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-06-07 10:06:28 +00:00
user_cancel_ = true ;
2022-05-17 07:04:55 +00:00
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_300 : : 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 ;
}
int hg_scanner_300 : : 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-03 03:56:07 +00:00
int len = sizeof ( USBCB ) ;
ret = io_ - > read_bulk ( & usb , & len ) ;
if ( ret )
{
status_ = ret ;
}
return ret ;
}
int hg_scanner_300 : : 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 ;
}
int hg_scanner_300 : : get_scanner_status ( USBCB & usb )
{
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 } ;
2023-02-28 07:33:50 +00:00
io_ - > set_timeout ( 2000 ) ;
2022-05-03 03:56:07 +00:00
ret = writeusb ( usb ) ;
2022-05-17 07:04:55 +00:00
if ( ret ! = SCANNER_ERR_OK )
2023-02-28 07:33:50 +00:00
{
VLOG_MINI_1 ( LOG_LEVEL_WARNING , " get_scanner_status write usb: %s \n " , hg_scanner_err_name ( ret ) ) ;
2022-05-03 03:56:07 +00:00
return ret ;
2023-02-28 07:33:50 +00:00
}
2022-05-03 03:56:07 +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
{
2023-02-28 07:33:50 +00:00
VLOG_MINI_1 ( LOG_LEVEL_WARNING , " get_scanner_status read usb: %s \n " , hg_scanner_err_name ( ret ) ) ;
2022-05-03 03:56:07 +00:00
status_ = ret ;
return ret ;
}
2022-05-17 07:04:55 +00:00
scanner_err code = settingsdsp_300 : : device_status_to_hg_err ( usb . u32_Data ) ;
2022-05-03 03:56:07 +00:00
return code ;
}
2022-06-01 03:04:10 +00:00
int hg_scanner_300 : : get_img_data ( std : : shared_ptr < tiny_buffer > & imagedata )
2022-05-03 03:56:07 +00:00
{
int total = imagedata - > size ( ) ,
2022-05-17 07:04:55 +00:00
ret = SCANNER_ERR_OK ,
2022-05-03 03:56:07 +00:00
index = 0 ,
block = total ;
2022-10-18 08:23:22 +00:00
USBCB usb { setting3288dsp : : GET_IMAGE , 0 , total } ;
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
{
2023-02-28 07:33:50 +00:00
VLOG_MINI_1 ( LOG_LEVEL_WARNING , " get_img_data setting3288dsp::GET_IMAGE write usb: %s \n " , hg_scanner_err_name ( ret ) ) ;
2022-05-03 03:56:07 +00:00
status_ = ret ;
return ret ;
}
2022-08-04 03:36:37 +00:00
//io_->set_timeout(500);
2022-05-03 03:56:07 +00:00
2023-02-13 08:38:05 +00:00
//printf_devconfig();
2022-05-03 03:56:07 +00:00
while ( total > 0 )
{
block = 512 * 1024 ;
if ( total < block )
block = total ;
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-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
{
2023-02-28 07:33:50 +00:00
VLOG_MINI_1 ( LOG_LEVEL_WARNING , " get_img_data read_bulk : %s \n " , hg_scanner_err_name ( ret ) ) ;
2022-05-03 03:56:07 +00:00
status_ = ret ;
return ret ;
}
index + = block ;
total - = block ;
}
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 ) ;
}
status_ = ret ;
return ret ;
}
2022-10-18 08:23:22 +00:00
int hg_scanner_300 : : writedown_device_configuration ( bool type , setting_hardware : : HGSCANCONF_3288 * 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 ;
2022-11-19 10:16:43 +00:00
SIZE size ;
2023-02-16 07:32:33 +00:00
setting_hardware : : HGSCANCONF_3288 p = dsp_config ;
2022-05-03 03:56:07 +00:00
if ( ! d )
2022-07-25 02:38:20 +00:00
{
2023-02-16 07:32:33 +00:00
p . params_3288 . lutmode = keep_watermark_ ;
2023-02-15 09:29:34 +00:00
d = & p ;
2022-07-25 02:38:20 +00:00
}
2022-11-19 10:16:43 +00:00
if ( is_multiout )
{
2023-02-13 08:38:05 +00:00
d - > params_3288 . isColor = image_prc_param_ . bits . multi_out = = MULTI_GRAY_AND_BW ? 0 : 1 ;
2022-11-19 10:16:43 +00:00
}
else if ( ( image_prc_param_ . bits . color_mode = = COLOR_MODE_256_GRAY
| | image_prc_param_ . bits . color_mode = = COLOR_MODE_BLACK_WHITE )
& & image_prc_param_ . bits . rid_color ! = RID_COLOR_NONE )
{
d - > params_3288 . isColor = 1 ;
}
2022-11-23 14:58:22 +00:00
if ( paper_size_ = = TwSS : : USStatement | | paper_size_ = = TwSS : : MaxSize )
2022-11-19 10:16:43 +00:00
{
2023-02-21 10:02:46 +00:00
//d->params_3288.pageSize = setting3288dsp::G400_MAXSIZE;
2022-11-19 10:16:43 +00:00
}
2023-02-13 08:38:05 +00:00
2023-02-28 06:00:27 +00:00
if ( ( is_quality_ = = IMG_SPEED ) & & ( resolution_ > = 300 ) )
2023-02-13 08:38:05 +00:00
{
2023-02-28 06:00:27 +00:00
VLOG_MINI_1 ( LOG_LEVEL_WARNING , " writedown_device_configuration is_quality_ is .(%d) \n " , is_quality_ )
2023-02-13 08:38:05 +00:00
d - > params_3288 . dpi = 1 ;
}
2023-02-16 02:57:18 +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
| | image_prc_param_ . bits . paper = = PAPER_16K
| | image_prc_param_ . bits . paper = = PAPER_8K
| | image_prc_param_ . bits . paper = = PAPER_16K_LATERAL
)
{
d - > params_3288 . enableSizeDetect = false ;
}
2022-11-19 10:16:43 +00:00
size = papersize . GetPaperSize ( TwSS : : A4 , 200 , img_conf_ . paperAlign ) ;
dsp_config . params_3288 . dstHeight = ( int ) ( ( size . cy + 200 ) / 100 ) ;
2022-05-03 03:56:07 +00:00
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 ) ;
2023-02-16 07:57:49 +00:00
if ( type )
{
printf_devconfig ( d ) ;
}
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_300 : : on_color_mode_changed ( int & color_mode )
{
2022-11-19 10:16:43 +00:00
dsp_config . params_3288 . isColor = ( color_mode = = COLOR_MODE_BLACK_WHITE | | color_mode = = COLOR_MODE_256_GRAY ) ? 0 : 1 ;
return SCANNER_ERR_OK ;
2022-05-03 03:56:07 +00:00
}
int hg_scanner_300 : : on_paper_changed ( int & paper )
{
bool exact = true ;
2023-02-15 07:06:36 +00:00
Paper_Map * papermap = pid_ = = 0x0300 & & is_kernelsnap3288_230210_ ? paper_map_3288_600dpi : paper_map_3288 ;
int paperlen = pid_ = = 0x0300 & & is_kernelsnap3288_230210_ ? ARRAY_SIZE ( paper_map_3288_600dpi ) : ARRAY_SIZE ( paper_map_3288 ) ;
int ind = hgpaper_to_devspaper ( papermap , paperlen , 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
2023-02-15 07:06:36 +00:00
if ( dsp_config . params_3288 . pageSize ! = papermap [ ind ] . dev_value )
2022-05-03 03:56:07 +00:00
{
2022-10-18 08:23:22 +00:00
int old = dsp_config . params_3288 . pageSize ;
2022-05-03 03:56:07 +00:00
2023-02-15 07:06:36 +00:00
dsp_config . params_3288 . pageSize = papermap [ 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_3288 . pageSize = old ;
2023-02-15 07:06:36 +00:00
for ( int i = 0 ; i < paperlen ; + + i )
2022-05-03 03:56:07 +00:00
{
2023-02-15 07:06:36 +00:00
if ( papermap [ i ] . dev_value = = old )
2022-05-03 03:56:07 +00:00
{
2023-02-15 07:06:36 +00:00
paper = papermap [ 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_300 : : on_paper_check_changed ( bool & check )
{
2023-02-16 07:57:49 +00:00
if ( ! is_kernelsnap3288_230210_ & & check )
2023-02-16 02:57:18 +00:00
{
check = false ;
notify_ui_working_status ( hg_log : : lang_load ( ID_STATU_DESC_SCANNER_ERR_DEVICE_NOT_SUPPORT ) , SANE_EVENT_ERROR , status_ ) ;
2023-02-17 07:16:22 +00:00
//VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "on_paper_check_changed:%s\r\n", hg_log::lang_load(ID_STATU_DESC_SCANNER_ERR_DEVICE_NOT_SUPPORT));
2023-02-16 02:57:18 +00:00
return SCANNER_ERR_DEVICE_NOT_SUPPORT ;
}
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_3288 . enableSizeDetect ^ check )
2022-05-03 03:56:07 +00:00
{
2022-10-18 08:23:22 +00:00
dsp_config . params_3288 . enableSizeDetect = 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_3288 . enableSizeDetect = ! check ;
check = dsp_config . params_3288 . enableSizeDetect ;
2022-05-03 03:56:07 +00:00
}
}
return ret ;
}
int hg_scanner_300 : : on_resolution_changed ( int & dpi )
{
2022-05-17 07:04:55 +00:00
int ret = SCANNER_ERR_OK ;
2023-02-13 08:38:05 +00:00
if ( is_kernelsnap3288_230210_ )
2023-02-15 09:29:34 +00:00
dsp_config . params_3288 . dpi = dpi = = 600 ? 3 : ( dpi < 599 & & dpi > = 300 ) ? 2 : 1 ;
2023-02-13 08:38:05 +00:00
else if ( is_kernelsnap3288_221106_ )
dsp_config . params_3288 . dpi = ( dpi > = 300 ) ? 2 : 1 ;
else
dsp_config . params_3288 . dpi = 1 ;
2023-02-28 06:00:27 +00:00
VLOG_MINI_3 ( LOG_LEVEL_WARNING , " on_resolution_changed is dpi:%d .set device dpi(%d),is_kernelsnap3288_221106_ is :%d \n " , dpi , dsp_config . params_3288 . dpi , is_kernelsnap3288_221106_ ) ;
2022-11-19 10:16:43 +00:00
2022-05-03 03:56:07 +00:00
ret = writedown_device_configuration ( ) ;
return ret ;
}
int hg_scanner_300 : : 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_3288 . doubleFeeded ^ check )
2022-05-03 03:56:07 +00:00
{
2022-10-18 08:23:22 +00:00
dsp_config . params_3288 . doubleFeeded = 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_3288 . doubleFeeded = ! check ;
check = dsp_config . params_3288 . doubleFeeded ;
2022-05-03 03:56:07 +00:00
}
}
return ret ;
}
2023-02-28 06:00:27 +00:00
int hg_scanner_300 : : set_kernelsnap_ver ( )
{
int ret = SCANNER_ERR_OK ;
string fw = get_firmware_version ( ) ;
if ( ! fw . empty ( ) )
{
if ( atoi ( fw . substr ( 4 , 6 ) . c_str ( ) ) > = 221106 & & atoi ( fw . substr ( 4 , 6 ) . c_str ( ) ) < 230210 )
is_kernelsnap3288_221106_ = true ;
else if ( atoi ( fw . substr ( 4 , 6 ) . c_str ( ) ) > = 230210 )
is_kernelsnap3288_230210_ = true ;
else
{
is_kernelsnap3288_221106_ = false ;
is_kernelsnap3288_230210_ = false ;
}
2023-03-06 07:34:56 +00:00
is_kernelsnap3288_230303_ = atoi ( fw . substr ( 4 , 6 ) . c_str ( ) ) > = 220303 ? true : false ;
2023-02-28 06:00:27 +00:00
}
else
{
ret = SCANNER_ERR_NO_DATA ;
}
VLOG_MINI_2 ( LOG_LEVEL_WARNING , " hg_scanner_300 is_kernelsnap3288_221106_ :%d ,is_kernelsnap3288_230210_:%d \n " , is_kernelsnap3288_221106_ , is_kernelsnap3288_230210_ ) ;
return SCANNER_ERR_OK ;
}
2022-05-03 03:56:07 +00:00
int hg_scanner_300 : : agreement ( TwSS tw , int align )
{
2022-05-17 07:04:55 +00:00
int ret = SCANNER_ERR_OK ;
2022-05-03 03:56:07 +00:00
SIZE size ;
2022-10-18 08:23:22 +00:00
setting_hardware : : HGSCANCONF_3288 d = dsp_config ;
2022-05-03 03:56:07 +00:00
size = papersize . GetPaperSize ( TwSS : : A4 , 200 , align ) ;
2022-10-18 08:23:22 +00:00
dsp_config . params_3288 . dstHeight = ( int ) ( ( size . cy + 200 ) / 100 ) ;
2022-05-03 03:56:07 +00:00
ret = writedown_device_configuration ( true , & d ) ;
return ret ;
}
int hg_scanner_300 : : initdevice ( )
{
dsp_config . value = 0 ;
2022-10-18 08:23:22 +00:00
dsp_config . params_3288 . enableLed = 1 ;
dsp_config . params_3288 . isCorrect = 1 ;
dsp_config . params_3288 . reversed1 = 0 ;
dsp_config . params_3288 . reversed2 = 0 ;
dsp_config . params_3288 . enableSizeDetect = 0 ;
2023-01-17 07:07:58 +00:00
//writedown_device_configuration(true);
//printf_devconfig();
2022-05-17 07:04:55 +00:00
return SCANNER_ERR_OK ;
2022-05-03 03:56:07 +00:00
}
void hg_scanner_300 : : writedown_image_configuration ( void )
{
SCANCONF ic ;
2022-11-19 10:16:43 +00:00
int len = sizeof ( ic ) ;
bzero ( & ic , len ) ;
ic . contrast = contrast_ ;
ic . brightness = bright_ ;
2022-11-23 11:00:17 +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-11-19 10:16:43 +00:00
if ( test_1_paper_ )
{
LOG_INFO ( LOG_LEVEL_DEBUG_INFO , " scanning mode: testing ONE paper ... \n " ) ;
ic . scannum = 1 ;
}
else
ic . scannum = scan_count_ ;
ic . en_sizecheck = dsp_config . params_3288 . enableSizeDetect ;
ic . hardwarecaps . en_skrewdetect = 0 ;
ic . hardwarecaps . en_doublefeed = dsp_config . params_3288 . doubleFeeded ;
ic . hardwarecaps . en_stapledetect = 0 ;
ic . hardwarecaps . skrewdetectlevel = 0 ;
// ic.hardwarecaps.is_autopaper = dsp_config_.params_dsp.is_autopaper;
ic . hardwarecaps . capturepixtype = 0 ; //暂无参数 获取图像类型
ic . hardwarecaps . lowpowermode = LowPowerMode : : Min_None ; //暂无参数 设置休眠时间 两个参数3399未使用
image_configuration ( ic ) ;
2022-05-03 03:56:07 +00:00
}
2022-10-18 08:23:22 +00:00
void hg_scanner_300 : : printf_devconfig ( setting_hardware : : HGSCANCONF_3288 * d )
2022-05-03 03:56:07 +00:00
{
if ( ! d )
d = & dsp_config ;
2022-10-18 08:23:22 +00:00
VLOG_MINI_1 ( LOG_LEVEL_DEBUG_INFO , " \r \n dsp_config.params_3288.doubleFeeded:%d \r \n " , d - > params_3288 . doubleFeeded ) ;
VLOG_MINI_1 ( LOG_LEVEL_DEBUG_INFO , " dsp_config.params_3288.dpi:%d \r \n " , d - > params_3288 . dpi ) ;
VLOG_MINI_1 ( LOG_LEVEL_DEBUG_INFO , " dsp_config.params_3288.dstHeight:%d \r \n " , d - > params_3288 . dstHeight ) ;
VLOG_MINI_1 ( LOG_LEVEL_DEBUG_INFO , " dsp_config.params_3288.enableLed:%d \r \n " , d - > params_3288 . enableLed ) ;
VLOG_MINI_1 ( LOG_LEVEL_DEBUG_INFO , " dsp_config.params_3288.enableStable:%d \r \n " , d - > params_3288 . enableStable ) ;
VLOG_MINI_1 ( LOG_LEVEL_DEBUG_INFO , " dsp_config.params_3288.isColor:%d \r \n " , d - > params_3288 . isColor ) ;
VLOG_MINI_1 ( LOG_LEVEL_DEBUG_INFO , " dsp_config.params_3288.isCorrect:%d \r \n " , d - > params_3288 . isCorrect ) ;
VLOG_MINI_1 ( LOG_LEVEL_DEBUG_INFO , " dsp_config.params_3288.pageSize:%d \r \n " , d - > params_3288 . pageSize ) ;
VLOG_MINI_1 ( LOG_LEVEL_DEBUG_INFO , " dsp_config.params_3288.reversed1:%d \r \n " , d - > params_3288 . reversed1 ) ;
VLOG_MINI_1 ( LOG_LEVEL_DEBUG_INFO , " dsp_config.params_3288.reversed2:%d \r \n " , d - > params_3288 . reversed2 ) ;
VLOG_MINI_1 ( LOG_LEVEL_DEBUG_INFO , " dsp_config.params_3288.enableSizeDetect:%d \r \n " , d - > params_3288 . enableSizeDetect ) ;
VLOG_MINI_1 ( LOG_LEVEL_DEBUG_INFO , " dsp_config.params_3288.value:%d \r \n " , d - > value ) ;
2022-05-03 03:56:07 +00:00
}
std : : string hg_scanner_300 : : get_firmware_version ( )
{
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 = 10 ; //协议定义长度为10 100 200 =8
2022-10-18 08:23:22 +00:00
USBCB cmd = { setting3288dsp : : GET_FW_VERSION , len , 0 , } ;
2022-05-03 03:56:07 +00:00
2023-02-28 06:00:27 +00:00
ret = writeusb ( cmd ) ;
std : : lock_guard < std : : mutex > lock ( io_lock_ ) ;
2022-05-03 03:56:07 +00:00
ret = io_ - > read_bulk ( buf , & len ) ;
2023-02-28 06:00:27 +00:00
string fw = buf ;
VLOG_MINI_1 ( LOG_LEVEL_WARNING , " get_firmware_version:%s \n " , ! fw . empty ( ) ? fw . c_str ( ) : " not find devs firmware_version " ) ;
2022-05-03 03:56:07 +00:00
return buf ;
}
std : : string hg_scanner_300 : : get_serial_num ( )
{
string SerialNum = " " ;
2022-05-17 07:04:55 +00:00
int ret = SCANNER_ERR_OK ,
2022-05-03 03:56:07 +00:00
len = 14 ;
SerialNum . resize ( len ) ;
2023-02-28 06:00:27 +00:00
USBCB cmd = { setting3288dsp : : GET_SERIAL , len , 0 , } ;
ret = writeusb ( cmd ) ;
2022-05-03 03:56:07 +00:00
2023-02-28 06:00:27 +00:00
std : : lock_guard < std : : mutex > lock ( io_lock_ ) ;
ret = io_ - > read_bulk ( & SerialNum [ 0 ] , & len ) ;
VLOG_MINI_1 ( LOG_LEVEL_WARNING , " get_serial_num:%s \n " , ! SerialNum . empty ( ) ? SerialNum . c_str ( ) : " not find devs get_serial_num " ) ;
2022-05-03 03:56:07 +00:00
return SerialNum ;
}
2022-12-22 10:37:53 +00:00
std : : string hg_scanner_300 : : get_ip ( void )
{
return " " ;
}
2022-05-03 03:56:07 +00:00
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int hg_scanner_300 : : 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 ;
}
2022-12-22 10:37:53 +00:00
int hg_scanner_300 : : set_clear_roller_num ( void )
2022-05-03 03:56:07 +00:00
{
2022-12-29 10:05:59 +00:00
USBCB usbcb = { setting3288dsp : : CLR_ROLLER_NUM , 0 , 4 } ;
return writeusb ( usbcb ) ;
2022-05-03 03:56:07 +00:00
}
2023-03-06 03:37:37 +00:00
int hg_scanner_300 : : set_clear_history_num ( void )
{
2023-03-06 07:34:56 +00:00
if ( ! is_kernelsnap3288_230303_ )
{
return SCANNER_ERR_DEVICE_NOT_SUPPORT ;
}
2023-03-06 03:37:37 +00:00
USBCB usbcb = { setting3288dsp : : CLR_SCAN_NUM , 0 , 4 } ;
return writeusb ( usbcb ) ;
}
2022-05-03 03:56:07 +00:00
int hg_scanner_300 : : 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
}
2022-12-22 10:37:53 +00:00
int hg_scanner_300 : : get_sleep_time ( int & 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
len = 0 ;
2022-12-22 10:37:53 +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 ;
}
len = sizeof ( usbcb ) ;
2022-12-22 10:37:53 +00:00
ret = io_ - > read_bulk ( & usbcb , & len ) ;
2022-05-17 07:04:55 +00:00
if ( ret = = SCANNER_ERR_OK )
2022-05-03 03:56:07 +00:00
{
2022-12-22 10:37:53 +00:00
data = ( SANE_Power ) usbcb . u32_Data ;
2022-05-03 03:56:07 +00:00
}
2023-02-28 06:00:27 +00:00
VLOG_MINI_1 ( LOG_LEVEL_WARNING , " get_serial_num:%d \n " , data ) ;
2022-05-03 03:56:07 +00:00
return ret ;
}
2022-12-22 10:37:53 +00:00
int hg_scanner_300 : : set_sleep_time ( int data )
2022-05-03 03:56:07 +00:00
{
2022-12-22 10:37:53 +00:00
int ret = SCANNER_ERR_OK ;
USBCB usbcb = { setting3288dsp : : SET_SLEEP_TIME , data , 0 } ;
2022-05-03 03:56:07 +00:00
ret = writeusb ( usbcb ) ;
return ret ;
}
2022-12-22 10:37:53 +00:00
int hg_scanner_300 : : get_scanner_paperon ( SANE_Bool & type )
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 ;
2022-12-28 01:56:54 +00:00
USBCB usbcb = { setting3288dsp : : GET_PAPERFEEDER_STATUS , 0 , 0 } ;
2022-05-03 03:56:07 +00:00
len = sizeof ( USBCB ) ;
ret = writeusb ( usbcb ) ;
2022-05-17 07:04:55 +00:00
if ( ret = = SCANNER_ERR_OK )
2022-05-03 03:56:07 +00:00
{
2022-12-22 10:37:53 +00:00
std : : lock_guard < std : : mutex > lock ( io_lock_ ) ;
ret = io_ - > read_bulk ( & usbcb , & len ) ;
type = usbcb . u32_Data = = 0 ? false : true ;
2022-05-03 03:56:07 +00:00
}
2022-12-22 10:37:53 +00:00
//if (usbcb.u32_Data == 0)
// ret = SCANNER_ERR_DEVICE_NO_PAPER;
//else
// ret = SCANNER_ERR_OK;
2023-02-28 06:00:27 +00:00
VLOG_MINI_1 ( LOG_LEVEL_WARNING , " get_scanner_paperon is(%s) \n " , ! type ? hg_scanner_err_name ( SCANNER_ERR_DEVICE_NO_PAPER ) : hg_scanner_err_name ( SCANNER_ERR_OK ) ) ;
2022-05-03 03:56:07 +00:00
return ret ;
}
2022-12-22 10:37:53 +00:00
int hg_scanner_300 : : get_scan_is_sleep ( SANE_Bool & type )
2022-05-03 03:56:07 +00:00
{
2022-12-22 10:37:53 +00:00
int ret = SCANNER_ERR_OK ,
len = 0 ;
2022-05-03 03:56:07 +00:00
2022-12-28 01:56:54 +00:00
USBCB usbcb = { setting3288dsp : : ACTIVE_SCANNER , 0 , 0 } ;
2022-05-03 03:56:07 +00:00
len = sizeof ( USBCB ) ;
ret = writeusb ( usbcb ) ;
2022-05-17 07:04:55 +00:00
if ( ret = = SCANNER_ERR_OK )
2022-05-03 03:56:07 +00:00
{
2022-12-22 10:37:53 +00:00
std : : lock_guard < std : : mutex > lock ( io_lock_ ) ;
ret = io_ - > read_bulk ( & usbcb , & len ) ;
2022-05-03 03:56:07 +00:00
}
2022-12-22 10:37:53 +00:00
if ( ret = = SCANNER_ERR_OK )
2022-05-03 03:56:07 +00:00
{
2022-12-22 10:37:53 +00:00
if ( usbcb . u32_Data = = 0x10 )
type = true ;
//return SCANNER_ERR_OK;
else if ( usbcb . u32_Data = = 0x100 )
type = false ;
//return SCANNER_ERR_DEVICE_SLEEPING;
2022-05-03 03:56:07 +00:00
}
2023-02-28 06:00:27 +00:00
VLOG_MINI_1 ( LOG_LEVEL_WARNING , " get_scan_is_sleep is(%s) \n " , ! type ? hg_scanner_err_name ( SCANNER_ERR_DEVICE_SLEEPING ) : hg_scanner_err_name ( SCANNER_ERR_OK ) ) ;
2022-12-22 10:37:53 +00:00
return ret ;
2022-05-03 03:56:07 +00:00
}
///此款设备无此功能
int hg_scanner_300 : : on_staple_check_changed ( bool & check )
{
2022-05-17 07:04:55 +00:00
return SCANNER_ERR_OK ;
2022-05-03 03:56:07 +00:00
}
int hg_scanner_300 : : on_skew_check_changed ( bool & check )
{
2022-05-17 07:04:55 +00:00
return SCANNER_ERR_OK ;
2022-05-03 03:56:07 +00:00
}
int hg_scanner_300 : : on_skew_check_level_changed ( int & check )
{
2022-05-17 07:04:55 +00:00
return SCANNER_ERR_OK ;
2022-05-03 03:56:07 +00:00
}
2022-07-23 10:01:44 +00:00
int hg_scanner_300 : : on_set_feedmode ( int feedmode )
{
return SCANNER_ERR_DEVICE_NOT_SUPPORT ;
}
2022-12-28 01:56:54 +00:00
int hg_scanner_300 : : on_pic_type ( bool & pic )
{
return SCANNER_ERR_DEVICE_NOT_SUPPORT ;
}
int hg_scanner_300 : : on_pick_paper ( bool autostrength )
{
return SCANNER_ERR_DEVICE_NOT_SUPPORT ;
}
int hg_scanner_300 : : on_pick_paper_threshold ( double threshold )
{
return SCANNER_ERR_DEVICE_NOT_SUPPORT ;
}
int hg_scanner_300 : : on_is_auto_paper ( bool isautopaper )
{
return SCANNER_ERR_DEVICE_NOT_SUPPORT ;
}
int hg_scanner_300 : : on_cis_get_image ( bool isautopaper )
{
is_cis_image = isautopaper ;
dsp_config . params_3288 . isCorrect = isautopaper = = true ? 0 : 1 ;
return writedown_device_configuration ( ) ;
}
2022-07-23 10:01:44 +00:00
int hg_scanner_300 : : on_get_feedmode ( int & feedmode )
{
return SCANNER_ERR_DEVICE_NOT_SUPPORT ;
}
int hg_scanner_300 : : get_device_log ( string & log )
{
2022-07-23 11:46:24 +00:00
return SCANNER_ERR_DEVICE_NOT_SUPPORT ;
2022-07-23 10:01:44 +00:00
}
2022-12-28 01:56:54 +00:00
int hg_scanner_300 : : set_devreboot ( int data )
2022-12-22 10:37:53 +00:00
{
2022-12-28 01:56:54 +00:00
USBCB usbcb = { setting3288dsp : : REBOOT , data , 0 } ;
return writeusb ( usbcb ) ;
2022-12-22 10:37:53 +00:00
}
int hg_scanner_300 : : set_devshtudown ( )
{
return SCANNER_ERR_DEVICE_NOT_SUPPORT ;
}
int hg_scanner_300 : : set_scan_islock ( SANE_Bool type )
{
return SCANNER_ERR_DEVICE_NOT_SUPPORT ;
}
int hg_scanner_300 : : get_scan_islock ( SANE_Bool & type )
{
return SCANNER_ERR_DEVICE_NOT_SUPPORT ;
}
int hg_scanner_300 : : set_scan_lock_check_val ( string str )
{
return SCANNER_ERR_DEVICE_NOT_SUPPORT ;
}
int hg_scanner_300 : : set_firmware_upgrade ( std : : string str )
{
return SCANNER_ERR_DEVICE_NOT_SUPPORT ;
}
int hg_scanner_300 : : set_clean_paper_road ( )
{
return SCANNER_ERR_DEVICE_NOT_SUPPORT ;
}
int hg_scanner_300 : : get_dev_islock_file ( int & data )
{
return SCANNER_ERR_DEVICE_NOT_SUPPORT ;
}
int hg_scanner_300 : : set_dev_islock_file ( int data )
{
return SCANNER_ERR_DEVICE_NOT_SUPPORT ;
}
2022-12-28 01:56:54 +00:00
int hg_scanner_300 : : set_speed_mode ( int data )
{
int ret = SCANNER_ERR_OK ,
len = 0 ;
2022-12-29 10:05:59 +00:00
USBCB usbcb = { setting3288dsp : : SET_SPEED_MODE , data , 0 } ;
2022-12-28 01:56:54 +00:00
len = sizeof ( usbcb ) ;
ret = io_ - > write_bulk ( & usbcb , & len ) ;
return 0 ;
}
2022-12-29 10:05:59 +00:00
int hg_scanner_300 : : get_speed_mode ( int & data )
{
int ret = SCANNER_ERR_OK ,
len = 0 ;
USBCB usbcb = { setting3288dsp : : GET_SPEED_MODE , 0 , 0 } ;
len = sizeof ( usbcb ) ;
ret = io_ - > write_bulk ( & usbcb , & len ) ;
if ( ret ! = SCANNER_ERR_OK )
{
return ret ;
}
ret = io_ - > read_bulk ( & usbcb , & len ) ;
if ( ret = = SCANNER_ERR_OK )
{
data = usbcb . u32_Data ;
}
return ret ;
}
2023-01-05 10:18:38 +00:00
int hg_scanner_300 : : set_distortion_check_val ( int data )
2022-12-28 01:56:54 +00:00
{
int ret = SCANNER_ERR_OK ,
len = 0 ;
2023-02-28 06:00:27 +00:00
int protocol_dpi = resolution_ = = 200 ? 1 : ( resolution_ = = 300 ? 2 : 3 ) ;
USBCB usbcb = { setting3288dsp : : SET_JUST_COF_V , data , protocol_dpi } ;
len = sizeof ( usbcb ) ;
float f = * ( float * ) & ( data ) ;
VLOG_MINI_3 ( LOG_LEVEL_WARNING , " set_distortion_check_val dpi is:%d,config dpi = %d,distortion_check_val(%f) \n " , resolution_ , protocol_dpi , f ) ;
io_ - > set_timeout ( 5000 ) ;
ret = io_ - > write_bulk ( & usbcb , & len ) ;
2022-12-28 01:56:54 +00:00
return ret ;
}
2023-01-05 10:18:38 +00:00
int hg_scanner_300 : : get_devs_distortion_check_val ( int & data )
{
int ret = SCANNER_ERR_OK ,
len = 0 ;
2023-02-28 06:00:27 +00:00
int protocol_dpi = resolution_ = = 200 ? 1 : ( resolution_ = = 300 ? 2 : 3 ) ;
USBCB usbcb = { setting3288dsp : : GET_JUST_COF_V , 0 , protocol_dpi } ;
2023-01-10 06:56:27 +00:00
len = sizeof ( usbcb ) ;
2023-01-05 10:18:38 +00:00
ret = io_ - > write_bulk ( & usbcb , & len ) ;
if ( ret = = SCANNER_ERR_OK )
{
io_ - > set_timeout ( 3000 ) ;
ret = io_ - > read_bulk ( & usbcb , & len ) ;
data = usbcb . u32_Data ;
}
2023-02-28 06:00:27 +00:00
float f = * ( float * ) & data ;
VLOG_MINI_3 ( LOG_LEVEL_WARNING , " get_distortion_check_val dpi is:%d,protocol_dpi = %d get_distortion_check_val(%f) \n " , resolution_ , protocol_dpi , f ) ;
2023-01-05 10:18:38 +00:00
return ret ;
}
2023-03-06 03:37:37 +00:00
int hg_scanner_300 : : set_auto_flat ( int data )
2022-12-29 16:05:43 +00:00
{
2023-03-06 03:37:37 +00:00
if ( data < 0 & & data > 6 )
{
data = 0 ;
}
USBCB usbcb = { setting3288dsp : : START_FLAT , data , 0 } ;
2022-12-29 16:05:43 +00:00
int len = sizeof ( usbcb ) ;
int ret = writeusb ( usbcb ) ;
2022-12-30 09:14:49 +00:00
if ( ret = = SCANNER_ERR_OK & & wait_usb_ . is_waiting ( ) )
2022-12-29 16:05:43 +00:00
{
//status_ = SCANNER_ERR_DEVICE_BUSY;
wait_usb_ . notify ( ) ;
std : : this_thread : : sleep_for ( std : : chrono : : milliseconds ( 300 ) ) ;
ret = try_third_app_after_start ( ret ) ;
}
else
status_ = ret ;
VLOG_MINI_1 ( LOG_LEVEL_WARNING , " set_auto_flat ret: %s \n " , hg_scanner_err_name ( ret ) ) ;
return ret ;
}
2022-12-31 04:08:44 +00:00
int hg_scanner_300 : : set_serial_num ( string str )
{
std : : lock_guard < std : : mutex > lock ( io_lock_ ) ;
USBCB usbcb = { setting3288dsp : : SEND_SERIAL , 0 , 14 } ;
int len = sizeof ( usbcb ) ,
ret = SCANNER_ERR_OK ;
ret = io_ - > write_bulk ( & usbcb , & len ) ;
if ( ret = = SCANNER_ERR_OK )
{
len = str . size ( ) ;
ret = io_ - > write_bulk ( & str , & len ) ;
}
return ret ;
}
2023-01-03 03:12:26 +00:00
int hg_scanner_300 : : set_vid_pid ( int data )
{
2023-01-04 09:27:02 +00:00
USBCB usbcb = { setting3288dsp : : SET_USB_INFOR_VIDPID , data , 0 } ;
2023-01-03 03:12:26 +00:00
int len = sizeof ( usbcb ) ;
return io_ - > write_bulk ( & usbcb , & len ) ;
}
int hg_scanner_300 : : get_vid_pid ( int & data )
{
USBCB usbcb = { setting3288dsp : : GET_USB_INFOR_VIDPID , 0 , 0 } ;
int ret = SCANNER_ERR_OK ,
len = sizeof ( usbcb ) ;
2023-01-04 09:27:02 +00:00
io_ - > write_bulk ( & usbcb , & len ) ;
2023-01-03 03:12:26 +00:00
io_ - > read_bulk ( & usbcb , & len ) ;
if ( ret = = SCANNER_ERR_OK )
{
data = usbcb . u32_Data ;
}
return ret ;
}
2022-12-22 10:37:53 +00:00
int hg_scanner_300 : : set_notify_sleep ( )
2022-07-23 10:01:44 +00:00
{
return SCANNER_ERR_DEVICE_NOT_SUPPORT ;
2022-11-26 06:55:03 +00:00
}
2022-12-29 10:05:59 +00:00
int hg_scanner_300 : : get_history_scan_count ( int & num )
2022-11-26 06:55:03 +00:00
{
2022-11-26 09:48:10 +00:00
int ret = SCANNER_ERR_OK ,
len = 0 ;
2022-11-26 11:27:23 +00:00
USBCB usbcb = { setting3288dsp : : GET_SCANN_NUM , 0 , 0 } ;
len = sizeof ( usbcb ) ;
2022-11-26 11:40:13 +00:00
ret = io_ - > write_bulk ( & usbcb , & len ) ;
if ( ret ! = SCANNER_ERR_OK )
{
return ret ;
}
2022-11-26 11:27:23 +00:00
ret = io_ - > read_bulk ( & usbcb , & len ) ;
if ( ret ! = SCANNER_ERR_OK )
{
return ret ;
}
num = usbcb . u32_Data ;
2022-11-26 06:55:03 +00:00
return ret ;
}
int hg_scanner_300 : : get_roller_num ( int & val )
{
2022-11-26 09:48:10 +00:00
int ret = SCANNER_ERR_OK ,
len = 0 ;
2022-11-26 11:27:23 +00:00
USBCB usbcb = { setting3288dsp : : GET_ROLLER_NUM , 0 , 0 } ;
len = sizeof ( usbcb ) ;
2022-11-26 11:40:13 +00:00
ret = io_ - > write_bulk ( & usbcb , & len ) ;
if ( ret ! = SCANNER_ERR_OK )
{
return ret ;
}
2022-11-26 11:27:23 +00:00
ret = io_ - > read_bulk ( & usbcb , & len ) ;
if ( ret ! = SCANNER_ERR_OK )
{
return ret ;
}
val = usbcb . u32_Data ;
2022-11-26 06:55:03 +00:00
return ret ;
2022-05-03 03:56:07 +00:00
}