4 XCSoar Glide Computer - http://www.xcsoar.org/
5 Copyright (C) 2000-2010 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.hpp"
25 #include "Device/Register.hpp"
26 #include "Device/Parser.hpp"
27 #include "Device/Descriptor.hpp"
28 #include "Device/device.hpp"
29 #include "Device/Geoid.h"
30 #include "Engine/Navigation/GeoPoint.hpp"
31 #include "Engine/Waypoint/Waypoints.hpp"
32 #include "InputEvents.hpp"
33 #include "Thread/Trigger.hpp"
34 #include "DeviceBlackboard.hpp"
35 #include "OS/PathName.hpp"
36 #include "Protection.hpp"
39 #include "Device/TTYPort.hpp"
41 #include "Device/SerialPort.hpp"
48 DeviceBlackboard device_blackboard
;
50 static DeviceDescriptor device
;
56 Mutex mutexBlackboard
;
58 void TriggerGPSUpdate() {}
59 void TriggerVarioUpdate() {}
62 * Fake Device/device.cpp
68 return device
.IsBaroSource();
74 return device
.IsCondor();
78 * Fake Device/Geoid.cpp
82 LookupGeoidSeparation(const GeoPoint pt
)
88 * Fake InputEvents.cpp
92 InputEvents::processGlideComputer(unsigned gce_id
)
98 InputEvents::processNmea(unsigned key
)
104 * Fake Settings*Blackboard.cpp
107 SettingsComputerBlackboard::SettingsComputerBlackboard() {}
108 SettingsMapBlackboard::SettingsMapBlackboard() {}
115 MakeWaypoint(const TCHAR
*name
, int altitude
,
116 double longitude
, double latitude
)
118 const GeoPoint
gp(Angle::degrees(fixed(7.7061111111111114)),
119 Angle::degrees(fixed(51.051944444444445)));
120 Waypoint
wp(GeoPoint(Angle::degrees(fixed(longitude
)),
121 Angle::degrees(fixed(latitude
))));
123 wp
.Altitude
= fixed(altitude
);
127 int main(int argc
, char **argv
)
130 fprintf(stderr
, "Usage: %s DRIVER PORT BAUD\n"
131 "Where DRIVER is one of:\n", argv
[0]);
134 for (unsigned i
= 0; (name
= devRegisterGetName(i
)) != NULL
; ++i
)
135 _ftprintf(stderr
, _T("\t%s\n"), name
);
140 PathName
driver_name(argv
[1]);
141 PathName
port_name(argv
[2]);
142 int baud
= atoi(argv
[3]);
144 device
.Driver
= devGetDriver(driver_name
);
145 if (device
.Driver
== NULL
) {
146 fprintf(stderr
, "No such driver: %s\n", argv
[1]);
150 if ((device
.Driver
->Flags
& drfLogger
) == 0) {
151 fprintf(stderr
, "Not a logger driver: %s\n", argv
[1]);
156 TTYPort
*port
= new TTYPort(port_name
, baud
, *(Port::Handler
*)NULL
);
158 SerialPort
*port
= new SerialPort(port_name
, baud
, *(Port::Handler
*)NULL
);
163 fprintf(stderr
, "Failed to open COM port\n");
167 if (!device
.Open()) {
169 fprintf(stderr
, "Failed to open driver: %s\n", argv
[1]);
173 Declaration
declaration(NULL
);
174 declaration
.PilotName
= _T("Foo Bar");
175 declaration
.AircraftType
= _T("Cirrus");
176 declaration
.AircraftRego
= _T("D-3003");
178 declaration
.append(MakeWaypoint(_T("Bergneustadt"), 488,
179 7.7061111111111114, 51.051944444444445));
180 declaration
.append(MakeWaypoint(_T("Foo"), 488, 8, 52));
181 declaration
.append(MakeWaypoint(_T("Bar"), 488, 7.5, 50));
182 declaration
.append(MakeWaypoint(_T("Bergneustadt"), 488,
183 7.7061111111111114, 51.051944444444445));
185 if (device
.Declare(&declaration
))
186 fprintf(stderr
, "Declaration ok\n");
188 fprintf(stderr
, "Declaration failed\n");