Merge branch 'dev' of http://192.168.10.5:8099/sane/code_app into dev
This commit is contained in:
commit
fd18cb5234
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -61,7 +61,6 @@ namespace ver_2
|
|||
HGBase_OpenThread(ThreadFunc, this, &m_thread);
|
||||
|
||||
m_initDevice = false;
|
||||
m_devNameList.clear();
|
||||
m_openDevice = false;
|
||||
m_devName.clear();
|
||||
m_sn.clear();
|
||||
|
@ -78,6 +77,8 @@ namespace ver_2
|
|||
m_scanning = false;
|
||||
m_scanEvent = NULL;
|
||||
m_dpi = 200;
|
||||
m_curBatchTime.clear();
|
||||
m_curImgIndex = 0;
|
||||
|
||||
HGChar cfgPath[256];
|
||||
HGBase_GetConfigPath(cfgPath, 256);
|
||||
|
@ -276,7 +277,7 @@ namespace ver_2
|
|||
if ((mask & GlobalConfig::fileSavePathMask) && cfg.fileSavePath.empty())
|
||||
return -1;
|
||||
if ((mask & GlobalConfig::fileNameModeMask) && ("date_time" != cfg.fileNameMode && "random" != cfg.fileNameMode
|
||||
&& "sn_date_time" != cfg.fileNameMode))
|
||||
&& "sn_date_time" != cfg.fileNameMode) && "folder_time_img_order" != cfg.fileNameMode)
|
||||
return -1;
|
||||
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))
|
||||
|
@ -1381,7 +1382,6 @@ namespace ver_2
|
|||
std::string errInfo2;
|
||||
CloseDevice(errInfo2);
|
||||
sane_exit();
|
||||
m_devNameList.clear();
|
||||
m_initDevice = false;
|
||||
|
||||
m_initIden.clear();
|
||||
|
@ -1406,9 +1406,21 @@ namespace ver_2
|
|||
return -1;
|
||||
}
|
||||
|
||||
HGBase_EnterLock(m_lock);
|
||||
deviceNameList = m_devNameList;
|
||||
HGBase_LeaveLock(m_lock);
|
||||
const SANE_Device** device = NULL;
|
||||
sane_get_devices(&device, SANE_TRUE);
|
||||
if (NULL == device)
|
||||
{
|
||||
errInfo.clear();
|
||||
return 0;
|
||||
}
|
||||
|
||||
const SANE_Device** p = device;
|
||||
while (NULL != *p)
|
||||
{
|
||||
deviceNameList.push_back((*p)->name);
|
||||
++p;
|
||||
}
|
||||
|
||||
errInfo.clear();
|
||||
return 0;
|
||||
}
|
||||
|
@ -1672,6 +1684,14 @@ namespace ver_2
|
|||
|
||||
m_scanning = true;
|
||||
errInfo.clear();
|
||||
|
||||
HGTimeInfo timeInfo;
|
||||
HGBase_GetLocalTime(&timeInfo);
|
||||
char filePath[256] = { 0 };
|
||||
sprintf(filePath, "%04d-%02d-%02d-%02d.%02d.%02d", timeInfo.year, timeInfo.month, timeInfo.day, timeInfo.hour, timeInfo.minute, timeInfo.second);
|
||||
m_curBatchTime = filePath;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1700,6 +1720,8 @@ namespace ver_2
|
|||
m_scanGetBase64 = false;
|
||||
m_scanning = false;
|
||||
m_dpi = 200;
|
||||
m_curBatchTime.clear();
|
||||
m_curImgIndex = 0;
|
||||
|
||||
errInfo.clear();
|
||||
return 0;
|
||||
|
@ -3324,6 +3346,21 @@ namespace ver_2
|
|||
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 if ("folder_time_img_order" == m_globalCfg.fileNameMode)
|
||||
{
|
||||
if (!m_curBatchTime.empty())
|
||||
{
|
||||
strcat(savePath, m_curBatchTime.c_str());
|
||||
strcat(savePath, "/");
|
||||
HGBase_StandardiseFileName(savePath, savePath, 256);
|
||||
|
||||
}
|
||||
HGBase_CreateDir(savePath);
|
||||
|
||||
HGTimeInfo timeInfo;
|
||||
HGBase_GetLocalTime(&timeInfo);
|
||||
sprintf(filePath, "%s%s%s.%s", savePath, m_globalCfg.fileNamePrefix.c_str(), std::to_string(m_curImgIndex).c_str(), suffix.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -4356,7 +4393,6 @@ namespace ver_2
|
|||
HGBase_WriteInfo(HGBASE_INFOTYPE_DESC, "SANE_EVENT_DEVICE_ARRIVED, name=%s", Utf8ToStdString(sane_dev->name).c_str());
|
||||
|
||||
HGBase_EnterLock(p->m_lock);
|
||||
p->m_devNameList.push_back(sane_dev->name);
|
||||
std::list<class WSUser *>::iterator iter;
|
||||
for (iter = p->m_user.begin(); iter != p->m_user.end(); ++iter)
|
||||
{
|
||||
|
@ -4383,14 +4419,6 @@ namespace ver_2
|
|||
}
|
||||
|
||||
HGBase_EnterLock(p->m_lock);
|
||||
for (int i = 0; i < (int)p->m_devNameList.size(); ++i)
|
||||
{
|
||||
if (0 == strcmp(sane_dev->name, p->m_devNameList[i].c_str()))
|
||||
{
|
||||
p->m_devNameList.erase(p->m_devNameList.begin() + i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
std::list<class WSUser *>::iterator iter;
|
||||
for (iter = p->m_user.begin(); iter != p->m_user.end(); ++iter)
|
||||
{
|
||||
|
@ -4485,6 +4513,8 @@ namespace ver_2
|
|||
HGBase_CreateImageFromData(data, &imgInfo, NULL, 0, HGBASE_IMGORIGIN_TOP, &img);
|
||||
if (NULL != img)
|
||||
{
|
||||
p->m_curImgIndex++;
|
||||
|
||||
HGBase_SetImageDpi(img, p->m_dpi, p->m_dpi);
|
||||
|
||||
HGBase_EnterLock(p->m_lock);
|
||||
|
|
|
@ -320,7 +320,6 @@ namespace ver_2
|
|||
HGThread m_thread;
|
||||
|
||||
bool m_initDevice;
|
||||
std::vector<std::string> m_devNameList;
|
||||
bool m_openDevice;
|
||||
SANE_Handle m_devHandle;
|
||||
std::string m_devName;
|
||||
|
@ -345,5 +344,8 @@ namespace ver_2
|
|||
int m_bindNameWidth;
|
||||
int m_bindNameBase;
|
||||
std::list<std::string> m_saveFilePathList;
|
||||
|
||||
std::string m_curBatchTime;
|
||||
int m_curImgIndex;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "base/HGDef.h"
|
||||
#include "base/HGDef.h"
|
||||
#include "base/HGInc.h"
|
||||
#include "base/HGCrash.h"
|
||||
#include "base/HGThread.h"
|
||||
|
@ -13,7 +13,7 @@
|
|||
#include "MsgPumpCallback.h"
|
||||
#include "curl/curl.h"
|
||||
|
||||
HGMsgPump msgPumpV1 = NULL;
|
||||
//HGMsgPump msgPumpV1 = NULL;
|
||||
HGMsgPump msgPumpV2 = NULL;
|
||||
|
||||
static void HGAPI CrashFunc(HGPointer crashAddr, HGPointer param)
|
||||
|
@ -75,6 +75,8 @@ static void HGAPI ThreadFuncV2(HGThread thread, HGPointer param)
|
|||
|
||||
#if defined(HG_CMP_MSC)
|
||||
|
||||
#ifndef _DEBUG
|
||||
|
||||
#if defined(OEM_HANWANG)
|
||||
#define SERVICE_NAME TEXT("HWWebService")
|
||||
#elif defined(OEM_LISICHENG)
|
||||
|
@ -102,12 +104,12 @@ void WINAPI ServiceCtrlHandler(DWORD dwControl)
|
|||
{
|
||||
case SERVICE_CONTROL_STOP: // 暂停控制
|
||||
ServiceStatus.dwCurrentState = SERVICE_STOPPED;// 状态设置为停止
|
||||
HGBase_ExitMsgPump(msgPumpV1);
|
||||
//HGBase_ExitMsgPump(msgPumpV1);
|
||||
HGBase_ExitMsgPump(msgPumpV2);
|
||||
break;
|
||||
case SERVICE_CONTROL_SHUTDOWN:// 关机控制
|
||||
ServiceStatus.dwCurrentState = SERVICE_STOPPED;// 状态设置为停止
|
||||
HGBase_ExitMsgPump(msgPumpV1);
|
||||
//HGBase_ExitMsgPump(msgPumpV1);
|
||||
HGBase_ExitMsgPump(msgPumpV2);
|
||||
break;
|
||||
default:
|
||||
|
@ -139,9 +141,9 @@ void WINAPI ServiceMain(DWORD dwNumServicesArgs, LPTSTR* lpServiceArgVectors)
|
|||
assert(0 == ret);
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
HGBase_CreateMsgPump(&msgPumpV1);
|
||||
HGThread threadV1 = NULL;
|
||||
HGBase_OpenThread(ThreadFuncV1, msgPumpV1, &threadV1);
|
||||
//HGBase_CreateMsgPump(&msgPumpV1);
|
||||
//HGThread threadV1 = NULL;
|
||||
//HGBase_OpenThread(ThreadFuncV1, msgPumpV1, &threadV1);
|
||||
|
||||
HGBase_CreateMsgPump(&msgPumpV2);
|
||||
HGThread threadV2 = NULL;
|
||||
|
@ -154,10 +156,10 @@ void WINAPI ServiceMain(DWORD dwNumServicesArgs, LPTSTR* lpServiceArgVectors)
|
|||
threadV2 = NULL;
|
||||
HGBase_DestroyMsgPump(msgPumpV2);
|
||||
msgPumpV2 = NULL;
|
||||
HGBase_CloseThread(threadV1);
|
||||
threadV1 = NULL;
|
||||
HGBase_DestroyMsgPump(msgPumpV1);
|
||||
msgPumpV1 = NULL;
|
||||
//HGBase_CloseThread(threadV1);
|
||||
//threadV1 = NULL;
|
||||
//HGBase_DestroyMsgPump(msgPumpV1);
|
||||
//msgPumpV1 = NULL;
|
||||
|
||||
curl_global_cleanup();
|
||||
WSACleanup();
|
||||
|
@ -184,12 +186,14 @@ int main()
|
|||
|
||||
int main()
|
||||
{
|
||||
HGBase_RegisterCrashFunc(CrashFunc, NULL);
|
||||
WSADATA ws = { 0 };
|
||||
int ret = WSAStartup(MAKEWORD(2, 2), &ws);
|
||||
assert(0 == ret);
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
HGBase_CreateMsgPump(&msgPumpV1);
|
||||
HGThread threadV1 = NULL;
|
||||
HGBase_OpenThread(ThreadFuncV1, msgPumpV1, &threadV1);
|
||||
//HGBase_CreateMsgPump(&msgPumpV1);
|
||||
//HGThread threadV1 = NULL;
|
||||
//HGBase_OpenThread(ThreadFuncV1, msgPumpV1, &threadV1);
|
||||
|
||||
HGBase_CreateMsgPump(&msgPumpV2);
|
||||
HGThread threadV2 = NULL;
|
||||
|
@ -199,10 +203,42 @@ int main()
|
|||
threadV2 = NULL;
|
||||
HGBase_DestroyMsgPump(msgPumpV2);
|
||||
msgPumpV2 = NULL;
|
||||
HGBase_CloseThread(threadV1);
|
||||
threadV1 = NULL;
|
||||
HGBase_DestroyMsgPump(msgPumpV1);
|
||||
msgPumpV1 = NULL;
|
||||
//HGBase_CloseThread(threadV1);
|
||||
//threadV1 = NULL;
|
||||
//HGBase_DestroyMsgPump(msgPumpV1);
|
||||
//msgPumpV1 = NULL;
|
||||
|
||||
curl_global_cleanup();
|
||||
WSACleanup();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
int main()
|
||||
{
|
||||
HGBase_RegisterCrashFunc(CrashFunc, NULL);
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
//HGBase_CreateMsgPump(&msgPumpV1);
|
||||
//HGThread threadV1 = NULL;
|
||||
//HGBase_OpenThread(ThreadFuncV1, msgPumpV1, &threadV1);
|
||||
|
||||
HGBase_CreateMsgPump(&msgPumpV2);
|
||||
HGThread threadV2 = NULL;
|
||||
HGBase_OpenThread(ThreadFuncV2, msgPumpV2, &threadV2);
|
||||
|
||||
HGBase_CloseThread(threadV2);
|
||||
threadV2 = NULL;
|
||||
HGBase_DestroyMsgPump(msgPumpV2);
|
||||
msgPumpV2 = NULL;
|
||||
//HGBase_CloseThread(threadV1);
|
||||
//threadV1 = NULL;
|
||||
//HGBase_DestroyMsgPump(msgPumpV1);
|
||||
//msgPumpV1 = NULL;
|
||||
|
||||
curl_global_cleanup();
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue