优化网络重试次数和日志

NWMQTT
Matthew 2 months ago
parent 94ca4f77a4
commit 0170e21b1d

@ -1704,7 +1704,8 @@ bool CPhoneDevice::TakePhotoWithNetCamera(IDevice::PHOTO_INFO& localPhotoInfo, c
cv::Mat rgb; cv::Mat rgb;
bool netCaptureResult = false; bool netCaptureResult = false;
for (int idx = 0; idx < 64; idx++) std::string lastError;
for (int idx = 0; idx < 128; idx++)
{ {
netHandle = GetEthnetHandle(); netHandle = GetEthnetHandle();
netPhotoInfo.netHandle = netHandle; netPhotoInfo.netHandle = netHandle;
@ -1739,8 +1740,8 @@ bool CPhoneDevice::TakePhotoWithNetCamera(IDevice::PHOTO_INFO& localPhotoInfo, c
XYLOG(XYLOG_SEVERITY_INFO, "NetCapture Succeeded PHOTOID=%u Img Size=%u", localPhotoInfo.photoId, (uint32_t)img.size()); 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)
{ {
std::string hexStr = ByteArrayToString(&img[0], img.size()); lastError = ByteArrayToString(&img[0], img.size());
XYLOG(XYLOG_SEVERITY_DEBUG,"Img Size<1000, img=%s", hexStr.c_str()); // XYLOG(XYLOG_SEVERITY_DEBUG,"Img Size<1000, img=%s", hexStr.c_str());
} }
rgb = cv::imdecode(cv::Mat(img), cv::IMREAD_COLOR); rgb = cv::imdecode(cv::Mat(img), cv::IMREAD_COLOR);
if (!rgb.empty()) if (!rgb.empty())
@ -1782,8 +1783,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", (uint32_t)localPhotoInfo.channel, (uint32_t)localPhotoInfo.preset, 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,
localPhotoInfo.photoId, netPhotoInfo.ip, netPhotoInfo.url); localPhotoInfo.photoId, 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