优化日志

NWMQTT
Matthew 2 months ago
parent 0170e21b1d
commit 8f49d82dec

@ -1705,7 +1705,8 @@ bool CPhoneDevice::TakePhotoWithNetCamera(IDevice::PHOTO_INFO& localPhotoInfo, c
bool netCaptureResult = false; bool netCaptureResult = false;
std::string lastError; std::string lastError;
for (int idx = 0; idx < 128; idx++) int idx = 0;
for (; idx < 128; idx++)
{ {
netHandle = GetEthnetHandle(); netHandle = GetEthnetHandle();
netPhotoInfo.netHandle = netHandle; netPhotoInfo.netHandle = netHandle;
@ -1737,7 +1738,6 @@ bool CPhoneDevice::TakePhotoWithNetCamera(IDevice::PHOTO_INFO& localPhotoInfo, c
} }
if (netCaptureResult && !img.empty()) if (netCaptureResult && !img.empty())
{ {
XYLOG(XYLOG_SEVERITY_INFO, "NetCapture Succeeded PHOTOID=%u Img Size=%u", localPhotoInfo.photoId, (uint32_t)img.size());
if(img.size() <= 1000) if(img.size() <= 1000)
{ {
lastError = ByteArrayToString(&img[0], img.size()); lastError = ByteArrayToString(&img[0], img.size());
@ -1746,6 +1746,7 @@ bool CPhoneDevice::TakePhotoWithNetCamera(IDevice::PHOTO_INFO& localPhotoInfo, c
rgb = cv::imdecode(cv::Mat(img), cv::IMREAD_COLOR); rgb = cv::imdecode(cv::Mat(img), cv::IMREAD_COLOR);
if (!rgb.empty()) if (!rgb.empty())
{ {
XYLOG(XYLOG_SEVERITY_INFO, "NetCapture Succeeded PHOTOID=%u Img Size=%u Retries=%d", localPhotoInfo.photoId, (uint32_t)img.size(), idx);
break; break;
} }
} }
@ -1783,8 +1784,8 @@ bool CPhoneDevice::TakePhotoWithNetCamera(IDevice::PHOTO_INFO& localPhotoInfo, c
} }
else else
{ {
XYLOG(XYLOG_SEVERITY_ERROR, "Failed to TP on NET Camera CH=%u PR=%X PHOTOID=%u URL=http://%s%s, LastErr:%s", (uint32_t)localPhotoInfo.channel, (uint32_t)localPhotoInfo.preset, XYLOG(XYLOG_SEVERITY_ERROR, "Failed to TP on NET Camera CH=%u PR=%X PHOTOID=%u Retries=%d URL=http://%s%s, LastErr:%s", (uint32_t)localPhotoInfo.channel, (uint32_t)localPhotoInfo.preset,
localPhotoInfo.photoId, netPhotoInfo.ip, netPhotoInfo.url, lastError.c_str()); localPhotoInfo.photoId, idx, netPhotoInfo.ip, netPhotoInfo.url, lastError.c_str());
#if !defined(NDEBUG) && defined(OUTPUT_DBG_INFO) #if !defined(NDEBUG) && defined(OUTPUT_DBG_INFO)
std::string pwrStatus = powerCtrlPtr->GetStatus(); std::string pwrStatus = powerCtrlPtr->GetStatus();
pwrStatus += ethernetPowerCtrl->GetStatus(); pwrStatus += ethernetPowerCtrl->GetStatus();

Loading…
Cancel
Save