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 #include "Device/Driver/Condor.hpp"
25 #include "Device/Driver.hpp"
26 #include "Units/System.hpp"
27 #include "Device/Parser.hpp"
28 #include "NMEA/Checksum.hpp"
29 #include "NMEA/Info.hpp"
30 #include "NMEA/InputLine.hpp"
35 class CondorDevice
: public AbstractDevice
{
37 virtual bool ParseNMEA(const char *line
, struct NMEAInfo
&info
) override
;
41 ReadSpeedVector(NMEAInputLine
&line
, SpeedVector
&value_r
)
45 bool bearing_valid
= line
.ReadChecked(bearing
);
46 bool norm_valid
= line
.ReadChecked(norm
);
48 if (bearing_valid
&& norm_valid
) {
49 // Condor 1.1.4 outputs the direction that the wind is going to,
50 // _not_ the direction it is coming from !!
52 // This seems to differ from the output that the LX devices are giving !!
53 value_r
.bearing
= Angle::Degrees(bearing
).Reciprocal();
54 value_r
.norm
= Units::ToSysUnit(norm
, Unit::KILOMETER_PER_HOUR
);
61 cLXWP0(NMEAInputLine
&line
, NMEAInfo
&info
)
64 $LXWP0,Y,222.3,1665.5,1.71,,,,,,239,174,10.1
67 1 IAS (kph) ----> Condor uses TAS!
80 bool tas_available
= line
.ReadChecked(airspeed
);
83 if (line
.ReadChecked(value
))
84 info
.ProvideBaroAltitudeTrue(value
);
87 info
.ProvideTrueAirspeed(Units::ToSysUnit(airspeed
, Unit::KILOMETER_PER_HOUR
));
89 if (line
.ReadChecked(value
))
90 info
.ProvideTotalEnergyVario(value
);
95 if (ReadSpeedVector(line
, wind
))
96 info
.ProvideExternalWind(wind
);
102 CondorDevice::ParseNMEA(const char *String
, NMEAInfo
&info
)
104 if (!VerifyNMEAChecksum(String
))
107 NMEAInputLine
line(String
);
111 if (StringIsEqual(type
, "$LXWP0"))
112 return cLXWP0(line
, info
);
118 CondorCreateOnPort(const DeviceConfig
&config
, gcc_unused Port
&com_port
)
120 return new CondorDevice();
123 const struct DeviceRegister condor_driver
= {
125 _T("Condor Soaring Simulator"),