From 38a8498dbc72cf622ee31f5543e596dbce54e87c Mon Sep 17 00:00:00 2001 From: Matthew Date: Fri, 25 Apr 2025 11:22:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=BD=91=E7=BB=9C=E6=89=93?= =?UTF-8?q?=E5=BC=80=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/cpp/PhoneDevice.cpp | 40 ++++++++++++++++---------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/app/src/main/cpp/PhoneDevice.cpp b/app/src/main/cpp/PhoneDevice.cpp index d979ac0b..92a627a8 100644 --- a/app/src/main/cpp/PhoneDevice.cpp +++ b/app/src/main/cpp/PhoneDevice.cpp @@ -1604,24 +1604,19 @@ bool CPhoneDevice::TakePhotoWithNetCamera(IDevice::PHOTO_INFO& localPhotoInfo, c #endif XYLOG(XYLOG_SEVERITY_DEBUG, "Ethernet Power ON"); + std::shared_ptr ethernetPowerCtrl = std::make_shared(localPhotoInfo.closeDelayTime); - uint32_t netWaitTime = (localPhotoInfo.cameraType == CAM_TYPE_PLZ) ? 20 : 4; - std::shared_ptr ethernetPowerCtrl = std::make_shared(netWaitTime); - - net_handle_t netHandle = GetEthnetHandle(); - if (netHandle == 0) + std::this_thread::sleep_for(std::chrono::milliseconds(5000)); + net_handle_t netHandle = 0; + // Wait about 10s + for (int idx = 0; idx < 84; idx++) { - // Wait about 10s - for (int idx = 0; idx < 84; idx++) + netHandle = GetEthnetHandle(); + if (netHandle != 0) { - std::this_thread::sleep_for(std::chrono::milliseconds(128)); - netHandle = GetEthnetHandle(); - - if (netHandle != 0) - { - break; - } + break; } + std::this_thread::sleep_for(std::chrono::milliseconds(128)); } if (netHandle == 0) @@ -1666,7 +1661,11 @@ bool CPhoneDevice::TakePhotoWithNetCamera(IDevice::PHOTO_INFO& localPhotoInfo, c XYLOG(XYLOG_SEVERITY_INFO, "Ethernet is Available Handle=%llu IP=%s CH=%u PR=%X PHOTOID=%u", (uint64_t)netHandle, buf, (uint32_t)localPhotoInfo.channel, (uint32_t)localPhotoInfo.preset, localPhotoInfo.photoId); } - // SetStaticIp(); + if (mBuildTime < 1738166400) + { + // 2025-01-30 + SetStaticIp(); + } std::this_thread::sleep_for(std::chrono::milliseconds(256)); std::string ip = GetIpStr(localPhotoInfo.ip); @@ -1743,14 +1742,13 @@ bool CPhoneDevice::TakePhotoWithNetCamera(IDevice::PHOTO_INFO& localPhotoInfo, c } img.clear(); - netCaptureResult = requestCapture(localPhotoInfo.channel, localPhotoInfo.preset, netPhotoInfo, img); + netCaptureResult = vendorCtrl->TakePhoto(localPhotoInfo.cameraId, img); if (netCaptureResult && !img.empty()) { if(img.size() <= 1000) { lastError = ByteArrayToString(&img[0], img.size()); - // XYLOG(XYLOG_SEVERITY_DEBUG,"Img Size<1000, img=%s", hexStr.c_str()); } rgb = cv::imdecode(cv::Mat(img), cv::IMREAD_COLOR); if (!rgb.empty()) @@ -2258,8 +2256,11 @@ bool CPhoneDevice::TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector< { uint32_t waitTime = localPhotoInfo.selfTestingTime; XYLOG(XYLOG_SEVERITY_INFO, "Camera is SelfTesting Time=%u s", waitTime); - waitTime = (waitTime != 0) ? (waitTime * 1024) : 10240; - std::this_thread::sleep_for(std::chrono::milliseconds(waitTime)); + waitTime = (waitTime <= 5 ) ? 0 : ((waitTime - 5) * 1024); + if (waitTime > 0) + { + std::this_thread::sleep_for(std::chrono::milliseconds(waitTime)); + } XYLOG(XYLOG_SEVERITY_INFO, "Camera SeltTesting Finished"); pThis->TakePhotoWithNetCamera(localPhotoInfo, path, osds, powerCtrlPtr); @@ -4371,7 +4372,6 @@ net_handle_t CPhoneDevice::GetEthnetHandle() const void CPhoneDevice::SetStaticIp(const std::string& iface, const std::string& ip, const std::string& netmask, const std::string& gateway) { - JNIEnv* env = NULL; jboolean ret = JNI_FALSE; bool didAttachThread = false;