source: src/mlx/acars.py@ 265:441bc4537a91

Last change on this file since 265:441bc4537a91 was 139:839016dcd0d1, checked in by István Váradi <ivaradi@…>, 13 years ago

Implemented ACARS sending

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