调整重启接口

This commit is contained in:
13038267101 2023-01-03 21:25:54 +08:00
parent 0f67142d27
commit d74ee4a2dd
1 changed files with 6 additions and 21 deletions

View File

@ -752,31 +752,16 @@ public:
/* 重启设备 */ /* 重启设备 */
int test_reboot_device(void *data) int test_reboot_device(void *data)
{ {
bool is_reboot = false; if (!data)
void* get_data = NULL;
int i = 0;
unsigned int len = sizeof(SANE_Int);
parameter* ptr = helper_->get_user_input(ui_helper::DATA_FROM_USER, ui_helper::VAL_TYPE_BOOL, set_test_name_.c_str(),L"是否进入烧录模式,是:进入烧写模式(rebootloader) 否:设备普通重启(reboot)");
if (ptr)
{ {
get_data = ptr->get_data(); helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)L"设备重启中失败", false);
if (!get_data)
{
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)L"重启设备设置失败...", false);
return -1;
}
is_reboot = *((bool*)get_data);
}
else
{
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)L"已退出--->重启设备模式...", false);
return -1; return -1;
} }
i = is_reboot; wchar_t* p = (wchar_t*)data;
int ret = helper_->io_control(IO_CTRL_CODE_SET_DEVS_REBOOT, &i, &len);
if (ret != SCANNER_ERR_OK)
return ret;
int i = _wtoi(p);
unsigned int len = sizeof(int);
int ret = helper_->io_control(IO_CTRL_CODE_SET_DEVS_REBOOT, &i, &len);
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)L"设备重启中,请观察设备是否重启", true); helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)L"设备重启中,请观察设备是否重启", true);
return ret; return ret;
} }