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