mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-02-18 19:03:16 +00:00
Implemented tt_gps
This commit is contained in:
parent
ea88165b08
commit
5071c390d4
21
TactilityC/Include/tt_gps.h
Normal file
21
TactilityC/Include/tt_gps.h
Normal file
@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
bool tt_gps_has_coordinates();
|
||||
|
||||
bool tt_gps_get_coordinates(
|
||||
float& longitude,
|
||||
float& latitude,
|
||||
float& speed,
|
||||
float& course,
|
||||
int& day,
|
||||
int& month,
|
||||
int& year
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
45
TactilityC/Source/tt_gps.cpp
Normal file
45
TactilityC/Source/tt_gps.cpp
Normal file
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@ -5,6 +5,7 @@
|
||||
#include "tt_app_manifest.h"
|
||||
#include "tt_app_selectiondialog.h"
|
||||
#include "tt_bundle.h"
|
||||
#include "tt_gps.h"
|
||||
#include "tt_hal_i2c.h"
|
||||
#include "tt_lvgl_keyboard.h"
|
||||
#include "tt_lvgl_spinner.h"
|
||||
@ -42,6 +43,8 @@ const struct esp_elfsym elf_symbols[] {
|
||||
ESP_ELFSYM_EXPORT(tt_bundle_put_bool),
|
||||
ESP_ELFSYM_EXPORT(tt_bundle_put_int32),
|
||||
ESP_ELFSYM_EXPORT(tt_bundle_put_string),
|
||||
ESP_ELFSYM_EXPORT(tt_gps_has_coordinates),
|
||||
ESP_ELFSYM_EXPORT(tt_gps_get_coordinates),
|
||||
ESP_ELFSYM_EXPORT(tt_hal_i2c_start),
|
||||
ESP_ELFSYM_EXPORT(tt_hal_i2c_stop),
|
||||
ESP_ELFSYM_EXPORT(tt_hal_i2c_is_started),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user