Merge branch 'master' of http://cd.holdtecs.net:8099/sane/code_production
This commit is contained in:
commit
68fd671615
|
@ -71,8 +71,14 @@ public:
|
|||
VAL_TYPE_STRING,
|
||||
VAL_TYPE_RANGE,
|
||||
VAL_TYPE_CUSTOM, // custom data, such as gamma table ...
|
||||
VAL_TYPE_TIPS_VAL, // status info tips and data info
|
||||
};
|
||||
|
||||
typedef struct _info// value_type == VAL_TUPE_TIPS
|
||||
{
|
||||
const wchar_t* desc; // desc is int
|
||||
const wchar_t* info; //info tips
|
||||
}_INFOTIPS, * PINFOTIPS;
|
||||
// get testing parameter ...
|
||||
virtual parameter* get_user_input(data_from from, value_type type
|
||||
, const wchar_t* title // window title when from == DATA_FROM_USER, or parameter name when from == DATA_FROM_KNOWN
|
||||
|
|
|
@ -420,45 +420,47 @@ public:
|
|||
unsigned int len = sizeof(int);
|
||||
int speed_mode = 0;
|
||||
void* get_data = NULL;
|
||||
/*parameter* ptr = helper_->get_user_input(ui_helper::DATA_FROM_USER, ui_helper::VAL_TYPE_RANGE,
|
||||
NAME, L"请设置速度模式,值越大速度越快");*/
|
||||
// helper_->test_callback((wchar_t*)data, ui_helper::TEST_EVENT_TIPS, (void*)L"请设置速度模式,值越大速度越快", true);
|
||||
bool type = false;
|
||||
|
||||
ui_helper::_INFOTIPS info_;
|
||||
const wchar_t *range=L"";
|
||||
const wchar_t G139[6] = { 70,80,90,110};
|
||||
const wchar_t G239[6] = { 100,110,120,130};
|
||||
const wchar_t G300[6] = { 40,50,60,70 };
|
||||
const wchar_t G400[6] = { 40,50,60,70,80};
|
||||
wchar_t info[128] = L"请设置速度模式,值越大速度越快.";
|
||||
;
|
||||
if (fw_ == 1)
|
||||
range = G139;
|
||||
else if(fw_ == 2)
|
||||
range = G239;
|
||||
else if (fw_ == 3)
|
||||
range = G300;
|
||||
else if (fw_ == 4)
|
||||
range = G400;
|
||||
//range = info;
|
||||
parameter* ptr = helper_->get_user_input(ui_helper::DATA_FROM_USER, ui_helper::VAL_TYPE_RANGE,
|
||||
NAME, range);
|
||||
|
||||
info_.info = info;
|
||||
if (fw_ == 1)info_.desc = G139;
|
||||
else if(fw_ == 2)info_.desc = G239;
|
||||
else if(fw_ == 3)info_.desc = G300;
|
||||
else if(fw_ == 4)info_.desc = G400;
|
||||
parameter* ptr = helper_->get_user_input(ui_helper::DATA_FROM_USER, ui_helper::VAL_TYPE_TIPS_VAL,NAME, (wchar_t *) &info_);
|
||||
if (ptr)
|
||||
{
|
||||
get_data = ptr->get_data();
|
||||
if (!get_data)
|
||||
{
|
||||
helper_->test_callback((wchar_t*)data, ui_helper::TEST_EVENT_RESULT, (void*)L"速度模式设置失败...", false);
|
||||
type = false;
|
||||
helper_->test_callback((wchar_t*)data, ui_helper::TEST_EVENT_RESULT, (void*)L"速度模式设置失败...", type);
|
||||
return -1;
|
||||
}
|
||||
speed_mode = *((int*)get_data);
|
||||
if (fw_ == 3 || fw_ == 4 && speed_mode >= 40 && speed_mode <= 80) //3288设置速度模式为1 2 3 4 5
|
||||
{
|
||||
if (speed_mode == 40)speed_mode = 1;
|
||||
else if (speed_mode == 50)speed_mode = 2;
|
||||
else if (speed_mode == 60)speed_mode = 3;
|
||||
else if (speed_mode == 70)speed_mode = 4;
|
||||
else if (speed_mode == 80)speed_mode = 5;
|
||||
else speed_mode = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
helper_->test_callback((wchar_t*)data, ui_helper::TEST_EVENT_RESULT, (void*)L"已退出--->设置速度模式...", false);
|
||||
type = false;
|
||||
helper_->test_callback((wchar_t*)data, ui_helper::TEST_EVENT_RESULT, (void*)L"已退出--->设置速度模式...", type);
|
||||
return -1;
|
||||
}
|
||||
if (speed_mode < 0)
|
||||
speed_mode = 70;
|
||||
int ret = helper_->io_control(IO_CTRL_CODE_SET_SPEED_MODE, &speed_mode, &len);
|
||||
if (ret != SCANNER_ERR_OK)
|
||||
{
|
||||
|
@ -467,19 +469,32 @@ range = G139;
|
|||
SANE_Int num = 0;
|
||||
unsigned int l = sizeof(SANE_Int);
|
||||
ret = helper_->io_control(IO_CTRL_CODE_GET_SPEED_MODE, &num, &l);
|
||||
int save_num = 0;
|
||||
wchar_t buf[128];
|
||||
if (fw_ == 3 || fw_ == 4 && num > 0 && num < 6)
|
||||
{
|
||||
if (num == 1)save_num = 40;
|
||||
else if (num == 2)save_num = 50;
|
||||
else if (num == 3)save_num = 60;
|
||||
else if (num == 4)save_num = 70;
|
||||
else if (num == 5)save_num = 80;
|
||||
}
|
||||
else
|
||||
save_num = num;
|
||||
|
||||
if (num != speed_mode)
|
||||
{
|
||||
wchar_t buf[128] = L"设置速度模式失败...现在速度是:";
|
||||
|
||||
wsprintfW(buf,L"%d", num);
|
||||
helper_->test_callback((wchar_t*)data, ui_helper::TEST_EVENT_RESULT, (void*)buf, false);
|
||||
type = false;
|
||||
wcscat(buf, L"设置速度模式失败...现在速度是:");
|
||||
wcscat(buf, (wchar_t *)save_num);
|
||||
}
|
||||
else
|
||||
{
|
||||
wchar_t buf[128] = L"设置速度模式成功...现在速度是:";
|
||||
wsprintfW(buf, L"%d", num);
|
||||
helper_->test_callback((wchar_t*)data, ui_helper::TEST_EVENT_RESULT, (void*)buf, true);
|
||||
type = true;
|
||||
wcscat(buf, L"设置速度模式成功...现在速度是:");
|
||||
wcscat(buf, (wchar_t*)save_num);
|
||||
}
|
||||
helper_->test_callback((wchar_t*)data, ui_helper::TEST_EVENT_RESULT, (void*)buf, type);
|
||||
return SCANNER_ERR_OK;
|
||||
}
|
||||
/* 放置校正纸 */
|
||||
|
|
Loading…
Reference in New Issue