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