Ignore:
Timestamp:
04/30/12 13:15:14 (12 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

The general message sending works and the most important messages are sent

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/fsuipc.py

    r117 r133  
    436436    normalData = timeData + \
    437437                 [ (0x3d00, -256),           # The name of the current aircraft
    438                    (0x3c00, -256) ]          # The path of the current AIR file
     438                   (0x3c00, -256),           # The path of the current AIR file
     439                   (0x1274, "h") ]           # Text display mode
    439440
    440441    flareData1 = [ (0x023a, "b"),            # Seconds of time
     
    496497        self._handler.start()
    497498
     499        self._scroll = False
     500
    498501        self._normalRequestID = None
    499502
     
    576579            self._flareRequestID = None
    577580
     581    def sendMessage(self, message, duration = 3):
     582        """Send a message to the pilot via the simulator.
     583
     584        duration is the number of seconds to keep the message displayed."""
     585       
     586        if self._scroll:
     587            if duration==0: duration = -1
     588            elif duration == 1: duration = -2
     589            else: duration = -duration
     590
     591        data = [(0x3380, -1 - len(message), message),
     592                (0x32fa, 'h', duration)]
     593
     594        self._handler.requestWrite(data, self._handleMessageSent)
     595           
    578596    def disconnect(self):
    579597        """Disconnect from the simulator."""
     
    613631
    614632        createdNewModel = self._setAircraftName(timestamp, data[5], data[6])
     633
     634        self._scroll = data[7]!=0
    615635       
    616636        if self._monitoringRequested and not self._monitoring:
     
    763783        dow = zfw - payload
    764784        callback(dow, payload, zfw, grossWeight)
     785
     786    def _handleMessageSent(self, success, extra):
     787        """Callback for a message sending request."""
     788        pass
    765789                                                 
    766790#------------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.