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