From 6be75f4a8e42e673fe6b102cdd7fb5a9140dea01 Mon Sep 17 00:00:00 2001 From: Matthew Date: Wed, 19 Feb 2025 22:10:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=91=E5=8F=B0=E7=94=B5=E6=BA=90=E5=92=8C?= =?UTF-8?q?=E7=BD=91=E7=BB=9C=E7=94=B5=E6=BA=90=E5=88=86=E5=BC=80=E6=8E=A7?= =?UTF-8?q?=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/cpp/GPIOControl.h | 19 ++++++++++++++++++- app/src/main/cpp/PhoneDevice.cpp | 7 +++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/app/src/main/cpp/GPIOControl.h b/app/src/main/cpp/GPIOControl.h index c66baec4..b07bfa27 100644 --- a/app/src/main/cpp/GPIOControl.h +++ b/app/src/main/cpp/GPIOControl.h @@ -556,7 +556,7 @@ public: PowerControl(CMD_SET_OTG_STATE, CMD_SET_NETWORK_POWER_EN, CMD_SET_PIC1_POWER, CMD_SET_485_EN_STATE, closeDelayTime) #else // USING_N938 #ifdef USING_PLZ - PowerControl(CMD_SET_3V3_PWR_EN, CMD_SET_OTG_STATE, CMD_SET_PTZ_PWR_ENABLE, CMD_SET_100M_ENABLE, CMD_SET_100M_SWITCH_PWR_ENABLE, CMD_SET_485_ENABLE, CMD_SET_12V_EN_STATE, closeDelayTime) + PowerControl(CMD_SET_PTZ_PWR_ENABLE, CMD_SET_485_ENABLE, CMD_SET_12V_EN_STATE, closeDelayTime) #else // USING_PLZ PowerControl(CMD_SET_OTG_STATE, CMD_SET_12V_EN_STATE, closeDelayTime) #endif // USING_PLZ @@ -565,6 +565,23 @@ public: } }; +class EthernetPowerCtrl : public PowerControl +{ +public: + EthernetPowerCtrl(uint32_t closeDelayTime) : +#ifdef USING_N938 + PowerControl(CMD_SET_OTG_STATE, CMD_SET_NETWORK_POWER_EN, closeDelayTime) +#else // USING_N938 +#ifdef USING_PLZ + PowerControl(CMD_SET_3V3_PWR_EN, CMD_SET_OTG_STATE, CMD_SET_100M_ENABLE, CMD_SET_100M_SWITCH_PWR_ENABLE, closeDelayTime) +#else // USING_PLZ + PowerControl(CMD_SET_OTG_STATE, closeDelayTime) +#endif // USING_PLZ +#endif // USING_N938 + { + } +}; + class UsbCameraPowerCtrl : public PowerControl { public: diff --git a/app/src/main/cpp/PhoneDevice.cpp b/app/src/main/cpp/PhoneDevice.cpp index bdd19e90..a156fb0b 100644 --- a/app/src/main/cpp/PhoneDevice.cpp +++ b/app/src/main/cpp/PhoneDevice.cpp @@ -645,6 +645,7 @@ void CPhoneDevice::SetRecognizationCfg(const IDevice::CFG_RECOGNIZATION* pRecogn bool CPhoneDevice::BindNetwork(int sock) { +#ifdef USING_ETHERNET m_devLocker.lock(); net_handle_t defNetHandle = m_defNetHandle; m_devLocker.unlock(); @@ -658,6 +659,7 @@ bool CPhoneDevice::BindNetwork(int sock) } return res == 0; } +#endif // USING_ETHERNET return true; } @@ -1509,6 +1511,9 @@ bool CPhoneDevice::TakePhotoWithNetCamera(IDevice::PHOTO_INFO& localPhotoInfo, c std::this_thread::sleep_for(std::chrono::milliseconds(waitTime)); } + XYLOG(XYLOG_SEVERITY_ERROR, "Ethernet Power ON"); + std::shared_ptr ethernetPowerCtrl = std::make_shared(1); + std::this_thread::sleep_for(std::chrono::milliseconds(100)); SetStaticIp(); std::this_thread::sleep_for(std::chrono::milliseconds(256)); @@ -1616,6 +1621,8 @@ bool CPhoneDevice::TakePhotoWithNetCamera(IDevice::PHOTO_INFO& localPhotoInfo, c std::this_thread::sleep_for(std::chrono::milliseconds(1000)); } + ethernetPowerCtrl.reset(); + cv::Mat rgb; if (netCaptureResult && !img.empty()) {