From b9fe6ce04805eefbacce33325bf0e293562dff46 Mon Sep 17 00:00:00 2001 From: Matthew Date: Thu, 24 Apr 2025 10:38:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=BD=91=E7=BB=9C=E6=91=84?= =?UTF-8?q?=E5=83=8F=E5=A4=B4=E4=BE=9B=E5=BA=94=E5=95=86=E7=9A=84=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 移除航煜对时的实现 --- app/src/main/cpp/PhoneDevice.cpp | 19 ++++++++----------- app/src/main/cpp/PhoneDevice.h | 2 +- app/src/main/cpp/netcamera/VendorCtrl.cpp | 5 +++++ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/app/src/main/cpp/PhoneDevice.cpp b/app/src/main/cpp/PhoneDevice.cpp index 2d8fbee2..01fa0dcd 100644 --- a/app/src/main/cpp/PhoneDevice.cpp +++ b/app/src/main/cpp/PhoneDevice.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #ifdef USING_HDRPLUS #include @@ -1661,7 +1662,7 @@ bool CPhoneDevice::TakePhotoWithNetCamera(IDevice::PHOTO_INFO& localPhotoInfo, c std::this_thread::sleep_for(std::chrono::milliseconds(256)); std::string ip = GetIpStr(localPhotoInfo.ip); - VendorCtrl* vendorCtrl = MakeVendorCtrl(localPhotoInfo.vendor, localPhotoInfo.channel, ip, localPhotoInfo.userName, localPhotoInfo.password, netHandle); + std::unique_ptr vendorCtrl(MakeVendorCtrl(localPhotoInfo.vendor, localPhotoInfo.channel, ip, localPhotoInfo.userName, localPhotoInfo.password, netHandle, false)); NET_PHOTO_INFO netPhotoInfo = { netHandle, 0 }; if (localPhotoInfo.vendor == 1) @@ -1866,8 +1867,8 @@ bool CPhoneDevice::TakeVideoWithNetCamera(IDevice::PHOTO_INFO& localPhotoInfo, c std::this_thread::sleep_for(std::chrono::milliseconds(256)); std::string ip = GetIpStr(localPhotoInfo.ip); - VendorCtrl* vendorCtrl = MakeVendorCtrl(localPhotoInfo.vendor, localPhotoInfo.channel, ip, localPhotoInfo.userName, localPhotoInfo.password, netHandle); - if (vendorCtrl == NULL) + std::unique_ptr vendorCtrl(MakeVendorCtrl(localPhotoInfo.vendor, localPhotoInfo.channel, ip, localPhotoInfo.userName, localPhotoInfo.password, netHandle, false)); + if (!vendorCtrl) { XYLOG(XYLOG_SEVERITY_ERROR, "Vendor(%u) not Supported CH=%u PR=%X PHOTOID=%u", (uint32_t)localPhotoInfo.vendor, (uint32_t)localPhotoInfo.channel, (unsigned int)localPhotoInfo.preset, localPhotoInfo.photoId); TakePhotoCb(0, localPhotoInfo, "", 0); @@ -1999,7 +2000,7 @@ bool CPhoneDevice::StartPushStreaming(IDevice::PHOTO_INFO& photoInfo, const std: } std::string ip = GetIpStr(photoInfo.ip); - VendorCtrl* vendorCtrl = MakeVendorCtrl(photoInfo.vendor, photoInfo.channel, ip, photoInfo.userName, photoInfo.password, netHandle); + VendorCtrl* vendorCtrl = MakeVendorCtrl(photoInfo.vendor, photoInfo.channel, ip, photoInfo.userName, photoInfo.password, netHandle, true); if (vendorCtrl == NULL) { XYLOG(XYLOG_SEVERITY_ERROR, "Vendor(%u) not Supported CH=%u PR=%X PHOTOID=%u", (uint32_t)photoInfo.vendor, (uint32_t)photoInfo.channel, (unsigned int)photoInfo.preset, photoInfo.photoId); @@ -5186,7 +5187,7 @@ void CPhoneDevice::SetStaticIp() } } -VendorCtrl* CPhoneDevice::MakeVendorCtrl(int vendor, uint8_t channel, const std::string& ip, const std::string& userName, const std::string& password, net_handle_t netHandle) +VendorCtrl* CPhoneDevice::MakeVendorCtrl(int vendor, uint8_t channel, const std::string& ip, const std::string& userName, const std::string& password, net_handle_t netHandle, bool syncTime) { VendorCtrl* vendorCtrl = NULL; switch (vendor) @@ -5198,15 +5199,11 @@ VendorCtrl* CPhoneDevice::MakeVendorCtrl(int vendor, uint8_t channel, const std: break; case 3: // Yu Shi - vendorCtrl = new YuShiCtrl(ip, userName, password, channel, netHandle); + vendorCtrl = new YuShiCtrl(ip, userName, password, channel, netHandle, syncTime); break; case 5: // Hang Yu - New - vendorCtrl = new HangYuCtrl(ip, userName, password, channel, netHandle); - } - if (vendorCtrl != NULL) - { - vendorCtrl->UpdateTime(time(NULL)); + vendorCtrl = new HangYuCtrl(ip, userName, password, channel, netHandle, syncTime); } return vendorCtrl; } diff --git a/app/src/main/cpp/PhoneDevice.h b/app/src/main/cpp/PhoneDevice.h index 8b10faf3..573abb47 100644 --- a/app/src/main/cpp/PhoneDevice.h +++ b/app/src/main/cpp/PhoneDevice.h @@ -280,7 +280,7 @@ public: net_handle_t GetEthnetHandle() const; - VendorCtrl* MakeVendorCtrl(int vendor, uint8_t channel, const std::string& ip, const std::string& userName, const std::string& password, net_handle_t netHandle); + VendorCtrl* MakeVendorCtrl(int vendor, uint8_t channel, const std::string& ip, const std::string& userName, const std::string& password, net_handle_t netHandle, bool syncTime); protected: diff --git a/app/src/main/cpp/netcamera/VendorCtrl.cpp b/app/src/main/cpp/netcamera/VendorCtrl.cpp index 777d29af..a914b22c 100644 --- a/app/src/main/cpp/netcamera/VendorCtrl.cpp +++ b/app/src/main/cpp/netcamera/VendorCtrl.cpp @@ -6,6 +6,11 @@ VendorCtrl::VendorCtrl(const std::string& ip, const std::string& userName, const std::string& password, uint8_t channel, net_handle_t netHandle, bool syncTime/* = true*/) : m_ip(ip), m_userName(userName), m_password(password), m_channel(channel), m_netHandle(netHandle) { + if (syncTime) + { + time_t ts = time(NULL); + UpdateTime(ts); + } } std::string VendorCtrl::CvtJSONToString(const Json::Value& data) {