5G-MAG Reference Tools - MBMS Modem
MeasurementFileWriter.h
Go to the documentation of this file.
1 // 5G-MAG Reference Tools
2 // MBMS Modem Process
3 //
4 // Copyright (C) 2021 Klaus Kühnhammer (Österreichische Rundfunksender GmbH & Co KG)
5 //
6 // This program is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU Affero General Public License as published by
8 // the Free Software Foundation, either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU Affero General Public License for more details.
15 //
16 // You should have received a copy of the GNU Affero General Public License
17 // along with this program. If not, see <http://www.gnu.org/licenses/>.
18 //
19 
20 #pragma once
21 
22 #include <libgpsmm.h>
23 
24 #include <string>
25 #include <thread>
26 #include <cstdint>
27 #include <memory>
28 #include <vector>
29 
30 #include <libconfig.h++>
31 
36  public:
42  explicit MeasurementFileWriter(const libconfig::Config& cfg);
43 
47  virtual ~MeasurementFileWriter();
48 
60  void WriteLogValues(const std::vector<std::string>& values);
61 
62  private:
63  void ReadGps();
64 
65  const libconfig::Config& _cfg;
66 
67  std::unique_ptr<gpsmm> _gps;
68  struct gps_data_t* _gps_data {};
69  std::thread _gps_reader_thread;
70  bool _running = true;
71 
72  std::string _last_gps_lat = "";
73  std::string _last_gps_lng = "";
74  std::string _last_gps_time = "";
75 };
Writes measurement data / current reception parameters to a file.
std::unique_ptr< gpsmm > _gps
virtual ~MeasurementFileWriter()
Default destructor.
const libconfig::Config & _cfg
void WriteLogValues(const std::vector< std::string > &values)
Write a line containing the passed values.
MeasurementFileWriter(const libconfig::Config &cfg)
Default constructor.
struct gps_data_t * _gps_data
static Config cfg
Global configuration object.
Definition: main.cpp:165