Record gps lat, lon, satinuse from recorder app if there was gps signal. (#1992)

* Record gps lat, lon, satinuse from recorder app if there was gps signal.

* Add _GEO to filename that has geotag
This commit is contained in:
Totoo
2024-03-15 14:56:20 +01:00
committed by GitHub
parent 181624daf1
commit 9e40e38f07
8 changed files with 90 additions and 6 deletions

View File

@@ -205,6 +205,11 @@ void RecordView::start() {
return;
}
// check for geo data, if present append filename with _GEO
if (latitude != 0 && longitude != 0 && latitude < 200 && longitude < 200) {
base_path.append_filename(u"_GEO");
}
std::unique_ptr<stream::Writer> writer;
switch (file_type) {
case FileType::WAV: {
@@ -223,7 +228,7 @@ void RecordView::start() {
case FileType::RawS8:
case FileType::RawS16: {
const auto metadata_file_error = write_metadata_file(
get_metadata_path(base_path), {receiver_model.target_frequency(), sampling_rate});
get_metadata_path(base_path), {receiver_model.target_frequency(), sampling_rate, latitude, longitude, satinuse});
if (metadata_file_error.is_valid()) {
handle_error(metadata_file_error.value());
return;
@@ -342,6 +347,12 @@ void RecordView::trim_capture() {
trim_path = {};
}
void RecordView::on_gps(const GPSPosDataMessage* msg) {
latitude = msg->lat;
longitude = msg->lon;
satinuse = msg->satinuse;
}
void RecordView::handle_capture_thread_done(const File::Error error) {
stop();
if (error.code()) {