Ken Van Hoeylandt 5055fa7822
Improved GPS Settings app and GPS service (#222)
- Fixes and improvements to `GpsSettings` app, `GpsDevice` and `GpsService`
- Implemented location/GPS statusbar icon
- Added app icon
- Added support for other GPS models (based on Meshtastic code)
2025-02-18 22:07:37 +01:00

51 lines
1.2 KiB
C++

#include "Tactility/PubSub.h"
#include "Tactility/service/ServiceManifest.h"
#include "Tactility/service/ServiceRegistry.h"
#include "Tactility/service/gps/GpsService.h"
using tt::hal::gps::GpsDevice;
namespace tt::service::gps {
extern ServiceManifest manifest;
static std::shared_ptr<GpsService> findGpsService() {
auto service = findServiceById(manifest.id);
assert(service != nullptr);
return std::static_pointer_cast<GpsService>(service);
}
void addGpsDevice(const std::shared_ptr<GpsDevice>& device) {
return findGpsService()->addGpsDevice(device);
}
void removeGpsDevice(const std::shared_ptr<GpsDevice>& device) {
return findGpsService()->removeGpsDevice(device);
}
bool startReceiving() {
return findGpsService()->startReceiving();
}
void stopReceiving() {
findGpsService()->stopReceiving();
}
bool hasCoordinates() {
return findGpsService()->hasCoordinates();
}
bool getCoordinates(minmea_sentence_rmc& rmc) {
return findGpsService()->getCoordinates(rmc);
}
State getState() {
return findGpsService()->getState();
}
std::shared_ptr<PubSub> getStatePubsub() {
return findGpsService()->getStatePubsub();
}
} // namespace tt::service::gps