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();