Ignore:
Timestamp:
03/16/18 08:58:18 (6 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
hg-Phase:
(<MercurialRepository 1 'hg:/home/ivaradi/mlx/hg' '/'>, 'public')
Message:

Aircraft type information (currently DOW, and crew-specific DOW values) are queried via RPC when logging in.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/rpc.py

    r895 r898  
    381381#---------------------------------------------------------------------------------------
    382382
     383class AircraftTypeInfo(RPCObject):
     384    """Information about an aircraft type."""
     385    # The instructions for the construction
     386    _instructions = {
     387        "dow" : int,
     388        "dowCockpit" : int,
     389        "dowCabin" : int,
     390        }
     391
     392    def __init__(self, value):
     393        """Construct the booked flight object from the given RPC result
     394        value."""
     395        super(AircraftTypeInfo, self).__init__(value,
     396                                               AircraftTypeInfo._instructions)
     397        self.aircraftType = const.icao2Type[value["typeCode"]]
     398
     399#---------------------------------------------------------------------------------------
     400
    383401class Registration(object):
    384402    """Data for registration."""
     
    507525            return None
    508526
     527    def getTypes(self):
     528        """Get the data of the aircraft types supported by us."""
     529        value = self._performCall(lambda sessionID:
     530                                  self._server.getTypes(sessionID))
     531
     532        return [AircraftTypeInfo(t) for t in value]
     533
    509534    def getFlights(self):
    510535        """Get the flights available for performing."""
Note: See TracChangeset for help on using the changeset viewer.