Add isGPSDetected() capability probe to SensorManager

Lets applications know whether a GPS was actually detected
(EnvironmentSensorManager reports its gps_detected state), e.g. to
hide GPS-dependent UI when no receiver is attached.
This commit is contained in:
João Brázio
2026-09-04 21:04:20 +01:00
parent 65aa1138ae
commit 8a418faf93
2 changed files with 2 additions and 0 deletions
+1
View File
@@ -23,6 +23,7 @@ public:
virtual const char* getSettingValue(int i) const { return NULL; }
virtual bool setSettingValue(const char* name, const char* value) { return false; }
virtual LocationProvider* getLocationProvider() { return NULL; }
virtual bool isGPSDetected() const { return false; }
// Helper functions to manage setting by keys (useful in many places ...)
const char* getSettingByKey(const char* key) {
@@ -38,6 +38,7 @@ public:
#if ENV_INCLUDE_GPS
EnvironmentSensorManager(LocationProvider &location): _location(&location){};
LocationProvider* getLocationProvider() { return _location; }
bool isGPSDetected() const override { return gps_detected; }
#else
EnvironmentSensorManager(){};
#endif