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