TactilityC additions (#287)
New TactilityC implementations for: - WiFi - GPS - Preferences - Timezone Also includes: - Some fixes to enums/naming - Cleanup elsewhere
This commit is contained in:
committed by
GitHub
parent
869a56125f
commit
1593eb80ce
@@ -0,0 +1,45 @@
|
||||
#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;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user