source: src/mlx/acars.py@ 419:4f45b4efd501

Last change on this file since 419:4f45b4efd501 was 298:24c67ec5cdca, checked in by István Váradi <ivaradi@…>, 12 years ago

Documented the non-GUI modules

File size: 1.8 KB
Line 
1
2import const
3
4#------------------------------------------------------------------------------
5
6## @package mlx.acars
7#
8# The handling of the ACARS.
9#
10# This module defines the \ref ACARS class that is used to extract and contain
11# the data needed to send ACARS information to the MAVA server.
12
13#------------------------------------------------------------------------------
14
15class ACARS(object):
16 """The ACARS object."""
17 def __init__(self, gui, state):
18 """Construct the acars."""
19 self.pid = gui.config.pilotID
20 self.pilotName = gui.loginResult.pilotName
21
22 flight = gui.flight
23 aircraft = flight.aircraft
24
25 self.state = state
26 self.bookedFlight = gui.bookedFlight
27
28 self.blockTime = 0 if flight.blockTimeStart is None \
29 else aircraft.state.timestamp - flight.blockTimeStart
30 self.stage = flight.stage
31
32 def getBlockTimeText(self):
33 """Get the block time in HH:MM format"""
34 hours = int(self.blockTime / 3600)
35 minutes = int((self.blockTime / 60)) % 60
36 return "%02d:%02d" % (hours, minutes)
37
38 def getEventText(self):
39 """Get the 'event', i.e. the stage."""
40 if self.stage==const.STAGE_BOARDING: return "Boarding"
41 elif self.stage==const.STAGE_PUSHANDTAXI: return "Taxiing"
42 elif self.stage==const.STAGE_TAKEOFF: return "Departing"
43 elif self.stage==const.STAGE_CLIMB: return "Climbing"
44 elif self.stage==const.STAGE_CRUISE: return "Cruising"
45 elif self.stage==const.STAGE_DESCENT:
46 return "Descending" if self.state.altitude>=10000 \
47 else "Approaching"
48 else:
49 return "Landed"
50
51#------------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.