diff --git a/code/base/test_base.cpp b/code/base/test_base.cpp index 18b4c6c..60214fd 100644 --- a/code/base/test_base.cpp +++ b/code/base/test_base.cpp @@ -752,31 +752,16 @@ public: /* 重启设备 */ int test_reboot_device(void *data) { - bool is_reboot = false; - 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) + if (!data) { - get_data = ptr->get_data(); - 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); + helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)L"设备重启中失败", false); return -1; } - i = is_reboot; - int ret = helper_->io_control(IO_CTRL_CODE_SET_DEVS_REBOOT, &i, &len); - if (ret != SCANNER_ERR_OK) - return ret; + wchar_t* p = (wchar_t*)data; + 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); return ret; }