Debian Codegraph @

src/Network/ATC-Inputs.hxx

raw symbols SCIP
1 // ATC-Inputs.hxx -- Translate ATC hardware inputs to FGFS properties
2 //
3 // Written by Curtis Olson, started November 2004.
4 //
5 // Copyright (C) 2004 Curtis L. Olson - http://www.flightgear.org/~curt
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 //
21 // $Id$
22
23
24 #ifndef _FG_ATC_INPUTS_HXX
25 #define _FG_ATC_INPUTS_HXX
26
27 #ifdef HAVE_CONFIG_H
28 # include <config.h>
29 #endif
30
31 #include <Main/fg_props.hxx>
32
33 #define ATC_ANAL_IN_VALUES 32
34 #define ATC_ANAL_IN_BYTES (2 * ATC_ANAL_IN_VALUES)
35 #define ATC_RADIO_SWITCH_BYTES 32
36 #define ATC_SWITCH_BYTES 16
37 #define ATC_NUM_COLS 8
38
39
40 class FGATCInput {
41
42 int is_open;
43
44 int board;
45 SGPath config;
46
47 int analog_in_fd;
48 int radios_fd;
49 int switches_fd;
50
51 char analog_in_file[256];
52 char radios_file[256];
53 char switches_file[256];
54
55 unsigned char analog_in_bytes[ATC_ANAL_IN_BYTES];
56 int analog_in_data[ATC_ANAL_IN_VALUES];
57 unsigned char radio_switch_data[ATC_RADIO_SWITCH_BYTES];
58 unsigned char switch_data[ATC_SWITCH_BYTES];
59
60 SGPropertyNode_ptr ignore_flight_controls;
61 SGPropertyNode_ptr ignore_pedal_controls;
62
63 SGPropertyNode_ptr analog_in_node;
64 SGPropertyNode_ptr radio_in_node;
65 SGPropertyNode_ptr switches_node;
66
67 void init_config();
68 bool do_analog_in();
69 bool do_radio_switches();
70 bool do_switches();
71
72 public:
73
74 // Constructor: The _board parameter specifies which board to
75 // reference. Possible values are 0 or 1. The _config_file
76 // parameter specifies the location of the input config file (xml)
77 FGATCInput( const int _board, const SGPath &_config_file );
78
79 // Destructor
80 ~FGATCInput() { }
81
82 bool open();
83
84 // process the hardware inputs. This code assumes the calling
85 // layer will lock the hardware.
86 bool process();
87
88 bool close();
89 };
90
91
92 #endif // _FG_ATC_INPUTS_HXX