From f247a6f4e0a78e0d33d94bac08d745bc341b34d7 Mon Sep 17 00:00:00 2001 From: Matthew Date: Fri, 4 Apr 2025 10:01:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E8=8E=B7=E5=8F=96=E5=85=89?= =?UTF-8?q?=E6=95=8F=E5=80=BC=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/cpp/PhoneDevice.cpp | 11 +++++++++++ app/src/main/cpp/PhoneDevice.h | 1 + 2 files changed, 12 insertions(+) diff --git a/app/src/main/cpp/PhoneDevice.cpp b/app/src/main/cpp/PhoneDevice.cpp index 39f230d1..0e16a3f3 100644 --- a/app/src/main/cpp/PhoneDevice.cpp +++ b/app/src/main/cpp/PhoneDevice.cpp @@ -1292,6 +1292,17 @@ float CPhoneDevice::QueryBattaryVoltage(int timesForAvg, bool* isCharging) return (matched > 0) ? ((float)totalVals / 1000.0 / matched) : 0; } +uint32_t CPhoneDevice::QueryLdr() +{ + int val = GpioControl::getLightAdc(); + if (val > 0) + { + return static_cast(val); + } + + return 0; +} + bool CPhoneDevice::RequestPosition() { JNIEnv* env = NULL; diff --git a/app/src/main/cpp/PhoneDevice.h b/app/src/main/cpp/PhoneDevice.h index 0e100af1..b76fc0c1 100644 --- a/app/src/main/cpp/PhoneDevice.h +++ b/app/src/main/cpp/PhoneDevice.h @@ -235,6 +235,7 @@ public: virtual bool Reboot(int resetType, bool manually, const std::string& reason, uint32_t timeout = 1000); virtual bool EnableGPS(bool enabled); virtual float QueryBattaryVoltage(int timesForAvg, bool* isCharging); + virtual uint32_t QueryLdr(); virtual bool RequestPosition(); virtual timer_uid_t RegisterHeartbeat(unsigned int timerType, unsigned int timeout, time_t tsForNextPhoto); virtual bool TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector& osds, const std::string& path);