From fed405d585f98d518ae544189d9924eed32eaf30 Mon Sep 17 00:00:00 2001 From: "XI.CHEN" <2311041011@qq.com> Date: Fri, 13 Dec 2024 11:35:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=B6=E9=97=B4=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E7=B1=BB=E5=9E=8B=EF=BC=8C=E6=8B=8D=E7=85=A7=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=94=A4=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/cpp/PhoneDevice.cpp | 10 +++++++--- app/src/main/cpp/PhoneDevice.h | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/main/cpp/PhoneDevice.cpp b/app/src/main/cpp/PhoneDevice.cpp index 33499561..c7dc9866 100644 --- a/app/src/main/cpp/PhoneDevice.cpp +++ b/app/src/main/cpp/PhoneDevice.cpp @@ -1729,12 +1729,13 @@ bool CPhoneDevice::TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector< } else if (mPhotoInfo.mediaType == 0 && (mPhotoInfo.cameraType == CAM_TYPE_SERIAL)) { + unsigned long wid_serial = RequestWakelock(0); CPhoneDevice* pThis = this; IDevice::PHOTO_INFO localPhotoInfo = mPhotoInfo; IDevice::SerialsPhotoParam param = { "", 0, 0 }; GetPhotoSerialsParamCb(param); - std::thread t([localPhotoInfo, param, pThis]() mutable + std::thread t([localPhotoInfo, param, pThis,wid_serial]() mutable { if (localPhotoInfo.preset != 0 && localPhotoInfo.preset != 0xFF) { @@ -1744,7 +1745,6 @@ bool CPhoneDevice::TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector< time_t ts = time(NULL); if(!pThis->GetPTZSensorsStatus() && !pThis->GetCameraStatus()) { - XYLOG(XYLOG_SEVERITY_INFO, "Camera is SeltTesting, selfTestingtime=%u", (uint32_t)localPhotoInfo.selfTestingTime); pThis->OpenPTZSensors(localPhotoInfo.selfTestingTime); } CameraPhotoCmd(ts, localPhotoInfo.channel, 0, localPhotoInfo.resolution, 0, param.serfile, param.baud, param.addr); @@ -1752,6 +1752,7 @@ bool CPhoneDevice::TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector< pThis->TakePTZPhotoCb(3, localPhotoInfo); pThis->ClosePTZSensors(localPhotoInfo.closeDelayTime); GpioControl::setCam3V3Enable(false, localPhotoInfo.closeDelayTime); + pThis->ReleaseWakelock(wid_serial); }); t.detach(); @@ -1837,7 +1838,7 @@ bool CPhoneDevice::TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector< return res; } -bool CPhoneDevice::OpenPTZSensors(int sec) +bool CPhoneDevice::OpenPTZSensors(uint32_t sec) { unsigned long wid = RequestWakelock(0); unsigned long long time_now = GetMicroTimeStamp(); @@ -1863,6 +1864,7 @@ bool CPhoneDevice::OpenPTZSensors(int sec) if(m_sensorsStatus && !m_cameraStatus) { + XYLOG(XYLOG_SEVERITY_INFO, "Camera is SeltTesting, selfTestingtime=%u", sec); auto start = std::chrono::steady_clock::now(); while (std::chrono::steady_clock::now() - start < std::chrono::seconds(sec)) { @@ -1888,6 +1890,8 @@ bool CPhoneDevice::OpenPTZSensors(int sec) if (!m_cameraStatus && m_sensorsStatus) { m_cameraStatus = true; + unsigned long long time_over = GetMicroTimeStamp(); + XYLOG(XYLOG_SEVERITY_INFO, "Camera SeltTesting is over, selfTestingtime=%u", (time_over - time_now)/1000); } } ReleaseWakelock(wid); diff --git a/app/src/main/cpp/PhoneDevice.h b/app/src/main/cpp/PhoneDevice.h index 1ed11fa3..ecd72cbf 100644 --- a/app/src/main/cpp/PhoneDevice.h +++ b/app/src/main/cpp/PhoneDevice.h @@ -231,7 +231,7 @@ public: virtual int GetIceData(ICE_INFO *iceInfo, ICE_TAIL *icetail, SENSOR_PARAM *sensorParam); virtual bool OpenSensors(int sensortype); virtual bool CloseSensors(int sensortype, uint32_t delayedCloseTime); - virtual bool OpenPTZSensors(int sec); + virtual bool OpenPTZSensors(uint32_t sec); virtual bool ClosePTZSensors(uint32_t delayedCloseTime); virtual bool GetPTZSensorsStatus(); virtual bool GetCameraStatus();