]> git.mxchange.org Git - flightgear.git/blob - src/FDM/ExternalPipe/ExternalPipe.hxx
Mathias Fröhlich:
[flightgear.git] / src / FDM / ExternalPipe / ExternalPipe.hxx
1 // ExternalPipe.hxx -- a "pipe" interface to an external flight dynamics model
2 //
3 // Written by Curtis Olson, started March 2003.
4 //
5 // Copyright (C) 2003  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., 675 Mass Ave, Cambridge, MA 02139, USA.
20 //
21 // $Id$
22
23 #ifndef _EXTERNAL_PIPE_HXX
24 #define _EXTERNAL_PIPE_HXX
25
26 #include <stdio.h>              // FILE*, fopen(), fread(), fwrite(), et. al.
27
28 #include <simgear/timing/timestamp.hxx> // fine grained timing measurements
29
30 #include <Network/net_ctrls.hxx>
31 #include <Network/net_fdm.hxx>
32
33
34 class FGExternalPipe: public FGInterface {
35
36 private:
37
38     bool valid;
39
40     string fifo_name_1;
41     string fifo_name_2;
42     FILE *pd1;
43     FILE *pd2;
44     string _protocol;
45
46     FGNetCtrls ctrls;
47     FGNetFDM fdm;
48     char *buf;
49
50     double last_weight;
51     double last_cg_offset;
52
53     vector <string> property_names;
54     vector <SGPropertyNode *> nodes;
55
56     // Protocol specific init routines
57     void init_binary();
58     void init_property();
59
60     // Protocol specific update routines
61     void update_binary( double dt );
62     void update_property( double dt );
63
64 public:
65
66     // Constructor
67     FGExternalPipe( double dt, string fifo_name, string protocol );
68
69     // Destructor
70     ~FGExternalPipe();
71
72     // Reset flight params to a specific position
73     void init();
74
75     // update the fdm
76     void update( double dt );
77
78 };
79
80
81 #endif // _EXTERNAL_PIPE_HXX