Merge branch 'dev' of http://192.168.10.5:8099/sane/code_twain into dev
This commit is contained in:
commit
1a5e2da847
|
@ -161,6 +161,7 @@ struct __declspec(novtable) ISaneInvoker : public IRef
|
||||||
COM_API_DECLARE(int, get_scanned_images(DWORD milliseconds = 0));
|
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(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 = NULL, int *dpi = NULL));
|
COM_API_DECLARE(bool, get_first_image_header(SANE_Parameters* header, size_t* bytes = NULL, int *dpi = NULL));
|
||||||
|
COM_API_DECLARE(bool, discard_first_image(void));
|
||||||
COM_API_DECLARE(bool, is_online(void));
|
COM_API_DECLARE(bool, is_online(void));
|
||||||
COM_API_DECLARE(bool, is_paper_on(void));
|
COM_API_DECLARE(bool, is_paper_on(void));
|
||||||
COM_API_DECLARE(int, last_error(void));
|
COM_API_DECLARE(int, last_error(void));
|
||||||
|
|
|
@ -2670,11 +2670,12 @@ COM_API_IMPLEMENT(scanner, int, get_scanned_images(DWORD milliseconds))
|
||||||
}
|
}
|
||||||
COM_API_IMPLEMENT(scanner, IScanImg*, take_first_image(twain_xfer xfer))
|
COM_API_IMPLEMENT(scanner, IScanImg*, take_first_image(twain_xfer xfer))
|
||||||
{
|
{
|
||||||
scanned_img* img = images_.take();
|
scanned_img* img = images_.take(false);
|
||||||
|
|
||||||
if (img)
|
if (img)
|
||||||
{
|
{
|
||||||
//img->prepare_data_for_transfer(xfer);
|
img->prepare_data_for_transfer(xfer);
|
||||||
|
img->add_ref();
|
||||||
|
|
||||||
wchar_t msg[128] = { 0 };
|
wchar_t msg[128] = { 0 };
|
||||||
swprintf_s(msg, _countof(msg) - 1, L"Begin transferring image %d of %p\r\n", fetch_imgs_ + 1, img);
|
swprintf_s(msg, _countof(msg) - 1, L"Begin transferring image %d of %p\r\n", fetch_imgs_ + 1, img);
|
||||||
|
@ -2687,6 +2688,19 @@ COM_API_IMPLEMENT(scanner, bool, get_first_image_header(SANE_Parameters* header,
|
||||||
{
|
{
|
||||||
return images_.get_header(header, bytes, dpi);
|
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))
|
COM_API_IMPLEMENT(scanner, bool, is_online(void))
|
||||||
{
|
{
|
||||||
std::string sn("");
|
std::string sn("");
|
||||||
|
|
|
@ -218,6 +218,7 @@ public:
|
||||||
COM_API_OVERRIDE(int, get_scanned_images(DWORD milliseconds = 0));
|
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(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, get_first_image_header(SANE_Parameters* header, size_t* bytes = NULL, int* dpi = NULL));
|
||||||
|
COM_API_OVERRIDE(bool, discard_first_image(void)); // call 'release' on returned value, plz
|
||||||
COM_API_OVERRIDE(bool, is_online(void));
|
COM_API_OVERRIDE(bool, is_online(void));
|
||||||
COM_API_OVERRIDE(bool, is_paper_on(void));
|
COM_API_OVERRIDE(bool, is_paper_on(void));
|
||||||
COM_API_OVERRIDE(int, last_error(void));
|
COM_API_OVERRIDE(int, last_error(void));
|
||||||
|
|
|
@ -114,7 +114,7 @@ namespace load_sane_util
|
||||||
|
|
||||||
swprintf_s(info, _countof(info) - 1, L" = %d\r\n", ret);
|
swprintf_s(info, _countof(info) - 1, L" = %d\r\n", ret);
|
||||||
OutputDebugStringW((L"[TWAIN]Load: " + std::wstring(path_dll) + info).c_str());
|
OutputDebugStringW((L"[TWAIN]Load: " + std::wstring(path_dll) + info).c_str());
|
||||||
if (!h && (ret == ERROR_MOD_NOT_FOUND || ret == ERROR_BAD_EXE_FORMAT))
|
if (!h && (ret == ERROR_MOD_NOT_FOUND || ret == ERROR_BAD_EXE_FORMAT || ret == 0))
|
||||||
{
|
{
|
||||||
std::wstring dir(path_dll);
|
std::wstring dir(path_dll);
|
||||||
size_t pos = dir.rfind(L'\\');
|
size_t pos = dir.rfind(L'\\');
|
||||||
|
|
|
@ -776,11 +776,18 @@ static bool __stdcall got_fixed_id(uint32_t id, void* param)
|
||||||
// huagao_ds ...
|
// huagao_ds ...
|
||||||
#include "../../../sdk/include/huagao/brand.h"
|
#include "../../../sdk/include/huagao/brand.h"
|
||||||
|
|
||||||
|
/*
|
||||||
static Identity* srcIdent = new Identity(
|
static Identity* srcIdent = new Identity(
|
||||||
Version(VERSION_MAIN, VERSION_SUB, Language::English, Country::China, VERSION_STR(VERSION_MAIN, VERSION_SUB, VERSION_BUILD1, VERSION_PATCH)),
|
Version(VERSION_MAIN, VERSION_SUB, Language::English, Country::China, VERSION_STR(VERSION_MAIN, VERSION_SUB, VERSION_BUILD1, VERSION_PATCH)),
|
||||||
DataGroup::Image, PRODUCT_VENDOR, PRODUCT_FAMILY, PRODUCT_NAME);
|
DataGroup::Image, PRODUCT_VENDOR, PRODUCT_FAMILY, PRODUCT_NAME);
|
||||||
static const SCANNERID scanner_guid = MAKE_SCANNER_ID(PRODUCT_PID, PRODUCT_VID);
|
/*/
|
||||||
|
static Identity myIdent(
|
||||||
|
Version(VERSION_MAIN, VERSION_SUB, Language::English, Country::China, VERSION_STR(VERSION_MAIN, VERSION_SUB, VERSION_BUILD1, VERSION_PATCH)),
|
||||||
|
DataGroup::Image, PRODUCT_VENDOR, PRODUCT_FAMILY, PRODUCT_NAME);
|
||||||
|
static Identity* srcIdent = &myIdent;
|
||||||
|
///////////*////////////////////////////////////
|
||||||
|
|
||||||
|
static const SCANNERID scanner_guid = MAKE_SCANNER_ID(PRODUCT_PID, PRODUCT_VID);
|
||||||
|
|
||||||
static std::once_flag oc;
|
static std::once_flag oc;
|
||||||
huagao_ds::huagao_ds() : cur_head_(NULL), dpi_(200), xfer_ready_failed_(false), log_all_triple_(false), scanner_status_(SCANNER_STATUS_NOT_INIT)
|
huagao_ds::huagao_ds() : cur_head_(NULL), dpi_(200), xfer_ready_failed_(false), log_all_triple_(false), scanner_status_(SCANNER_STATUS_NOT_INIT)
|
||||||
|
@ -1088,13 +1095,28 @@ Result huagao_ds::pendingXfersGet(const Identity&, PendingXfers& data)
|
||||||
}
|
}
|
||||||
Result huagao_ds::pendingXfersEnd(const Identity& id, 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);
|
return pendingXfersGet(id, data);
|
||||||
}
|
}
|
||||||
Result huagao_ds::pendingXfersReset(const Identity& id, PendingXfers& data)
|
Result huagao_ds::pendingXfersReset(const Identity& id, PendingXfers& data)
|
||||||
{
|
{
|
||||||
pending_xfer_.clear();
|
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)
|
Result huagao_ds::setupMemXferGet(const Identity& id, SetupMemXfer& data)
|
||||||
{
|
{
|
||||||
|
@ -1369,6 +1391,8 @@ Result huagao_ds::imageMemXferGet(const Identity& origin, ImageMemXfer& data)
|
||||||
|
|
||||||
if (rows == 0)
|
if (rows == 0)
|
||||||
return badValue();
|
return badValue();
|
||||||
|
else if (rows > img->height())
|
||||||
|
rows = img->height();
|
||||||
|
|
||||||
if (pending_xfer_.img)
|
if (pending_xfer_.img)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue