From 98c99e016c65b227b315ef609e2a8281ddff871c Mon Sep 17 00:00:00 2001 From: "XI.CHEN" <2311041011@qq.com> Date: Thu, 5 Dec 2024 15:26:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=B2=E5=8F=A3=E6=8B=8D=E7=85=A7=E5=90=AF?= =?UTF-8?q?=E7=94=A8=E7=BA=BF=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/cpp/PhoneDevice.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/app/src/main/cpp/PhoneDevice.cpp b/app/src/main/cpp/PhoneDevice.cpp index 8954f0ed..3fafc88b 100644 --- a/app/src/main/cpp/PhoneDevice.cpp +++ b/app/src/main/cpp/PhoneDevice.cpp @@ -1694,20 +1694,27 @@ bool CPhoneDevice::TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector< } else if (mPhotoInfo.mediaType == 0 && (mPhotoInfo.cameraType == CAM_TYPE_SERIAL)) { - if (photoInfo.preset != 0 && photoInfo.preset != 0xFF) + CPhoneDevice* pThis = this; + IDevice::PHOTO_INFO localPhotoInfo = mPhotoInfo; + std::thread t([localPhotoInfo, path, pThis]() mutable + { + if (localPhotoInfo.preset != 0 && localPhotoInfo.preset != 0xFF) { - CameraPhotoCmd(time(NULL), photoInfo.channel, MOVE_PRESETNO, 0, photoInfo.preset); + CameraPhotoCmd(time(NULL), localPhotoInfo.channel, MOVE_PRESETNO, 0, localPhotoInfo.preset); std::this_thread::sleep_for(std::chrono::seconds(3)); } time_t ts = time(NULL); - if(!GetPTZSensorsStatus() && !GetCameraStatus()) + if(!pThis->GetPTZSensorsStatus() && !pThis->GetCameraStatus()) { - XYLOG(XYLOG_SEVERITY_INFO, "Camera is SeltTesting, selfTestingtime = %d", photoInfo.selfTestingTime); - OpenPTZSensors(photoInfo.selfTestingTime); + XYLOG(XYLOG_SEVERITY_INFO, "Camera is SeltTesting, selfTestingtime = %d", localPhotoInfo.selfTestingTime); + pThis->OpenPTZSensors(localPhotoInfo.selfTestingTime); } - CameraPhotoCmd(ts, photoInfo.channel, 0, photoInfo.resolution, 0); + CameraPhotoCmd(ts, localPhotoInfo.channel, 0, localPhotoInfo.resolution, 0); XYLOG(XYLOG_SEVERITY_INFO, "Taking photo over"); - res = TakePTZPhotoCb(3, photoInfo); + pThis->TakePTZPhotoCb(3, localPhotoInfo); + }); + + t.detach(); } else if (mPhotoInfo.usingSysCamera == 1) {