FlightGear next
net_ctrls.hxx
Go to the documentation of this file.
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// !!! IMPORTANT !!!
24/* There is some space reserved in the protocol for future use.
25 * When adding a new type, add it just before the "reserved" definition
26 * and subtract the size of this new type from the RESERVED_SPACE definition
27 * (1 for (u)int32_t or float and 2 for double).
28 *
29 * This way the protocol will be forward and backward compatible until
30 * RESERVED_SPACE becomes zero.
31 */
32
33#define RESERVED_SPACE 25
34const uint32_t FG_NET_CTRLS_VERSION = 27;
35
36
37// Define a structure containing the control parameters
38
40
41public:
42
43 enum {
47 };
48
49 uint32_t version; // increment when data values change
50
51 // Aero controls
52 double aileron; // -1 ... 1
53 double elevator; // -1 ... 1
54 double rudder; // -1 ... 1
55 double aileron_trim; // -1 ... 1
56 double elevator_trim; // -1 ... 1
57 double rudder_trim; // -1 ... 1
58 double flaps; // 0 ... 1
59 double spoilers;
60 double speedbrake;
61
62 // Aero control faults
63 uint32_t flaps_power; // true = power available
64 uint32_t flap_motor_ok;
65
66 // Engine controls
67 uint32_t num_engines; // number of valid engines
71 uint32_t starter_power[FG_MAX_ENGINES];// true = starter power
72 double throttle[FG_MAX_ENGINES]; // 0 ... 1
73 double mixture[FG_MAX_ENGINES]; // 0 ... 1
74 double condition[FG_MAX_ENGINES]; // 0 ... 1
75 uint32_t fuel_pump_power[FG_MAX_ENGINES];// true = on
76 double prop_advance[FG_MAX_ENGINES]; // 0 ... 1
77 uint32_t feed_tank_to[4];
78 uint32_t reverse[4];
79
80
81 // Engine faults
85 uint32_t spark_plugs_ok[FG_MAX_ENGINES]; // false = fouled plugs
86 uint32_t oil_press_status[FG_MAX_ENGINES];// 0 = normal, 1 = low, 2 = full fail
88
89 // Fuel management
90 uint32_t num_tanks; // number of valid tanks
91 uint32_t fuel_selector[FG_MAX_TANKS]; // false = off, true = on
92 uint32_t xfer_pump[5]; // specifies transfer from array
93 // value tank to tank specified by
94 // int value
95 uint32_t cross_feed; // false = off, true = on
96
97 // Brake controls
98 double brake_left;
103
104 // Landing Gear
105 uint32_t gear_handle; // true=gear handle down; false= gear handle up
106
107 // Switches
109
110 // nav and Comm
111 double comm_1;
112 double comm_2;
113 double nav_1;
114 double nav_2;
115
116 // wind and turbulance
120
121 // temp and pressure
122 double temp_c;
124
125 // other information about environment
126 double hground; // ground elevation (meters)
127 double magvar; // local magnetic variation in degs.
128
129 // hazards
130 uint32_t icing; // icing status could me much
131 // more complex but I'm
132 // starting simple here.
133
134 // simulation control
135 uint32_t speedup; // integer speedup multiplier
136 uint32_t freeze; // 0=normal
137 // 0x01=master
138 // 0x02=position
139 // 0x04=fuel
140
141 // --- New since FlightGear 0.9.10 (FG_NET_CTRLS_VERSION = 27)
142
143 // --- Add new variables just before this line.
144
145 uint32_t reserved[RESERVED_SPACE]; // 100 bytes reserved for future use.
146};
147
148
149#endif // _NET_CTRLS_HXX
150
151
double copilot_brake_left
uint32_t flaps_power
Definition net_ctrls.hxx:63
uint32_t fuel_pump_ok[FG_MAX_ENGINES]
Definition net_ctrls.hxx:87
double brake_left
Definition net_ctrls.hxx:98
uint32_t freeze
double flaps
Definition net_ctrls.hxx:58
uint32_t reverse[4]
Definition net_ctrls.hxx:78
double speedbrake
Definition net_ctrls.hxx:60
uint32_t starter_power[FG_MAX_ENGINES]
Definition net_ctrls.hxx:71
double mixture[FG_MAX_ENGINES]
Definition net_ctrls.hxx:73
double copilot_brake_right
double prop_advance[FG_MAX_ENGINES]
Definition net_ctrls.hxx:76
uint32_t master_bat[FG_MAX_ENGINES]
Definition net_ctrls.hxx:68
double wind_dir_deg
uint32_t master_avionics
double wind_speed_kt
uint32_t cross_feed
Definition net_ctrls.hxx:95
double elevator_trim
Definition net_ctrls.hxx:56
uint32_t feed_tank_to[4]
Definition net_ctrls.hxx:77
double condition[FG_MAX_ENGINES]
Definition net_ctrls.hxx:74
double rudder
Definition net_ctrls.hxx:54
double aileron
Definition net_ctrls.hxx:52
uint32_t flap_motor_ok
Definition net_ctrls.hxx:64
double magvar
double turbulence_norm
double comm_2
uint32_t master_alt[FG_MAX_ENGINES]
Definition net_ctrls.hxx:69
uint32_t mag_left_ok[FG_MAX_ENGINES]
Definition net_ctrls.hxx:83
uint32_t engine_ok[FG_MAX_ENGINES]
Definition net_ctrls.hxx:82
double press_inhg
uint32_t xfer_pump[5]
Definition net_ctrls.hxx:92
uint32_t num_engines
Definition net_ctrls.hxx:67
uint32_t fuel_selector[FG_MAX_TANKS]
Definition net_ctrls.hxx:91
double comm_1
double temp_c
uint32_t mag_right_ok[FG_MAX_ENGINES]
Definition net_ctrls.hxx:84
double hground
double nav_2
uint32_t spark_plugs_ok[FG_MAX_ENGINES]
Definition net_ctrls.hxx:85
uint32_t gear_handle
double spoilers
Definition net_ctrls.hxx:59
uint32_t num_tanks
Definition net_ctrls.hxx:90
double nav_1
double throttle[FG_MAX_ENGINES]
Definition net_ctrls.hxx:72
uint32_t oil_press_status[FG_MAX_ENGINES]
Definition net_ctrls.hxx:86
uint32_t speedup
double aileron_trim
Definition net_ctrls.hxx:55
uint32_t icing
double elevator
Definition net_ctrls.hxx:53
uint32_t version
Definition net_ctrls.hxx:49
uint32_t fuel_pump_power[FG_MAX_ENGINES]
Definition net_ctrls.hxx:75
double rudder_trim
Definition net_ctrls.hxx:57
double brake_parking
uint32_t reserved[25]
uint32_t magnetos[FG_MAX_ENGINES]
Definition net_ctrls.hxx:70
double brake_right
Definition net_ctrls.hxx:99
const uint32_t FG_NET_CTRLS_VERSION
Definition net_ctrls.hxx:34
#define RESERVED_SPACE
Definition net_ctrls.hxx:33