code_production/code/base/test_base.cpp

239 lines
33 KiB
C++
Raw Normal View History

2022-12-08 10:10:19 +00:00
#include"test_base.h"
#include<string>
#include <stdio.h>
#include <windows.h>
#include <map>
#include <iostream>
static struct Test_Map
{
const wchar_t* name; //test-1
const wchar_t* title; //"<22><>б<EFBFBD><D0B1><EFBFBD><EFBFBD>"
const int ver;
io_code num;
2022-12-12 02:33:25 +00:00
2022-12-08 10:10:19 +00:00
}Test_Map_NO[] =
{
2022-12-12 02:33:25 +00:00
{HGPDTTOOLDB_NAME_DIAL_SWITCH ,HGPDTTOOLDB_TITLE_DIAL_SWITCH ,0,IO_CTRL_CODE_BASE},
{HGPDTTOOLDB_NAME_ROCKER_SWITCH ,HGPDTTOOLDB_TITLE_ROCKER_SWITCH ,0,IO_CTRL_CODE_BASE},
{HGPDTTOOLDB_NAME_BOOT_STATUS ,HGPDTTOOLDB_TITLE_BOOT_STATUS ,0,IO_CTRL_CODE_BASE},
{HGPDTTOOLDB_NAME_LCD_DISPLAY ,HGPDTTOOLDB_TITLE_LCD_DISPLAY ,0,IO_CTRL_CODE_BASE},
{HGPDTTOOLDB_NAME_KEY_FUNCTION ,HGPDTTOOLDB_TITLE_KEY_FUNCTION ,0,IO_CTRL_CODE_BASE},
{HGPDTTOOLDB_NAME_COUNTING_MODE ,HGPDTTOOLDB_TITLE_COUNTING_MODE ,0,IO_CTRL_CODE_BASE},
{HGPDTTOOLDB_NAME_CIS_ORIGINAL_IMAGE,HGPDTTOOLDB_TITLE_CIS_ORIGINAL_IMAGE ,0,IO_CTRL_CODE_BASE},
{HGPDTTOOLDB_NAME_HOST_FAN ,HGPDTTOOLDB_TITLE_HOST_FAN ,0,IO_CTRL_CODE_BASE},
{HGPDTTOOLDB_NAME_LED_LIGHT ,HGPDTTOOLDB_TITLE_LED_LIGHT ,0,IO_CTRL_CODE_BASE},
{HGPDTTOOLDB_NAME_RESET ,HGPDTTOOLDB_TITLE_RESET ,0,IO_CTRL_CODE_BASE},
{HGPDTTOOLDB_NAME_PAPER_FEED ,HGPDTTOOLDB_TITLE_PAPER_FEED ,0,IO_CTRL_CODE_BASE}, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{HGPDTTOOLDB_NAME_SCANNING_SENSOR ,HGPDTTOOLDB_TITLE_SCANNING_SENSOR ,0,IO_CTRL_CODE_BASE},//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{HGPDTTOOLDB_NAME_PLACE_CORRECTION_PAPER,HGPDTTOOLDB_TITLE_PLACE_CORRECTION_PAPER ,0,IO_CTRL_CODE_BASE},
{HGPDTTOOLDB_NAME_AUTO_FLAT_FIELD ,HGPDTTOOLDB_TITLE_AUTO_FLAT_FIELD ,0,IO_CTRL_CODE_BASE},//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{HGPDTTOOLDB_NAME_IMAGE_QUALITY ,HGPDTTOOLDB_TITLE_IMAGE_QUALITY ,0,IO_CTRL_CODE_BASE},
{HGPDTTOOLDB_NAME_COLORCARD_IMAGEING_QUALITY ,HGPDTTOOLDB_TITLE_COLORCARD_IMAGEING_QUALITY ,0,IO_CTRL_CODE_BASE},
{HGPDTTOOLDB_NAME_COLORCARD_BIAS_IMAGEING_QUALITY ,HGPDTTOOLDB_TITLE_COLORCARD_BIAS_IMAGEING_QUALITY ,0,IO_CTRL_CODE_BASE},
{HGPDTTOOLDB_NAME_CLARITY_QUALITY ,HGPDTTOOLDB_TITLE_CLARITY_QUALITY ,0,IO_CTRL_CODE_BASE},
{HGPDTTOOLDB_NAME_DISTORTION ,HGPDTTOOLDB_TITLE_DISTORTION ,0,IO_CTRL_CODE_BASE},
{HGPDTTOOLDB_NAME_SEPARATER_MOTOR ,HGPDTTOOLDB_TITLE_SEPARATER_MOTOR ,0,IO_CTRL_CODE_BASE},
2022-12-08 10:10:19 +00:00
},
Test_Map_Bool[]
{
2022-12-12 02:33:25 +00:00
{HGPDTTOOLDB_NAME_CLEAR_PAPER_PATH ,HGPDTTOOLDB_TITLE_CLEAR_PAPER_PATH ,0,IO_CTRL_CODE_GET_CLEAN_PAPER_ROAD},
{HGPDTTOOLDB_NAME_SKEW_DETECTION ,HGPDTTOOLDB_TITLE_SKEW_DETECTION ,0,IO_CTRL_CODE_SET_SKEW_CHECK},
{HGPDTTOOLDB_NAME_ULTRASONIC_MODULE ,HGPDTTOOLDB_TITLE_ULTRASONIC_MODULE ,0,IO_CTRL_CODE_BASE},
{HGPDTTOOLDB_NAME_COVER_SENSOR ,HGPDTTOOLDB_TITLE_COVER_SENSOR ,0,IO_CTRL_CODE_BASE},
{HGPDTTOOLDB_NAME_REBOOT_DEVICE ,HGPDTTOOLDB_TITLE_REBOOT_DEVICE ,0,IO_CTRL_CODE_BASE},
{HGPDTTOOLDB_NAME_MECH_PAPER_FEEDING_INCLINATION,HGPDTTOOLDB_TITLE_MECH_PAPER_FEEDING_INCLINATION ,0,IO_CTRL_CODE_BASE},
{HGPDTTOOLDB_NAME_CLEAR_ROLLER_COUNT ,HGPDTTOOLDB_TITLE_CLEAR_ROLLER_COUNT,0,IO_CTRL_CODE_SET_CLEAR_ROLLER_COUNT},
2022-12-08 10:10:19 +00:00
},
Test_Map_String[]
{
2022-12-12 02:33:25 +00:00
{HGPDTTOOLDB_NAME_CLEAR_ROLLER_COUNT ,HGPDTTOOLDB_TITLE_CLEAR_ROLLER_COUNT,0,IO_CTRL_CODE_SET_CLEAR_ROLLER_COUNT},
2022-12-08 10:10:19 +00:00
},
Test_Map_Int[]
{
2022-12-12 02:33:25 +00:00
{HGPDTTOOLDB_NAME_PAPER_SEPARATION_STRENGTH ,HGPDTTOOLDB_TITLE_PAPER_SEPARATION_STRENGTH,0,IO_CTRL_CODE_SET_FEEDMODE},
{HGPDTTOOLDB_NAME_CONFIGURE_SPEED_MODE ,HGPDTTOOLDB_TITLE_CONFIGURE_SPEED_MODE ,0,IO_CTRL_CODE_BASE},
{HGPDTTOOLDB_NAME_DORMANCY ,HGPDTTOOLDB_TITLE_DORMANCY ,0,IO_CTRL_CODE_SET_POWER_LEVEL},
{HGPDTTOOLDB_NAME_SKEW_GEAR ,HGPDTTOOLDB_TITLE_SKEW_GEAR,0,IO_CTRL_CODE_SET_SKEW_CHECK_VAL},
{HGPDTTOOLDB_NAME_SINGLE_PAGE_TEST_1 ,HGPDTTOOLDB_TITLE_SINGLE_PAGE_TEST_1,0,IO_CTRL_CODE_TEST_SINGLE},
{HGPDTTOOLDB_NAME_SINGLE_PAGE_TEST_2 ,HGPDTTOOLDB_TITLE_SINGLE_PAGE_TEST_2,0,IO_CTRL_CODE_TEST_SINGLE},
{HGPDTTOOLDB_NAME_SINGLE_PAGE_TEST_3 ,HGPDTTOOLDB_TITLE_SINGLE_PAGE_TEST_3,0,IO_CTRL_CODE_TEST_SINGLE},
{HGPDTTOOLDB_NAME_PRESSUER_TEST ,HGPDTTOOLDB_TITLE_PRESSUER_TEST ,0,IO_CTRL_CODE_BASE},
2022-12-08 10:10:19 +00:00
};
//test
static std::string jsontext1("{\"global\":{\"device_type\":\"G139-G239\",\"option_count\":75},\"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!=true\"]},\"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},\"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\\u767d\
static std::string jsontext2("ase\",\"title\":\"\\u56fe\\u50cf\\u62c6\\u5206\",\"desc\":\"\\u81ea\\u52a8\\u62c6\\u5206\\u56fe\\u50cf\",\"type\":\"bool\",\"cur\":false,\"default\":false,\"size\":4,\"depend_and\":[\"page!=\\u5bf9\\u6298\",\"!=\\u8df3\\u8fc7\\u7a7a\\u767d\\u9875\\uff08\\u53d1\\u7968\\u7eb8\\uff09\",\"!=\\u8df3\\u8fc7\\u7a7a\\u767d\\u9875\\uff08\\u901a\\u7528\\uff09\"]},\"is-erase-black-frame\":{\"category\":\"base\",\"title\":\"\\u6d88\\u9664\\u9ed1\\u6846\",\"desc\":\"\\u6d88\\u9664\\u6587\\u7a3f\\u8303\\u56f4\\u5916\\u7684\\u9ed1\\u8272\\u80cc\\u666f\",\"type\":\"bool\",\"cur\":true,\"default\":true,\"size\":4},\"bkg-fill-mode\":{\"category\":\"advanced\",\"title\":\"\\u80cc\\u666f\\u586b\\u5145\\u65b9\\u5f0f\",\"desc\":\"\\u9009\\u62e9\\u80cc\\u666f\\u586b\\u5145\\u65b9\\u5f0f\",\"type\":\"string\",\"cur\":\"\\u51f8\\u591a\\u8fb9\\u5f62\",\"default\":\"\\u51f8\\u591a\\u8fb9\\u5f62\",\"size\":40,\"range\":[\"\\u51f8\\u591a\\u8fb9\\u5f62\",\"\\u51f9\\u591a\\u8fb9\\u5f62\"],\"depend_or\":[\"is-erase-black-frame==true\"]},\"is-fill-color\":{\"category\":\"base\",\"title\":\"\\u8272\\u5f69\\u586b\\u5145\",\"desc\":\"\\u542f\\u7528\\u540e\\u9ed1\\u6846\\u90e8\\u5206\\u5c06\\u586b\\u5145\\u4e3a\\u6587\\u7a3f\\u5e95\\u8272\",\"type\":\"bool\",\"cur\":false,\"default\":false,\"size\":4,\"depend_and\":[\"is-erase-black-frame==true\"]},\"threshold\":{\"category\":\"advanced\",\"title\":\"\\u9608\\u503c\",\"desc\":\"\\u6587\\u7a3f\\u5e95\\u8272\\u4e0e\\u9ed1\\u8272\\u80cc\\u666f\\u7070\\u5ea6\\u503c\\u7684\\u5dee\\u503c\\u5927\\u4e8e\\u8be5\\u503c\\uff0c\\u624d\\u4f1a\\u88ab\\u8bc6\\u522b\\u4e3a\\u6587\\u7a3f\",\"type\":\"int\",\"cur\":40,\"default\":40,\"size\":4,\"range\":{\"min\":30,\"max\":50},\"depend_or\":[\"is-erase-black-frame==true\",\"paper==\\u5339\\u914d\\u539f\\u59cb\\u5c3a\\u5bf8\",\"==\\u6700\\u5927\\u626b\\u63cf\\u5c3a\\u5bf8\",\"==\\u6700\\u5927\\u626b\\u63cf\\u5c3a\\u5bf8\\u81ea\\u52a8\\u88c1\\u5207\",\"is-anti-skew==true\"]},\"anti-noise-level\":{\"category\":\"advanced\",\"title\":\"\\u80cc\\u666f\\u6297\\u566a\\u7b49\\u7ea7\",\"desc\":\"\\u80fd\\u591f\\u5bb9\\u5fcd\\u7684\\u80cc\\u666f\\u6742\\u8272\\u6761\\u7eb9\\u7684\\u5bbd\\u5ea6\",\"type\":\"int\",\"cur\":8,\"default\":8,\"size\":4,\"range\":{\"min\":1,\"max\":20},\"depend_or\":[\"is-erase-black-frame==true\",\"paper==\\u5339\\u914d\\u539f\\u59cb\\u5c3a\\u5bf8\",\"==\\u6700\\u5927\\u626b\\u63cf\\u5c3a\\u5bf8\",\"==\\u6700\\u5927\\u626b\\u63cf\\u5c3a\\u5bf8\\u81ea\\u52a8\\u88c1\\u5207\",\"is-anti-skew==true\"]},\"margin\":{\"category\":\"advanced\",\"title\":\"\\u8fb9\\u7f18\\u7f29\\u8fdb\",\"desc\":\"\\u5bfb\\u627e\\u6587\\u7a3f\\u8fb9\\u7f18\\u65f6\\u5bf9\\u8fb9\\u7f18\\u7684\\u4fb5\\u5165\\u7a0b\\u5ea6\",\"type\":\"int\",\"cur\":5,\"default\":5,\"size\":4,\"range\":{\"min\":5,\"max\":30},\"depend_or\":[\"is-erase-black-frame==true\",\"paper==\\u5339\\u914d\\u539f\\u59cb\\u5c3a\\u5bf8\",\"==\\u6700\\u5927\\u626b\\u63cf\\u5c3a\\u5bf8\\u81ea\\u52a8\\u88c1\\u5207\",\"==\\u6700\\u5927\\u626b\\u63cf\\u5c3a\\u5bf8\",\"is-anti-skew==true\"]},\"is-dark-sample\":{\"category\":\"base\",\"title\":\"\\u6df1\\u8272\\u6837\\u5f20\",\"desc\":\"\\u542f\\u7528\\u8be5\\u6a21\\u5f0f\\u9632\\u6b62\\u6df1\\u8272\\u5e95\\u8272\\u7684\\u6587\\u7a3f\\u56fe\\u50cf\\u88ab\\u8bef\\u5904\\u7406\",\"type\":\"bool\",\"cur\":false,\"default\":false,\"size\":4,\"depend_and\":[\"page!=\\u5bf9\\u6298\",\"is-erase-black-frame!=true\",\"paper!=\\u5339\\u914d\\u539f\\u59cb\\u5c3a\\u5bf8\",\"!=\\u6700\\u5927\\u626b\\u63cf\\u5c3a\\u5bf8\",\"!=\\u6700\\u5927\\u626b\\u63cf\\u5c3a\\u5bf8\\u81ea\\u52a8\\u88c1\\u5207\",\"is-anti-skew!=true\"]},\"is-anti-permeate\":{\"category\":\"base\",\"title\":\"\\u9632\\u6b62\\u6e17\\u900f\",\"desc\":\"\\u9632\\u6b62\\u80cc\\u9762\\u56fe\\u6848\\u6e17\\u900f\",\"type\":\"bool\",\"cur\":false,\"default\":false,\"size\":4},\"permeate-level\":{\"category\":\"base\",\"title\":\" \\u9632\\u6b62\\u6e17\\u900f\\u7b49\\u7ea7\",\"desc\":\"\\u9009\\u62e9\\u9632\\u6b62\\u6e17\\u900f\\u7684\\u7b49\\u7ea7\",\"type\":\"string\",\"cur\":\"\\u8f83\\u5f31\",\"d
int sane_ex_callback(SANE_Handle hdev, int code, void* data, unsigned int* len, void* param)
{
switch (code)
{
case SANE_EVENT_DEVICE_ARRIVED:
{
SANE_Device* sane_dev = (SANE_Device*)data;
}
break;
case SANE_EVENT_DEVICE_LEFT:
{
SANE_Device* sane_dev = (SANE_Device*)data;
}
break;
case SANE_EVENT_WORKING:
{
std::string str = (char*)data;
}
break;
case SANE_EVENT_SCAN_FINISHED:
{
std::string str = (char*)data;
}
break;
case SANE_EVENT_STATUS:
{
std::string str = (char*)data;
}
break;
case SANE_EVENT_ERROR:
{
std::string str = (char*)data;
}
break;
case SANE_EVENT_IMAGE_OK:
{
SANE_Image* sane_img = (SANE_Image*)data;
}
break;
}
return 0;
}
int str_to_wchar(std::string str, wchar_t* s, size_t* strlen)
{
if (str.empty())
return ERROR_INSUFFICIENT_BUFFER;
size_t size = str.length();
int len = 0;
len = MultiByteToWideChar(CP_UTF8, 0, str.c_str(), -1, NULL, 0);
if (*strlen < len)
{
*strlen = len;
return ERROR_INSUFFICIENT_BUFFER;
}
MultiByteToWideChar(CP_UTF8, 0, str.c_str(), -1, s, len);
return 0;
}
int get_json_config_file()
{
int len = 0;
char exePath[256];
char* buf = NULL;
GetModuleFileNameA(NULL, exePath, 255);
(strrchr(exePath, '\\'))[1] = 0; //ȥ<><C8A5>ִ<EFBFBD>е<EFBFBD><D0B5>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
strcat(exePath, "DLLs\\G302.hsc");
FILE* fp = fopen(exePath, "rb");
if (fp == NULL)
{
return -1;
}
fseek(fp, 0, SEEK_END);
len = ftell(fp);
fseek(fp, 0, SEEK_SET);
buf = new char[len];
if (!buf)
{
fclose(fp);
return -1;
}
memset(buf, 0, len);
fread(buf, len, 1, fp);
fclose(fp);
std::cout << buf << std::endl;
}
int func_test_init(void* init)
{
return 0;
}
int func_test_get_list(wchar_t* buf, size_t* len)
{
return str_to_wchar(jsontext1+ jsontext2, buf, len);
}
int func_test_go(const wchar_t* name, const wchar_t* oper, ui_helper* helper)
{
if (!name || !oper || !helper)
{
return -1;
}
helper->add_ref();
helper->register_sane_callback(sane_ex_callback, NULL);
bool flag = false;
wchar_t* des = NULL;
int ret = 0;
2022-12-12 02:33:25 +00:00
size_t map_bool_len = sizeof(Test_Map_Bool) / sizeof(Test_Map_Bool[0]);
size_t map_str_len = sizeof(Test_Map_String) / sizeof(Test_Map_String[0]);
size_t map_int_len = sizeof(Test_Map_Int) / sizeof(Test_Map_Int[0]);
2022-12-08 10:10:19 +00:00
ui_helper::test_event ev = ui_helper::TEST_EVENT_TIPS; //<2F><>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>TEST_EVENT_TIPS<50><53><EFBFBD><EFBFBD><EFBFBD>Խ<EFBFBD><D4BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>TEST_EVENT_RESULT
2022-12-12 02:33:25 +00:00
for (size_t i = 0; i < map_bool_len + map_str_len + map_int_len; i++)
2022-12-08 10:10:19 +00:00
{
des = (wchar_t*)Test_Map_Bool[i].title;
if (wcscmp(name, Test_Map_Bool[i].name) == 0) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Dz<EFBFBD><C7B2><EFBFBD><E1B4AB><EFBFBD><EFBFBD>
{
SANE_Bool map_bool = true;
unsigned int len = sizeof(SANE_Bool);
ret = helper->io_control(Test_Map_Bool[i].num,&map_bool, &len);
if (ret == SCANNER_ERR_OK)
{
ev = ui_helper::TEST_EVENT_RESULT;
helper->test_callback(Test_Map_Bool[i].name, ev, des, true);
map_bool = false;
ret = helper->io_control(Test_Map_Bool[i].num, &map_bool, &len);
return SCANNER_ERR_OK;
}
}
else if(wcscmp(name, Test_Map_String[i].name) == 0)
{
if (wcscmp(name, HGPDTTOOLDB_NAME_PAPER_SEPARATION_STRENGTH) == 0)
{
}
return SCANNER_ERR_OK;
}
2022-12-12 02:33:25 +00:00
else if (wcscmp(name, Test_Map_Int[i].name) == 0)
2022-12-08 10:10:19 +00:00
{
return SCANNER_ERR_OK;
}
}
helper->release();
helper->unregister_sane_callback(sane_ex_callback);
return SCANNER_ERR_OK;
}
int func_test_uninit(void* uninit)
{
return 0;
}
int main()
{
get_json_config_file();
int ret = 0;
wchar_t* str_wchar = NULL;
size_t len = 0;
ret = func_test_get_list(str_wchar, &len);
if (ret == ERROR_INSUFFICIENT_BUFFER)
{
str_wchar = new wchar_t[len];
ret = func_test_get_list(str_wchar, &len);
}
ret = func_test_go(L"test-5",L"start",NULL);
//std::wcout << str_wchar << std::endl;
}