Renderer, ...: use PixelRect::GetCenter()
[xcsoar.git] / src / Device / Register.cpp
blobbd37e2a2b2f42b840ea7a9bdfc0c434a466267d7
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 #include "Device/Register.hpp"
25 #include "Device/Driver.hpp"
26 #include "Device/Driver/CAI302.hpp"
27 #include "Device/Driver/CaiGpsNav.hpp"
28 #include "Device/Driver/EW.hpp"
29 #include "Device/Driver/Eye.hpp"
30 #include "Device/Driver/AltairPro.hpp"
31 #include "Device/Driver/Generic.hpp"
32 #include "Device/Driver/Vega.hpp"
33 #include "Device/Driver/NmeaOut.hpp"
34 #include "Device/Driver/GTAltimeter.hpp"
35 #include "Device/Driver/PosiGraph.hpp"
36 #include "Device/Driver/BorgeltB50.hpp"
37 #include "Device/Driver/Volkslogger.hpp"
38 #include "Device/Driver/EWMicroRecorder.hpp"
39 #include "Device/Driver/LX.hpp"
40 #include "Device/Driver/IMI.hpp"
41 #include "Device/Driver/Zander.hpp"
42 #include "Device/Driver/FlymasterF1.hpp"
43 #include "Device/Driver/XCOM760.hpp"
44 #include "Device/Driver/Condor.hpp"
45 #include "Device/Driver/Leonardo.hpp"
46 #include "Device/Driver/Flytec.hpp"
47 #include "Device/Driver/ILEC.hpp"
48 #include "Device/Driver/Westerboer.hpp"
49 #include "Device/Driver/WesterboerVW921.hpp"
50 #include "Device/Driver/FLARM.hpp"
51 #include "Device/Driver/FlyNet.hpp"
52 #include "Device/Driver/CProbe.hpp"
53 #include "Device/Driver/LevilAHRS_G.hpp"
54 #include "Device/Driver/BlueFlyVario.hpp"
55 #include "Util/Macros.hpp"
57 #include <assert.h>
58 #include <string.h>
60 /** NULL terminated array of available device drivers. */
61 static const struct DeviceRegister *const driver_list[] = {
62 // IMPORTANT: ADD NEW ONES TO BOTTOM OF THIS LIST
63 &generic_driver, // MUST BE FIRST
64 &cai302_driver,
65 &ew_driver,
66 &altair_pro_driver,
67 &vega_driver,
68 &gps_nav_driver,
69 &nmea_out_driver,
70 &posigraph_driver,
71 &b50_driver,
72 &volkslogger_driver,
73 &ew_microrecorder_driver,
74 &lx_driver,
75 &zander_driver,
76 &flymaster_f1_driver,
77 &xcom760_driver,
78 &condor_driver,
79 &leonardo_driver,
80 &flytec_driver,
81 &ilec_driver,
82 &westerboer_driver,
83 &imi_driver,
84 &flarm_driver,
85 &westerboer_vw921_driver,
86 &flynet_driver,
87 &gt_altimeter_driver,
88 &c_probe_driver,
89 &levil_driver,
90 &eye_driver,
91 &bluefly_driver,
92 NULL
95 const struct DeviceRegister *
96 GetDriverByIndex(unsigned i)
98 assert(i < ARRAY_SIZE(driver_list));
100 return driver_list[i];
103 const struct DeviceRegister *
104 FindDriverByName(const TCHAR *name)
106 for (auto i = driver_list; *i != NULL; ++i) {
107 const DeviceRegister &driver = **i;
108 if (_tcscmp(driver.name, name) == 0)
109 return &driver;
112 return driver_list[0];
115 const TCHAR *
116 FindDriverDisplayName(const TCHAR *name)
118 assert(name != NULL);
120 for (auto i = driver_list; *i != NULL; ++i) {
121 const DeviceRegister &driver = **i;
122 if (_tcscmp(driver.name, name) == 0)
123 return driver.display_name;
126 return name;