]> git.mxchange.org Git - flightgear.git/blob - src/Network/ATC-Main.hxx
Merge branch 'topics/mainloop' into next
[flightgear.git] / src / Network / ATC-Main.hxx
1 // ATC-Main.hxx -- FGFS interface to ATC 610x hardware
2 //
3 // Written by Curtis Olson, started January 2002.
4 //
5 // Copyright (C) 2002  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_MAIN_HXX
25 #define _FG_ATC_MAIN_HXX
26
27 #ifdef HAVE_CONFIG_H
28 #  include <config.h>
29 #endif
30
31 #include <plib/netChat.h>
32
33 #include <simgear/misc/sg_path.hxx>
34
35 #include <Main/fg_props.hxx>
36
37 #include "protocol.hxx"
38
39 #include "ATC-Inputs.hxx"
40 #include "ATC-Outputs.hxx"
41
42
43 class FGATCMain : public FGProtocol {
44
45     FGATCInput *input0;         // board0 input interface class
46     FGATCInput *input1;         // board1 input interface class
47     FGATCOutput *output0;       // board0 output interface class
48     FGATCOutput *output1;       // board1 output interface class
49
50     SGPath input0_path;
51     SGPath input1_path;
52     SGPath output0_path;
53     SGPath output1_path;
54
55     int board;
56
57     int lock0_fd;
58     int lock1_fd;
59
60 public:
61
62     FGATCMain() :
63         input0(NULL),
64         input1(NULL),
65         output0(NULL),
66         output1(NULL),
67         input0_path(""),
68         input1_path(""),
69         output0_path(""),
70         output1_path("")
71     { }
72
73     ~FGATCMain() {
74         delete input0;
75         delete input1;
76         delete output0;
77         delete output1;
78     }
79
80     // Open and initialize ATC 610x hardware
81     bool open();
82
83     void init_config();
84
85     bool process();
86
87     bool close();
88
89     inline void set_path_names( const SGPath &in0, const SGPath &in1,
90                                 const SGPath &out0, const SGPath &out1 )
91     {
92         input0_path = in0;
93         input1_path = in1;
94         output0_path = out0;
95         output1_path = out1;
96     }
97 };
98
99
100 #endif // _FG_ATC_MAIN_HXX