source: src/mlx/const.py@ 339:ede634649e12

Last change on this file since 339:ede634649e12 was 335:db900a4a0930, checked in by István Váradi <ivaradi@…>, 12 years ago

#139: added a checker for thev transponder state

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