]> git.mxchange.org Git - flightgear.git/blob - src/Network/ATC-Outputs.hxx
Merge branch 'jmt/track-bug' into next
[flightgear.git] / src / Network / ATC-Outputs.hxx
1 // ATC-Outputs.hxx -- Translate FGFS properties into ATC hardware outputs
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_OUTPUTS_HXX
25 #define _FG_ATC_OUTPUTS_HXX
26
27 #ifdef HAVE_CONFIG_H
28 #  include <config.h>
29 #endif
30
31 #include <Main/fg_props.hxx>
32
33 #define ATC_RADIO_DISPLAY_BYTES 48
34 #define ATC_ANALOG_OUT_CHANNELS 48
35 #define ATC_COMPASS_CH 5
36 #define ATC_STEPPER_HOME 0xC0
37
38
39 class FGATCOutput {
40
41     int is_open;
42
43     int board;
44     SGPath config;
45
46     int lock_fd;
47     int analog_out_fd;
48     int lamps_fd;
49     int radio_display_fd;
50     int stepper_fd;
51
52     char analog_out_file[256];
53     char lamps_file[256];
54     char radio_display_file[256];
55     char stepper_file[256];
56
57     unsigned char analog_out_data[ATC_ANALOG_OUT_CHANNELS*2];
58     unsigned char radio_display_data[ATC_RADIO_DISPLAY_BYTES];
59
60     SGPropertyNode_ptr analog_out_node;
61     SGPropertyNode_ptr lamps_out_node;
62     SGPropertyNode_ptr radio_display_node;
63     SGPropertyNode_ptr steppers_node;
64
65     void init_config();
66     bool do_analog_out();
67     bool do_lamps();
68     bool do_radio_display();
69     bool do_steppers();
70
71     // hardwired stepper motor code
72     float compass_position;
73
74 public:
75
76     // Constructor: The _board parameter specifies which board to
77     // reference.  Possible values are 0 or 1.  The _config_file
78     // parameter specifies the location of the output config file (xml)
79     FGATCOutput( const int _board, const SGPath &_config_file );
80
81     // Destructor
82     ~FGATCOutput() { }
83
84     // need to pass in atc hardware lock_fd so that the radios and
85     // lamps can be blanked and so that the compass can be homed.
86     bool open( int lock_fd );
87
88     // process the hardware outputs.  This code assumes the calling
89     // layer will lock the hardware.
90     bool process();
91
92     bool close();
93 };
94
95
96 #endif // _FG_ATC_OUTPUTS_HXX