| 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 <simgear/misc/sg_path.hxx> |
| 32 | |
| 33 | #include <Main/fg_props.hxx> |
| 34 | |
| 35 | #include "protocol.hxx" |
| 36 | |
| 37 | #include "ATC-Inputs.hxx" |
| 38 | #include "ATC-Outputs.hxx" |
| 39 | |
| 40 | |
| 41 | class FGATCMain : public FGProtocol { |
| 42 | |
| 43 | FGATCInput *input0; // board0 input interface class |
| 44 | FGATCInput *input1; // board1 input interface class |
| 45 | FGATCOutput *output0; // board0 output interface class |
| 46 | FGATCOutput *output1; // board1 output interface class |
| 47 | |
| 48 | SGPath input0_path; |
| 49 | SGPath input1_path; |
| 50 | SGPath output0_path; |
| 51 | SGPath output1_path; |
| 52 | |
| 53 | int lock0_fd; |
| 54 | int lock1_fd; |
| 55 | |
| 56 | public: |
| 57 | |
| 58 | FGATCMain() : |
| 59 | input0(NULL), |
| 60 | input1(NULL), |
| 61 | output0(NULL), |
| 62 | output1(NULL), |
| 63 | input0_path(""), |
| 64 | input1_path(""), |
| 65 | output0_path(""), |
| 66 | output1_path("") |
| 67 | { } |
| 68 | |
| 69 | ~FGATCMain() { |
| 70 | delete input0; |
| 71 | delete input1; |
| 72 | delete output0; |
| 73 | delete output1; |
| 74 | } |
| 75 | |
| 76 | // Open and initialize ATC 610x hardware |
| 77 | bool open(); |
| 78 | |
| 79 | void init_config(); |
| 80 | |
| 81 | bool process(); |
| 82 | |
| 83 | bool close(); |
| 84 | |
| 85 | inline void set_path_names( const SGPath &in0, const SGPath &in1, |
| 86 | const SGPath &out0, const SGPath &out1 ) |
| 87 | { |
| 88 | input0_path = in0; |
| 89 | input1_path = in1; |
| 90 | output0_path = out0; |
| 91 | output1_path = out1; |
| 92 | } |
| 93 | }; |
| 94 | |
| 95 | |
| 96 | #endif // _FG_ATC_MAIN_HXX |