]> git.mxchange.org Git - flightgear.git/blob - src/Network/atc610x.hxx
Updated adf property names.
[flightgear.git] / src / Network / atc610x.hxx
1 // atc610x.hxx -- FGFS interface to ATC 610x hardware
2 //
3 // Written by Curtis Olson, started January 2002.
4 //
5 // Copyright (C) 2002  Curtis L. Olson - curt@flightgear.org
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., 675 Mass Ave, Cambridge, MA 02139, USA.
20 //
21 // $Id$
22
23
24 #ifndef _FG_ATC610X_HXX
25 #define _FG_ATC610X_HXX
26
27 #ifdef HAVE_CONFIG_H
28 #  include <config.h>
29 #endif
30
31 #include <plib/netChat.h>
32
33 #include <simgear/timing/timestamp.hxx>
34
35 #include <Main/fg_props.hxx>
36
37 #include "protocol.hxx"
38
39
40 #define ATC_ANAL_IN_VALUES 32
41 #define ATC_ANAL_IN_BYTES (2 * ATC_ANAL_IN_VALUES)
42 #define ATC_COMPASS_CH 5
43 #define ATC_STEPPER_HOME 0xC0
44 #define ATC_RADIO_DISPLAY_BYTES 48
45 #define ATC_RADIO_SWITCH_BYTES 32
46 #define ATC_SWITCH_BYTES 16
47 #define ATC_NUM_COLS 8
48
49
50 class FGATC610x : public FGProtocol {
51
52     int board;
53
54     int lock_fd;
55     int analog_in_fd;
56     int lamps_fd;
57     int radios_fd;
58     int stepper_fd;
59     int switches_fd;
60
61     char lock_file[256];
62     char analog_in_file[256];
63     char lamps_file[256];
64     char radios_file[256];
65     char stepper_file[256];
66     char switches_file[256];
67
68     unsigned char analog_in_bytes[ATC_ANAL_IN_BYTES];
69     int analog_in_data[ATC_ANAL_IN_VALUES];
70     unsigned char radio_display_data[ATC_RADIO_DISPLAY_BYTES];
71     unsigned char radio_switch_data[ATC_RADIO_SWITCH_BYTES];
72     unsigned char switch_data[ATC_SWITCH_BYTES];
73
74     float compass_position;
75     SGPropertyNode *mag_compass;
76     SGPropertyNode *dme_min, *dme_kt, *dme_nm;
77     SGPropertyNode *com1_freq, *com1_stby_freq;
78     SGPropertyNode *com2_freq, *com2_stby_freq;
79     SGPropertyNode *nav1_freq, *nav1_stby_freq;
80     SGPropertyNode *nav2_freq, *nav2_stby_freq;
81     SGPropertyNode *adf_adf_btn, *adf_bfo_btn;
82     SGPropertyNode *adf_on_off_vol;
83     SGPropertyNode *adf_freq, *adf_stby_freq;
84     SGPropertyNode *adf_stby_mode, *adf_timer_mode;
85     SGPropertyNode *adf_count_mode, *adf_flight_timer, *adf_elapsed_timer;
86     SGPropertyNode *inner, *middle, *outer;
87
88     int dme_switch;
89
90     SGTimeStamp last_time_stamp;
91     double et_flash_time;
92     bool et_flash; 
93
94     bool do_analog_in();
95     bool do_lights( double dt );
96     bool do_radio_switches();
97     bool do_radio_display();
98     bool do_steppers();
99     bool do_switches();
100
101 public:
102
103     FGATC610x():
104         et_flash_time(0.0)
105     {
106     }
107
108     ~FGATC610x() { }
109
110     bool open();
111
112     bool process();
113
114     bool close();
115 };
116
117
118 #endif // _FG_ATC610X_HXX