change the initializing of identity
This commit is contained in:
parent
e6174371f8
commit
20325d7c88
|
@ -776,11 +776,23 @@ static bool 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 = nullptr;
|
||||||
Version(VERSION_MAIN, VERSION_SUB, Language::English, Country::China, VERSION_STR(VERSION_MAIN, VERSION_SUB, VERSION_BUILD1, VERSION_PATCH)),
|
// static Identity* srcIdent = new Identity(
|
||||||
DataGroup::Image, PRODUCT_VENDOR, PRODUCT_FAMILY, PRODUCT_NAME_TWAIN);
|
// 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, Str32(product_twain_name.c_str()));
|
||||||
static const SCANNERID scanner_guid = MAKE_SCANNER_ID(PRODUCT_PID, PRODUCT_VID);
|
static const SCANNERID scanner_guid = MAKE_SCANNER_ID(PRODUCT_PID, PRODUCT_VID);
|
||||||
|
|
||||||
|
static void init_identity(void)
|
||||||
|
{
|
||||||
|
if(!srcIdent)
|
||||||
|
{
|
||||||
|
Str32 n;
|
||||||
|
|
||||||
|
n.setData((std::string(PRODUCT_NAME) + " TWAIN").c_str());
|
||||||
|
srcIdent = new Identity(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, n);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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)
|
||||||
|
@ -828,11 +840,14 @@ int huagao_ds::on_scanner_event(int ev, void* param)
|
||||||
|
|
||||||
const Identity& huagao_ds::defaultIdentity() noexcept {
|
const Identity& huagao_ds::defaultIdentity() noexcept {
|
||||||
// remember, we return a reference, therefore the identity must not be placed on the stack of this method
|
// remember, we return a reference, therefore the identity must not be placed on the stack of this method
|
||||||
|
init_identity();
|
||||||
|
|
||||||
return *srcIdent;
|
return *srcIdent;
|
||||||
}
|
}
|
||||||
Result huagao_ds::selectIdentity(Twpp::Identity& ident) noexcept {
|
Result huagao_ds::selectIdentity(Twpp::Identity& ident) noexcept {
|
||||||
// remember, we return a reference, therefore the identity must not be placed on the stack of this method
|
// remember, we return a reference, therefore the identity must not be placed on the stack of this method
|
||||||
|
init_identity();
|
||||||
|
|
||||||
ident = *srcIdent;
|
ident = *srcIdent;
|
||||||
|
|
||||||
return success();
|
return success();
|
||||||
|
|
Loading…
Reference in New Issue