修复pendingXfer协议;在pendingXfer-EndXfer协议中抛弃首张图片
This commit is contained in:
parent
3bf9f0d671
commit
e191acdafe
|
@ -1088,13 +1088,28 @@ Result huagao_ds::pendingXfersGet(const Identity&, PendingXfers& data)
|
|||
}
|
||||
Result huagao_ds::pendingXfersEnd(const Identity& id, PendingXfers& data)
|
||||
{
|
||||
// complete transferring of current image ...
|
||||
pending_xfer_.clear();
|
||||
if (scanner_.get())
|
||||
{
|
||||
scanner_->discard_first_image();
|
||||
}
|
||||
|
||||
return pendingXfersGet(id, data);
|
||||
}
|
||||
Result huagao_ds::pendingXfersReset(const Identity& id, PendingXfers& data)
|
||||
{
|
||||
pending_xfer_.clear();
|
||||
if (scanner_.get())
|
||||
{
|
||||
scanner_->stop();
|
||||
while (scanner_->discard_first_image());
|
||||
}
|
||||
data.setCount(0);
|
||||
|
||||
return pendingXfersGet(id, data);
|
||||
return success();
|
||||
|
||||
//return pendingXfersGet(id, data);
|
||||
}
|
||||
Result huagao_ds::setupMemXferGet(const Identity& id, SetupMemXfer& data)
|
||||
{
|
||||
|
|
|
@ -165,6 +165,7 @@ public:
|
|||
COM_API_DECLARE(int, get_scanned_images(DWORD milliseconds = 0));
|
||||
COM_API_DECLARE(IScanImg*, take_first_image(twain_xfer xfer = TWAIN_XFER_Native)); // call 'release' on returned value, plz
|
||||
COM_API_DECLARE(bool, get_first_image_header(SANE_Parameters* header, size_t* bytes = nullptr, int *dpi = nullptr));
|
||||
COM_API_DECLARE(bool, discard_first_image(void));
|
||||
COM_API_DECLARE(bool, is_online(void));
|
||||
COM_API_DECLARE(bool, is_paper_on(void));
|
||||
COM_API_DECLARE(int, last_error(void));
|
||||
|
|
|
@ -2309,11 +2309,12 @@ COM_API_IMPLEMENT(scanner, int, get_scanned_images(DWORD milliseconds))
|
|||
}
|
||||
COM_API_IMPLEMENT(scanner, IScanImg*, take_first_image(twain_xfer xfer))
|
||||
{
|
||||
scanned_img* img = images_.take();
|
||||
scanned_img* img = images_.take(false);
|
||||
|
||||
if (img)
|
||||
{
|
||||
img->prepare_data_for_transfer(xfer);
|
||||
img->add_ref();
|
||||
|
||||
utils::to_log(LOG_LEVEL_DEBUG, "Begin transferring image %d of %p\r\n", fetch_imgs_ + 1, img);
|
||||
}
|
||||
|
@ -2324,6 +2325,19 @@ COM_API_IMPLEMENT(scanner, bool, get_first_image_header(SANE_Parameters* header,
|
|||
{
|
||||
return images_.get_header(header, bytes, dpi);
|
||||
}
|
||||
COM_API_IMPLEMENT(scanner, bool, discard_first_image(void))
|
||||
{
|
||||
scanned_img* img = images_.take();
|
||||
if (img)
|
||||
{
|
||||
img->release();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
COM_API_IMPLEMENT(scanner, bool, is_online(void))
|
||||
{
|
||||
std::string sn("");
|
||||
|
|
|
@ -213,6 +213,7 @@ public:
|
|||
COM_API_OVERRIDE(int, get_scanned_images(DWORD milliseconds = 0));
|
||||
COM_API_OVERRIDE(IScanImg*, take_first_image(twain_xfer xfer = TWAIN_XFER_Native)); // call 'release' on returned value, plz
|
||||
COM_API_OVERRIDE(bool, get_first_image_header(SANE_Parameters* header, size_t* bytes = NULL, int* dpi = NULL));
|
||||
COM_API_OVERRIDE(bool, discard_first_image(void));
|
||||
COM_API_OVERRIDE(bool, is_online(void));
|
||||
COM_API_OVERRIDE(bool, is_paper_on(void));
|
||||
COM_API_OVERRIDE(int, last_error(void));
|
||||
|
|
Loading…
Reference in New Issue