websdk保存图片时增加sn_date_time命名方式

This commit is contained in:
luoliangyi 2024-01-12 09:16:53 +08:00
parent 82b717b16a
commit a981aaaa6b
4 changed files with 16 additions and 2 deletions

View File

@ -64,6 +64,7 @@ namespace ver_2
m_devNameList.clear(); m_devNameList.clear();
m_openDevice = false; m_openDevice = false;
m_devName.clear(); m_devName.clear();
m_sn.clear();
m_devHandle = NULL; m_devHandle = NULL;
m_devParams.clear(); m_devParams.clear();
m_scanBlankCheck = false; m_scanBlankCheck = false;
@ -266,7 +267,8 @@ namespace ver_2
if ((mask & GlobalConfig::fileSavePathMask) && cfg.fileSavePath.empty()) if ((mask & GlobalConfig::fileSavePathMask) && cfg.fileSavePath.empty())
return -1; return -1;
if ((mask & GlobalConfig::fileNameModeMask) && ("date_time" != cfg.fileNameMode && "random" != cfg.fileNameMode)) if ((mask & GlobalConfig::fileNameModeMask) && ("date_time" != cfg.fileNameMode && "random" != cfg.fileNameMode
&& "sn_date_time" != cfg.fileNameMode))
return -1; return -1;
if ((mask & GlobalConfig::imageFormatMask) && ("jpg" != cfg.imageFormat && "bmp" != cfg.imageFormat && "png" != cfg.imageFormat && "tif" != cfg.imageFormat if ((mask & GlobalConfig::imageFormatMask) && ("jpg" != cfg.imageFormat && "bmp" != cfg.imageFormat && "png" != cfg.imageFormat && "tif" != cfg.imageFormat
&& "pdf" != cfg.imageFormat && "ofd" != cfg.imageFormat && "ocr-pdf" != cfg.imageFormat && "ocr-ofd" != cfg.imageFormat)) && "pdf" != cfg.imageFormat && "ofd" != cfg.imageFormat && "ocr-pdf" != cfg.imageFormat && "ocr-ofd" != cfg.imageFormat))
@ -1327,6 +1329,9 @@ namespace ver_2
m_devName = deviceName; m_devName = deviceName;
m_openDevice = true; m_openDevice = true;
errInfo.clear(); errInfo.clear();
std::string snError;
GetDeviceSN(m_sn, snError);
return 0; return 0;
} }
@ -1348,8 +1353,9 @@ namespace ver_2
m_devName.clear(); m_devName.clear();
m_devParams.clear(); m_devParams.clear();
m_openDevice = false; m_openDevice = false;
errInfo.clear(); errInfo.clear();
m_sn.clear();
return 0; return 0;
} }
@ -3176,6 +3182,13 @@ namespace ver_2
HGBase_GetUuid(uuid, 256); HGBase_GetUuid(uuid, 256);
sprintf(filePath, "%s%s%s.%s", savePath, m_globalCfg.fileNamePrefix.c_str(), uuid, suffix.c_str()); sprintf(filePath, "%s%s%s.%s", savePath, m_globalCfg.fileNamePrefix.c_str(), uuid, suffix.c_str());
} }
else if ("sn_date_time" == m_globalCfg.fileNameMode)
{
HGTimeInfo timeInfo;
HGBase_GetLocalTime(&timeInfo);
sprintf(filePath, "%s%s%s_%04d%02d%02d%02d%02d%02d%03d.%s", savePath, m_globalCfg.fileNamePrefix.c_str(), m_sn.c_str(), timeInfo.year,
timeInfo.month, timeInfo.day, timeInfo.hour, timeInfo.minute, timeInfo.second, timeInfo.milliseconds, suffix.c_str());
}
else else
{ {
HGTimeInfo timeInfo; HGTimeInfo timeInfo;

View File

@ -317,6 +317,7 @@ namespace ver_2
bool m_openDevice; bool m_openDevice;
SANE_Handle m_devHandle; SANE_Handle m_devHandle;
std::string m_devName; std::string m_devName;
std::string m_sn;
std::vector<DeviceParamsGroup> m_devParams; std::vector<DeviceParamsGroup> m_devParams;
bool m_scanBlankCheck; bool m_scanBlankCheck;
bool m_scanTemp; bool m_scanTemp;