扫描完成后,在取图操作中返回失败和扫描仪最终的状态(卡纸……)
This commit is contained in:
parent
5fa741d27d
commit
556d58e56d
|
@ -158,6 +158,7 @@ struct __declspec(novtable) ISaneInvoker : public IRef
|
|||
COM_API_DECLARE(bool, get_first_image_header(SANE_Parameters* header, size_t* bytes = NULL, int *dpi = NULL));
|
||||
COM_API_DECLARE(bool, is_online(void));
|
||||
COM_API_DECLARE(bool, is_paper_on(void));
|
||||
COM_API_DECLARE(int, last_error(void));
|
||||
|
||||
// Function: 获取配置项信息
|
||||
//
|
||||
|
|
|
@ -2420,6 +2420,11 @@ COM_API_IMPLEMENT(scanner, bool, is_paper_on(void))
|
|||
else
|
||||
return false;
|
||||
}
|
||||
COM_API_IMPLEMENT(scanner, int, last_error(void))
|
||||
{
|
||||
return err_;
|
||||
}
|
||||
|
||||
COM_API_IMPLEMENT(scanner, bool, get_option_info(int sn, value_type* type, value_limit* limit, int* bytes))
|
||||
{
|
||||
EXAPIPOS ex = find_ex_api(sn);
|
||||
|
@ -2936,10 +2941,6 @@ int scanner::handle_device_event(int ev_code, void* data, unsigned int* len)
|
|||
|
||||
return 0;
|
||||
}
|
||||
int scanner::last_error(void)
|
||||
{
|
||||
return err_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -201,6 +201,7 @@ public:
|
|||
COM_API_OVERRIDE(bool, get_first_image_header(SANE_Parameters* header, size_t* bytes = NULL, int* dpi = NULL));
|
||||
COM_API_OVERRIDE(bool, is_online(void));
|
||||
COM_API_OVERRIDE(bool, is_paper_on(void));
|
||||
COM_API_OVERRIDE(int, last_error(void));
|
||||
COM_API_OVERRIDE(bool, get_option_info(int sn, value_type* type, value_limit* limit, int* bytes));
|
||||
COM_API_OVERRIDE(bool, get_value(int sn, set_opt_value, void* param));
|
||||
COM_API_OVERRIDE(int, set_value(int sn, void* val));
|
||||
|
@ -325,5 +326,4 @@ public:
|
|||
// methods:
|
||||
public:
|
||||
int handle_device_event(int ev_code, void* data, unsigned int* len);
|
||||
int last_error(void);
|
||||
};
|
|
@ -937,8 +937,14 @@ Twpp::ConditionCode huagao_ds::condition_code_from_hg_error(int hgerr)
|
|||
return Twpp::ConditionCode::NoMedia;
|
||||
if (hgerr == SCANNER_ERR_OPENED_BY_OTHER_PROCESS)
|
||||
return Twpp::ConditionCode::MaxConnections;
|
||||
if(hgerr == SCANNER_ERR_INSUFFICIENT_MEMORY)
|
||||
return Twpp::ConditionCode::LowMemory;
|
||||
if(hgerr == SCANNER_ERR_DEVICE_NOT_FOUND)
|
||||
return Twpp::ConditionCode::NoDs;
|
||||
|
||||
return (Twpp::ConditionCode)((int)Twpp::ConditionCode::CustomBase + hgerr);
|
||||
return ConditionCode::Bummer;
|
||||
|
||||
// return (Twpp::ConditionCode)((int)Twpp::ConditionCode::CustomBase + hgerr);
|
||||
}
|
||||
|
||||
Result huagao_ds::capabilityGet(const Identity& origin, Capability& data)
|
||||
|
@ -1286,7 +1292,7 @@ Result huagao_ds::imageLayoutGet(const Identity&, ImageLayout& data)
|
|||
if (!scanner_.get())
|
||||
return seqError();
|
||||
else if(get_scanned_image_count(-1) == 0)
|
||||
return { ReturnCode::XferDone, ConditionCode::Success };
|
||||
return { ReturnCode::Failure, condition_code_from_hg_error(scanner_->last_error()) };
|
||||
|
||||
int res = 200;
|
||||
|
||||
|
@ -1328,7 +1334,7 @@ Result huagao_ds::imageMemXferGet(const Identity& origin, ImageMemXfer& data)
|
|||
// return seqError();
|
||||
//}
|
||||
|
||||
return { ReturnCode::XferDone, ConditionCode::Success };
|
||||
return { ReturnCode::Failure, condition_code_from_hg_error(scanner_->last_error()) };
|
||||
}
|
||||
|
||||
IScanImg *img = pending_xfer_.img ? pending_xfer_.img : scanner_->take_first_image(TWAIN_XFER_Memory);
|
||||
|
@ -1404,7 +1410,7 @@ Result huagao_ds::imageNativeXferGet(const Identity& id, ImageNativeXfer& data)
|
|||
if (!scanner_.get())
|
||||
return seqError();
|
||||
else if(get_scanned_image_count(-1) == 0)
|
||||
return { ReturnCode::XferDone, ConditionCode::Success };
|
||||
return { ReturnCode::Failure, condition_code_from_hg_error(scanner_->last_error()) };
|
||||
|
||||
IScanImg* img = scanner_->take_first_image(TWAIN_XFER_Native);
|
||||
|
||||
|
@ -1445,7 +1451,7 @@ Twpp::Result huagao_ds::imageFileXferGet(const Twpp::Identity& origin)
|
|||
if (!scanner_.get())
|
||||
return seqError();
|
||||
else if(get_scanned_image_count(-1) == 0)
|
||||
return { ReturnCode::XferDone, ConditionCode::Success };
|
||||
return { ReturnCode::Failure, condition_code_from_hg_error(scanner_->last_error()) };
|
||||
|
||||
IScanImg* img = scanner_->take_first_image(TWAIN_XFER_File);
|
||||
Twpp::Result ret = seqError();
|
||||
|
|
Loading…
Reference in New Issue