Renderer, ...: use PixelRect::GetCenter()
[xcsoar.git] / src / Device / Driver / PosiGraph.cpp
blob10f32303c071ce587d3731929e50c216ece850f5
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 // created 20070428 sgi, basic NMEA sentance supported
25 // WARNING PosiGraph dont send any GGA sentance
26 // GGA sentance trigger nav process in XCSoar
27 // Posigraph driver trigger Nav process with RMC sentance (if driver is devA())
29 // ToDo
31 // adding baro alt sentance paser to support baro source priority if (d == pDevPrimaryBaroSource){...}
33 #include "Device/Driver/PosiGraph.hpp"
34 #include "Device/Driver/LX/Internal.hpp"
35 #include "Device/Parser.hpp"
36 #include "Device/Driver.hpp"
37 #include "Profile/DeviceConfig.hpp"
38 #include "NMEA/Info.hpp"
39 #include "NMEA/InputLine.hpp"
41 #include <string.h>
43 class PGDevice : public LXDevice {
44 public:
45 PGDevice(Port &_port, unsigned baud_rate, unsigned bulk_baud_rate)
46 :LXDevice(_port, baud_rate, bulk_baud_rate) {}
48 public:
49 virtual bool ParseNMEA(const char *line, struct NMEAInfo &info) override;
52 static bool
53 GPWIN(NMEAInputLine &line, NMEAInfo &info)
55 line.Skip(2);
57 fixed value;
58 if (line.ReadChecked(value))
59 info.ProvidePressureAltitude(value / 10);
61 return false;
64 bool
65 PGDevice::ParseNMEA(const char *String, NMEAInfo &info)
67 NMEAInputLine line(String);
68 char type[16];
69 line.Read(type, 16);
71 // $GPWIN ... Winpilot proprietary sentance includinh baro altitude
72 // $GPWIN ,01900 , 0 , 5159 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 * 6 B , 0 7 * 6 0 E
73 if (StringIsEqual(type, "$GPWIN"))
74 return GPWIN(line, info);
75 else
76 return LXDevice::ParseNMEA(String, info);
79 static Device *
80 PGCreateOnPort(const DeviceConfig &config, Port &com_port)
82 return new PGDevice(com_port, config.baud_rate, config.bulk_baud_rate);
85 const struct DeviceRegister posigraph_driver = {
86 _T("PosiGraph Logger"),
87 _T("PosiGraph Logger"),
88 DeviceRegister::DECLARE | DeviceRegister::BULK_BAUD_RATE,
89 PGCreateOnPort,