1 | # Various constants used in the logger
|
---|
2 |
|
---|
3 | #-------------------------------------------------------------------------------
|
---|
4 |
|
---|
5 | # The version of the program
|
---|
6 | VERSION="0.4"
|
---|
7 |
|
---|
8 | #-------------------------------------------------------------------------------
|
---|
9 |
|
---|
10 | # The ratio between lbs and kg
|
---|
11 | LBSTOKG=0.4536
|
---|
12 |
|
---|
13 | # The ratio between kgs and lbs
|
---|
14 | KGSTOLB=1/LBSTOKG
|
---|
15 |
|
---|
16 | # The ratio between feet and metre
|
---|
17 | FEETTOMETRES=0.3048
|
---|
18 |
|
---|
19 | #-------------------------------------------------------------------------------
|
---|
20 |
|
---|
21 | # The ratio between knots and km/h
|
---|
22 | KNOTSTOKMPH=1.852
|
---|
23 |
|
---|
24 | # The ratio between km/h and knots
|
---|
25 | KMPHTOKNOTS=1/1.852
|
---|
26 |
|
---|
27 | #-------------------------------------------------------------------------------
|
---|
28 |
|
---|
29 | # Flight simulator type: MS Flight Simulator 2004
|
---|
30 | SIM_MSFS9 = 1
|
---|
31 |
|
---|
32 | # Flight simulator type: MS Flight Simulator X
|
---|
33 | SIM_MSFSX = 2
|
---|
34 |
|
---|
35 | # Flight simulator type: X-Plane 9
|
---|
36 | SIM_XPLANE9 = 3
|
---|
37 |
|
---|
38 | # Flight simulator type: X-Plane 10
|
---|
39 | SIM_XPLANE10 = 4
|
---|
40 |
|
---|
41 | #-------------------------------------------------------------------------------
|
---|
42 |
|
---|
43 | # Aircraft type: Boeing 737-600
|
---|
44 | AIRCRAFT_B736 = 1
|
---|
45 |
|
---|
46 | # Aircraft type: Boeing 737-700
|
---|
47 | AIRCRAFT_B737 = 2
|
---|
48 |
|
---|
49 | # Aircraft type: Boeing 737-800
|
---|
50 | AIRCRAFT_B738 = 3
|
---|
51 |
|
---|
52 | # Aircraft type: Boeing 737-800 (charter configuration)
|
---|
53 | AIRCRAFT_B738C = 16
|
---|
54 |
|
---|
55 | # Aircraft type: Boeing 737-300
|
---|
56 | AIRCRAFT_B733 = 4
|
---|
57 |
|
---|
58 | # Aircraft type: Boeing 737-400
|
---|
59 | AIRCRAFT_B734 = 5
|
---|
60 |
|
---|
61 | # Aircraft type: Boeing 737-500
|
---|
62 | AIRCRAFT_B735 = 6
|
---|
63 |
|
---|
64 | # Aircraft type: Dash-8 Q400
|
---|
65 | AIRCRAFT_DH8D = 7
|
---|
66 |
|
---|
67 | # Aircraft type: Boeing 767-200
|
---|
68 | AIRCRAFT_B762 = 8
|
---|
69 |
|
---|
70 | # Aircraft type: Boeing 767-300
|
---|
71 | AIRCRAFT_B763 = 9
|
---|
72 |
|
---|
73 | # Aircraft type: Canadair CRJ-200
|
---|
74 | AIRCRAFT_CRJ2 = 10
|
---|
75 |
|
---|
76 | # Aircraft type: Fokker F-70
|
---|
77 | AIRCRAFT_F70 = 11
|
---|
78 |
|
---|
79 | # Aircraft type: Lisunov Li-2
|
---|
80 | AIRCRAFT_DC3 = 12
|
---|
81 |
|
---|
82 | # Aircraft type: Tupolev Tu-134
|
---|
83 | AIRCRAFT_T134 = 13
|
---|
84 |
|
---|
85 | # Aircraft type: Tupolev Tu-154
|
---|
86 | AIRCRAFT_T154 = 14
|
---|
87 |
|
---|
88 | # Aircraft type: Yakovlev Yak-40
|
---|
89 | AIRCRAFT_YK40 = 15
|
---|
90 |
|
---|
91 | #-------------------------------------------------------------------------------
|
---|
92 |
|
---|
93 | # The list of aircraft types that we know of
|
---|
94 | # The order is mostly from most recent to oldest considering
|
---|
95 | # Malev's history
|
---|
96 | aircraftTypes = [AIRCRAFT_B736, AIRCRAFT_B737,
|
---|
97 | AIRCRAFT_B738, AIRCRAFT_B738C,
|
---|
98 | AIRCRAFT_DH8D,
|
---|
99 | AIRCRAFT_F70, AIRCRAFT_CRJ2,
|
---|
100 | AIRCRAFT_B762, AIRCRAFT_B763,
|
---|
101 | AIRCRAFT_B733, AIRCRAFT_B734, AIRCRAFT_B735,
|
---|
102 | AIRCRAFT_T154, AIRCRAFT_T134,
|
---|
103 | AIRCRAFT_YK40, AIRCRAFT_DC3]
|
---|
104 |
|
---|
105 | #-------------------------------------------------------------------------------
|
---|
106 |
|
---|
107 | # A mapping of aircraft types to their 'internal' ICAO codes (which are
|
---|
108 | # the same as the real ICAO codes, except in a few cases)
|
---|
109 | icaoCodes = { AIRCRAFT_B736 : "B736",
|
---|
110 | AIRCRAFT_B737 : "B737",
|
---|
111 | AIRCRAFT_B738 : "B738",
|
---|
112 | AIRCRAFT_B738C : "B738C",
|
---|
113 | AIRCRAFT_B733 : "B733",
|
---|
114 | AIRCRAFT_B734 : "B734",
|
---|
115 | AIRCRAFT_B735 : "B735",
|
---|
116 | AIRCRAFT_DH8D : "DH8D",
|
---|
117 | AIRCRAFT_B762 : "B762",
|
---|
118 | AIRCRAFT_B763 : "B763",
|
---|
119 | AIRCRAFT_CRJ2 : "CRJ2",
|
---|
120 | AIRCRAFT_F70 : "F70",
|
---|
121 | AIRCRAFT_DC3 : "DC3",
|
---|
122 | AIRCRAFT_T134 : "T134",
|
---|
123 | AIRCRAFT_T154 : "T154",
|
---|
124 | AIRCRAFT_YK40 : "YK40" }
|
---|
125 |
|
---|
126 | #-------------------------------------------------------------------------------
|
---|
127 |
|
---|
128 | # Flight stage: boarding
|
---|
129 | STAGE_BOARDING = 1
|
---|
130 |
|
---|
131 | # Flight stage: pushback, startup and taxi
|
---|
132 | STAGE_PUSHANDTAXI = 2
|
---|
133 |
|
---|
134 | # Flight stage: takeoff
|
---|
135 | STAGE_TAKEOFF = 3
|
---|
136 |
|
---|
137 | # Flight stage: RTO
|
---|
138 | STAGE_RTO = 4
|
---|
139 |
|
---|
140 | # Flight stage: climb
|
---|
141 | STAGE_CLIMB = 5
|
---|
142 |
|
---|
143 | # Flight stage: cruise
|
---|
144 | STAGE_CRUISE = 6
|
---|
145 |
|
---|
146 | # Flight stage: descent
|
---|
147 | STAGE_DESCENT = 7
|
---|
148 |
|
---|
149 | # Flight stage: landing
|
---|
150 | STAGE_LANDING = 8
|
---|
151 |
|
---|
152 | # Flight stage: taxi after landing
|
---|
153 | STAGE_TAXIAFTERLAND = 9
|
---|
154 |
|
---|
155 | # Flight stage: parking
|
---|
156 | STAGE_PARKING = 10
|
---|
157 |
|
---|
158 | # Flight stage: go-around
|
---|
159 | STAGE_GOAROUND = 11
|
---|
160 |
|
---|
161 | # Flight stage: end
|
---|
162 | STAGE_END = 12
|
---|
163 |
|
---|
164 | #-------------------------------------------------------------------------------
|
---|
165 |
|
---|
166 | _stageStrings = { STAGE_BOARDING : "boarding",
|
---|
167 | STAGE_PUSHANDTAXI : "pushback and taxi",
|
---|
168 | STAGE_TAKEOFF : "takeoff",
|
---|
169 | STAGE_RTO : "RTO",
|
---|
170 | STAGE_CLIMB : "climb",
|
---|
171 | STAGE_CRUISE : "cruise",
|
---|
172 | STAGE_DESCENT : "descent",
|
---|
173 | STAGE_LANDING : "landing",
|
---|
174 | STAGE_TAXIAFTERLAND : "taxi",
|
---|
175 | STAGE_PARKING : "parking",
|
---|
176 | STAGE_GOAROUND : "go-around",
|
---|
177 | STAGE_END : "end" }
|
---|
178 |
|
---|
179 | def stage2string(stage):
|
---|
180 | """Convert the given stage to a lower-case string."""
|
---|
181 | return _stageStrings[stage] if stage in _stageStrings else None
|
---|
182 |
|
---|
183 | #-------------------------------------------------------------------------------
|
---|
184 |
|
---|
185 | # Plane status: unknown
|
---|
186 | PLANE_UNKNOWN = 0
|
---|
187 |
|
---|
188 | # Plane status: at home, i.e. LHBP
|
---|
189 | PLANE_HOME = 1
|
---|
190 |
|
---|
191 | # Plane status: away
|
---|
192 | PLANE_AWAY = 2
|
---|
193 |
|
---|
194 | # Plane status: parking
|
---|
195 | PLANE_PARKING = 3
|
---|
196 |
|
---|
197 | #-------------------------------------------------------------------------------
|
---|
198 |
|
---|
199 | # Flight type: scheduled
|
---|
200 | FLIGHTTYPE_SCHEDULED = 0
|
---|
201 |
|
---|
202 | # Flight type: old-timer
|
---|
203 | FLIGHTTYPE_OLDTIMER = 1
|
---|
204 |
|
---|
205 | # Flight type: VIP
|
---|
206 | FLIGHTTYPE_VIP = 2
|
---|
207 |
|
---|
208 | # Flight type: charter
|
---|
209 | FLIGHTTYPE_CHARTER = 3
|
---|
210 |
|
---|
211 | #-------------------------------------------------------------------------------
|
---|
212 |
|
---|
213 | flightTypes = [ FLIGHTTYPE_SCHEDULED,
|
---|
214 | FLIGHTTYPE_OLDTIMER,
|
---|
215 | FLIGHTTYPE_VIP,
|
---|
216 | FLIGHTTYPE_CHARTER ]
|
---|
217 |
|
---|
218 | #-------------------------------------------------------------------------------
|
---|
219 |
|
---|
220 | _flightTypeStrings = { FLIGHTTYPE_SCHEDULED : "scheduled",
|
---|
221 | FLIGHTTYPE_OLDTIMER : "ot",
|
---|
222 | FLIGHTTYPE_VIP : "vip",
|
---|
223 | FLIGHTTYPE_CHARTER : "charter" }
|
---|
224 |
|
---|
225 | def flightType2string(flightType):
|
---|
226 | """Get the string equivalent of the given flight type."""
|
---|
227 | return _flightTypeStrings[flightType] \
|
---|
228 | if flightType in _flightTypeStrings else None
|
---|
229 |
|
---|
230 | #-------------------------------------------------------------------------------
|
---|
231 |
|
---|
232 | # Delay code: loading problems
|
---|
233 | DELAYCODE_LOADING = 0
|
---|
234 |
|
---|
235 | # Delay code: VATSIM problem
|
---|
236 | DELAYCODE_VATSIM = 1
|
---|
237 |
|
---|
238 | # Delay code: network problems
|
---|
239 | DELAYCODE_NETWORK = 2
|
---|
240 |
|
---|
241 | # Delay code: controller's fault
|
---|
242 | DELAYCODE_CONTROLLER = 3
|
---|
243 |
|
---|
244 | # Delay code: system crash or freeze
|
---|
245 | DELAYCODE_SYSTEM = 4
|
---|
246 |
|
---|
247 | # Delay code: navigation problem
|
---|
248 | DELAYCODE_NAVIGATION = 5
|
---|
249 |
|
---|
250 | # Delay code: traffic problems
|
---|
251 | DELAYCODE_TRAFFIC = 6
|
---|
252 |
|
---|
253 | # Delay code: apron navigation
|
---|
254 | DELAYCODE_APRON = 7
|
---|
255 |
|
---|
256 | # Delay code: weather problems
|
---|
257 | DELAYCODE_WEATHER = 8
|
---|
258 |
|
---|
259 | # Delay code: personal reasons
|
---|
260 | DELAYCODE_PERSONAL = 9
|
---|
261 |
|
---|
262 | #-------------------------------------------------------------------------------
|
---|
263 |
|
---|
264 | # Message type: logger error
|
---|
265 | # FIXME: cannot set the hotkey
|
---|
266 | MESSAGETYPE_LOGGER_ERROR = 1
|
---|
267 |
|
---|
268 | # Message type: information
|
---|
269 | MESSAGETYPE_INFORMATION = 2
|
---|
270 |
|
---|
271 | # Message type: fault messages
|
---|
272 | MESSAGETYPE_FAULT = 3
|
---|
273 |
|
---|
274 | # Message type: NO-GO fault messages
|
---|
275 | MESSAGETYPE_NOGO = 4
|
---|
276 |
|
---|
277 | # Message type: gate system messages
|
---|
278 | MESSAGETYPE_GATE_SYSTEM = 5
|
---|
279 |
|
---|
280 | # Message type: environment messages
|
---|
281 | # FIXME: flight plan closed (5 sec)
|
---|
282 | MESSAGETYPE_ENVIRONMENT = 6
|
---|
283 |
|
---|
284 | # Message type: help messages
|
---|
285 | MESSAGETYPE_HELP = 7
|
---|
286 |
|
---|
287 | # Message type: visibility messages
|
---|
288 | MESSAGETYPE_VISIBILITY = 8
|
---|
289 |
|
---|
290 | #-------------------------------------------------------------------------------
|
---|
291 |
|
---|
292 | messageTypes = [ MESSAGETYPE_LOGGER_ERROR,
|
---|
293 | MESSAGETYPE_INFORMATION,
|
---|
294 | MESSAGETYPE_FAULT,
|
---|
295 | MESSAGETYPE_NOGO,
|
---|
296 | MESSAGETYPE_GATE_SYSTEM,
|
---|
297 | MESSAGETYPE_ENVIRONMENT,
|
---|
298 | MESSAGETYPE_HELP,
|
---|
299 | MESSAGETYPE_VISIBILITY ]
|
---|
300 |
|
---|
301 | #-------------------------------------------------------------------------------
|
---|
302 |
|
---|
303 | _messageTypeStrings = { MESSAGETYPE_LOGGER_ERROR : "loggerError",
|
---|
304 | MESSAGETYPE_INFORMATION : "information",
|
---|
305 | MESSAGETYPE_FAULT : "fault",
|
---|
306 | MESSAGETYPE_NOGO : "nogo",
|
---|
307 | MESSAGETYPE_GATE_SYSTEM : "gateSystem",
|
---|
308 | MESSAGETYPE_ENVIRONMENT : "environment",
|
---|
309 | MESSAGETYPE_HELP : "help",
|
---|
310 | MESSAGETYPE_VISIBILITY : "visibility" }
|
---|
311 |
|
---|
312 | def messageType2string(messageType):
|
---|
313 | """Get the string equivalent of the given message type."""
|
---|
314 | return _messageTypeStrings[messageType] \
|
---|
315 | if messageType in _messageTypeStrings else None
|
---|
316 |
|
---|
317 | #-------------------------------------------------------------------------------
|
---|
318 |
|
---|
319 | # Message display level: none
|
---|
320 | MESSAGELEVEL_NONE = 0
|
---|
321 |
|
---|
322 | # Message display level: only message in the simulator
|
---|
323 | MESSAGELEVEL_FS = 1
|
---|
324 |
|
---|
325 | # Message display level: only sound
|
---|
326 | MESSAGELEVEL_SOUND = 2
|
---|
327 |
|
---|
328 | # Message display level: both
|
---|
329 | MESSAGELEVEL_BOTH = 3
|
---|
330 |
|
---|
331 | #-------------------------------------------------------------------------------
|
---|
332 |
|
---|
333 | messageLevels = [ MESSAGELEVEL_NONE,
|
---|
334 | MESSAGELEVEL_FS,
|
---|
335 | MESSAGELEVEL_SOUND,
|
---|
336 | MESSAGELEVEL_BOTH ]
|
---|
337 |
|
---|
338 | #-------------------------------------------------------------------------------
|
---|
339 |
|
---|
340 | _messageLevelStrings = { MESSAGELEVEL_NONE : "none",
|
---|
341 | MESSAGELEVEL_FS : "fs",
|
---|
342 | MESSAGELEVEL_SOUND : "sound",
|
---|
343 | MESSAGELEVEL_BOTH : "both" }
|
---|
344 |
|
---|
345 | def messageLevel2string(messageLevel):
|
---|
346 | """Get the string equivalent of the given message level."""
|
---|
347 | return _messageLevelStrings[messageLevel] \
|
---|
348 | if messageLevel in _messageLevelStrings else None
|
---|
349 |
|
---|
350 | def string2messageLevel(str):
|
---|
351 | """Get the message level for the given string."""
|
---|
352 | for (value, s) in _messageLevelStrings.iteritems():
|
---|
353 | if str==s:
|
---|
354 | return value
|
---|
355 | return MESSAGELEVEL_NONE
|
---|
356 |
|
---|
357 | #-------------------------------------------------------------------------------
|
---|
358 |
|
---|
359 | # Sound: ding
|
---|
360 | SOUND_DING = "ding.wav"
|
---|
361 |
|
---|
362 | # Sound: notify
|
---|
363 | SOUND_NOTIFY = "notify.wav"
|
---|
364 |
|
---|
365 | # Sound: NOTAM
|
---|
366 | SOUND_NOTAM = "notam.mp3"
|
---|
367 |
|
---|
368 | # Sound: scream
|
---|
369 | SOUND_SCREAM = "sikoly.mp3"
|
---|
370 |
|
---|
371 | # Sound: boarding
|
---|
372 | SOUND_BOARDING = "board.mp3"
|
---|
373 |
|
---|
374 | # Sound: Malev theme
|
---|
375 | SOUND_MALEV = "malev.mp3"
|
---|
376 |
|
---|
377 | # Sound: taxi: Boeing 737 NG
|
---|
378 | SOUND_TAXI_BOEING737NG = "737taxi.mp3"
|
---|
379 |
|
---|
380 | # Sound: taxi: Boeing 767
|
---|
381 | SOUND_TAXI_BOEING767 = "767taxi.mp3"
|
---|
382 |
|
---|
383 | # Sound: taxi: Fokker F70
|
---|
384 | SOUND_TAXI_F70 = "F70taxi.mp3"
|
---|
385 |
|
---|
386 | # Sound: takeoff preparation request from the captain
|
---|
387 | SOUND_CAPTAIN_TAKEOFF = "cpt_takeoff.mp3"
|
---|
388 |
|
---|
389 | # Sound: cruise
|
---|
390 | SOUND_CRUISE = "TOC.mp3"
|
---|
391 |
|
---|
392 | # Sound: descent
|
---|
393 | SOUND_DESCENT = "TOD.mp3"
|
---|
394 |
|
---|
395 | # Sound: applause
|
---|
396 | SOUND_APPLAUSE = "taps.mp3"
|
---|
397 |
|
---|
398 | # Sound: speedbrake
|
---|
399 | SOUND_SPEEDBRAKE = "speed.mp3"
|
---|
400 |
|
---|
401 | # Sound: taxi after landing
|
---|
402 | SOUND_TAXIAFTERLAND = "TaxiAfterLand.mp3"
|
---|
403 |
|
---|
404 |
|
---|
405 | #-------------------------------------------------------------------------------
|
---|
406 |
|
---|
407 | # Fuel tank: centre
|
---|
408 | FUELTANK_CENTRE = 1
|
---|
409 |
|
---|
410 | # Fuel tank: left
|
---|
411 | FUELTANK_LEFT = 2
|
---|
412 |
|
---|
413 | # Fuel tank: right
|
---|
414 | FUELTANK_RIGHT = 3
|
---|
415 |
|
---|
416 | # Fuel tank: left aux
|
---|
417 | FUELTANK_LEFT_AUX = 4
|
---|
418 |
|
---|
419 | # Fuel tank: right aux
|
---|
420 | FUELTANK_RIGHT_AUX = 5
|
---|
421 |
|
---|
422 | # Fuel tank: left tip
|
---|
423 | FUELTANK_LEFT_TIP = 6
|
---|
424 |
|
---|
425 | # Fuel tank: right tip
|
---|
426 | FUELTANK_RIGHT_TIP = 7
|
---|
427 |
|
---|
428 | # Fuel tank: external 1
|
---|
429 | FUELTANK_EXTERNAL1 = 8
|
---|
430 |
|
---|
431 | # Fuel tank: external 2
|
---|
432 | FUELTANK_EXTERNAL2 = 9
|
---|
433 |
|
---|
434 | # Fuel tank: centre2
|
---|
435 | FUELTANK_CENTRE2 = 10
|
---|
436 |
|
---|
437 | #-------------------------------------------------------------------------------
|
---|
438 |
|
---|
439 | fuelTanks = [ FUELTANK_CENTRE,
|
---|
440 | FUELTANK_LEFT,
|
---|
441 | FUELTANK_RIGHT,
|
---|
442 | FUELTANK_LEFT_AUX,
|
---|
443 | FUELTANK_RIGHT_AUX,
|
---|
444 | FUELTANK_LEFT_TIP,
|
---|
445 | FUELTANK_RIGHT_TIP,
|
---|
446 | FUELTANK_EXTERNAL1,
|
---|
447 | FUELTANK_EXTERNAL2,
|
---|
448 | FUELTANK_CENTRE2 ]
|
---|
449 |
|
---|
450 | #-------------------------------------------------------------------------------
|
---|
451 |
|
---|
452 | _fuelTankStrings = { FUELTANK_CENTRE : "centre",
|
---|
453 | FUELTANK_LEFT : "left",
|
---|
454 | FUELTANK_RIGHT : "right",
|
---|
455 | FUELTANK_LEFT_AUX : "left_aux",
|
---|
456 | FUELTANK_RIGHT_AUX : "right_aux",
|
---|
457 | FUELTANK_LEFT_TIP : "left_tip",
|
---|
458 | FUELTANK_RIGHT_TIP : "right_tip",
|
---|
459 | FUELTANK_EXTERNAL1 : "external1",
|
---|
460 | FUELTANK_EXTERNAL2 : "external2",
|
---|
461 | FUELTANK_CENTRE2 : "centre2" }
|
---|
462 |
|
---|
463 | def fuelTank2string(fuelTank):
|
---|
464 | """Get the string equivalent of the given fuelTank."""
|
---|
465 | return _fuelTankStrings[fuelTank] \
|
---|
466 | if fuelTank in _fuelTankStrings else None
|
---|
467 |
|
---|
468 | #-------------------------------------------------------------------------------
|
---|
469 |
|
---|
470 | # The available gates at LHBP
|
---|
471 | lhbpGateNumbers = []
|
---|
472 |
|
---|
473 | for i in range(1, 7):
|
---|
474 | lhbpGateNumbers.append(str(i))
|
---|
475 |
|
---|
476 | for i in range(10, 19):
|
---|
477 | lhbpGateNumbers.append(str(i))
|
---|
478 |
|
---|
479 | for i in range(24, 28):
|
---|
480 | lhbpGateNumbers.append(str(i))
|
---|
481 |
|
---|
482 | for i in range(31, 39):
|
---|
483 | lhbpGateNumbers.append(str(i))
|
---|
484 |
|
---|
485 | for i in range(42, 47):
|
---|
486 | lhbpGateNumbers.append(str(i))
|
---|
487 |
|
---|
488 | for i in range(60, 84):
|
---|
489 | if i!=70 and i!=80:
|
---|
490 | lhbpGateNumbers.append(str(i))
|
---|
491 |
|
---|
492 | #-------------------------------------------------------------------------------
|
---|
493 |
|
---|
494 | languages = ["$system", "en_GB", "hu_HU"]
|
---|
495 |
|
---|
496 | #-------------------------------------------------------------------------------
|
---|
497 |
|
---|