|
@@ -1115,9 +1115,8 @@ int CHSPScannerFSM::ScanImage(SpReqAnsContext<HSPScannerService_ScanImage_Req,
|
|
|
//TODO:
|
|
|
ctx->Ans.filePath = csImageFile;
|
|
|
CBlob& cbData = ctx->Ans.imageData;
|
|
|
- FILE* fHandle = fopen(csImageFile, "rb");
|
|
|
- if(fHandle)
|
|
|
- {
|
|
|
+ FILE* fHandle = fopen(csImageFile.GetData(), "rb");
|
|
|
+ if(fHandle) {
|
|
|
fseek(fHandle, 0, SEEK_END);
|
|
|
long fileSize = ftell(fHandle);
|
|
|
if(fileSize <= 0) {
|
|
@@ -1138,7 +1137,7 @@ int CHSPScannerFSM::ScanImage(SpReqAnsContext<HSPScannerService_ScanImage_Req,
|
|
|
{
|
|
|
erroCode = Error_Resource;
|
|
|
LogError(Severity_High, Error_Resource, LOG_EVT_HSPS_READ_IMAGE_FILE_FAILED,
|
|
|
- CSimpleStringA::Format("fopen(%s) failed.", (LPCTSTR)csImageFile)
|
|
|
+ CSimpleStringA::Format("fopen(%s) failed: %d, %s", (LPCTSTR)csImageFile, errno, strerror(errno))
|
|
|
);
|
|
|
//GetAndDbgDevError();
|
|
|
nRes = 4;
|
|
@@ -1160,14 +1159,11 @@ int CHSPScannerFSM::ScanImage(SpReqAnsContext<HSPScannerService_ScanImage_Req,
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- //Dbg("ScanImage failed returned 0x%x.", erroCode);
|
|
|
- //GetAndDbgDevError();
|
|
|
- LogErrMsg("ScanImage::ScanImage", erroCode, MEC_DEVAPI_HSPSCANNER_ScanImage, TRUE);
|
|
|
+ LOG_HSPSCANNER_ERROR_MSG_MACRO(erroCode, ScanImage);
|
|
|
ctx->Answer(erroCode);
|
|
|
//Todo: SetCustLastErrorCode();
|
|
|
return 2;
|
|
|
}
|
|
|
-
|
|
|
return nRes;
|
|
|
}
|
|
|
|
|
@@ -1288,8 +1284,7 @@ int CHSPScannerFSM::ScanImageEx(SpReqAnsContext<HSPScannerService_ScanImageEx_Re
|
|
|
else
|
|
|
{
|
|
|
Dbg("ScanImageEx failed returned 0x%x, %d, %d.", erroCode, len, strlen((const char*)pBtImage));
|
|
|
- //GetAndDbgDevError();
|
|
|
- LogErrMsg("ScanImageEx::ScanImageEx", erroCode, MEC_DEVAPI_HSPSCANNER_ScanImageEx, TRUE);
|
|
|
+ LOG_HSPSCANNER_ERROR_MSG_MACRO(erroCode, ScanImageEx);
|
|
|
ctx->Answer(erroCode);
|
|
|
nRes = 2;
|
|
|
}
|
|
@@ -1345,7 +1340,6 @@ int CHSPScannerFSM::SetProperty(SpReqAnsContext<HSPScannerService_SetProperty_Re
|
|
|
if(FAILURED(erroCode))
|
|
|
{
|
|
|
retCode |= 0x0001;
|
|
|
- //GetAndDbgDevError();
|
|
|
LogErrMsg("SetProperty::SetParam", erroCode, MEC_DEVAPI_HSPSCANNER_SetParam, TRUE);
|
|
|
erroCode = Error_Succeed;
|
|
|
}
|
|
@@ -1373,8 +1367,7 @@ int CHSPScannerFSM::SetProperty(SpReqAnsContext<HSPScannerService_SetProperty_Re
|
|
|
if(FAILURED(erroCode))
|
|
|
{
|
|
|
retCode |= 0x0002;
|
|
|
- LogErrMsg("SetProperty::SetParam", erroCode, MEC_DEVAPI_HSPSCANNER_SetParam, TRUE);
|
|
|
- //GetAndDbgDevError();
|
|
|
+ LOG_HSPSCANNER_ERROR_MSG_MACRO(erroCode, SetParam);
|
|
|
erroCode = Error_Succeed;
|
|
|
}
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
@@ -1396,8 +1389,7 @@ int CHSPScannerFSM::SetProperty(SpReqAnsContext<HSPScannerService_SetProperty_Re
|
|
|
if(FAILURED(erroCode))
|
|
|
{
|
|
|
retCode |= 0x0004;
|
|
|
- LogErrMsg("SetProperty::SetParam", erroCode, MEC_DEVAPI_HSPSCANNER_SetParam, TRUE);
|
|
|
- //GetAndDbgDevError();
|
|
|
+ LOG_HSPSCANNER_ERROR_MSG_MACRO(erroCode, SetParam);
|
|
|
erroCode = Error_Succeed;
|
|
|
}
|
|
|
|
|
@@ -1435,9 +1427,7 @@ int CHSPScannerFSM::SetWinPos(SpReqAnsContext<HSPScannerService_SetWinPos_Req,
|
|
|
erroCode = m_hDevHelper->SetViewPos(ctx->Req.pointX, ctx->Req.pointY, ctx->Req.nWidth);
|
|
|
if(FAILURED(erroCode))
|
|
|
{
|
|
|
- LogErrMsg("SetWinPos::SetViewPos", erroCode, MEC_DEVAPI_HSPSCANNER_SetViewPos, TRUE);
|
|
|
- //Dbg("SetViewPos failed returned 0x%x.", erroCode);
|
|
|
- //GetAndDbgDevError();
|
|
|
+ LOG_HSPSCANNER_ERROR_MSG_MACRO(erroCode, SetViewPos);
|
|
|
nRes = 2;
|
|
|
}
|
|
|
else
|
|
@@ -1454,8 +1444,7 @@ int CHSPScannerFSM::SetWinPos(SpReqAnsContext<HSPScannerService_SetWinPos_Req,
|
|
|
Dbg("End to SetViewParam returned 0x%x.", erroCode);
|
|
|
if(FAILURED(erroCode))
|
|
|
{
|
|
|
- LogErrMsg("SetWinPos::SetParam", erroCode, MEC_DEVAPI_HSPSCANNER_SetParam, TRUE);
|
|
|
- //GetAndDbgDevError();
|
|
|
+ LOG_HSPSCANNER_ERROR_MSG_MACRO(erroCode, SetParam);
|
|
|
nRes = 1;
|
|
|
}
|
|
|
}
|
|
@@ -1478,9 +1467,7 @@ int CHSPScannerFSM::GetDevStatus(SpReqAnsContext<HSPScannerService_GetDevStatus_
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- //Dbg("GetDevStatus failed returned 0x%x.", erroCode);
|
|
|
- //GetAndDbgDevError();
|
|
|
- LogErrMsg("GetDevStatus::GetDevStatus", erroCode, MEC_DEVAPI_HSPSCANNER_GetDevStatus, TRUE);
|
|
|
+ LOG_HSPSCANNER_ERROR_MSG_MACRO(erroCode, GetDevStatus);
|
|
|
nRes = 1;
|
|
|
}
|
|
|
ctx->Answer(erroCode);
|
|
@@ -1517,11 +1504,6 @@ int CHSPScannerFSM::GetDevInfo(SpReqAnsContext<HSPScannerService_GetDevInfo_Req,
|
|
|
|
|
|
BOOL CHSPScannerFSM::GetCurImageName(CSimpleStringA& csImagName, bool bExt /*= false*/)
|
|
|
{
|
|
|
- //SYSTEMTIME st;
|
|
|
- //GetLocalTime(&st);
|
|
|
- //char szBuffer[MAX_PATH_SIZE] = {0};
|
|
|
- //sprintf_s(szBuffer, MAX_PATH_SIZE, "%02d%02d%02d%03d.jpg", st.wHour, st.wMinute, st.wSecond,
|
|
|
- // st.wMilliseconds);
|
|
|
if(bExt)
|
|
|
{
|
|
|
csImagName = "MaterialImageExt.jpg";
|