From a15a0f6ed6cd66db214b2a59f165fb98058cc25c Mon Sep 17 00:00:00 2001 From: "XI.CHEN" Date: Wed, 20 Nov 2024 15:31:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=8D=E7=85=A7=E7=A7=BB=E5=88=B0PhoneDevice?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/cpp/PhoneDevice.cpp | 16 ++++++++++++++++ app/src/main/cpp/PhoneDevice.h | 12 ++++++++++++ 2 files changed, 28 insertions(+) diff --git a/app/src/main/cpp/PhoneDevice.cpp b/app/src/main/cpp/PhoneDevice.cpp index 4a74d909..34b36eca 100644 --- a/app/src/main/cpp/PhoneDevice.cpp +++ b/app/src/main/cpp/PhoneDevice.cpp @@ -1406,6 +1406,19 @@ bool CPhoneDevice::TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector< mPath = path; mOsds = osds; + + +#ifdef USING_N938 + if (photoInfo.mediaType == 0) { + // CameraPhotoCmd(time(NULL), channel, MOVE_PRESETNO, 0, type); + // std::this_thread::sleep_for(std::chrono::seconds(2)); + time_t ts = time(NULL); + CameraPhotoCmd(ts, photoInfo.channel, 0, 6, 0); + TakePTZPhotoCb(2, photoInfo); + } + return true; +#else + NdkCamera::CAMERA_PARAMS params; memset(¶ms, 0, sizeof(params)); @@ -1558,6 +1571,7 @@ bool CPhoneDevice::TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector< } return res; +#endif } bool CPhoneDevice::CloseCamera() @@ -3242,6 +3256,7 @@ bool CPhoneDevice::OpenSensors(int sensortype) #ifndef USING_N938 #ifndef USING_PLZ GpioControl::setInt(CMD_SET_485_EN_STATE, 1); + #else GpioControl::setInt(CMD_SET_485_ENABLE, 1); #endif @@ -3359,3 +3374,4 @@ bool CPhoneDevice::CloseSensors(int sensortype) } return 0; } + diff --git a/app/src/main/cpp/PhoneDevice.h b/app/src/main/cpp/PhoneDevice.h index c0ad2ee1..c07c807b 100644 --- a/app/src/main/cpp/PhoneDevice.h +++ b/app/src/main/cpp/PhoneDevice.h @@ -221,6 +221,7 @@ public: virtual int GetIceData(ICE_INFO *iceInfo, ICE_TAIL *icetail, SENSOR_PARAM *sensorParam); virtual bool OpenSensors(int sensortype); virtual bool CloseSensors(int sensortype); +// bool CapturePhoto(unsigned char channel, unsigned char type); bool GetNextScheduleItem(uint32_t tsBasedZero, uint32_t scheduleTime, vector& items); @@ -274,6 +275,17 @@ protected: return false; } + inline bool TakePTZPhotoCb(int result, const IDevice::PHOTO_INFO& photoInfo) const + { + if (m_listener != NULL) + { + std::vector objects; + return m_listener->OnPTZPhotoTaken(result, photoInfo); + } + + return false; + } + void QueryPowerInfo(std::map& powerInfo); std::string QueryCpuTemperature();