2022-12-08 10:10:19 +00:00
|
|
|
|
#include"test_base.h"
|
|
|
|
|
#include<string>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <windows.h>
|
|
|
|
|
#include <map>
|
|
|
|
|
#include <iostream>
|
2022-12-14 06:58:06 +00:00
|
|
|
|
#include "huagao/hgscanner_error.h"
|
2022-12-08 10:10:19 +00:00
|
|
|
|
|
2022-12-15 11:53:41 +00:00
|
|
|
|
|
2022-12-26 09:18:25 +00:00
|
|
|
|
|
|
|
|
|
static 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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static std::wstring set_test_name_;
|
2022-12-15 11:53:41 +00:00
|
|
|
|
class test
|
2022-12-08 10:10:19 +00:00
|
|
|
|
{
|
2022-12-15 11:53:41 +00:00
|
|
|
|
ui_helper* helper_;
|
2022-12-26 09:18:25 +00:00
|
|
|
|
|
2022-12-15 11:53:41 +00:00
|
|
|
|
public:
|
2022-12-26 09:18:25 +00:00
|
|
|
|
|
|
|
|
|
static int sane_ex_callback(SANE_Handle hdev, int code, void* data, unsigned int* len, void* param)
|
|
|
|
|
{
|
|
|
|
|
if (!hdev && !param)
|
|
|
|
|
{
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
ui_helper* h= (ui_helper*)param;
|
|
|
|
|
switch (code)
|
|
|
|
|
{
|
|
|
|
|
case SANE_EVENT_WORKING:
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case SANE_EVENT_SCAN_FINISHED:
|
|
|
|
|
{
|
|
|
|
|
std::wstring wstr = L"";
|
|
|
|
|
size_t len = 0;
|
|
|
|
|
bool type = false;
|
|
|
|
|
int ret = str_to_wchar((char*)data, (wchar_t*)wstr.c_str(),&len);
|
|
|
|
|
if (ret == ERROR_INSUFFICIENT_BUFFER)
|
|
|
|
|
ret = str_to_wchar((char*)data, (wchar_t*)wstr.c_str(), &len);
|
|
|
|
|
if (ret == ERROR_INSUFFICIENT_BUFFER)
|
|
|
|
|
{
|
|
|
|
|
h->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)wstr.c_str(), type);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-27 08:26:41 +00:00
|
|
|
|
if (wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_SKEW_DETECTION) == 0)
|
2022-12-26 09:18:25 +00:00
|
|
|
|
{
|
|
|
|
|
type = strcmp((char*)data, STATU_DESC_SCANNER_ERR_DEVICE_PAPER_SKEW) == 0 ? true : false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
h->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)wstr.c_str(), type);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case SANE_EVENT_STATUS:
|
|
|
|
|
{
|
|
|
|
|
//std::string ret_call_ = (char*)data;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case SANE_EVENT_ERROR:
|
|
|
|
|
{
|
|
|
|
|
//ret_call_ = (char*)data;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case SANE_EVENT_IMAGE_OK:
|
|
|
|
|
{
|
2022-12-27 08:26:41 +00:00
|
|
|
|
if (wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_CIS_ORIGINAL_IMAGE) == 0 ||
|
|
|
|
|
wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_IMAGE_QUALITY) == 0)
|
|
|
|
|
{
|
|
|
|
|
if (wcscmp(set_test_name_.c_str(), HGPDTTOOLDB_NAME_CIS_ORIGINAL_IMAGE) == 0)
|
|
|
|
|
{
|
|
|
|
|
SANE_Bool type = false;
|
|
|
|
|
unsigned int len = sizeof(SANE_Bool);
|
|
|
|
|
h->io_control(IO_CTRL_CODE_SET_CIS_IMAGE, &type, &len); //ʹ<><CAB9><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD>Ĭ<EFBFBD><C4AC>
|
|
|
|
|
}
|
|
|
|
|
h->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_HAVE_IMAGE, data, true);
|
|
|
|
|
}
|
2022-12-26 09:18:25 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2022-12-15 11:53:41 +00:00
|
|
|
|
test(ui_helper* helper) :helper_(helper)
|
2022-12-23 02:39:07 +00:00
|
|
|
|
{
|
2022-12-26 09:18:25 +00:00
|
|
|
|
helper->register_sane_callback(sane_ex_callback, NULL);
|
2022-12-23 02:39:07 +00:00
|
|
|
|
init_test_map_();
|
|
|
|
|
}
|
2022-12-15 11:53:41 +00:00
|
|
|
|
~test()
|
|
|
|
|
{}
|
|
|
|
|
|
2022-12-23 02:39:07 +00:00
|
|
|
|
struct ptrcmp
|
|
|
|
|
{
|
2022-12-27 08:26:41 +00:00
|
|
|
|
bool operator()(const wchar_t* NAME1, const wchar_t* NAME2)const
|
2022-12-23 02:39:07 +00:00
|
|
|
|
{
|
2022-12-27 08:26:41 +00:00
|
|
|
|
return wcscmp(NAME1, NAME2) < 0;
|
2022-12-23 02:39:07 +00:00
|
|
|
|
}
|
|
|
|
|
};
|
2022-12-27 08:26:41 +00:00
|
|
|
|
std::map<std::wstring, int(test::*)(void *)> test_map_;
|
2022-12-15 11:53:41 +00:00
|
|
|
|
void init_test_map_()
|
|
|
|
|
{
|
2022-12-27 08:26:41 +00:00
|
|
|
|
test_map_[HGPDTTOOLDB_NAME_DIAL_SWITCH] = &test::test_dial_switch;
|
|
|
|
|
test_map_[HGPDTTOOLDB_NAME_ROCKER_SWITCH] = &test::test_pocker_switch;
|
|
|
|
|
test_map_[HGPDTTOOLDB_NAME_BOOT_STATUS] = &test::test_boot_status;
|
|
|
|
|
test_map_[HGPDTTOOLDB_NAME_LCD_DISPLAY] = &test::test_lcd_display;
|
|
|
|
|
test_map_[HGPDTTOOLDB_NAME_CLEAR_PAPER_PATH] = &test::tset_clear_paper_path;
|
|
|
|
|
test_map_[HGPDTTOOLDB_NAME_KEY_FUNCTION] = &test::test_key_funtion;
|
|
|
|
|
test_map_[HGPDTTOOLDB_NAME_COUNTING_MODE] = &test::test_count_mode;
|
|
|
|
|
test_map_[HGPDTTOOLDB_NAME_SKEW_DETECTION] = &test::test_skew_detection;
|
|
|
|
|
test_map_[HGPDTTOOLDB_NAME_SEPARATER_MOTOR] = &test::test_separater_motor;
|
|
|
|
|
test_map_[HGPDTTOOLDB_NAME_CIS_ORIGINAL_IMAGE] = &test::test_cis__original_image;
|
|
|
|
|
test_map_[HGPDTTOOLDB_NAME_HOST_FAN] = &test::test_host_fan;
|
|
|
|
|
test_map_[HGPDTTOOLDB_NAME_ULTRASONIC_MODULE] = &test::test_ultrasonic_module;
|
|
|
|
|
test_map_[HGPDTTOOLDB_NAME_LED_LIGHT] = &test::test_led_light;
|
|
|
|
|
test_map_[HGPDTTOOLDB_NAME_RESET] = &test::test_reset;
|
|
|
|
|
test_map_[HGPDTTOOLDB_NAME_PAPER_FEED] = &test::test_paper_feed;
|
|
|
|
|
test_map_[HGPDTTOOLDB_NAME_COVER_SENSOR] = &test::test_cover_sensor;
|
|
|
|
|
test_map_[HGPDTTOOLDB_NAME_SCANNING_SENSOR] = &test::test_scanning_sensor;
|
|
|
|
|
test_map_[HGPDTTOOLDB_NAME_CONFIGURE_SPEED_MODE] = &test::test_configure_speed_mode;
|
|
|
|
|
test_map_[HGPDTTOOLDB_NAME_PLACE_CORRECTION_PAPER] = &test::test_place_correction_paper;
|
|
|
|
|
test_map_[HGPDTTOOLDB_NAME_AUTO_FLAT_FIELD] = &test::test_auto_flat_field;
|
|
|
|
|
test_map_[HGPDTTOOLDB_NAME_REBOOT_DEVICE] = &test::test_reboot_device;
|
|
|
|
|
test_map_[HGPDTTOOLDB_NAME_IMAGE_QUALITY] = &test::test_image_quality;
|
|
|
|
|
test_map_[HGPDTTOOLDB_NAME_COLORCARD_IMAGEING_QUALITY] = &test::test_colorcard_imageing_quality;
|
|
|
|
|
test_map_[HGPDTTOOLDB_NAME_COLORCARD_BIAS_IMAGEING_QUALITY] = &test::test_colorcard_bias_imageing_quality;
|
|
|
|
|
test_map_[HGPDTTOOLDB_NAME_CLARITY_QUALITY] = &test::test_clarity_quality;
|
|
|
|
|
test_map_[HGPDTTOOLDB_NAME_DISTORTION] = &test::test_distortion;
|
|
|
|
|
test_map_[HGPDTTOOLDB_NAME_DORMANCY] = &test::test_dormancy;
|
|
|
|
|
test_map_[HGPDTTOOLDB_NAME_SKEW_GEAR] = &test::test_skew_gear;
|
|
|
|
|
test_map_[HGPDTTOOLDB_NAME_PAPER_SEPARATION_STRENGTH] = &test::test_paper_separation_strength;
|
|
|
|
|
test_map_[HGPDTTOOLDB_NAME_MECH_PAPER_FEEDING_INCLINATION] = &test::test_mech_paper_feeding_inclination;
|
|
|
|
|
test_map_[HGPDTTOOLDB_NAME_SINGLE_PAGE_TEST_1] = &test::test_single_page_test_1;
|
|
|
|
|
test_map_[HGPDTTOOLDB_NAME_SINGLE_PAGE_TEST_2] = &test::test_single_page_test_2;
|
|
|
|
|
test_map_[HGPDTTOOLDB_NAME_SINGLE_PAGE_TEST_3] = &test::test_single_page_test_3;
|
|
|
|
|
test_map_[HGPDTTOOLDB_NAME_PRESSUER_TEST] = &test::test_pressuer_test;
|
|
|
|
|
test_map_[HGPDTTOOLDB_NAME_CLEAR_ROLLER_COUNT] = &test::test_clear_roller_count;
|
2022-12-23 02:39:07 +00:00
|
|
|
|
}
|
|
|
|
|
int set_test(const wchar_t* str)
|
|
|
|
|
{
|
2022-12-27 08:26:41 +00:00
|
|
|
|
|
2022-12-23 02:39:07 +00:00
|
|
|
|
if (!str)
|
|
|
|
|
return SCANNER_ERR_NO_DATA;
|
2022-12-26 09:18:25 +00:00
|
|
|
|
set_test_name_ = str;
|
2022-12-23 02:39:07 +00:00
|
|
|
|
int ret = SCANNER_ERR_OK;
|
|
|
|
|
|
|
|
|
|
auto it = test_map_.find(str);
|
2022-12-27 08:26:41 +00:00
|
|
|
|
|
2022-12-23 02:39:07 +00:00
|
|
|
|
if (it != test_map_.end())
|
|
|
|
|
{
|
2022-12-27 08:26:41 +00:00
|
|
|
|
ret = (this->*test_map_[str])((void *)str);
|
2022-12-23 02:39:07 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2022-12-26 09:18:25 +00:00
|
|
|
|
helper_->test_callback(str, ui_helper::TEST_EVENT_NOT_FIND_TEST, NULL, false);
|
2022-12-27 08:26:41 +00:00
|
|
|
|
return ret;
|
2022-12-23 02:39:07 +00:00
|
|
|
|
}
|
|
|
|
|
if (ret != SCANNER_ERR_OK)
|
|
|
|
|
{
|
2022-12-26 09:18:25 +00:00
|
|
|
|
helper_->test_callback(str, ui_helper::TEST_EVENT_IO_FAIL, NULL, ret);
|
2022-12-23 02:39:07 +00:00
|
|
|
|
}
|
|
|
|
|
return ret;
|
2022-12-15 11:53:41 +00:00
|
|
|
|
}
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
/* <20><><EFBFBD>뿪<EFBFBD><EBBFAA>У<EFBFBD><D0A3> */
|
2022-12-27 08:26:41 +00:00
|
|
|
|
int test_dial_switch(void *data)
|
2022-12-15 11:53:41 +00:00
|
|
|
|
{
|
2022-12-23 02:39:07 +00:00
|
|
|
|
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
2022-12-15 11:53:41 +00:00
|
|
|
|
}
|
|
|
|
|
/* <20><><EFBFBD>鴬<EFBFBD>Ϳ<EFBFBD><CDBF>ع<EFBFBD><D8B9><EFBFBD> */
|
2022-12-27 08:26:41 +00:00
|
|
|
|
int test_pocker_switch(void *data)
|
2022-12-15 11:53:41 +00:00
|
|
|
|
{
|
|
|
|
|
|
2022-12-23 02:39:07 +00:00
|
|
|
|
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
2022-12-15 11:53:41 +00:00
|
|
|
|
}
|
|
|
|
|
/* <20>豸<EFBFBD>ϵ粢<CFB5>۲쿪<DBB2><ECBFAA>״̬ */
|
2022-12-27 08:26:41 +00:00
|
|
|
|
int test_boot_status(void *data)
|
2022-12-15 11:53:41 +00:00
|
|
|
|
{
|
|
|
|
|
|
2022-12-23 02:39:07 +00:00
|
|
|
|
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
2022-12-15 11:53:41 +00:00
|
|
|
|
}
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD>Һ<EFBFBD><D2BA><EFBFBD><EFBFBD>ʾ */
|
2022-12-27 08:26:41 +00:00
|
|
|
|
int test_lcd_display(void *data)
|
2022-12-15 11:53:41 +00:00
|
|
|
|
{
|
2022-12-23 02:39:07 +00:00
|
|
|
|
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
2022-12-15 11:53:41 +00:00
|
|
|
|
}
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7> */
|
2022-12-27 08:26:41 +00:00
|
|
|
|
int tset_clear_paper_path(void *data)
|
2022-12-15 11:53:41 +00:00
|
|
|
|
{
|
2022-12-23 02:39:07 +00:00
|
|
|
|
int ret = helper_->io_control(IO_CTRL_CODE_GET_CLEAN_PAPER_ROAD, NULL, NULL);
|
|
|
|
|
if (ret != SCANNER_ERR_OK)
|
|
|
|
|
{
|
2022-12-26 09:18:25 +00:00
|
|
|
|
return ret;
|
2022-12-23 02:39:07 +00:00
|
|
|
|
}
|
2022-12-27 08:26:41 +00:00
|
|
|
|
helper_->test_callback((wchar_t*)data, ui_helper::TEST_EVENT_MANUAL_CONFIRMATION, (void*)L"<EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>", true);
|
2022-12-23 02:39:07 +00:00
|
|
|
|
return ret;
|
2022-12-15 11:53:41 +00:00
|
|
|
|
}
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܼ<EFBFBD><DCBC><EFBFBD> */
|
2022-12-27 08:26:41 +00:00
|
|
|
|
int test_key_funtion(void *data)
|
2022-12-15 11:53:41 +00:00
|
|
|
|
{
|
2022-12-23 02:39:07 +00:00
|
|
|
|
return SCANNER_ERR_DEVICE_NOT_SUPPORT;
|
2022-12-15 11:53:41 +00:00
|
|
|
|
}
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD>ģʽ<C4A3><CABD><EFBFBD><EFBFBD> */
|
2022-12-27 08:26:41 +00:00
|
|
|
|
int test_count_mode(void *data)
|
2022-12-15 11:53:41 +00:00
|
|
|
|
{
|
2022-12-23 02:39:07 +00:00
|
|
|
|
SANE_Bool ismode = false;
|
|
|
|
|
unsigned int len = sizeof(SANE_Bool);
|
2022-12-26 09:18:25 +00:00
|
|
|
|
|
|
|
|
|
int ret = helper_->io_control(IO_CTRL_CODE_GET_IS_MODE, &ismode, &len);
|
2022-12-23 02:39:07 +00:00
|
|
|
|
if (ret != SCANNER_ERR_OK)
|
|
|
|
|
{
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
2022-12-27 08:26:41 +00:00
|
|
|
|
helper_->test_callback((wchar_t*)data, ui_helper::TEST_EVENT_MANUAL_CONFIRMATION, (void*)L"<EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>ƥ<EFBFBD><EFBFBD>", ismode);
|
2022-12-23 02:39:07 +00:00
|
|
|
|
return ret;
|
2022-12-15 11:53:41 +00:00
|
|
|
|
}
|
|
|
|
|
/* <20><>б<EFBFBD><D0B1><EFBFBD><EFBFBD> */
|
2022-12-27 08:26:41 +00:00
|
|
|
|
int test_skew_detection(void *data)
|
2022-12-15 11:53:41 +00:00
|
|
|
|
{
|
2022-12-27 08:26:41 +00:00
|
|
|
|
const wchar_t* NAME = (wchar_t*)data;
|
2022-12-26 09:18:25 +00:00
|
|
|
|
SANE_Bool type = true;
|
2022-12-23 02:39:07 +00:00
|
|
|
|
unsigned int len = sizeof(SANE_Bool);
|
2022-12-27 08:26:41 +00:00
|
|
|
|
int num = 0;
|
|
|
|
|
parameter * ptr = helper_->get_user_input(ui_helper::DATA_FROM_USER, ui_helper::VAL_TYPE_INT, NAME,L"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>1-5<><35>Ĭ<EFBFBD><C4AC>:1");
|
|
|
|
|
if (ptr)
|
|
|
|
|
num = *((int*)ptr->get_data());
|
|
|
|
|
|
|
|
|
|
if (num == 0)
|
|
|
|
|
num = 1;
|
2022-12-23 02:39:07 +00:00
|
|
|
|
|
2022-12-26 09:18:25 +00:00
|
|
|
|
int ret = helper_->io_control(IO_CTRL_CODE_SET_SKEW_CHECK, &type, &len);
|
|
|
|
|
if (ret != SCANNER_ERR_OK)
|
2022-12-27 08:26:41 +00:00
|
|
|
|
{
|
2022-12-26 09:18:25 +00:00
|
|
|
|
return ret;
|
2022-12-27 08:26:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ret = helper_->io_control(IO_CTRL_CODE_SET_SKEW_CHECK_VAL, &num, &len);
|
2022-12-23 02:39:07 +00:00
|
|
|
|
if (ret != SCANNER_ERR_OK)
|
2022-12-27 08:26:41 +00:00
|
|
|
|
{
|
2022-12-23 02:39:07 +00:00
|
|
|
|
return ret;
|
2022-12-27 08:26:41 +00:00
|
|
|
|
}
|
2022-12-23 02:39:07 +00:00
|
|
|
|
ret = helper_->io_control(IO_CTRL_CODE_TEST_SINGLE, NULL, NULL);
|
|
|
|
|
|
|
|
|
|
return ret;
|
2022-12-15 11:53:41 +00:00
|
|
|
|
}
|
|
|
|
|
/* <20><>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
2022-12-27 08:26:41 +00:00
|
|
|
|
int test_separater_motor(void *data)
|
2022-12-15 11:53:41 +00:00
|
|
|
|
{
|
|
|
|
|
return SCANNER_ERR_OK;
|
|
|
|
|
}
|
|
|
|
|
/* cisԭͼ<D4AD><CDBC><EFBFBD><EFBFBD> */
|
2022-12-27 08:26:41 +00:00
|
|
|
|
int test_cis__original_image(void *data)
|
2022-12-15 11:53:41 +00:00
|
|
|
|
{
|
2022-12-27 08:26:41 +00:00
|
|
|
|
const wchar_t* NAME = (wchar_t*)data;
|
|
|
|
|
SANE_Bool type = true;
|
|
|
|
|
unsigned int len = sizeof(SANE_Bool);
|
|
|
|
|
int ret = SCANNER_ERR_OK;
|
|
|
|
|
|
|
|
|
|
ret = helper_->io_control(IO_CTRL_CODE_SET_CIS_IMAGE, &type, &len);
|
|
|
|
|
if (ret != SCANNER_ERR_OK)
|
|
|
|
|
{
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
ret = helper_->io_control(IO_CTRL_CODE_TEST_SINGLE, NULL, NULL);
|
|
|
|
|
if (ret != SCANNER_ERR_OK)
|
|
|
|
|
{
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
2022-12-15 11:53:41 +00:00
|
|
|
|
}
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȹ<EFBFBD><C8B9>ܼ<EFBFBD><DCBC><EFBFBD> */
|
2022-12-27 08:26:41 +00:00
|
|
|
|
int test_host_fan(void *data)
|
2022-12-15 11:53:41 +00:00
|
|
|
|
{
|
|
|
|
|
return SCANNER_ERR_OK;
|
|
|
|
|
}
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
2022-12-27 08:26:41 +00:00
|
|
|
|
int test_ultrasonic_module(void *data)
|
2022-12-15 11:53:41 +00:00
|
|
|
|
{
|
|
|
|
|
return SCANNER_ERR_OK;
|
|
|
|
|
}
|
|
|
|
|
/* led<65><64>״̬<D7B4><CCAC><EFBFBD><EFBFBD> */
|
2022-12-27 08:26:41 +00:00
|
|
|
|
int test_led_light(void *data)
|
2022-12-15 11:53:41 +00:00
|
|
|
|
{
|
|
|
|
|
return SCANNER_ERR_OK;
|
|
|
|
|
}
|
|
|
|
|
/* <20><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD> */
|
2022-12-27 08:26:41 +00:00
|
|
|
|
int test_reset(void *data)
|
2022-12-15 11:53:41 +00:00
|
|
|
|
{
|
|
|
|
|
return SCANNER_ERR_OK;
|
|
|
|
|
}
|
|
|
|
|
/* <20><>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD> */
|
2022-12-27 08:26:41 +00:00
|
|
|
|
int test_paper_feed(void *data) //ʹ<>õ<EFBFBD><C3B5><EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2022-12-15 11:53:41 +00:00
|
|
|
|
{
|
|
|
|
|
return SCANNER_ERR_OK;
|
|
|
|
|
}
|
|
|
|
|
/* <20><><EFBFBD>Ǵ<EFBFBD><C7B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
2022-12-27 08:26:41 +00:00
|
|
|
|
int test_cover_sensor(void *data) //int<6E>˵㷵<CBB5><E3B7B5> ʹ<>õ<EFBFBD><C3B5><EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2022-12-15 11:53:41 +00:00
|
|
|
|
{
|
|
|
|
|
return SCANNER_ERR_OK;
|
|
|
|
|
}
|
|
|
|
|
/* ɨ<>贫<EFBFBD><E8B4AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
2022-12-27 08:26:41 +00:00
|
|
|
|
int test_scanning_sensor(void *data)
|
2022-12-15 11:53:41 +00:00
|
|
|
|
{
|
|
|
|
|
return SCANNER_ERR_OK;
|
|
|
|
|
}
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>ģʽ */
|
2022-12-27 08:26:41 +00:00
|
|
|
|
int test_configure_speed_mode(void *data)
|
2022-12-15 11:53:41 +00:00
|
|
|
|
{
|
|
|
|
|
return SCANNER_ERR_OK;
|
|
|
|
|
}
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD>У<EFBFBD><D0A3>ֽ */
|
2022-12-27 08:26:41 +00:00
|
|
|
|
int test_place_correction_paper(void *data)
|
2022-12-15 11:53:41 +00:00
|
|
|
|
{
|
|
|
|
|
return SCANNER_ERR_OK;
|
|
|
|
|
}
|
|
|
|
|
/* <20>Զ<EFBFBD>ƽ<EFBFBD><C6BD>У<EFBFBD><D0A3> */
|
2022-12-27 08:26:41 +00:00
|
|
|
|
int test_auto_flat_field(void *data)
|
2022-12-15 11:53:41 +00:00
|
|
|
|
{
|
|
|
|
|
return SCANNER_ERR_OK;
|
|
|
|
|
}
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD><EFBFBD>豸 */
|
2022-12-27 08:26:41 +00:00
|
|
|
|
int test_reboot_device(void *data)
|
2022-12-15 11:53:41 +00:00
|
|
|
|
{
|
2022-12-23 02:39:07 +00:00
|
|
|
|
return SCANNER_ERR_OK;
|
2022-12-15 11:53:41 +00:00
|
|
|
|
}
|
|
|
|
|
/* ɨ<><C9A8>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7> */
|
2022-12-27 08:26:41 +00:00
|
|
|
|
int test_image_quality(void *data)
|
2022-12-15 11:53:41 +00:00
|
|
|
|
{
|
2022-12-27 08:26:41 +00:00
|
|
|
|
const wchar_t* NAME = (wchar_t*)data;
|
|
|
|
|
SANE_Bool type = false;
|
|
|
|
|
unsigned int len = sizeof(SANE_Bool);
|
|
|
|
|
int ret = helper_->io_control(IO_CTRL_CODE_SET_SKEW_CHECK, &type, &len);
|
|
|
|
|
if (ret != SCANNER_ERR_OK)
|
|
|
|
|
{
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
ret = helper_->io_control(IO_CTRL_CODE_GET_IMAGE, NULL, NULL);
|
|
|
|
|
return ret;
|
2022-12-15 11:53:41 +00:00
|
|
|
|
}
|
|
|
|
|
/* ɫ<><C9AB>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
2022-12-27 08:26:41 +00:00
|
|
|
|
int test_colorcard_imageing_quality(void *data)
|
2022-12-15 11:53:41 +00:00
|
|
|
|
{
|
2022-12-23 02:39:07 +00:00
|
|
|
|
return SCANNER_ERR_OK;
|
2022-12-15 11:53:41 +00:00
|
|
|
|
}
|
|
|
|
|
/* ɫ<><C9AB>ֽƫɫ<C6AB><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
2022-12-27 08:26:41 +00:00
|
|
|
|
int test_colorcard_bias_imageing_quality(void *data)
|
2022-12-15 11:53:41 +00:00
|
|
|
|
{
|
2022-12-23 02:39:07 +00:00
|
|
|
|
return SCANNER_ERR_OK;
|
2022-12-15 11:53:41 +00:00
|
|
|
|
}
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
2022-12-27 08:26:41 +00:00
|
|
|
|
int test_clarity_quality(void *data)
|
2022-12-15 11:53:41 +00:00
|
|
|
|
{
|
2022-12-23 02:39:07 +00:00
|
|
|
|
return SCANNER_ERR_OK;
|
2022-12-15 11:53:41 +00:00
|
|
|
|
}
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
2022-12-27 08:26:41 +00:00
|
|
|
|
int test_distortion(void *data)
|
2022-12-15 11:53:41 +00:00
|
|
|
|
{
|
2022-12-23 02:39:07 +00:00
|
|
|
|
return SCANNER_ERR_OK;
|
2022-12-15 11:53:41 +00:00
|
|
|
|
}
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
2022-12-27 08:26:41 +00:00
|
|
|
|
int test_dormancy(void *data)
|
2022-12-15 11:53:41 +00:00
|
|
|
|
{
|
2022-12-23 02:39:07 +00:00
|
|
|
|
return SCANNER_ERR_OK;
|
2022-12-15 11:53:41 +00:00
|
|
|
|
}
|
|
|
|
|
/* <20><>б<EFBFBD><D0B1>λ<EFBFBD><CEBB><EFBFBD><EFBFBD> */
|
2022-12-27 08:26:41 +00:00
|
|
|
|
int test_skew_gear(void *data)
|
2022-12-15 11:53:41 +00:00
|
|
|
|
{
|
2022-12-23 02:39:07 +00:00
|
|
|
|
return SCANNER_ERR_OK;
|
2022-12-15 11:53:41 +00:00
|
|
|
|
}
|
|
|
|
|
/* <20><>ֽǿ<D6BD>ȼ<EFBFBD><C8BC><EFBFBD> */
|
2022-12-27 08:26:41 +00:00
|
|
|
|
int test_paper_separation_strength(void *data)
|
2022-12-15 11:53:41 +00:00
|
|
|
|
{
|
2022-12-23 02:39:07 +00:00
|
|
|
|
return SCANNER_ERR_OK;
|
2022-12-15 11:53:41 +00:00
|
|
|
|
}
|
|
|
|
|
/* <20><>е<EFBFBD><D0B5>ֽ<EFBFBD><D6BD>б<EFBFBD><D0B1><EFBFBD><EFBFBD> */
|
2022-12-27 08:26:41 +00:00
|
|
|
|
int test_mech_paper_feeding_inclination(void *data)
|
2022-12-15 11:53:41 +00:00
|
|
|
|
{
|
2022-12-23 02:39:07 +00:00
|
|
|
|
return SCANNER_ERR_OK;
|
2022-12-15 11:53:41 +00:00
|
|
|
|
}
|
|
|
|
|
/* <20><><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>1 */
|
2022-12-27 08:26:41 +00:00
|
|
|
|
int test_single_page_test_1(void *data)
|
2022-12-15 11:53:41 +00:00
|
|
|
|
{
|
2022-12-23 02:39:07 +00:00
|
|
|
|
return SCANNER_ERR_OK;
|
2022-12-15 11:53:41 +00:00
|
|
|
|
}
|
|
|
|
|
/* <20><><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>2 */
|
2022-12-27 08:26:41 +00:00
|
|
|
|
int test_single_page_test_2(void *data)
|
2022-12-15 11:53:41 +00:00
|
|
|
|
{
|
2022-12-23 02:39:07 +00:00
|
|
|
|
return SCANNER_ERR_OK;
|
2022-12-15 11:53:41 +00:00
|
|
|
|
}
|
|
|
|
|
/* <20><><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>3 */
|
2022-12-27 08:26:41 +00:00
|
|
|
|
int test_single_page_test_3(void *data)
|
2022-12-15 11:53:41 +00:00
|
|
|
|
{
|
2022-12-23 02:39:07 +00:00
|
|
|
|
return SCANNER_ERR_OK;
|
2022-12-15 11:53:41 +00:00
|
|
|
|
}
|
|
|
|
|
/* ѹ<><D1B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD><32> */
|
2022-12-27 08:26:41 +00:00
|
|
|
|
int test_pressuer_test(void *data)
|
2022-12-15 11:53:41 +00:00
|
|
|
|
{
|
2022-12-23 02:39:07 +00:00
|
|
|
|
return SCANNER_ERR_OK;
|
2022-12-15 11:53:41 +00:00
|
|
|
|
}
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
2022-12-27 08:26:41 +00:00
|
|
|
|
int test_clear_roller_count(void *data)
|
2022-12-15 11:53:41 +00:00
|
|
|
|
{
|
2022-12-23 02:39:07 +00:00
|
|
|
|
return SCANNER_ERR_OK;
|
2022-12-15 11:53:41 +00:00
|
|
|
|
}
|
|
|
|
|
private:
|
|
|
|
|
|
2022-12-08 10:10:19 +00:00
|
|
|
|
};
|
2022-12-15 11:53:41 +00:00
|
|
|
|
|
|
|
|
|
|
2022-12-08 10:10:19 +00:00
|
|
|
|
//test
|
2022-12-27 08:26:41 +00:00
|
|
|
|
static std::string jsontext1("{\"1\":{\"NAME\":\"test-8\",\"ver\":1}}");
|
2022-12-15 11:53:41 +00:00
|
|
|
|
bool have_img_ = false;
|
2022-12-27 08:26:41 +00:00
|
|
|
|
|
|
|
|
|
DECL_API(int) func_test_init(void* init)
|
2022-12-08 10:10:19 +00:00
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2022-12-15 06:39:32 +00:00
|
|
|
|
DECL_API(int) func_test_get_list(wchar_t* buf, size_t* len)
|
2022-12-08 10:10:19 +00:00
|
|
|
|
{
|
2022-12-14 06:58:06 +00:00
|
|
|
|
return str_to_wchar(jsontext1, buf, len);
|
2022-12-08 10:10:19 +00:00
|
|
|
|
}
|
2022-12-27 08:26:41 +00:00
|
|
|
|
DECL_API(int) func_test_go(const wchar_t* NAME, const wchar_t* oper, ui_helper* helper)
|
2022-12-08 10:10:19 +00:00
|
|
|
|
{
|
2022-12-27 08:26:41 +00:00
|
|
|
|
if (!NAME || !oper || !helper)
|
2022-12-08 10:10:19 +00:00
|
|
|
|
{
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2022-12-27 08:26:41 +00:00
|
|
|
|
//helper->add_ref(void *data);
|
2022-12-08 10:10:19 +00:00
|
|
|
|
|
|
|
|
|
|
2022-12-27 08:26:41 +00:00
|
|
|
|
int ret = 0;
|
|
|
|
|
SANE_Bool type = false;
|
|
|
|
|
unsigned int len = sizeof(SANE_Bool);
|
|
|
|
|
test ts(helper);
|
|
|
|
|
ret = ts.set_test(NAME);
|
|
|
|
|
if (ret != SCANNER_ERR_OK)
|
|
|
|
|
{
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
ret = helper->io_control(IO_CTRL_CODE_RESTORE_SETTINGS, NULL, NULL);//<2F><><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD>Ĭ<EFBFBD><C4AC>
|
2022-12-23 02:39:07 +00:00
|
|
|
|
return ret;
|
2022-12-08 10:10:19 +00:00
|
|
|
|
}
|
2022-12-27 08:26:41 +00:00
|
|
|
|
DECL_API(int) func_test_uninit(void* uninit)
|
2022-12-08 10:10:19 +00:00
|
|
|
|
{
|
|
|
|
|
return 0;
|
2022-12-26 09:18:25 +00:00
|
|
|
|
}
|