30#include <simgear/debug/logstream.hxx>
31#include <simgear/math/sg_geodesy.hxx>
32#include <simgear/io/iochannel.hxx>
33#include <simgear/timing/sg_time.hxx>
50bool IGCProtocol::gen_Hrecords()
52 const std::string AircraftType =
fgGetString(
"/sim/aircraft",
"unknown");
55 SGTime *t =
globals->get_time_params();
56 int Day = t->getGmt()->tm_mday;
57 int Month = t->getGmt()->tm_mon+1;
58 int Year = t->getGmt()->tm_year % 100;
60#ifdef FLIGHTGEAR_VERSION
61 const char* Version = FLIGHTGEAR_VERSION;
63 const char* Version =
"unknown version";
67 "AXYYZZZFlightGear\r\n"
68 "HFDTE%02d%02d%02d\r\n"
70 "HFGTYGliderType:%s\r\n"
71 "HFGIDGliderID:%s\r\n"
72 "HFDTM100GPSDatum:WGS84\r\n"
73 "HFRFWFirmwareVersion:FlightGear %s\r\n"
74 "HFRHWHardwareVersion:FlightGear Flight Simulator\r\n"
75 "HFFTYFRType:Flight Simulator\r\n",
81 io->write(buf, length);
122 char lonDir =
'E', latDir =
'N';
123 int lonDeg, latDeg, lonMin, latMin;
125 SGTime *t =
globals->get_time_params();
127 double deg =
fdm.get_Latitude() * SGD_RADIANS_TO_DEGREES;
135 latMin = (int)((deg - (
double)latDeg) * 60.0 * 1000.0);
137 deg =
fdm.get_Longitude() * SGD_RADIANS_TO_DEGREES;
145 lonMin = (int)((deg - (
double)lonDeg) * 60.0 * 1000.0);
147 int Altitude =
fdm.get_Altitude() * SG_FEET_TO_METER;
151 int h = t->getGmt()->tm_hour;
152 int m = t->getGmt()->tm_min;
153 int s = t->getGmt()->tm_sec;
166 latDeg, latMin, latDir,
167 lonDeg, lonMin, lonDir,
186 SG_LOG( SG_IO, SG_ALERT,
"This shouldn't happen, but the channel "
187 <<
"is already in use, ignoring" );
195 SG_LOG( SG_IO, SG_ALERT,
"Error opening channel communication layer." );
213 if (!io->write( buf, length ))
215 SG_LOG( SG_IO, SG_WARN,
"Error writing data." );
221 SG_LOG( SG_IO, SG_ALERT,
"Error: IGC input is not supported.");
SGProtocolDir get_direction() const
SGIOChannel * get_io_channel() const
void set_enabled(const bool b)
std::string fgGetString(const char *name, const char *defaultValue)
Get a string value for a property.