属性添加用户权限控制;修复隐藏属性屏蔽时机(在返回全部属性配置时过滤)

This commit is contained in:
gb 2024-03-12 16:25:55 +08:00
parent e3e218f086
commit 2d57b6ea74
26 changed files with 580 additions and 228 deletions

View File

@ -1,27 +1,29 @@
{ {
"clr-correct": { "clr-correct": {
"cat": "imgp", "cat": "imgp",
"group": "高级设置", "group": "advance",
"title": "颜色校正", "title": "颜色校正",
"desc": "根据校正参数调整从CIS出来的原始图像颜色", "desc": "根据校正参数调整从CIS出来的原始图像颜色",
"type": "bool", "type": "bool",
"pos": 24, "pos": 24,
"ui-pos": 10, "ui-pos": 15,
"auth": 0, "auth": 100,
"visible": 2,
"size": 4, "size": 4,
"cur": true, "cur": true,
"default": true "default": true
}, },
"lut-file": { "lut-file": {
"cat": "imgp", "cat": "imgp",
"group": "高级设置", "group": "advance",
"title": "校正模板", "title": "校正模板",
"desc": "颜色校正使用的基准图像数据", "desc": "颜色校正使用的基准图像数据",
"type": "string", "type": "string",
"pos": 25, "pos": 25,
"ui-pos": 11, "ui-pos": 16,
"auth": 0, "auth": 100,
"bind": true, "bind": true,
"visible": 2,
"size": 80, "size": 80,
"default": { "default": {
"cis-mode==彩色&&resolution>200&&resolution<400": "\/usr\/local\/huago\/Textlut300clr.bmp", "cis-mode==彩色&&resolution>200&&resolution<400": "\/usr\/local\/huago\/Textlut300clr.bmp",

View File

@ -6,8 +6,9 @@
"desc": "选择镜头色彩工作模式", "desc": "选择镜头色彩工作模式",
"type": "string", "type": "string",
"ui-pos": 10, "ui-pos": 10,
"auth": 0, "auth": 100,
"bind": true, "bind": true,
"visible": 2,
"size": 12, "size": 12,
"default": { "default": {
"(mode.enabled&&(mode==256级灰度||mode==黑白)) || (multiout-type.enabled&&multiout-type==灰度+黑白)": "灰度", "(mode.enabled&&(mode==256级灰度||mode==黑白)) || (multiout-type.enabled&&multiout-type==灰度+黑白)": "灰度",
@ -22,8 +23,9 @@
"desc": "设置镜头工作的分辨率", "desc": "设置镜头工作的分辨率",
"type": "int", "type": "int",
"ui-pos": 11, "ui-pos": 11,
"auth": 0, "auth": 100,
"bind": true, "bind": true,
"visible": 2,
"size": 4, "size": 4,
"default": { "default": {
"resolution>=400": 600, "resolution>=400": 600,
@ -31,22 +33,19 @@
}, },
"range": [300, 600] "range": [300, 600]
}, },
"y-dpi": { "resolution": {
"cat": "none", "cat": "imgp",
"group": "CIS", "group": "base",
"title": "走纸分辨率", "title": "分辨率",
"desc": "走纸方向的图像采集分辨率", "desc": "设置扫描图像的分辨率",
"type": "int", "type": "int",
"ui-pos": 13, "pos": 9999,
"fix-id": 34840,
"ui-pos": 20,
"auth": 0, "auth": 0,
"bind": true, "affect": 6,
"size": 4, "unit": "dpi",
"default": { "size": 4
"resolution>200 && resolution<400": 300,
"resolution>=400": 600,
"default": 200
},
"range": [200, 300, 600]
}, },
"cis-led": { "cis-led": {
"cat": "none", "cat": "none",
@ -55,7 +54,8 @@
"desc": "CIS工作时是否打开背景灯", "desc": "CIS工作时是否打开背景灯",
"type": "bool", "type": "bool",
"ui-pos": 12, "ui-pos": 12,
"auth": 0, "auth": 100,
"visible": 2,
"size": 4, "size": 4,
"cur": true, "cur": true,
"default": true "default": true
@ -257,7 +257,8 @@
"desc": "CIS控制通信速率", "desc": "CIS控制通信速率",
"type": "int", "type": "int",
"ui-pos": 20, "ui-pos": 20,
"auth": 0, "auth": 100,
"visible": 2,
"size": 4, "size": 4,
"cur": 921600, "cur": 921600,
"default": 921600, "default": 921600,
@ -270,8 +271,9 @@
"desc": "采集头接受命令后的动作延迟时间", "desc": "采集头接受命令后的动作延迟时间",
"type": "int", "type": "int",
"ui-pos": 21, "ui-pos": 21,
"auth": 0, "auth": 100,
"unit": "microsec", "unit": "microsec",
"visible": 2,
"size": 4, "size": 4,
"cur": 1000, "cur": 1000,
"default": 1000 "default": 1000
@ -283,7 +285,8 @@
"desc": "采集头每一帧的采集高度", "desc": "采集头每一帧的采集高度",
"type": "int", "type": "int",
"ui-pos": 22, "ui-pos": 22,
"auth": 0, "auth": 100,
"visible": 2,
"size": 4, "size": 4,
"cur": 12, "cur": 12,
"default": 12 "default": 12
@ -295,7 +298,8 @@
"desc": "采样频率", "desc": "采样频率",
"type": "int", "type": "int",
"ui-pos": 23, "ui-pos": 23,
"auth": 0, "auth": 100,
"visible": 2,
"size": 4, "size": 4,
"cur": 201, "cur": 201,
"default": 201 "default": 201
@ -349,7 +353,8 @@
"desc": "设置走纸电机的速度,张\/分PPM", "desc": "设置走纸电机的速度,张\/分PPM",
"type": "int", "type": "int",
"ui-pos": 25, "ui-pos": 25,
"auth": 0, "auth": 100,
"visible": 2,
"size": 4, "size": 4,
"cur": 100, "cur": 100,
"default": 100, "default": 100,
@ -375,7 +380,8 @@
"type": "bool", "type": "bool",
"fix-id": 34868, "fix-id": 34868,
"ui-pos": 22, "ui-pos": 22,
"auth": 0, "auth": 100,
"visible": 2,
"size": 4, "size": 4,
"cur": true, "cur": true,
"default": true "default": true
@ -388,7 +394,8 @@
"type": "int", "type": "int",
"fix-id": 34869, "fix-id": 34869,
"ui-pos": 23, "ui-pos": 23,
"auth": 0, "auth": 100,
"visible": 2,
"size": 4, "size": 4,
"cur": 3, "cur": 3,
"default": 3, "default": 3,
@ -401,14 +408,15 @@
}, },
"motor-ver": { "motor-ver": {
"cat": "none", "cat": "none",
"group": "关于", "group": "about",
"title": "电机驱动版本", "title": "电机驱动版本",
"desc": "电机板驱动程序版本号", "desc": "电机板驱动程序版本号",
"type": "string", "type": "string",
"fix-id": 34909, "fix-id": 34909,
"ui-pos": 16, "ui-pos": 16,
"auth": 0, "auth": 100,
"readonly": true, "readonly": true,
"visible": 2,
"size": 24, "size": 24,
"auto": false, "auto": false,
"cur": "", "cur": "",
@ -416,13 +424,14 @@
}, },
"fpga-ver": { "fpga-ver": {
"cat": "none", "cat": "none",
"group": "关于", "group": "about",
"title": "CIS控制器版本", "title": "CIS控制器版本",
"desc": "镜头参数控制驱动程序版本号", "desc": "镜头参数控制驱动程序版本号",
"type": "string", "type": "string",
"ui-pos": 17, "ui-pos": 17,
"auth": 0, "auth": 100,
"readonly": true, "readonly": true,
"visible": 2,
"size": 24, "size": 24,
"auto": false, "auto": false,
"cur": "", "cur": "",
@ -430,14 +439,15 @@
}, },
"cis-len": { "cis-len": {
"cat": "base", "cat": "base",
"group": "关于", "group": "about",
"title": "镜头长", "title": "镜头长",
"desc": "图像采集镜头的长度单位为毫米mm", "desc": "图像采集镜头的长度单位为毫米mm",
"type": "int", "type": "int",
"ui-pos": 30, "ui-pos": 30,
"auth": 0, "auth": 100,
"unit": "mm", "unit": "mm",
"readonly": true, "readonly": true,
"visible": 2,
"size": 4, "size": 4,
"auto": false, "auto": false,
"cur": 3888, "cur": 3888,
@ -450,7 +460,8 @@
"desc": "为抵抗形变,在水平方向的拉伸率", "desc": "为抵抗形变,在水平方向的拉伸率",
"type": "float", "type": "float",
"ui-pos": 40, "ui-pos": 40,
"auth": 0, "auth": 100,
"visible": 2,
"size": 8, "size": 8,
"auto": false, "auto": false,
"default": { "default": {
@ -472,7 +483,8 @@
"desc": "为抵抗形变,在垂直方向的拉伸率", "desc": "为抵抗形变,在垂直方向的拉伸率",
"type": "float", "type": "float",
"ui-pos": 41, "ui-pos": 41,
"auth": 0, "auth": 100,
"visible": 2,
"size": 8, "size": 8,
"auto": false, "auto": false,
"default": { "default": {
@ -494,8 +506,9 @@
"desc": "FPGA最佳速率", "desc": "FPGA最佳速率",
"type": "int", "type": "int",
"ui-pos": 42, "ui-pos": 42,
"auth": 0, "auth": 100,
"bind": true, "bind": true,
"visible": 2,
"size": 4, "size": 4,
"auto": false, "auto": false,
"default": { "default": {
@ -512,8 +525,9 @@
"desc": "正面红色通道的曝光强度", "desc": "正面红色通道的曝光强度",
"type": "int", "type": "int",
"ui-pos": 70, "ui-pos": 70,
"auth": 0, "auth": 100,
"bind": true, "bind": true,
"visible": 2,
"size": 4, "size": 4,
"default": { "default": {
"cis-mode==灰度 && cis-dpi==300": 336, "cis-mode==灰度 && cis-dpi==300": 336,
@ -534,8 +548,9 @@
"desc": "正面绿色通道的曝光强度", "desc": "正面绿色通道的曝光强度",
"type": "int", "type": "int",
"ui-pos": 71, "ui-pos": 71,
"auth": 0, "auth": 100,
"bind": true, "bind": true,
"visible": 2,
"size": 4, "size": 4,
"default": { "default": {
"cis-mode==灰度 && cis-dpi==300": 336, "cis-mode==灰度 && cis-dpi==300": 336,
@ -556,8 +571,9 @@
"desc": "正面蓝色通道的曝光强度", "desc": "正面蓝色通道的曝光强度",
"type": "int", "type": "int",
"ui-pos": 72, "ui-pos": 72,
"auth": 0, "auth": 100,
"bind": true, "bind": true,
"visible": 2,
"size": 4, "size": 4,
"default": { "default": {
"cis-mode==灰度 && cis-dpi==300": 336, "cis-mode==灰度 && cis-dpi==300": 336,
@ -578,8 +594,9 @@
"desc": "背面红色通道的曝光强度", "desc": "背面红色通道的曝光强度",
"type": "int", "type": "int",
"ui-pos": 73, "ui-pos": 73,
"auth": 0, "auth": 100,
"bind": true, "bind": true,
"visible": 2,
"size": 4, "size": 4,
"default": { "default": {
"cis-mode==灰度 && cis-dpi==300": 410, "cis-mode==灰度 && cis-dpi==300": 410,
@ -600,8 +617,9 @@
"desc": "背面绿色通道的曝光强度", "desc": "背面绿色通道的曝光强度",
"type": "int", "type": "int",
"ui-pos": 74, "ui-pos": 74,
"auth": 0, "auth": 100,
"bind": true, "bind": true,
"visible": 2,
"size": 4, "size": 4,
"default": { "default": {
"cis-mode==灰度 && cis-dpi==300": 410, "cis-mode==灰度 && cis-dpi==300": 410,
@ -622,8 +640,9 @@
"desc": "背面蓝色通道的曝光强度", "desc": "背面蓝色通道的曝光强度",
"type": "int", "type": "int",
"ui-pos": 75, "ui-pos": 75,
"auth": 0, "auth": 100,
"bind": true, "bind": true,
"visible": 2,
"size": 4, "size": 4,
"default": { "default": {
"cis-mode==灰度 && cis-dpi==300": 410, "cis-mode==灰度 && cis-dpi==300": 410,
@ -644,8 +663,9 @@
"desc": "正面通道1的增益量", "desc": "正面通道1的增益量",
"type": "int", "type": "int",
"ui-pos": 90, "ui-pos": 90,
"auth": 0, "auth": 100,
"bind": true, "bind": true,
"visible": 2,
"size": 4, "size": 4,
"default": { "default": {
"cis-mode==灰度 && cis-dpi==300": 170, "cis-mode==灰度 && cis-dpi==300": 170,
@ -666,8 +686,9 @@
"desc": "正面通道2的增益量", "desc": "正面通道2的增益量",
"type": "int", "type": "int",
"ui-pos": 91, "ui-pos": 91,
"auth": 0, "auth": 100,
"bind": true, "bind": true,
"visible": 2,
"size": 4, "size": 4,
"default": { "default": {
"cis-mode==灰度 && cis-dpi==300": 170, "cis-mode==灰度 && cis-dpi==300": 170,
@ -688,8 +709,9 @@
"desc": "正面通道3的增益量", "desc": "正面通道3的增益量",
"type": "int", "type": "int",
"ui-pos": 92, "ui-pos": 92,
"auth": 0, "auth": 100,
"bind": true, "bind": true,
"visible": 2,
"size": 4, "size": 4,
"default": { "default": {
"cis-mode==灰度 && cis-dpi==300": 170, "cis-mode==灰度 && cis-dpi==300": 170,
@ -710,8 +732,9 @@
"desc": "正面通道4的增益量", "desc": "正面通道4的增益量",
"type": "int", "type": "int",
"ui-pos": 93, "ui-pos": 93,
"auth": 0, "auth": 100,
"bind": true, "bind": true,
"visible": 2,
"size": 4, "size": 4,
"default": { "default": {
"cis-mode==灰度 && cis-dpi==300": 170, "cis-mode==灰度 && cis-dpi==300": 170,
@ -732,8 +755,9 @@
"desc": "正面通道5的增益量", "desc": "正面通道5的增益量",
"type": "int", "type": "int",
"ui-pos": 94, "ui-pos": 94,
"auth": 0, "auth": 100,
"bind": true, "bind": true,
"visible": 2,
"size": 4, "size": 4,
"default": { "default": {
"cis-mode==灰度 && cis-dpi==300": 170, "cis-mode==灰度 && cis-dpi==300": 170,
@ -754,8 +778,9 @@
"desc": "正面通道6的增益量", "desc": "正面通道6的增益量",
"type": "int", "type": "int",
"ui-pos": 95, "ui-pos": 95,
"auth": 0, "auth": 100,
"bind": true, "bind": true,
"visible": 2,
"size": 4, "size": 4,
"default": { "default": {
"cis-mode==灰度 && cis-dpi==300": 170, "cis-mode==灰度 && cis-dpi==300": 170,
@ -776,8 +801,9 @@
"desc": "背面通道1的增益量", "desc": "背面通道1的增益量",
"type": "int", "type": "int",
"ui-pos": 120, "ui-pos": 120,
"auth": 0, "auth": 100,
"bind": true, "bind": true,
"visible": 2,
"size": 4, "size": 4,
"default": { "default": {
"cis-mode==灰度 && cis-dpi==300": 170, "cis-mode==灰度 && cis-dpi==300": 170,
@ -798,8 +824,9 @@
"desc": "背面通道2的增益量", "desc": "背面通道2的增益量",
"type": "int", "type": "int",
"ui-pos": 121, "ui-pos": 121,
"auth": 0, "auth": 100,
"bind": true, "bind": true,
"visible": 2,
"size": 4, "size": 4,
"default": { "default": {
"cis-mode==灰度 && cis-dpi==300": 170, "cis-mode==灰度 && cis-dpi==300": 170,
@ -820,8 +847,9 @@
"desc": "背面通道3的增益量", "desc": "背面通道3的增益量",
"type": "int", "type": "int",
"ui-pos": 122, "ui-pos": 122,
"auth": 0, "auth": 100,
"bind": true, "bind": true,
"visible": 2,
"size": 4, "size": 4,
"default": { "default": {
"cis-mode==灰度 && cis-dpi==300": 170, "cis-mode==灰度 && cis-dpi==300": 170,
@ -842,8 +870,9 @@
"desc": "背面通道4的增益量", "desc": "背面通道4的增益量",
"type": "int", "type": "int",
"ui-pos": 123, "ui-pos": 123,
"auth": 0, "auth": 100,
"bind": true, "bind": true,
"visible": 2,
"size": 4, "size": 4,
"default": { "default": {
"cis-mode==灰度 && cis-dpi==300": 170, "cis-mode==灰度 && cis-dpi==300": 170,
@ -864,8 +893,9 @@
"desc": "背面通道5的增益量", "desc": "背面通道5的增益量",
"type": "int", "type": "int",
"ui-pos": 124, "ui-pos": 124,
"auth": 0, "auth": 100,
"bind": true, "bind": true,
"visible": 2,
"size": 4, "size": 4,
"default": { "default": {
"cis-mode==灰度 && cis-dpi==300": 170, "cis-mode==灰度 && cis-dpi==300": 170,
@ -886,8 +916,9 @@
"desc": "背面通道6的增益量", "desc": "背面通道6的增益量",
"type": "int", "type": "int",
"ui-pos": 125, "ui-pos": 125,
"auth": 0, "auth": 100,
"bind": true, "bind": true,
"visible": 2,
"size": 4, "size": 4,
"default": { "default": {
"cis-mode==灰度 && cis-dpi==300": 170, "cis-mode==灰度 && cis-dpi==300": 170,
@ -908,8 +939,9 @@
"desc": "正面通道1的增益补偿量", "desc": "正面通道1的增益补偿量",
"type": "int", "type": "int",
"ui-pos": 160, "ui-pos": 160,
"auth": 0, "auth": 100,
"bind": true, "bind": true,
"visible": 2,
"size": 4, "size": 4,
"default": { "default": {
"cis-mode==灰度 && cis-dpi==300": 116, "cis-mode==灰度 && cis-dpi==300": 116,
@ -930,8 +962,9 @@
"desc": "正面通道2的增益补偿量", "desc": "正面通道2的增益补偿量",
"type": "int", "type": "int",
"ui-pos": 161, "ui-pos": 161,
"auth": 0, "auth": 100,
"bind": true, "bind": true,
"visible": 2,
"size": 4, "size": 4,
"default": { "default": {
"cis-mode==灰度 && cis-dpi==300": 121, "cis-mode==灰度 && cis-dpi==300": 121,
@ -952,8 +985,9 @@
"desc": "正面通道3的增益补偿量", "desc": "正面通道3的增益补偿量",
"type": "int", "type": "int",
"ui-pos": 162, "ui-pos": 162,
"auth": 0, "auth": 100,
"bind": true, "bind": true,
"visible": 2,
"size": 4, "size": 4,
"default": { "default": {
"cis-mode==灰度 && cis-dpi==300": 119, "cis-mode==灰度 && cis-dpi==300": 119,
@ -974,8 +1008,9 @@
"desc": "正面通道4的增益补偿量", "desc": "正面通道4的增益补偿量",
"type": "int", "type": "int",
"ui-pos": 163, "ui-pos": 163,
"auth": 0, "auth": 100,
"bind": true, "bind": true,
"visible": 2,
"size": 4, "size": 4,
"default": { "default": {
"cis-mode==灰度 && cis-dpi==300": 128, "cis-mode==灰度 && cis-dpi==300": 128,
@ -996,8 +1031,9 @@
"desc": "正面通道5的增益补偿量", "desc": "正面通道5的增益补偿量",
"type": "int", "type": "int",
"ui-pos": 164, "ui-pos": 164,
"auth": 0, "auth": 100,
"bind": true, "bind": true,
"visible": 2,
"size": 4, "size": 4,
"default": { "default": {
"cis-mode==灰度 && cis-dpi==300": 129, "cis-mode==灰度 && cis-dpi==300": 129,
@ -1018,8 +1054,9 @@
"desc": "正面通道6的增益补偿量", "desc": "正面通道6的增益补偿量",
"type": "int", "type": "int",
"ui-pos": 165, "ui-pos": 165,
"auth": 0, "auth": 100,
"bind": true, "bind": true,
"visible": 2,
"size": 4, "size": 4,
"default": { "default": {
"cis-mode==灰度 && cis-dpi==300": 127, "cis-mode==灰度 && cis-dpi==300": 127,
@ -1040,8 +1077,9 @@
"desc": "背面通道1的增益补偿量", "desc": "背面通道1的增益补偿量",
"type": "int", "type": "int",
"ui-pos": 200, "ui-pos": 200,
"auth": 0, "auth": 100,
"bind": true, "bind": true,
"visible": 2,
"size": 4, "size": 4,
"default": { "default": {
"cis-mode==灰度 && cis-dpi==300": 110, "cis-mode==灰度 && cis-dpi==300": 110,
@ -1062,8 +1100,9 @@
"desc": "背面通道2的增益补偿量", "desc": "背面通道2的增益补偿量",
"type": "int", "type": "int",
"ui-pos": 201, "ui-pos": 201,
"auth": 0, "auth": 100,
"bind": true, "bind": true,
"visible": 2,
"size": 4, "size": 4,
"default": { "default": {
"cis-mode==灰度 && cis-dpi==300": 120, "cis-mode==灰度 && cis-dpi==300": 120,
@ -1084,8 +1123,9 @@
"desc": "背面通道3的增益补偿量", "desc": "背面通道3的增益补偿量",
"type": "int", "type": "int",
"ui-pos": 202, "ui-pos": 202,
"auth": 0, "auth": 100,
"bind": true, "bind": true,
"visible": 2,
"size": 4, "size": 4,
"default": { "default": {
"cis-mode==灰度 && cis-dpi==300": 115, "cis-mode==灰度 && cis-dpi==300": 115,
@ -1106,8 +1146,9 @@
"desc": "背面通道4的增益补偿量", "desc": "背面通道4的增益补偿量",
"type": "int", "type": "int",
"ui-pos": 203, "ui-pos": 203,
"auth": 0, "auth": 100,
"bind": true, "bind": true,
"visible": 2,
"size": 4, "size": 4,
"default": { "default": {
"cis-mode==灰度 && cis-dpi==300": 117, "cis-mode==灰度 && cis-dpi==300": 117,
@ -1128,8 +1169,9 @@
"desc": "背面通道5的增益补偿量", "desc": "背面通道5的增益补偿量",
"type": "int", "type": "int",
"ui-pos": 204, "ui-pos": 204,
"auth": 0, "auth": 100,
"bind": true, "bind": true,
"visible": 2,
"size": 4, "size": 4,
"default": { "default": {
"cis-mode==灰度 && cis-dpi==300": 118, "cis-mode==灰度 && cis-dpi==300": 118,
@ -1150,8 +1192,9 @@
"desc": "背面通道6的增益补偿量", "desc": "背面通道6的增益补偿量",
"type": "int", "type": "int",
"ui-pos": 205, "ui-pos": 205,
"auth": 0, "auth": 100,
"bind": true, "bind": true,
"visible": 2,
"size": 4, "size": 4,
"default": { "default": {
"cis-mode==灰度 && cis-dpi==300": 121, "cis-mode==灰度 && cis-dpi==300": 121,
@ -1172,7 +1215,8 @@
"desc": "CIS正面分段之间的相位差", "desc": "CIS正面分段之间的相位差",
"type": "int", "type": "int",
"ui-pos": 26, "ui-pos": 26,
"auth": 0, "auth": 100,
"visible": 2,
"size": 4, "size": 4,
"cur": 66, "cur": 66,
"default": 66, "default": 66,
@ -1189,7 +1233,8 @@
"desc": "CIS背面分段之间的相位差", "desc": "CIS背面分段之间的相位差",
"type": "int", "type": "int",
"ui-pos": 27, "ui-pos": 27,
"auth": 0, "auth": 100,
"visible": 2,
"size": 4, "size": 4,
"cur": 67, "cur": 67,
"default": 67, "default": 67,
@ -1198,5 +1243,19 @@
"max": 256, "max": 256,
"step": 1 "step": 1
} }
},
"paper-timer": {
"cat": "base",
"group": "advance",
"title": "输出走纸时间",
"desc": "输出走纸过程中,各阶段耗时",
"type": "bool",
"pos": 50,
"ui-pos": 40,
"auth": 100,
"visible": 2,
"size": 4,
"cur": false,
"default": false
} }
} }

View File

@ -8,8 +8,8 @@
"ver": 1, "ver": 1,
"pos": 9900, "pos": 9900,
"ui-pos": 10, "ui-pos": 10,
"auth": 0, "auth": 10,
"visible": 0, "visible": 2,
"size": 16, "size": 16,
"cur": "JPEG", "cur": "JPEG",
"default": "JPEG", "default": "JPEG",
@ -24,10 +24,10 @@
"ver": 1, "ver": 1,
"pos": 9901, "pos": 9901,
"ui-pos": 11, "ui-pos": 11,
"auth": 0, "auth": 10,
"affect": 4, "affect": 4,
"unit": "%", "unit": "%",
"visible": 0, "visible": 2,
"size": 4, "size": 4,
"cur": 100, "cur": 100,
"default": 100, "default": 100,

View File

@ -1,13 +1,14 @@
{ {
"dump-img": { "dump-img": {
"cat": "base", "cat": "base",
"group": "高级设置", "group": "advance",
"title": "输出中间图像", "title": "输出中间图像",
"desc": "输出各算法中间结果图像", "desc": "输出各算法中间结果图像",
"type": "bool", "type": "bool",
"ui-pos": 10, "ui-pos": 20,
"auth": 0, "auth": 10,
"affect": 2, "affect": 2,
"visible": 2,
"size": 4, "size": 4,
"cur": false, "cur": false,
"default": false "default": false

View File

@ -1,14 +1,14 @@
{ {
"rebuild": { "rebuild": {
"cat": "imgp", "cat": "imgp",
"group": "高级设置", "group": "advance",
"title": "CIS图像还原", "title": "CIS图像还原",
"desc": "将从CIS输出的原始数据流还原为BMP图片并拆分正反面", "desc": "将从CIS输出的原始数据流还原为BMP图片并拆分正反面",
"type": "bool", "type": "bool",
"pos": 10, "pos": 10,
"ui-pos": 1, "ui-pos": 1,
"auth": 0, "auth": 100,
"visible": 0, "visible": 2,
"size": 4, "size": 4,
"auto": false, "auto": false,
"cur": true, "cur": true,

View File

@ -1,7 +1,7 @@
{ {
"dev-vid": { "dev-vid": {
"cat": "base", "cat": "base",
"group": "关于", "group": "about",
"title": "USB-VID", "title": "USB-VID",
"desc": "设备制造商在USB组织的ID", "desc": "设备制造商在USB组织的ID",
"type": "string", "type": "string",
@ -16,7 +16,7 @@
}, },
"dev-pid": { "dev-pid": {
"cat": "base", "cat": "base",
"group": "关于", "group": "about",
"title": "USB-PID", "title": "USB-PID",
"desc": "设备在USB组织中的产品ID", "desc": "设备在USB组织中的产品ID",
"type": "string", "type": "string",
@ -31,7 +31,7 @@
}, },
"dev-name": { "dev-name": {
"cat": "base", "cat": "base",
"group": "关于", "group": "about",
"title": "设备名称", "title": "设备名称",
"desc": "设备名称", "desc": "设备名称",
"type": "string", "type": "string",
@ -41,12 +41,12 @@
"readonly": true, "readonly": true,
"size": 96, "size": 96,
"auto": false, "auto": false,
"cur": "300NewTx", "cur": "HUAGOSCAN G200",
"default": "300NewTx" "default": "HUAGOSCAN G200"
}, },
"dev-model": { "dev-model": {
"cat": "base", "cat": "base",
"group": "关于", "group": "about",
"title": "产品系列", "title": "产品系列",
"desc": "设备所属产品系列名称", "desc": "设备所属产品系列名称",
"type": "string", "type": "string",
@ -61,7 +61,7 @@
}, },
"dev-sn": { "dev-sn": {
"cat": "base", "cat": "base",
"group": "关于", "group": "about",
"title": "序列号", "title": "序列号",
"desc": "设备序列号", "desc": "设备序列号",
"type": "string", "type": "string",
@ -77,7 +77,7 @@
}, },
"fmw-ver": { "fmw-ver": {
"cat": "base", "cat": "base",
"group": "关于", "group": "about",
"title": "固件版本", "title": "固件版本",
"desc": "设备固件版本号", "desc": "设备固件版本号",
"type": "string", "type": "string",
@ -92,7 +92,7 @@
}, },
"roller-life": { "roller-life": {
"cat": "base", "cat": "base",
"group": "关于", "group": "about",
"title": "滚轴寿命", "title": "滚轴寿命",
"desc": "该设备滚轴过纸的最大张数", "desc": "该设备滚轴过纸的最大张数",
"type": "int", "type": "int",
@ -105,14 +105,46 @@
"cur": 450000, "cur": 450000,
"default": 450000 "default": 450000
}, },
"roll-cnt": {
"cat": "base",
"group": "about",
"title": "滚轴张数",
"desc": "当前滚轴扫描张数",
"type": "int",
"fix-id": 39170,
"ui-pos": 21,
"auth": 0,
"readonly": true,
"size": 4,
"auto": false,
"ownread": true,
"cur": 0,
"default": 0
},
"total-cnt": {
"cat": "base",
"group": "about",
"title": "历史张数",
"desc": "该设备历史总计扫描张数",
"type": "int",
"fix-id": 34889,
"ui-pos": 22,
"auth": 0,
"readonly": true,
"size": 4,
"auto": false,
"ownread": true,
"cur": 0,
"default": 0
},
"ip-addr": { "ip-addr": {
"cat": "base", "cat": "base",
"group": "关于", "group": "about",
"title": "IP", "title": "IP",
"desc": "设备联网时所分配的IP地址", "desc": "设备联网时所分配的IP地址",
"type": "string", "type": "string",
"fix-id": 34904, "fix-id": 34904,
"ui-pos": 21, "ui-pos": 30,
"auth": 0, "auth": 0,
"readonly": true, "readonly": true,
"size": 96, "size": 96,
@ -123,12 +155,12 @@
}, },
"mac-addr": { "mac-addr": {
"cat": "base", "cat": "base",
"group": "关于", "group": "about",
"title": "MAC", "title": "MAC",
"desc": "设备网卡地址", "desc": "设备网卡地址",
"type": "string", "type": "string",
"fix-id": 34905, "fix-id": 34905,
"ui-pos": 22, "ui-pos": 31,
"auth": 0, "auth": 0,
"readonly": true, "readonly": true,
"size": 96, "size": 96,
@ -137,4 +169,4 @@
"cur": "0", "cur": "0",
"default": "0" "default": "0"
} }
} }

View File

@ -1,12 +1,26 @@
{ {
"login-hint": {
"cat": "none",
"group": "user",
"title": "登录提示",
"desc": "登录帐户提示",
"type": "string",
"ui-pos": 10,
"auth": 0,
"readonly": true,
"size": 32,
"ownread": true,
"cur": "",
"default": ""
},
"user-name": { "user-name": {
"cat": "none", "cat": "none",
"group": "用户", "group": "user",
"title": "用户名", "title": "用户名",
"desc": "登录用户账号", "desc": "登录用户账号",
"type": "string", "type": "string",
"fix-id": 39173, "fix-id": 39173,
"ui-pos": 10, "ui-pos": 15,
"auth": 0, "auth": 0,
"size": 32, "size": 32,
"cur": "", "cur": "",
@ -14,12 +28,12 @@
}, },
"user-pwd": { "user-pwd": {
"cat": "none", "cat": "none",
"group": "用户", "group": "user",
"title": "密码", "title": "密码",
"desc": "登录用户账号密码", "desc": "登录用户账号密码",
"type": "string", "type": "string",
"fix-id": 39174, "fix-id": 39174,
"ui-pos": 11, "ui-pos": 16,
"auth": 0, "auth": 0,
"size": 32, "size": 32,
"cur": "", "cur": "",
@ -27,7 +41,7 @@
}, },
"login": { "login": {
"cat": "none", "cat": "none",
"group": "用户", "group": "user",
"title": "登录", "title": "登录",
"desc": "用户登录", "desc": "用户登录",
"type": "button", "type": "button",
@ -40,7 +54,7 @@
}, },
"logout": { "logout": {
"cat": "none", "cat": "none",
"group": "用户", "group": "user",
"title": "注销", "title": "注销",
"desc": "用户登出", "desc": "用户登出",
"type": "button", "type": "button",
@ -53,17 +67,17 @@
}, },
"dev-sn": { "dev-sn": {
"cat": "base", "cat": "base",
"group": "关于", "group": "about",
"title": "序列号", "title": "序列号",
"desc": "设备序列号", "desc": "设备序列号",
"type": "string", "type": "string",
"pos": 100,
"fix-id": 34902, "fix-id": 34902,
"ui-pos": 14, "ui-pos": 14,
"pos": 100,
"auth": 0, "auth": 0,
"size": 32, "size": 32,
"auto": false, "auto": false,
"cur": "", "cur": "",
"default": "" "default": ""
} }
} }

File diff suppressed because one or more lines are too long

View File

@ -98,6 +98,9 @@ class scanner_hw : public sane_opt_provider
int to_paper_out_ = 5000; // timeout in ms of paper passed int to_paper_out_ = 5000; // timeout in ms of paper passed
int to_stream_ = 5000; // timeout in ms of frame data can be read int to_stream_ = 5000; // timeout in ms of frame data can be read
static int empty_printf(const char* fmt, ...);
int (*dbg_print_)(const char* fmt, ...) = &scanner_hw::empty_printf;
void init(void); void init(void);
void init_version(std::string& text); void init_version(std::string& text);
void load_correct_data(std::string& text); void load_correct_data(std::string& text);

View File

@ -11,7 +11,7 @@
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
static std::string device_opt_json[] = { static std::string device_opt_json[] = {
"{\"clr-correct\":{\"cat\":\"imgp\",\"group\":\"\\u9ad8\\u7ea7\\u8bbe\\u7f6e\",\"title\":\"\\u989c\\u8272\\u6821\\u6b63\",\"desc\":\"\\u6839\\u636e\\u6821\\u6b63\\u53c2\\u6570\\uff0c\\u8c03\\u6574\\u4eceCIS\\u51fa\\u6765\\u7684\\u539f\\u59cb\\u56fe\\u50cf\\u989c\\u8272\",\"type\":\"bool\",\"pos\":24,\"ui-pos\":10,\"auth\":0,\"size\":4,\"cur\":true,\"default\":true},\"lut-file\":{\"cat\":\"imgp\",\"group\":\"\\u9ad8\\u7ea7\\u8bbe\\u7f6e\",\"title\":\"\\u6821\\u6b63\\u6a21\\u677f\",\"desc\":\"\\u989c\\u8272\\u6821\\u6b63\\u4f7f\\u7528\\u7684\\u57fa\\u51c6\\u56fe\\u50cf\\u6570\\u636e\",\"type\":\"string\",\"pos\":25,\"ui-pos\":11,\"auth\":0,\"bind\":true,\"size\":80,\"default\":{\"cis-mode==\\u5f69\\u8272&&resolution>200&&resolution<400\":\"\\/usr\\/local\\/huago\\/Textlut300clr.bmp\",\"cis-mode==\\u5f69\\u8272&&resolution>=400\":\"\\/usr\\/local\\/huago\\/Textlut600clr.bmp\",\"cis-mode==\\u7070\\u5ea6&&resolution<=200\":\"\\/usr\\/local\\/huago\\/Textlut200gray.bmp\",\"cis-mode==\\u7070\\u5ea6&&resolution>200&&resolution<400\":\"\\/usr\\/local\\/huago\\/Textlut300gray.bmp\",\"cis-mode==\\u7070\\u5ea6&&resolution>=400\":\"\\/usr\\/local\\/huago\\/Textlut600gray.bmp\",\"default\":\"\\/usr\\/local\\/huago\\/Textlut200clr.bmp\"}},\"cis-mode\":{\"cat\":\"none\",\"group\":\"CIS\",\"title\":\"CIS\\u989c\\u8272\\u6a21\\u5f0f\",\"desc\":\"\\u9009\\u62e9\\u955c\\u5934\\u8272\\u5f69\\u5de5\\u4f5c\\u6a21\\u5f0f\",\"type\":\"string\",\"pos\":1000,\"ui-pos\":10,\"auth\":0,\"bind\":true,\"size\":12,\"default\":{\"(mode.enabled&&(mode==256\\u7ea7\\u7070\\u5ea6||mode==\\u9ed1\\u767d)) || (multiout-type.enabled&&multiout-type==\\u7070\\u5ea6+\\u9ed1\\u767d)\":\"\\u7070\\u5ea6\",\"default\":\"\\u5f69\\u8272\"},\"range\":[\"\\u5f69\\u8272\",\"\\u7070\\u5ea6\"]}}" "{\"clr-correct\":{\"cat\":\"imgp\",\"group\":\"advance\",\"title\":\"\\u989c\\u8272\\u6821\\u6b63\",\"desc\":\"\\u6839\\u636e\\u6821\\u6b63\\u53c2\\u6570\\uff0c\\u8c03\\u6574\\u4eceCIS\\u51fa\\u6765\\u7684\\u539f\\u59cb\\u56fe\\u50cf\\u989c\\u8272\",\"type\":\"bool\",\"pos\":24,\"ui-pos\":15,\"auth\":100,\"visible\":2,\"size\":4,\"cur\":true,\"default\":true},\"lut-file\":{\"cat\":\"imgp\",\"group\":\"advance\",\"title\":\"\\u6821\\u6b63\\u6a21\\u677f\",\"desc\":\"\\u989c\\u8272\\u6821\\u6b63\\u4f7f\\u7528\\u7684\\u57fa\\u51c6\\u56fe\\u50cf\\u6570\\u636e\",\"type\":\"string\",\"pos\":25,\"ui-pos\":16,\"auth\":100,\"bind\":true,\"visible\":2,\"size\":80,\"default\":{\"cis-mode==\\u5f69\\u8272&&resolution>200&&resolution<400\":\"\\/usr\\/local\\/huago\\/Textlut300clr.bmp\",\"cis-mode==\\u5f69\\u8272&&resolution>=400\":\"\\/usr\\/local\\/huago\\/Textlut600clr.bmp\",\"cis-mode==\\u7070\\u5ea6&&resolution<=200\":\"\\/usr\\/local\\/huago\\/Textlut200gray.bmp\",\"cis-mode==\\u7070\\u5ea6&&resolution>200&&resolution<400\":\"\\/usr\\/local\\/huago\\/Textlut300gray.bmp\",\"cis-mode==\\u7070\\u5ea6&&resolution>=400\":\"\\/usr\\/local\\/huago\\/Textlut600gray.bmp\",\"default\":\"\\/usr\\/local\\/huago\\/Textlut200clr.bmp\"}},\"cis-mode\":{\"cat\":\"none\",\"group\":\"CIS\",\"title\":\"CIS\\u989c\\u8272\\u6a21\\u5f0f\",\"desc\":\"\\u9009\\u62e9\\u955c\\u5934\\u8272\\u5f69\\u5de5\\u4f5c\\u6a21\\u5f0f\",\"type\":\"string\",\"pos\":1000,\"ui-pos\":10,\"auth\":0,\"bind\":true,\"size\":12,\"default\":{\"(mode.enabled&&(mode==256\\u7ea7\\u7070\\u5ea6||mode==\\u9ed1\\u767d)) || (multiout-type.enabled&&multiout-type==\\u7070\\u5ea6+\\u9ed1\\u767d)\":\"\\u7070\\u5ea6\",\"default\":\"\\u5f69\\u8272\"},\"range\":[\"\\u5f69\\u8272\",\"\\u7070\\u5ea6\"]}}"
}; };

View File

@ -6,7 +6,7 @@
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// img_encoder // img_encoder
static std::string device_opt_json[] = { static std::string device_opt_json[] = {
"{\"img-fmt\":{\"cat\":\"imgp\",\"group\":\"output\",\"title\":\"\\u56fe\\u7247\\u683c\\u5f0f\",\"desc\":\"\\u8bbe\\u5907\\u8f93\\u51fa\\u7684\\u56fe\\u7247\\u6587\\u4ef6\\u683c\\u5f0f\",\"type\":\"string\",\"ver\":1,\"pos\":9900,\"ui-pos\":10,\"auth\":0,\"visible\":0,\"size\":16,\"cur\":\"JPEG\",\"default\":\"JPEG\",\"range\":[\"JPEG\",\"PNG\",\"BMP\"]},\"jpeg-quality\":{\"cat\":\"imgp\",\"group\":\"output\",\"title\":\"JPEG\\u8d28\\u91cf\",\"desc\":\"\\u8bbe\\u7f6eJPEG\\u538b\\u7f29\\u8d28\\u91cf\\uff0c\\u8d28\\u91cf\\u8d8a\\u9ad8\\uff0c\\u538b\\u7f29\\u7387\\u8d8a\\u4f4e\",\"type\":\"int\",\"ver\":1,\"pos\":9901,\"ui-pos\":11,\"auth\":0,\"affect\":4,\"unit\":\"%\",\"visible\":0,\"size\":4,\"cur\":100,\"default\":100,\"range\":{\"min\":10,\"max\":100,\"step\":1},\"depend\":\"img-fmt==JPEG\"}}" "{\"img-fmt\":{\"cat\":\"imgp\",\"group\":\"output\",\"title\":\"\\u56fe\\u7247\\u683c\\u5f0f\",\"desc\":\"\\u8bbe\\u5907\\u8f93\\u51fa\\u7684\\u56fe\\u7247\\u6587\\u4ef6\\u683c\\u5f0f\",\"type\":\"string\",\"ver\":1,\"pos\":9900,\"ui-pos\":10,\"auth\":10,\"visible\":2,\"size\":16,\"cur\":\"JPEG\",\"default\":\"JPEG\",\"range\":[\"JPEG\",\"PNG\",\"BMP\"]},\"jpeg-quality\":{\"cat\":\"imgp\",\"group\":\"output\",\"title\":\"JPEG\\u8d28\\u91cf\",\"desc\":\"\\u8bbe\\u7f6eJPEG\\u538b\\u7f29\\u8d28\\u91cf\\uff0c\\u8d28\\u91cf\\u8d8a\\u9ad8\\uff0c\\u538b\\u7f29\\u7387\\u8d8a\\u4f4e\",\"type\":\"int\",\"ver\":1,\"pos\":9901,\"ui-pos\":11,\"auth\":10,\"affect\":4,\"unit\":\"%\",\"visible\":2,\"size\":4,\"cur\":100,\"default\":100,\"range\":{\"min\":10,\"max\":100,\"step\":1},\"depend\":\"img-fmt==JPEG\"}}"
}; };

View File

@ -8,7 +8,7 @@
static std::string device_opt_json[] = { static std::string device_opt_json[] = {
"{\"rebuild\":{\"cat\":\"imgp\",\"group\":\"\\u9ad8\\u7ea7\\u8bbe\\u7f6e\",\"title\":\"CIS\\u56fe\\u50cf\\u8fd8\\u539f\",\"desc\":\"\\u5c06\\u4eceCIS\\u8f93\\u51fa\\u7684\\u539f\\u59cb\\u6570\\u636e\\u6d41\\uff0c\\u8fd8\\u539f\\u4e3aBMP\\u56fe\\u7247\\uff0c\\u5e76\\u62c6\\u5206\\u6b63\\u53cd\\u9762\",\"type\":\"bool\",\"pos\":10,\"ui-pos\":1,\"auth\":0,\"visible\":0,\"size\":4,\"auto\":false,\"cur\":true,\"default\":true}}" "{\"rebuild\":{\"cat\":\"imgp\",\"group\":\"advance\",\"title\":\"CIS\\u56fe\\u50cf\\u8fd8\\u539f\",\"desc\":\"\\u5c06\\u4eceCIS\\u8f93\\u51fa\\u7684\\u539f\\u59cb\\u6570\\u636e\\u6d41\\uff0c\\u8fd8\\u539f\\u4e3aBMP\\u56fe\\u7247\\uff0c\\u5e76\\u62c6\\u5206\\u6b63\\u53cd\\u9762\",\"type\":\"bool\",\"pos\":10,\"ui-pos\":1,\"auth\":100,\"visible\":2,\"size\":4,\"auto\":false,\"cur\":true,\"default\":true}}"
}; };
rebuild::rebuild(bool weaker) : image_processor("rebuild") rebuild::rebuild(bool weaker) : image_processor("rebuild")

View File

@ -25,7 +25,7 @@
} }
static std::string device_opt_json[] = { static std::string device_opt_json[] = {
"{\"dump-img\":{\"cat\":\"base\",\"group\":\"\\u9ad8\\u7ea7\\u8bbe\\u7f6e\",\"title\":\"\\u8f93\\u51fa\\u4e2d\\u95f4\\u56fe\\u50cf\",\"desc\":\"\\u8f93\\u51fa\\u5404\\u7b97\\u6cd5\\u4e2d\\u95f4\\u7ed3\\u679c\\u56fe\\u50cf\",\"type\":\"bool\",\"ui-pos\":10,\"auth\":0,\"affect\":2,\"size\":4,\"cur\":false,\"default\":false}}" "{\"dump-img\":{\"cat\":\"base\",\"group\":\"advance\",\"title\":\"\\u8f93\\u51fa\\u4e2d\\u95f4\\u56fe\\u50cf\",\"desc\":\"\\u8f93\\u51fa\\u5404\\u7b97\\u6cd5\\u4e2d\\u95f4\\u7ed3\\u679c\\u56fe\\u50cf\",\"type\":\"bool\",\"ui-pos\":20,\"auth\":10,\"affect\":2,\"visible\":2,\"size\":4,\"cur\":false,\"default\":false}}"
}; };

View File

@ -154,7 +154,6 @@ async_scanner::async_scanner() : usb_(nullptr), cfg_mgr_(nullptr), scan_id_(0)
cfg_mgr_ = new device_option(true, user, on_log); cfg_mgr_ = new device_option(true, user, on_log);
utils::to_log(LOG_LEVEL_DEBUG, "OPT - initializing ...\n"); utils::to_log(LOG_LEVEL_DEBUG, "OPT - initializing ...\n");
const_opts_ = new scanner_const_opts();
user_ = new user_priv(); user_ = new user_priv();
cfg_mgr_->add(const_opts_); cfg_mgr_->add(const_opts_);
@ -294,6 +293,7 @@ dyn_mem_ptr async_scanner::handle_bulk_cmd(LPPACK_BASE pack, uint32_t* used, pac
void async_scanner::init(void) void async_scanner::init(void)
{ {
cis_ = new scanner_hw(); cis_ = new scanner_hw();
const_opts_ = new scanner_const_opts();
auto uicb = [this](devui::LPMSGSTREAM pack) -> void auto uicb = [this](devui::LPMSGSTREAM pack) -> void
{ {
@ -320,9 +320,19 @@ void async_scanner::init(void)
{ {
cis_->clean_paper_passway(); cis_->clean_paper_passway();
} }
else if(devui::UI_CMD_GET_HISTORY_COUNT == pack->msg)
{
const_opts_->set_history_count(*(uint32_t*)pack->data);
}
else if(devui::UI_CMD_GET_ROLLER_COUNT == pack->msg)
{
const_opts_->set_roller_count(*(uint32_t*)pack->data);
}
}; };
devui::init_ui(uicb, false); devui::init_ui(uicb, false);
devui::send_message(devui::UI_CMD_GET_HISTORY_COUNT);
devui::send_message(devui::UI_CMD_GET_ROLLER_COUNT);
} }
bool async_scanner::on_energy_conservation(bool normal) bool async_scanner::on_energy_conservation(bool normal)
{ {
@ -441,6 +451,11 @@ dyn_mem_ptr async_scanner::handle_set_opt(LPPACK_BASE pack, uint32_t* used, pack
} }
cfg_ret->after_do = after; cfg_ret->after_do = after;
cfg_ret->val_size = val_size; cfg_ret->val_size = val_size;
if(name == SANE_OPT_NAME(LOGIN))
{
int priv = user_->get_current_privilege();
memcpy(cfg_ret->data + cfg_ret->val_off, &priv, sizeof(priv));
}
BASE_PACKET_REPLY(*pk, pack->cmd + 1, pack->pack_id, err); BASE_PACKET_REPLY(*pk, pack->cmd + 1, pack->pack_id, err);
pk->payload_len = sizeof(CFGVAL) + name.length() + 1 + cfg->max_size + 1; pk->payload_len = sizeof(CFGVAL) + name.length() + 1 + cfg->max_size + 1;
reply->set_len(l); reply->set_len(l);

View File

@ -3,6 +3,7 @@
#include <json/gb_json.h> #include <json/gb_json.h>
#include <sane/sane_ex.h> #include <sane/sane_ex.h>
#include <string.h> #include <string.h>
#include <base/ui.h>
@ -20,7 +21,7 @@
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// option json: // option json:
static std::string device_opt_json[] = { static std::string device_opt_json[] = {
"{\"dev-vid\":{\"cat\":\"base\",\"group\":\"\\u5173\\u4e8e\",\"title\":\"USB-VID\",\"desc\":\"\\u8bbe\\u5907\\u5236\\u9020\\u5546\\u5728USB\\u7ec4\\u7ec7\\u7684ID\",\"type\":\"string\",\"fix-id\":34898,\"ui-pos\":10,\"auth\":0,\"readonly\":true,\"size\":16,\"auto\":false,\"cur\":\"3072\",\"default\":\"3072\"},\"dev-pid\":{\"cat\":\"base\",\"group\":\"\\u5173\\u4e8e\",\"title\":\"USB-PID\",\"desc\":\"\\u8bbe\\u5907\\u5728USB\\u7ec4\\u7ec7\\u4e2d\\u7684\\u4ea7\\u54c1ID\",\"type\":\"string\",\"fix-id\":34899,\"ui-pos\":11,\"auth\":0,\"readonly\":true,\"size\":16,\"auto\":false,\"cur\":\"0306\",\"default\":\"0306\"},\"dev-name\":{\"cat\":\"base\",\"group\":\"\\u5173\\u4e8e\",\"title\":\"\\u8bbe\\u5907\\u540d\\u79f0\",\"desc\":\"\\u8bbe\\u5907\\u540d\\u79f0\",\"type\":\"string\",\"fix-id\":34900,\"ui-pos\":12,\"auth\":0,\"readonly\":true,\"size\":96,\"auto\":false,\"cur\":\"300NewTx\",\"default\":\"300NewTx\"},\"dev-model\":{\"cat\":\"base\",\"group\":\"\\u5173\\u4e8e\",\"title\":\"\\u4ea7\\u54c1\\u7cfb\\u5217\",\"desc\":\"\\u8bbe\\u5907\\u6240\\u5c5e\\u4ea7\\u54c1\\u7cfb\\u5217\\u540d\\u79f0\",\"type\":\"string\",\"fix-id\":34901,\"ui-pos\":13,\"auth\":0,\"readonly\":true,\"size\":96,\"auto\":false,\"cur\":\"G200\",\"default\":\"G200\"},\"dev-sn\":{\"cat\":\"base\",\"group\":\"\\u5173\\u4e8e\",\"title\":\"\\u5e8f\\u5217\\u53f7\",\"desc\":\"\\u8bbe\\u5907\\u5e8f\\u5217\\u53f7\",\"type\":\"string\",\"fix-id\":34902,\"ui-pos\":14,\"auth\":0,\"readonly\":true,\"size\":32,\"auto\":false,\"ownread\":true,\"cur\":\"GB20231201\",\"default\":\"GB20231201\"},\"fmw-ver\":{\"cat\":\"base\",\"group\":\"\\u5173\\u4e8e\",\"title\":\"\\u56fa\\u4ef6\\u7248\\u672c\",\"desc\":\"\\u8bbe\\u5907\\u56fa\\u4ef6\\u7248\\u672c\\u53f7\",\"type\":\"string\",\"fix-id\":34903,\"ui-pos\":15,\"auth\":0,\"readonly\":true,\"size\":32,\"auto\":false,\"cur\":\"G2393B0500\",\"default\":\"G2393B0500\"},\"roller-life\":{\"cat\":\"base\",\"group\":\"\\u5173\\u4e8e\",\"title\":\"\\u6eda\\u8f74\\u5bff\\u547d\",\"desc\":\"\\u8be5\\u8bbe\\u5907\\u6eda\\u8f74\\u8fc7\\u7eb8\\u7684\\u6700\\u5927\\u5f20\\u6570\",\"type\":\"int\",\"fix-id\":34907,\"ui-pos\":20,\"auth\":0,\"readonly\":true,\"size\":4,\"auto\":false,\"cur\":450000,\"default\":450000},\"ip-addr\":{\"cat\":\"base\",\"group\":\"\\u5173\\u4e8e\",\"title\":\"IP\",\"desc\":\"\\u8bbe\\u5907\\u8054\\u7f51\\u65f6\\u6240\\u5206\\u914d\\u7684IP\\u5730\\u5740\",\"type\":\"string\",\"fix-id\":34904,\"ui-pos\":21,\"auth\":0,\"readonly\":true,\"size\":96,\"auto\":false,\"ownread\":true,\"cur\":\"0\",\"default\":\"0\"},\"mac-addr\":{\"cat\":\"base\",\"group\":\"\\u5173\\u4e8e\",\"title\":\"MAC\",\"desc\":\"\\u8bbe\\u5907\\u7f51\\u5361\\u5730\\u5740\",\"type\":\"string\",\"fix-id\":34905,\"ui-pos\":22,\"auth\":0,\"readonly\":true,\"size\":96,\"auto\":false,\"ownread\":true,\"cur\":\"0\",\"default\":\"0\"}}" "{\"dev-vid\":{\"cat\":\"base\",\"group\":\"about\",\"title\":\"USB-VID\",\"desc\":\"\\u8bbe\\u5907\\u5236\\u9020\\u5546\\u5728USB\\u7ec4\\u7ec7\\u7684ID\",\"type\":\"string\",\"fix-id\":34898,\"ui-pos\":10,\"auth\":0,\"readonly\":true,\"size\":16,\"auto\":false,\"cur\":\"3072\",\"default\":\"3072\"},\"dev-pid\":{\"cat\":\"base\",\"group\":\"about\",\"title\":\"USB-PID\",\"desc\":\"\\u8bbe\\u5907\\u5728USB\\u7ec4\\u7ec7\\u4e2d\\u7684\\u4ea7\\u54c1ID\",\"type\":\"string\",\"fix-id\":34899,\"ui-pos\":11,\"auth\":0,\"readonly\":true,\"size\":16,\"auto\":false,\"cur\":\"0306\",\"default\":\"0306\"},\"dev-name\":{\"cat\":\"base\",\"group\":\"about\",\"title\":\"\\u8bbe\\u5907\\u540d\\u79f0\",\"desc\":\"\\u8bbe\\u5907\\u540d\\u79f0\",\"type\":\"string\",\"fix-id\":34900,\"ui-pos\":12,\"auth\":0,\"readonly\":true,\"size\":96,\"auto\":false,\"cur\":\"HUAGOSCAN G200\",\"default\":\"HUAGOSCAN G200\"},\"dev-model\":{\"cat\":\"base\",\"group\":\"about\",\"title\":\"\\u4ea7\\u54c1\\u7cfb\\u5217\",\"desc\":\"\\u8bbe\\u5907\\u6240\\u5c5e\\u4ea7\\u54c1\\u7cfb\\u5217\\u540d\\u79f0\",\"type\":\"string\",\"fix-id\":34901,\"ui-pos\":13,\"auth\":0,\"readonly\":true,\"size\":96,\"auto\":false,\"cur\":\"G200\",\"default\":\"G200\"},\"dev-sn\":{\"cat\":\"base\",\"group\":\"about\",\"title\":\"\\u5e8f\\u5217\\u53f7\",\"desc\":\"\\u8bbe\\u5907\\u5e8f\\u5217\\u53f7\",\"type\":\"string\",\"fix-id\":34902,\"ui-pos\":14,\"auth\":0,\"readonly\":true,\"size\":32,\"auto\":false,\"ownread\":true,\"cur\":\"GB20231201\",\"default\":\"GB20231201\"},\"fmw-ver\":{\"cat\":\"base\",\"group\":\"about\",\"title\":\"\\u56fa\\u4ef6\\u7248\\u672c\",\"desc\":\"\\u8bbe\\u5907\\u56fa\\u4ef6\\u7248\\u672c\\u53f7\",\"type\":\"string\",\"fix-id\":34903,\"ui-pos\":15,\"auth\":0,\"readonly\":true,\"size\":32,\"auto\":false,\"cur\":\"G2393B0500\",\"default\":\"G2393B0500\"},\"roller-life\":{\"cat\":\"base\",\"group\":\"about\",\"title\":\"\\u6eda\\u8f74\\u5bff\\u547d\",\"desc\":\"\\u8be5\\u8bbe\\u5907\\u6eda\\u8f74\\u8fc7\\u7eb8\\u7684\\u6700\\u5927\\u5f20\\u6570\",\"type\":\"int\",\"fix-id\":34907,\"ui-pos\":20,\"auth\":0,\"readonly\":true,\"size\":4,\"auto\":false,\"cur\":450000,\"default\":450000},\"roll-cnt\":{\"cat\":\"base\",\"group\":\"about\",\"title\":\"\\u6eda\\u8f74\\u5f20\\u6570\",\"desc\":\"\\u5f53\\u524d\\u6eda\\u8f74\\u626b\\u63cf\\u5f20\\u6570\",\"type\":\"int\",\"fix-id\":39170,\"ui-pos\":21,\"auth\":0,\"readonly\":true,\"size\":4,\"auto\":false,\"ownread\":true,\"cur\":0,\"default\":0},\"total-cnt\":{\"cat\":\"base\",\"group\":\"about\",\"title\":\"\\u5386\\u53f2\\u5f20\\u6570\",\"desc\":\"\\u8be5\\u8bbe\\u5907\\u5386\\u53f2\\u603b\\u8ba1\\u626b\\u63cf\\u5f20\\u6570\",\"type\":\"int\",\"fix-id\":34889,\"ui-pos\":22,\"auth\":0,\"readonly\":true,\"size\":4,\"auto\":false,\"ownread\":true,\"cur\":0,\"default\":0},\"ip-addr\":{\"cat\":\"base\",\"group\":\"about\",\"title\":\"IP\",\"desc\":\"\\u8bbe\\u5907\\u8054\\u7f51\\u65f6\\u6240\\u5206\\u914d\\u7684IP\\u5730\\u5740\",\"type\":\"string\",\"fix-id\":34904,\"ui-pos\":30,\"auth\":0,\"readonly\":true,\"size\":96,\"auto\":false,\"ownread\":true,\"cur\":\"0\",\"default\":\"0\"},\"mac-addr\":{\"cat\":\"base\",\"group\":\"about\",\"title\":\"MAC\",\"desc\":\"\\u8bbe\\u5907\\u7f51\\u5361\\u5730\\u5740\",\"type\":\"string\",\"fix-id\":34905,\"ui-pos\":31,\"auth\":0,\"readonly\":true,\"size\":96,\"auto\":false,\"ownread\":true,\"cur\":\"0\",\"default\":\"0\"}}"
}; };
@ -87,6 +88,7 @@ void scanner_const_opts::init(void)
for(auto& v: device_opt_json) for(auto& v: device_opt_json)
text += v; text += v;
;
if(jsn->attach_text(&text[0])) if(jsn->attach_text(&text[0]))
{ {
gb_json *child = nullptr; gb_json *child = nullptr;
@ -176,6 +178,21 @@ void scanner_const_opts::init(void)
child->release(); child->release();
} }
jsn->get_value(SANE_OPT_NAME(ROLLER_COUNT), child);
if(child)
{
child->set_value("cur", (int)roller_cnt_);
child->set_value("default", (int)roller_cnt_);
child->release();
}
jsn->get_value(SANE_OPT_NAME(HISTORY_COUNT), child);
if(child)
{
child->set_value("cur", (int)hist_cnt_);
child->set_value("default", (int)hist_cnt_);
child->release();
}
text = jsn->to_string(); text = jsn->to_string();
set_opt_json_text(&text[0]); set_opt_json_text(&text[0]);
} }
@ -208,6 +225,18 @@ char* scanner_const_opts::get_value(const char* name, void* value, size_t* size,
sprintf(ver, "%u.%u.%u%02u", VER_MAIN, VER_FAMILY, VER_DATE, VER_BUILD); sprintf(ver, "%u.%u.%u%02u", VER_MAIN, VER_FAMILY, VER_DATE, VER_BUILD);
val = ver; val = ver;
} }
else if(strcmp(SANE_OPT_NAME(ROLLER_COUNT), name) == 0)
{
devui::send_message(devui::UI_CMD_GET_ROLLER_COUNT);
std::this_thread::sleep_for(std::chrono::milliseconds(50));
val = std::string((char*)&roller_cnt_, sizeof(roller_cnt_));
}
else if(strcmp(SANE_OPT_NAME(HISTORY_COUNT), name) == 0)
{
devui::send_message(devui::UI_CMD_GET_HISTORY_COUNT);
std::this_thread::sleep_for(std::chrono::milliseconds(50));
val = std::string((char*)&hist_cnt_, sizeof(hist_cnt_));
}
else if(err) else if(err)
*err = ENOTSUP; *err = ENOTSUP;
@ -221,4 +250,13 @@ char* scanner_const_opts::get_value(const char* name, void* value, size_t* size,
} }
return ret; return ret;
} }
void scanner_const_opts::set_roller_count(uint32_t cnt)
{
roller_cnt_ = cnt;
}
void scanner_const_opts::set_history_count(uint32_t cnt)
{
hist_cnt_ = cnt;
}

View File

@ -9,6 +9,8 @@
class scanner_const_opts : public sane_opt_provider class scanner_const_opts : public sane_opt_provider
{ {
std::string root_; std::string root_;
uint32_t hist_cnt_ = 0;
uint32_t roller_cnt_ = 0;
std::string get_device_content(const char* path, bool truncate_from_lrn = false); std::string get_device_content(const char* path, bool truncate_from_lrn = false);
std::string get_ip(void); std::string get_ip(void);
@ -24,5 +26,10 @@ protected:
public: public:
// return malloc(), real data size stored in parameter 'size'. invoker should free() the returned value // return malloc(), real data size stored in parameter 'size'. invoker should free() the returned value
virtual char* get_value(const char* name, void* value, size_t* size, int* err = nullptr) override; virtual char* get_value(const char* name, void* value, size_t* size, int* err = nullptr) override;
public:
void set_roller_count(uint32_t cnt);
void set_history_count(uint32_t cnt);
}; };

View File

@ -25,6 +25,9 @@ namespace devui
UI_CMD_CLEAN_PASSWAY = 0x30, UI_CMD_CLEAN_PASSWAY = 0x30,
UI_CMD_GET_HISTORY_COUNT = 0x50,
UI_CMD_GET_ROLLER_COUNT,
UI_STATUS_SCANNING = 0x1000, // begin scanning. data: (LPSCANSTREAM) UI_STATUS_SCANNING = 0x1000, // begin scanning. data: (LPSCANSTREAM)
UI_STATUS_PAPER_CNT, // ONE paper has pass through. data: (uint32_t*)milliseconds for paper pass through UI_STATUS_PAPER_CNT, // ONE paper has pass through. data: (uint32_t*)milliseconds for paper pass through
UI_STATUS_MESSAGE, // status message, hold screen. data: LPSTATMSG UI_STATUS_MESSAGE, // status message, hold screen. data: LPSTATMSG

View File

@ -59,11 +59,3 @@ public:
// 跨模块图像处理接口。回调函数返回false则停止处理void*参数同 'param'。 // 跨模块图像处理接口。回调函数返回false则停止处理void*参数同 'param'。
virtual int process(LPPROCIIM* in, size_t cnt, bool(*result)(LPPROCIIM, void*), void* param); virtual int process(LPPROCIIM* in, size_t cnt, bool(*result)(LPPROCIIM, void*), void* param);
}; };
#define ADD_THIS_JSON() \
{ \
std::string t(""); \
for(auto& v: device_opt_json) \
t += v; \
set_opt_json_text(&t[0]); \
}

View File

@ -135,6 +135,7 @@
#define SANE_STD_OPT_NAME_CO_GPS "co-gps" // 公司地图定位 over-line #define SANE_STD_OPT_NAME_CO_GPS "co-gps" // 公司地图定位 over-line
#define SANE_STD_OPT_NAME_USER_NAME "user-name" // 登录账号 over-line #define SANE_STD_OPT_NAME_USER_NAME "user-name" // 登录账号 over-line
#define SANE_STD_OPT_NAME_USER_PASSWORD "user-pwd" // 登录密码 over-line #define SANE_STD_OPT_NAME_USER_PASSWORD "user-pwd" // 登录密码 over-line
#define SANE_STD_OPT_NAME_USER_LOGIN_HINT "login-hint" // 用户登录密码提示 over-line
#define SANE_STD_OPT_NAME_LOGIN "login" // 登录 over-line #define SANE_STD_OPT_NAME_LOGIN "login" // 登录 over-line
#define SANE_STD_OPT_NAME_LOGOUT "logout" // 登出 over-line #define SANE_STD_OPT_NAME_LOGOUT "logout" // 登出 over-line
#define SANE_STD_OPT_NAME_DRIVER_LOG "drv-log" // 驱动日志 over-line #define SANE_STD_OPT_NAME_DRIVER_LOG "drv-log" // 驱动日志 over-line
@ -168,7 +169,6 @@
#define SANE_STD_OPT_NAME_CIS_REBUILD "rebuild" // 复原从CIS出来的数据流为原始图像 over-line #define SANE_STD_OPT_NAME_CIS_REBUILD "rebuild" // 复原从CIS出来的数据流为原始图像 over-line
#define SANE_STD_OPT_NAME_CIS_MODE "cis-mode" #define SANE_STD_OPT_NAME_CIS_MODE "cis-mode"
#define SANE_STD_OPT_NAME_CIS_DPI "cis-dpi" #define SANE_STD_OPT_NAME_CIS_DPI "cis-dpi"
#define SANE_STD_OPT_NAME_Y_DPI "y-dpi"
#define SANE_STD_OPT_NAME_CIS_BAUD "baud" #define SANE_STD_OPT_NAME_CIS_BAUD "baud"
#define SANE_STD_OPT_NAME_CIS_DELAY "act-after" #define SANE_STD_OPT_NAME_CIS_DELAY "act-after"
#define SANE_STD_OPT_NAME_CIS_FRAME_H "frame-h" #define SANE_STD_OPT_NAME_CIS_FRAME_H "frame-h"
@ -187,6 +187,7 @@
#define SANE_STD_OPT_NAME_CIS_OFFSET_BACK "off-b" #define SANE_STD_OPT_NAME_CIS_OFFSET_BACK "off-b"
#define SANE_STD_OPT_NAME_CIS_STRETCH_H "stretch-h" #define SANE_STD_OPT_NAME_CIS_STRETCH_H "stretch-h"
#define SANE_STD_OPT_NAME_CIS_STRETCH_V "stretch-v" #define SANE_STD_OPT_NAME_CIS_STRETCH_V "stretch-v"
#define SANE_STD_OPT_NAME_CIS_PAPER_TIME "paper-timer"
#define SANE_STD_OPT_NAME_MOTOR_SPEED "motor-speed" #define SANE_STD_OPT_NAME_MOTOR_SPEED "motor-speed"
#define SANE_STD_OPT_NAME_COLOR_CORRECT "clr-correct" #define SANE_STD_OPT_NAME_COLOR_CORRECT "clr-correct"
#define SANE_STD_OPT_NAME_LUT_FILE "lut-file" #define SANE_STD_OPT_NAME_LUT_FILE "lut-file"

View File

@ -48,3 +48,37 @@ public:
virtual void enable(const char* name, bool able); virtual void enable(const char* name, bool able);
}; };
#define ADD_THIS_JSON() \
{ \
std::string t(""); \
for(auto& v: device_opt_json) \
t += v; \
set_opt_json_text(&t[0]); \
}
// change given options 'cur' value and add my JSON
// vals: std::map<std::string, void*>. void* is bool*, int*, double* or char*
#define ADD_THIS_JSON_WITH_VALUES(vals) \
{ \
std::string t(""); \
for(auto& v: device_opt_json) \
t += v; \
gb_json *jsn = new gb_json(); \
if(jsn->attatch(&t[0])) \
{ \
for(auto& v: vals) \
{ \
gb_json *child = nullptr; \
jsn->get_value(v.first.c_str(), child); \
if(child) \
{ \
sane_opt_provider::set_opt_value(child, v.second); \
child->release(); \
} \
} \
t = jsn->to_string(); \
} \
jsn->release(); \
set_opt_json_text(&t[0]); \
}

View File

@ -154,6 +154,9 @@ static struct
, {"bright", "\xE4\xBA\xAE\xE5\xBA\xA6"} , {"bright", "\xE4\xBA\xAE\xE5\xBA\xA6"}
, {"imgp", "\xE5\x9B\xBE\xE5\x83\x8F\xE5\xA4\x84\xE7\x90\x86"} , {"imgp", "\xE5\x9B\xBE\xE5\x83\x8F\xE5\xA4\x84\xE7\x90\x86"}
, {"feeder", "\xE9\x80\x81\xE7\xBA\xB8\xE6\x96\xB9\xE5\xBC\x8F\xE8\xAE\xBE\xE7\xBD\xAE"} // <20><><EFBFBD>ã<EFBFBD>\xE8\xAE\xBE\xE7\xBD\xAE , {"feeder", "\xE9\x80\x81\xE7\xBA\xB8\xE6\x96\xB9\xE5\xBC\x8F\xE8\xAE\xBE\xE7\xBD\xAE"} // <20><><EFBFBD>ã<EFBFBD>\xE8\xAE\xBE\xE7\xBD\xAE
, {"advance", "\xE9\xAB\x98\xE7\xBA\xA7\xE8\xAE\xBE\xE7\xBD\xAE"} // <20><><EFBFBD>ã<EFBFBD>\xE8\xAE\xBE\xE7\xBD\xAE
, {"user", "\xE7\x94\xA8\xE6\x88\xB7"} // <20><><EFBFBD>ã<EFBFBD>\xE8\xAE\xBE\xE7\xBD\xAE
, {"about", "\xE5\x85\xB3\xE4\xBA\x8E"} // <20><><EFBFBD>ã<EFBFBD>\xE8\xAE\xBE\xE7\xBD\xAE
}; };
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -931,11 +934,11 @@ gb_json* device_option::group_opt(const char* title)
return jsn; return jsn;
} }
int device_option::next_group(int start) int device_option::next_group(gb_json* root, int start)
{ {
for (; start < origin_->children(); ++start) for (; start < root->children(); ++start)
{ {
gb_json* child = origin_->child(start); gb_json* child = root->child(start);
std::string str(""); std::string str("");
child->get_value("type", str); child->get_value("type", str);
@ -947,23 +950,41 @@ int device_option::next_group(int start)
return start; return start;
} }
int device_option::insert_group(const char* name, const char* title) int device_option::insert_group(const char* title)
{ {
gb_json* group = nullptr; gb_json* group = nullptr;
int ind = origin_->children(); int ind = origin_->children(), grpind = next_group(origin_, 0);
std::string name("grp-" + std::to_string(++grp_ind_)), t("");
while(grpind < origin_->children())
{
group = origin_->child(grpind);
group->get_value("title", t);
if(t == title || group->key() == title)
break;
group->release();
group = nullptr;
grpind = next_group(origin_, grpind + 1);
}
origin_->get_value(name, group);
if (group) if (group)
{ {
ind = origin_->index(group); ind = grpind;
group->release(); group->release();
} }
else else
{ {
for (auto& v : g_known_group_with_sn) for (auto& v : g_known_group_with_sn)
{ {
if (v.name == name) if (v.title == title)
{ {
name = v.name;
break;
}
else if (v.name == title)
{
name = v.name;
title = v.title.c_str(); title = v.title.c_str();
break; break;
} }
@ -985,9 +1006,9 @@ int device_option::insert_group(const char* name, const char* title)
} }
else else
ind = 0; ind = 0;
ind = next_group(ind); ind = next_group(origin_, ind);
group = group_opt(title); group = group_opt(title);
origin_->insert(ind, name, group); origin_->insert(ind, name.c_str(), group);
group->release(); group->release();
} }
@ -1098,6 +1119,13 @@ void device_option::insert_option(gb_json* opt, sane_opt_provider* from, const c
} }
else if (vo > vn) else if (vo > vn)
{ {
// re-init existing ...
std::string text(opt->to_string()), fo(src_[existing->key()]->from());
existing->attach_text(&text[0]);
existing->key() = opt->key();
write_log("Re-Initialize option '%s' for new provider(%s - %d) is ahead of existing(%s - %d) ...\n", opt->key().c_str()
, from->from(), vn, fo.c_str(), vo);
from->set_following_provider(opt->key().c_str(), src_[existing->key()]); from->set_following_provider(opt->key().c_str(), src_[existing->key()]);
src_[existing->key()]->release(); src_[existing->key()]->release();
src_[opt->key()] = from; src_[opt->key()] = from;
@ -1164,12 +1192,12 @@ void device_option::insert_option(gb_json* opt, sane_opt_provider* from, const c
int index = -1, pos = -1; int index = -1, pos = -1;
if (group) if (group)
index = insert_group(group, group); index = insert_group(group);
// insert poisition according to 'ui-pos' // insert poisition according to 'ui-pos'
if (!opt->get_value("ui-pos", pos) || pos == -1) if (!opt->get_value("ui-pos", pos) || pos == -1)
{ {
index = next_group(index + 1); index = next_group(origin_, index + 1);
} }
else else
{ {
@ -1214,7 +1242,7 @@ void device_option::insert_option(gb_json* opt, sane_opt_provider* from, const c
// opt->get_value("type", type); // opt->get_value("type", type);
// val.resize(size); // val.resize(size);
// type = sane_opt_provider::sane_value_2_text(type.c_str(), &val[0]); // type = sane_opt_provider::sane_value_2_text(type.c_str(), &val[0]);
// utils::to_log(LOG_LEVEL_ALL, "Set option '%s' to default value: '%s'\n", opt->key().c_str(), type.c_str()); // write_log("Set option '%s' to default value: '%s'\n", opt->key().c_str(), type.c_str());
// from->set_value(opt->key().c_str(), &val[0]); // from->set_value(opt->key().c_str(), &val[0]);
// sane_opt_provider::set_opt_value(opt, &val[0]); // sane_opt_provider::set_opt_value(opt, &val[0]);
// } // }
@ -1546,19 +1574,7 @@ bool device_option::to_now(bool init, bool* changed)
if (init) if (init)
init_depends(from); init_depends(from);
int pub = visibility(from); // check hidden option is moved to do when get all options json, here should add into, or else the option maybe in wrong status !!!
if (pub == OPT_VISIBLE_HIDE || pub == OPT_VISIBLE_NOT_SUPPORT)
{
int auth = 0;
from->get_value("auth", auth);
if (pub == OPT_VISIBLE_NOT_SUPPORT || !user_ || !user_(auth))
{
from->release();
from = origin_->next_child();
continue;
}
}
to = copy_opt(from, &cur_chged); to = copy_opt(from, &cur_chged);
from->release(); from->release();
if (to) if (to)
@ -1722,6 +1738,84 @@ void device_option::remove_provider(gb_json* root, sane_opt_provider* sop)
} }
} }
} }
void device_option::remove_empty_group(gb_json* root)
{
int prev = -2, index = next_group(root, 0);
std::vector<int> grp0;
while(index < root->children())
{
if(index - prev == 1)
grp0.push_back(prev);
else if(prev >= 0)
{
// contains only-accessible option
int cnt = 0;
for (int i = prev + 1; i < index; ++i)
{
gb_json* child = root->child(i);
int visible = 0;
child->get_value("visible", visible);
child->release();
if (visible != OPT_VISIBLE_ACCESS)
{
cnt++;
break;
}
}
if(cnt == 0)
grp0.push_back(prev);
}
prev = index;
index = next_group(root, index + 1);
}
if (prev >= 0)
{
// contains only-accessible option
int cnt = 0;
for (int i = prev + 1; i < index; ++i)
{
gb_json* child = root->child(i);
int visible = 0;
child->get_value("visible", visible);
child->release();
if (visible != OPT_VISIBLE_ACCESS)
{
cnt++;
break;
}
}
if (cnt == 0)
grp0.push_back(prev);
}
for(int i = grp0.size() - 1; i >= 0; --i)
{
std::string title("");
gb_json *grp = root->child(grp0[i]);
grp->get_value("title", title);
grp->release();
utils::to_log(LOG_LEVEL_ALL, "remove empty group '%s'.\n", title.c_str());
root->remove(grp0[i]);
}
}
bool device_option::is_hidden_option(gb_json* opt)
{
int pub = visibility(opt);
bool hidden = false;
if (pub != OPT_VISIBLE_ALL)
{
int auth = 0;
opt->get_value("auth", auth);
if (pub == OPT_VISIBLE_HIDE || pub == OPT_VISIBLE_NOT_SUPPORT || !user_ || !user_(auth))
{
hidden = true;
}
}
return hidden;
}
std::string device_option::option_value(gb_json* jsn, bool def_val) std::string device_option::option_value(gb_json* jsn, bool def_val)
{ {
@ -1847,6 +1941,7 @@ void device_option::clear(void)
for (auto& v : src_) for (auto& v : src_)
v.second->release(); v.second->release();
src_.clear(); src_.clear();
grp_ind_ = 0;
} }
bool device_option::add(sane_opt_provider* sop, bool apply_default_val) bool device_option::add(sane_opt_provider* sop, bool apply_default_val)
{ {
@ -1908,7 +2003,7 @@ bool device_option::refine_data(const char* name, void* value)
if(refined) if(refined)
{ {
result = sane_opt_provider::sane_value_2_text(type.c_str(), value); result = sane_opt_provider::sane_value_2_text(type.c_str(), value);
utils::to_log(LOG_LEVEL_DEBUG, "Refine value of '%s' from '%s' to '%s'.\n", name, org.c_str(), result.c_str()); write_log("Refine value of '%s' from '%s' to '%s'.\n", name, org.c_str(), result.c_str());
} }
child->release(); child->release();
@ -1952,7 +2047,7 @@ int device_option::update_data(const char* name, void* value, bool reorder_if_ne
err = update_provider_value(name, value); err = update_provider_value(name, value);
child->get_value("type", type); child->get_value("type", type);
utils::to_log(LOG_LEVEL_DEBUG, "set option '%s' value to '%s' = %d.\n", name, sane_opt_provider::sane_value_2_text(type.c_str(), value).c_str(), err); write_log("set option '%s' value to '%s' = %d.\n", name, sane_opt_provider::sane_value_2_text(type.c_str(), value).c_str(), err);
if (err == SCANNER_ERR_OK || err == SCANNER_ERR_NOT_EXACT if (err == SCANNER_ERR_OK || err == SCANNER_ERR_NOT_EXACT
|| err == SCANNER_ERR_RELOAD_IMAGE_PARAM || err == SCANNER_ERR_RELOAD_OPT_PARAM || err == SCANNER_ERR_RELOAD_IMAGE_PARAM || err == SCANNER_ERR_RELOAD_OPT_PARAM
@ -2146,10 +2241,25 @@ std::string device_option::get_option_value(const char* name, int type, int* siz
{ {
if (!name) if (!name)
{ {
if (no_grp_ && origin_) gb_json *filter = new gb_json(),
value = origin_->to_string(); *child = jsn->first_child();
else
value = jsn->to_string(); while(child)
{
if(!is_hidden_option(child))
filter->set_value(child->key().c_str(), child);
child->release();
child = jsn->next_child();
}
if(!no_grp_)
remove_empty_group(filter);
value = filter->to_string();
filter->release();
// if (no_grp_ && origin_)
// value = origin_->to_string();
// else
// value = jsn->to_string();
} }
else else
{ {

View File

@ -34,6 +34,8 @@ class device_option : public refer
gb_json* origin_; gb_json* origin_;
gb_json* now_; gb_json* now_;
bool no_grp_ = false; // i am a lower option manager, need not group bool no_grp_ = false; // i am a lower option manager, need not group
int grp_ind_ = 0;
std::map<std::string, sane_opt_provider*> src_; std::map<std::string, sane_opt_provider*> src_;
std::vector<std::string> master_opts_; // options that value changed will affect others std::vector<std::string> master_opts_; // options that value changed will affect others
std::map<std::string, simple_logic*> slaver_; std::map<std::string, simple_logic*> slaver_;
@ -185,8 +187,8 @@ class device_option : public refer
void clear_for_reconstruct(void); void clear_for_reconstruct(void);
gb_json* group_opt(const char* title); gb_json* group_opt(const char* title);
int next_group(int start); // return index of the next group int next_group(gb_json* root, int start); // return index of the next group
int insert_group(const char* name, const char* title); // return index of the group int insert_group(const char* title); // return index of the group
void insert_option(gb_json* opt, sane_opt_provider* from, const char* group = nullptr); void insert_option(gb_json* opt, sane_opt_provider* from, const char* group = nullptr);
bool arrange_raw_json(sane_opt_provider* sop); // create origin_ and re-arrange groups bool arrange_raw_json(sane_opt_provider* sop); // create origin_ and re-arrange groups
void init_depends(gb_json* opt); void init_depends(gb_json* opt);
@ -195,6 +197,8 @@ class device_option : public refer
bool to_now(bool init, bool* changed); bool to_now(bool init, bool* changed);
int update_provider_value(const char* name, void* value, bool skip_first = false/*readonly value should skip first*/); int update_provider_value(const char* name, void* value, bool skip_first = false/*readonly value should skip first*/);
void remove_provider(gb_json* root, sane_opt_provider* sop); void remove_provider(gb_json* root, sane_opt_provider* sop);
void remove_empty_group(gb_json* root);
bool is_hidden_option(gb_json* opt);
protected: protected:
static std::string option_value(gb_json* jsn, bool def_val); static std::string option_value(gb_json* jsn, bool def_val);

View File

@ -11,17 +11,34 @@
// json ... // json ...
static std::string device_opt_json[] = { static std::string device_opt_json[] = {
"{\"user-name\":{\"cat\":\"none\",\"group\":\"\\u7528\\u6237\",\"title\":\"\\u7528\\u6237\\u540d\",\"desc\":\"\\u767b\\u5f55\\u7528\\u6237\\u8d26\\u53f7\",\"type\":\"string\",\"fix-id\":39173,\"ui-pos\":10,\"auth\":0,\"size\":32,\"cur\":\"\",\"default\":\"\"},\"user-pwd\":{\"cat\":\"none\",\"group\":\"\\u7528\\u6237\",\"title\":\"\\u5bc6\\u7801\",\"desc\":\"\\u767b\\u5f55\\u7528\\u6237\\u8d26\\u53f7\\u5bc6\\u7801\",\"type\":\"string\",\"fix-id\":39174,\"ui-pos\":11,\"auth\":0,\"size\":32,\"cur\":\"\",\"default\":\"\"},\"login\":{\"cat\":\"none\",\"group\":\"\\u7528\\u6237\",\"title\":\"\\u767b\\u5f55\",\"desc\":\"\\u7528\\u6237\\u767b\\u5f55\",\"type\":\"button\",\"fix-id\":39168,\"ui-pos\":20,\"auth\":0,\"affect\":6,\"size\":4,\"auto\":false},\"logout\":{\"cat\":\"none\",\"group\":\"\\u7528\\u6237\",\"title\":\"\\u6ce8\\u9500\",\"desc\":\"\\u7528\\u6237\\u767b\\u51fa\",\"type\":\"button\",\"fix-id\":39169,\"ui-pos\":21,\"auth\":0,\"affect\":6,\"size\":4,\"auto\":false},\"dev-sn\":{\"cat\":\"base\",\"group\":\"\\u5173\\u4e8e\",\"title\":\"\\u5e8f\\u5217\\u53f7\",\"desc\":\"\\u8bbe\\u5907\\u5e8f\\u5217\\u53f7\",\"type\":\"string\",\"pos\":100,\"fix-id\":34902,\"ui-pos\":14,\"auth\":0,\"size\":32,\"auto\":false,\"cur\":\"\",\"default\":\"\"}}" "{\"login-hint\":{\"cat\":\"none\",\"group\":\"user\",\"title\":\"\\u767b\\u5f55\\u63d0\\u793a\",\"desc\":\"\\u767b\\u5f55\\u5e10\\u6237\\u63d0\\u793a\",\"type\":\"string\",\"ui-pos\":10,\"auth\":0,\"readonly\":true,\"size\":32,\"ownread\":true,\"cur\":\"\",\"default\":\"\"},\"user-name\":{\"cat\":\"none\",\"group\":\"user\",\"title\":\"\\u7528\\u6237\\u540d\",\"desc\":\"\\u767b\\u5f55\\u7528\\u6237\\u8d26\\u53f7\",\"type\":\"string\",\"fix-id\":39173,\"ui-pos\":15,\"auth\":0,\"size\":32,\"cur\":\"\",\"default\":\"\"},\"user-pwd\":{\"cat\":\"none\",\"group\":\"user\",\"title\":\"\\u5bc6\\u7801\",\"desc\":\"\\u767b\\u5f55\\u7528\\u6237\\u8d26\\u53f7\\u5bc6\\u7801\",\"type\":\"string\",\"fix-id\":39174,\"ui-pos\":16,\"auth\":0,\"size\":32,\"cur\":\"\",\"default\":\"\"},\"login\":{\"cat\":\"none\",\"group\":\"user\",\"title\":\"\\u767b\\u5f55\",\"desc\":\"\\u7528\\u6237\\u767b\\u5f55\",\"type\":\"button\",\"fix-id\":39168,\"ui-pos\":20,\"auth\":0,\"affect\":6,\"size\":4,\"auto\":false},\"logout\":{\"cat\":\"none\",\"group\":\"user\",\"title\":\"\\u6ce8\\u9500\",\"desc\":\"\\u7528\\u6237\\u767b\\u51fa\",\"type\":\"button\",\"fix-id\":39169,\"ui-pos\":21,\"auth\":0,\"affect\":6,\"size\":4,\"auto\":false},\"dev-sn\":{\"cat\":\"base\",\"group\":\"about\",\"title\":\"\\u5e8f\\u5217\\u53f7\",\"desc\":\"\\u8bbe\\u5907\\u5e8f\\u5217\\u53f7\",\"type\":\"string\",\"pos\":100,\"fix-id\":34902,\"ui-pos\":14,\"auth\":0,\"size\":32,\"auto\":false,\"cur\":\"\",\"default\":\"\"}}"
}; };
static bool check_user_password(const char* pwd, void* param)
{
return true;
}
static bool check_admin_password(const char* pwd, void* param)
{
return STRICMP(pwd, "HuaGoScan") == 0;
}
static bool check_owner_password(const char* pwd, void* param)
{
return STRICMP(pwd, "HuaGoScan") == 0;
}
static bool check_dev_password(const char* pwd, void* param)
{
return STRICMP(pwd, "HuaGoScan") == 0;
}
struct struct
{ {
std::string name; std::string name;
int priv; int priv;
}g_user_priv[] = { {"user", USER_PRIVILEGE_COMMON} bool(*chkpwd)(const char* pwd, void* param);
, {"admin", USER_PRIVILEGE_LOCAL_MGR} }g_user_priv[] = { {"user", USER_PRIVILEGE_COMMON, check_user_password} // no password needed
, {"owner", USER_PRIVILEGE_TECH_SUPPORTING} , {"admin", USER_PRIVILEGE_LOCAL_MGR, check_admin_password} // fixed password - "HuaGoScan"
, {"developer", USER_PRIVILEGE_DEVLOPER} , {"owner", USER_PRIVILEGE_TECH_SUPPORTING, check_owner_password} // calc - 1, valid in 1 hour
, {"developer", USER_PRIVILEGE_DEVLOPER, check_dev_password} // calc - 2, valid in 5 minutes
}; };
static std::string base64_table = "!@#$_~=;/+"; static std::string base64_table = "!@#$_~=;/+";
@ -34,14 +51,6 @@ user_priv::user_priv()
simple_ini ini; simple_ini ini;
std::string text(""); std::string text("");
cfg_file_ = utils::get_local_data_path() + PATH_SEPARATOR + "config";
utils::create_folder(cfg_file_.c_str());
cfg_file_ += std::string(PATH_SEPARATOR) + "user.txt";
ini.load(cfg_file_.c_str());
for(auto& v: g_user_priv)
login_times_[v.name] = atoi(ini.get(v.name.c_str(), "login", "0").c_str());
set_where("user"); set_where("user");
for(auto& v : device_opt_json) for(auto& v : device_opt_json)
text += v; text += v;
@ -49,15 +58,6 @@ user_priv::user_priv()
} }
user_priv::~user_priv() user_priv::~user_priv()
{ {
simple_ini ini;
ini.load(cfg_file_.c_str());
for(auto& v: login_times_)
{
if(v.second)
ini.set(v.first.c_str(), "login", std::to_string(v.second).c_str());
}
ini.save(cfg_file_.c_str());
} }
bool user_priv::login(void) bool user_priv::login(void)
@ -68,14 +68,7 @@ bool user_priv::login(void)
{ {
if(v.name == name_) if(v.name == name_)
{ {
if(name_ == "user") ok = v.chkpwd(pwd_.c_str(), &hint_[0]);
{
ok = true;
}
else
{
ok = true;
}
break; break;
} }
} }
@ -102,7 +95,16 @@ int user_priv::set_value(const char* name, void* val)
if(strcmp(name, SANE_OPT_NAME(USER_NAME)) == 0) if(strcmp(name, SANE_OPT_NAME(USER_NAME)) == 0)
{ {
name_ = (char*)val; ret = SCANNER_ERR_INVALID_USER_NAME;
for(auto& v: g_user_priv)
{
if(v.name == (char*)val)
{
ret = SCANNER_ERR_OK;
name_ = (char*)val;
break;
}
}
priv_ = USER_PRIVILEGE_COMMON; priv_ = USER_PRIVILEGE_COMMON;
} }
else if(strcmp(name, SANE_OPT_NAME(USER_PASSWORD)) == 0) else if(strcmp(name, SANE_OPT_NAME(USER_PASSWORD)) == 0)
@ -119,31 +121,31 @@ int user_priv::set_value(const char* name, void* val)
else if(strcmp(name, SANE_OPT_NAME(LOGIN)) == 0) else if(strcmp(name, SANE_OPT_NAME(LOGIN)) == 0)
{ {
// login ... // login ...
if(login_times_.count(name) == 0) int prev = priv_;
if(name_.empty())
{ {
ret = SCANNER_ERR_INVALID_USER_NAME; ret = SCANNER_ERR_INVALID_USER_NAME;
} }
else if(login())
{
reset_privilege();
}
else else
{ {
if(login()) ret = SCANNER_ERR_INVALID_PASSWORD;
{
simple_ini ini;
ini.load(cfg_file_.c_str());
login_times_[name]++;
reset_privilege();
ini.set(name, "login", std::to_string(login_times_[name]).c_str());
}
else
{
ret = SCANNER_ERR_INVALID_PASSWORD;
}
} }
if(prev != priv_)
ret = SCANNER_ERR_CONFIGURATION_CHANGED;
*(int*)val = priv_;
} }
else if(strcmp(name, SANE_OPT_NAME(LOGOUT)) == 0) else if(strcmp(name, SANE_OPT_NAME(LOGOUT)) == 0)
{ {
int prev = priv_;
name_ = pwd_ = ""; name_ = pwd_ = "";
reset_privilege(); reset_privilege();
*(int*)val = priv_;
if(prev != priv_)
ret = SCANNER_ERR_CONFIGURATION_CHANGED;
} }
else else
{ {
@ -152,16 +154,30 @@ int user_priv::set_value(const char* name, void* val)
return ret; return ret;
} }
char* user_priv::get_value(const char* name, void* value, size_t* size, int* err)
{
char *ret = nullptr;
int e = SCANNER_ERR_DEVICE_NOT_FOUND;
if(strcmp(name, SANE_OPT_NAME(USER_LOGIN_HINT)) == 0)
{
ret = (char*)malloc(hint_.length() + 1);
memcpy(ret, hint_.c_str(), hint_.length());
ret[hint_.length()] = 0;
e = SCANNER_ERR_OK;
}
if(err)
*err = e;
return ret;
}
bool user_priv::has_privilege(int priv) bool user_priv::has_privilege(int priv)
{ {
return priv_ >= priv; return priv_ >= priv;
} }
int user_priv::get_current_user_login_times(void) int user_priv::get_current_privilege(void)
{ {
if(login_times_.count(name_)) return priv_;
return login_times_[name_];
else
return 0;
} }

View File

@ -24,11 +24,10 @@
class user_priv : public sane_opt_provider class user_priv : public sane_opt_provider
{ {
std::map<std::string, int> login_times_; std::string hint_ = "";
std::string cfg_file_;
std::string dev_sn_ = "01234567AABBCCDDEE"; std::string dev_sn_ = "01234567AABBCCDDEE";
std::string name_; std::string name_ = "";
std::string pwd_; std::string pwd_ = "";
int priv_ = USER_PRIVILEGE_COMMON; int priv_ = USER_PRIVILEGE_COMMON;
@ -44,9 +43,10 @@ protected:
// sane_opt_provider // sane_opt_provider
public: public:
virtual int set_value(const char* name, void* val) override; virtual int set_value(const char* name, void* val) override;
virtual char* get_value(const char* name, void* value, size_t* size, int* err) override;
public: public:
bool has_privilege(int priv); bool has_privilege(int priv);
int get_current_user_login_times(void); int get_current_privilege(void);
}; };

View File

@ -582,6 +582,16 @@ ui_mgr::ui_mgr() : disp_data_("lcd-msg")
if(!display_status(&msg)) if(!display_status(&msg))
set_ready_status_enabled(true); set_ready_status_enabled(true);
} }
else if(pack->msg == devui::UI_CMD_GET_HISTORY_COUNT)
{
uint32_t cnt = (uint32_t)perm_data_->history_count();
devui::send_message(pack->msg, (uint8_t*)&cnt, sizeof(cnt));
}
else if(pack->msg == devui::UI_CMD_GET_ROLLER_COUNT)
{
uint32_t cnt = (uint32_t)perm_data_->roller_count();
devui::send_message(pack->msg, (uint8_t*)&cnt, sizeof(cnt));
}
}; };
devui::init_ui(statu, true); devui::init_ui(statu, true);
} }

View File

@ -60,8 +60,8 @@ add_packagedirs("sdk")
add_defines("BUILD_AS_DEVICE") add_defines("BUILD_AS_DEVICE")
add_defines("VER_MAIN=2") add_defines("VER_MAIN=2")
add_defines("VER_FAMILY=200") add_defines("VER_FAMILY=200")
add_defines("VER_DATE=20240309") add_defines("VER_DATE=20240312")
add_defines("VER_BUILD=12") add_defines("VER_BUILD=7")
target("conf") target("conf")
set_kind("phony") set_kind("phony")