mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-02-18 10:53:17 +00:00
New TactilityC implementations for: - WiFi - GPS - Preferences - Timezone Also includes: - Some fixes to enums/naming - Cleanup elsewhere
45 lines
890 B
C++
45 lines
890 B
C++
#include "tt_gps.h"
|
|
#include <Tactility/service/gps/GpsService.h>
|
|
|
|
using namespace tt::service;
|
|
|
|
extern "C" {
|
|
|
|
bool tt_gps_has_coordinates() {
|
|
auto service = gps::findGpsService();
|
|
return service != nullptr && service->hasCoordinates();
|
|
}
|
|
|
|
bool tt_gps_get_coordinates(
|
|
float* longitude,
|
|
float* latitude,
|
|
float* speed,
|
|
float* course,
|
|
int* day,
|
|
int* month,
|
|
int* year
|
|
) {
|
|
auto service = gps::findGpsService();
|
|
|
|
if (service == nullptr) {
|
|
return false;
|
|
}
|
|
|
|
minmea_sentence_rmc rmc;
|
|
|
|
if (!service->getCoordinates(rmc)) {
|
|
return false;
|
|
}
|
|
|
|
*longitude = minmea_tocoord(&rmc.longitude);
|
|
*latitude = minmea_tocoord(&rmc.latitude);
|
|
*speed = minmea_tocoord(&rmc.speed);
|
|
*course = minmea_tocoord(&rmc.course);
|
|
*day = rmc.date.day;
|
|
*month = rmc.date.month;
|
|
*year = rmc.date.year;
|
|
|
|
return true;
|
|
}
|
|
|
|
} |