]> git.mxchange.org Git - flightgear.git/blob - src/Network/net_ctrls.hxx
05b59367eaad1155477abe73d624da29541a0e38
[flightgear.git] / src / Network / net_ctrls.hxx
1 // net_ctrls.hxx -- defines a common net I/O interface to the flight
2 //                  sim controls
3 //
4 // Written by Curtis Olson - http://www.flightgear.org/~curt
5 // Started July 2001.
6 //
7 // This file is in the Public Domain, and comes with no warranty.
8 //
9 // $Id$
10
11
12 #ifndef _NET_CTRLS_HXX
13 #define _NET_CTRLS_HXX
14
15
16 // NOTE: this file defines an external interface structure.  Due to
17 // variability between platforms and architectures, we only used fixed
18 // length types here.  Specifically, integer types can vary in length.
19 // I am not aware of any platforms that don't use 4 bytes for float
20 // and 8 bytes for double.
21
22 #ifdef HAVE_STDINT_H
23 # include <stdint.h>
24 #elif defined( _MSC_VER ) || defined(__MINGW32__) || defined(sun)
25 typedef signed short     int16_t;
26 typedef signed int       int32_t;
27 typedef unsigned short   uint16_t;
28 typedef unsigned int     uint32_t;
29 #else
30 # error "Port me! Platforms that don't have <stdint.h> need to define int8_t, et. al."
31 #endif
32
33 const uint32_t FG_NET_CTRLS_VERSION = 26;
34
35
36 // Define a structure containing the control parameters
37
38 class FGNetCtrls {
39
40 public:
41
42     enum {
43         FG_MAX_ENGINES = 4,
44         FG_MAX_WHEELS = 16,
45         FG_MAX_TANKS = 6
46     };
47
48     uint32_t version;                    // increment when data values change
49
50     // Aero controls
51     double aileron;                      // -1 ... 1
52     double elevator;                     // -1 ... 1
53     double rudder;                       // -1 ... 1
54     double aileron_trim;                 // -1 ... 1
55     double elevator_trim;                // -1 ... 1
56     double rudder_trim;                  // -1 ... 1
57     double flaps;                        //  0 ... 1
58
59     // Aero control faults
60     uint32_t flaps_power;                 // true = power available
61     uint32_t flap_motor_ok;
62
63     // Engine controls
64     uint32_t num_engines;                // number of valid engines
65     uint32_t master_bat[FG_MAX_ENGINES];
66     uint32_t master_alt[FG_MAX_ENGINES];
67     uint32_t magnetos[FG_MAX_ENGINES];
68     uint32_t starter_power[FG_MAX_ENGINES];// true = starter power
69     double throttle[FG_MAX_ENGINES];     //  0 ... 1
70     double mixture[FG_MAX_ENGINES];      //  0 ... 1
71     double condition[FG_MAX_ENGINES];    //  0 ... 1
72     uint32_t fuel_pump_power[FG_MAX_ENGINES];// true = on
73     double prop_advance[FG_MAX_ENGINES]; //  0 ... 1
74
75     // Engine faults
76     uint32_t engine_ok[FG_MAX_ENGINES];
77     uint32_t mag_left_ok[FG_MAX_ENGINES];
78     uint32_t mag_right_ok[FG_MAX_ENGINES];
79     uint32_t spark_plugs_ok[FG_MAX_ENGINES];  // false = fouled plugs
80     uint32_t oil_press_status[FG_MAX_ENGINES];// 0 = normal, 1 = low, 2 = full fail
81     uint32_t fuel_pump_ok[FG_MAX_ENGINES];
82
83     // Fuel management
84     uint32_t num_tanks;                      // number of valid tanks
85     uint32_t fuel_selector[FG_MAX_TANKS];    // false = off, true = on
86     uint32_t cross_feed;                     // false = off, true = on
87
88     // Brake controls
89     double brake_left;
90     double brake_right;
91     double copilot_brake_left;
92     double copilot_brake_right;
93     double brake_parking;
94     
95     // Landing Gear
96     uint32_t gear_handle; // true=gear handle down; false= gear handle up
97
98     // Switches
99     uint32_t master_avionics;
100
101     // wind and turbulance
102     double wind_speed_kt;
103     double wind_dir_deg;
104     double turbulence_norm;
105
106     // temp and pressure
107     double temp_c;
108     double press_inhg;
109
110     // other information about environment
111     double hground;                      // ground elevation (meters)
112     double magvar;                       // local magnetic variation in degs.
113
114     // hazards
115     uint32_t icing;                       // icing status could me much
116                                          // more complex but I'm
117                                          // starting simple here.
118
119     // simulation control
120     uint32_t speedup;                    // integer speedup multiplier
121     uint32_t freeze;                     // 0=normal
122                                          // 0x01=master
123                                          // 0x02=position
124                                          // 0x04=fuel
125 };
126
127
128 #endif // _NET_CTRLS_HXX
129
130