forked from PanGalacticTech/Kerbal_Controller
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKerbalSimpitMessageTypes.h
More file actions
241 lines (165 loc) · 6.25 KB
/
Copy pathKerbalSimpitMessageTypes.h
File metadata and controls
241 lines (165 loc) · 6.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
/** @file KerbalSimpitMessageTypes.h
Constants for inbound and outbound message IDs.
*/
#ifndef KerbalSimpitMessageTypes_h
#define KerbalSimpitMessageTypes_h
/** Common packets.
These packet types are used for both inbound and outbound messages.
*/
enum CommonPackets {
/// Sync message. Used for handshaking.
SYNC_MESSAGE = 0,
/// Echo request. Either end can send this, and an echo response is expected.
ECHO_REQ_MESSAGE = 1,
/// Echo response. Sent in reply to an echo request.
ECHO_RESP_MESSAGE = 2
};
/** Outbound packets.
IDs for packets that go from the game to devices.
*/
enum OutboundPackets {
/// Scene change packets are sent by the plugin when
/// entering or leaving the flight scene.
SCENE_CHANGE_MESSAGE = 3,
/** Sea level and surface altitude.
Messages on this channel contain an altitudeMessage.
*/
ALTITUDE_MESSAGE = 8,
/** Apoapsis and periapsis.
Messages on this channel contain an apsidesMessage.
*/
APSIDES_MESSAGE = 9,
// Resources:
/** Liquid fuel in the vessel.
Messages on this channel contain a resourceMessage. */
LF_MESSAGE = 10,
/** Liquid fuel in the current stage.
Messages on this channel contain a resourceMessage. */
LF_STAGE_MESSAGE = 11,
/** Oxidizer in the vessel.
Messages on this channel contain a resourceMessage. */
OX_MESSAGE = 12,
/** Oxidizer in the current stage.
Messages on this channel contain a resourceMessage. */
OX_STAGE_MESSAGE = 13,
/** Solid fuel in the vessel.
Messages on this channel contain a resourceMessage. */
SF_MESSAGE = 14,
/** Solid fuel in the current stage.
Messages on this channel contain a resourceMessage. */
SF_STAGE_MESSAGE = 15,
/** Monoprollent in the vessel.
Messages on this channel contain a resourceMessage. */
MONO_MESSAGE = 16,
/** Electic Charge in the vessel.
Messages on this channel contain a resourceMessage. */
ELECTRIC_MESSAGE = 17,
/** EVA propellant. Only available for Kerbals on EVA.
Messages on this channel contain a resourceMessage. */
EVA_MESSAGE = 18,
/** Ore in the vessel.
Messages on this channel contain a resourceMessage. */
ORE_MESSAGE = 19,
/** Ablator in the vessel.
Messages on this channel contain a resourceMessage. */
AB_MESSAGE = 20,
/** Ablator in the current stage.
Messages on this channel contain a resourceMessage. */
AB_STAGE_MESSAGE = 21,
/** Vessel velocity.
Messages on this channel contain a velocityMessage. */
VELOCITY_MESSAGE = 22,
/** Action groups.
Messages on this channel contain a single byte representing the
currently active action groups. A given action group can be checked
by performing a
<a href="http://playground.arduino.cc/Code/BitMath#bitwise_and">bitwise AND</a>
with the message. For example:
\code
if (msg & SAS_ACTION) {
// code to execute if SAS is active
}
\endcode
Possible action groups are:
- STAGE_ACTION
- GEAR_ACTION
- LIGHT_ACTION
- RCS_ACTION
- SAS_ACTION
- BRAKES_ACTION
- ABORT_ACTION
*/
ACTIONSTATUS_MESSAGE = 23,
/** Time to the next apoapsis and periapsis.
Messages on this channel contain an apsidesTimeMessage. */
APSIDESTIME_MESSAGE = 24,
/** Information about targetted object.
This channel delivers messages about the object targetted by the
active vessel. Messages on this channel contain a targetInfoMessage. */
TARGETINFO_MESSAGE = 25,
/** Name of current Sphere of Influence.
This channel delivers an ASCII string containing the name of the body
the active vessel is currently orbiting. Note that this is always the
English name, regardless of the language the game is currently set to. */
SOI_MESSAGE = 26,
/** Information about airspeed.
This channel delivers messages containing indicated airspeed and
mach number for the active vessel. */
AIRSPEED_MESSAGE = 27,
};
/** Inbound packets.
These packet types are used for packets going from devices to the game.
*/
enum InboundPackets {
/** Register to receive messages on a given channel. */
REGISTER_MESSAGE = 8,
/** Deregister, indicate that no further messages
for the given channel should be sent. */
DEREGISTER_MESSAGE = 9,
// Custom action packets activate and deactivate custom action groups
/** Activate the given Custom Action Group(s). */
CAGACTIVATE_MESSAGE = 10,
/** Deactivate the given Custom Action Group(s). */
CAGDEACTIVATE_MESSAGE = 11,
/** Toggle the given Custom Action Group(s) (Active CAGs will
deactivate, inactive CAGs will activate). */
CAGTOGGLE_MESSAGE = 12,
/** Activate the given standard Action Group(s).
Note that *every request* to activate the Stage action group will
result in the next stage being activated.
For all other action groups, multiple activate requests will have
no effect.
*/
AGACTIVATE_MESSAGE = 13,
/** Deactivate the given standard Action Group(s). */
AGDEACTIVATE_MESSAGE = 14,
/** Toggle the given standard Action Group(s). */
AGTOGGLE_MESSAGE = 15,
/** Send vessel rotation commands. */
ROTATION_MESSAGE = 16,
/** Send vessel translation commands. */
TRANSLATION_MESSAGE = 17,
/** Send wheel steering/throttle commands. */
WHEEL_MESSAGE = 18,
/** Send vessel throttle commands. */
THROTTLE_MESSAGE = 19
};
/** Action Group Indexes
These are used to mask out elements of an ACTIONSTATUS_MESSAGE. */
enum ActionGroupIndexes {
/** Bitmask for the Stage action group. */
STAGE_ACTION = 1,
/** Bitmask for the Gear action group. */
GEAR_ACTION = 2,
/** Bitmask for the Light action group. */
LIGHT_ACTION = 4,
/** Bitmask for the RCS action group. */
RCS_ACTION = 8,
/** Bitmask for the SAS action group. */
SAS_ACTION = 16,
/** Bitmask for the Brakes action group. */
BRAKES_ACTION = 32,
/** Bitmask for the Abort action group. */
ABORT_ACTION = 64
};
#endif