po: update French translation
[xcsoar.git] / src / Logger / LoggerImpl.hpp
blob643f492e4cbf04e2607c1942a1b9278eba879994
1 /*
2 Copyright_License {
4 XCSoar Glide Computer - http://www.xcsoar.org/
5 Copyright (C) 2000-2013 The XCSoar Project
6 A detailed list of copyright holders can be found in the file "AUTHORS".
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 #if !defined(XCSOAR_LOGGER_IMPL_HPP)
25 #define XCSOAR_LOGGER_IMPL_HPP
27 #include "LoggerFRecord.hpp"
28 #include "Time/BrokenDateTime.hpp"
29 #include "Geo/GeoPoint.hpp"
30 #include "Util/OverwritingRingBuffer.hpp"
32 #include <tchar.h>
33 #include <windef.h>
35 struct NMEAInfo;
36 struct LoggerSettings;
37 struct Declaration;
38 class OrderedTask;
39 class IGCWriter;
41 /**
42 * Implementation of logger
44 class LoggerImpl
46 public:
47 enum {
48 /** Buffer size (s) of points recorded before takeoff */
49 PRETAKEOFF_BUFFER_MAX = 60,
52 /** Buffer for points recorded before takeoff */
53 struct PreTakeoffBuffer
55 /** Location of fix */
56 GeoPoint location;
57 /** Barometric altitude (m STD) */
58 fixed pressure_altitude;
59 /** GPS Altitude (m) */
60 fixed altitude_gps;
61 /** Date and time of fix */
62 BrokenDateTime date_time_utc;
63 /** IDs of satellites in fix */
64 int satellite_ids[GPSState::MAXSATELLITES];
65 bool satellite_ids_available;
66 /** Time of fix (s) */
67 fixed time;
68 /** GPS fix quality */
69 FixQuality fix_quality;
70 /** GPS fix state */
71 int satellites_used;
72 bool satellites_used_available;
73 /** GPS Horizontal Dilution of precision */
74 fixed hdop;
76 /**
77 * Is the fix real? (no replay, no simulator)
79 bool real;
81 bool pressure_altitude_available;
82 bool gps_altitude_available;
84 /**
85 * Set buffer value from NMEA_INFO structure
87 * @param src Item to set
89 * @return Buffer value
91 const struct PreTakeoffBuffer &operator=(const NMEAInfo &src);
94 private:
95 TCHAR filename[MAX_PATH];
96 IGCWriter *writer;
98 OverwritingRingBuffer<PreTakeoffBuffer, PRETAKEOFF_BUFFER_MAX> pre_takeoff_buffer;
100 LoggerFRecord frecord;
103 * If at least one GPS fix came from the simulator
104 * (NMEA_INFO.Simulator), then this flag is true, and signing is
105 * disabled.
107 bool simulator;
109 public:
110 /** Default constructor */
111 LoggerImpl();
112 ~LoggerImpl();
114 public:
115 void LogPoint(const NMEAInfo &gps_info);
116 void LogEvent(const NMEAInfo &gps_info, const char* event);
118 bool IsActive() const {
119 return writer != NULL;
122 void StartLogger(const NMEAInfo &gps_info, const LoggerSettings &settings,
123 const TCHAR *asset_number, const Declaration &decl);
126 * Stops the logger
127 * @param gps_info NMEA_INFO struct holding the current date
129 void StopLogger(const NMEAInfo &gps_info);
130 void LoggerNote(const TCHAR *text);
131 void ClearBuffer();
133 private:
135 * @param logger_id the ID of the logger, consisting of exactly 3
136 * alphanumeric characters (plain ASCII)
138 void StartLogger(const NMEAInfo &gps_info, const LoggerSettings &settings,
139 const char *logger_id);
141 private:
142 void LogPointToBuffer(const NMEAInfo &gps_info);
143 void WritePoint(const NMEAInfo &gps_info);
146 #endif