Index: src/mlx/pyuipc_sim.py
===================================================================
--- src/mlx/pyuipc_sim.py	(revision 321)
+++ src/mlx/pyuipc_sim.py	(revision 334)
@@ -186,5 +186,5 @@
         bcd |= value % 10
         return bcd
-        
+
     @staticmethod
     def _writeFrequency(value):
@@ -207,5 +207,5 @@
         if isMain: mainFrequency = value
         else: extFrequency = value
-        
+
         return Values._toADFFrequency(mainFrequency, extFrequency)
 
@@ -222,5 +222,5 @@
 
         return bcd
-        
+
     def __init__(self):
         """Construct the values with defaults."""
@@ -235,5 +235,5 @@
         self.latitude = 47.5
         self.longitude = 19.05
-        
+
         self.paused = False
         self.frozen = False
@@ -243,7 +243,7 @@
         self.stalled = False
         self.onTheGround = True
-        
+
         self.zfw = 50000.0
-        
+
         self.fuelWeights = [0.0, 3000.0, 3000.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
         # Wikipedia: "Jet fuel", Jet A-1 density at 15*C .804kg/l -> 6.7 pounds/gallon
@@ -293,5 +293,5 @@
         self.windDirection = 300.0
         self.visibility = 10000
-        
+
         self.n1 = [0.0, 0.0, 0.0]
         self.throttles = [0.0, 0.0, 0.0]
@@ -313,4 +313,6 @@
         self.pmdg_737ng_switches = 0
         self.pmdg_737ngx_lts_positionsw = 0
+
+        self.xpdrC = False
 
     def read(self, offset, type):
@@ -447,5 +449,5 @@
                            (self.flapsNotches[index+1] - self.flapsNotches[index]))
         elif offset==0x0be0 or offset==0x0be4:    # Flaps left and  right
-            return self.flaps * 16383.0 / self.flapsNotches[-1]        
+            return self.flaps * 16383.0 / self.flapsNotches[-1]
         elif offset==0x0be8:       # Gear control
             return int(self.gearControl * 16383.0)
@@ -504,5 +506,5 @@
             return (self.zfw + sum(self.fuelWeights)) * const.KGSTOLB
         elif offset==0x31e4:       # Radio altitude
-            # FIXME: if self.radioAltitude is None, calculate from the 
+            # FIXME: if self.radioAltitude is None, calculate from the
             # altitude with some, perhaps random, ground altitude
             # value
@@ -551,4 +553,6 @@
         elif offset==0x6500:       # PMDG 737NGX lights position SW
             return self.pmdg_737ngx_lts_positionsw
+        elif offset==0x7b91:       # Transponder standby
+            return 0 if self.xpdrC else 1
         else:
             print "Unhandled offset: %04x" % (offset,)
@@ -697,6 +701,6 @@
             self.navLightsOn = (value&0x01)!=0
             self.antiCollisionLightsOn = (value&0x02)!=0
-            self.landingLightsOn = (value&0x04)!=0 
-            self.strobeLightsOn = (value&0x10)!=0 
+            self.landingLightsOn = (value&0x04)!=0
+            self.strobeLightsOn = (value&0x10)!=0
         elif offset==0x0e8a:       # Visibility
             self.visibility = value * 1609.344 / 100.0
@@ -781,14 +785,16 @@
         elif offset==0x6500:       # PMDG 737NGX lights position SW
             self.pmdg_737ngx_lts_positionsw = value
+        elif offset==0x7b91:       # Transponder standby
+            self.xpdrC = value==0
         else:
             print "Unhandled offset: %04x" % (offset,)
             raise FSUIPCException(ERR_DATA)
-        
+
     def _readUTC(self):
         """Read the UTC time.
-        
+
         The current offset is added to it."""
         return time.gmtime(time.time() + self._timeOffset)
-        
+
     def _getFuelLevel(self, index):
         """Get the fuel level for the fuel tank with the given
@@ -796,5 +802,5 @@
         return 0 if self.fuelCapacities[index]==0.0 else \
             int(self.fuelWeights[index] * 65536.0 * 128.0 / self.fuelCapacities[index])
-    
+
     def _getFuelCapacity(self, index):
         """Get the capacity of the fuel tank with the given index."""
@@ -811,5 +817,5 @@
         tm1 = tm[:index] + (value,) + tm[(index+1):]
         self._timeOffset += calendar.timegm(tm1) - calendar.timegm(tm)
-    
+
     def _setThrottle(self, index, value):
         """Set the throttle value for the given index."""
@@ -820,5 +826,5 @@
         self.fuelWeights[index] = self.fuelCapacities[index] * float(value) / \
                                   65536.0 / 128.0
-    
+
     def _setFuelCapacity(self, index, value):
         """Set the capacity of the fuel tank with the given index."""
@@ -830,5 +836,5 @@
                                       const.FEETTOMETRES,
                                       5.25588)
-        temperature = 15 - self.altitude * 6.5 * const.FEETTOMETRES / 1000.0 
+        temperature = 15 - self.altitude * 6.5 * const.FEETTOMETRES / 1000.0
         temperature += 273.15  # Celsius -> Kelvin
         airDensity = pressure / (temperature * 287.05)
@@ -868,5 +874,5 @@
     else:
         raise FSUIPCException(ERR_NOTOPEN)
-        
+
 #------------------------------------------------------------------------------
 
@@ -877,5 +883,5 @@
     else:
         raise FSUIPCException(ERR_NOTOPEN)
-            
+
 #------------------------------------------------------------------------------
 
@@ -887,5 +893,5 @@
     else:
         raise FSUIPCException(ERR_NOTOPEN)
-            
+
 #------------------------------------------------------------------------------
 
@@ -924,7 +930,7 @@
         serverSocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
         serverSocket.bind(("", PORT))
-    
+
         serverSocket.listen(5)
-    
+
         while True:
             (clientSocket, clientAddress) = serverSocket.accept()
@@ -936,10 +942,10 @@
         socketFile = clientSocket.makefile()
         try:
-            while True:                
+            while True:
                 (length,) = struct.unpack("I", clientSocket.recv(4))
                 data = clientSocket.recv(length)
                 (call, args) = cPickle.loads(data)
                 exception = None
-                
+
                 try:
                     if call==CALL_READ:
@@ -977,5 +983,5 @@
                 pass
             clientSocket.close()
-                   
+
 #------------------------------------------------------------------------------
 
@@ -1013,5 +1019,5 @@
         """Quit from the simulator."""
         data = cPickle.dumps((CALL_QUIT, None))
-        self._socket.send(struct.pack("I", len(data)) + data)        
+        self._socket.send(struct.pack("I", len(data)) + data)
 
     def _call(self, command, data):
@@ -1037,5 +1043,5 @@
         """Convert the given string to a PyUIPC boolean value (i.e. 0 or 1)."""
         return 1 if s in ["yes", "true", "on"] else 0
-    
+
     @staticmethod
     def bool2str(value):
@@ -1047,5 +1053,5 @@
         """Convert the given degree (as a string) into a PyUIPC value."""
         return int(float(degree) * 65536.0 * 65536.0 / 360.0)
-        
+
     @staticmethod
     def pyuipc2degree(value):
@@ -1057,25 +1063,25 @@
         """Convert the given percentage value (as a string) into a PyUIPC value."""
         return int(float(level) * 128.0 * 65536.0 / 100.0)
-        
+
     @staticmethod
     def pyuipc2fuelLevel(value):
         """Convert the PyUIPC value into a percentage value."""
         return value * 100.0 / 128.0 / 65536.0
-        
+
     @staticmethod
     def fuelCapacity2pyuipc(capacity):
         """Convert the given capacity value (as a string) into a PyUIPC value."""
         return int(capacity)
-        
+
     @staticmethod
     def pyuipc2fuelCapacity(value):
         """Convert the given capacity value into a PyUIPC value."""
         return value
-        
+
     @staticmethod
     def throttle2pyuipc(throttle):
         """Convert the given throttle value (as a string) into a PyUIPC value."""
         return int(float(throttle) * 16384.0 / 100.0)
-        
+
     @staticmethod
     def pyuipc2throttle(value):
@@ -1086,5 +1092,5 @@
         """Construct the CLI."""
         cmd.Cmd.__init__(self)
-        
+
         self.use_rawinput = True
         self.intro = "\nPyUIPC simulator command prompt\n"
@@ -1158,5 +1164,5 @@
                                      lambda word: None)
         self._valueHandlers["vs"] = ([(0x02c8, "d")],
-                                     lambda value: value * 60 /                                     
+                                     lambda value: value * 60 /
                                      const.FEETTOMETRES / 256.0,
                                      lambda word: int(float(word) *
@@ -1164,5 +1170,5 @@
                                                       256.0 / 60.0))
         self._valueHandlers["tdRate"] = ([(0x030c, "d")],
-                                         lambda value: value * 60 /                                     
+                                         lambda value: value * 60 /
                                          const.FEETTOMETRES / 256.0,
                                          lambda word: int(float(word) *
@@ -1331,10 +1337,10 @@
                                              CLI.pyuipc2throttle,
                                              CLI.throttle2pyuipc)
-                                                            
+
         self._valueHandlers["visibility"] = ([(0x0e8a, "H")],
                                              lambda value: value*1609.344/100.0,
                                              lambda word: int(float(word)*
                                                               100.0/1609.344))
-                                                            
+
         self._valueHandlers["payloadCount"] = ([(0x13fc, "d")],
                                                lambda value: value,
@@ -1348,5 +1354,5 @@
         self._valueHandlers["textScrolling"] = ([(0x1274, "h")],
                                                 CLI.bool2str, CLI.str2bool)
-                                                            
+
         self._valueHandlers["messageDuration"] = ([(0x32fa, "h")],
                                                   lambda value: value,
@@ -1371,4 +1377,7 @@
                                                              lambda value: value,
                                                              lambda word: int(word))
+        self._valueHandlers["xpdrC"] = ([(0x7b91, "b")],
+                                        lambda value: value,
+                                        lambda word: int(word))
 
     def default(self, line):
@@ -1383,5 +1392,5 @@
         """Handle the get command."""
         names = args.split()
-        data = []        
+        data = []
         for name in names:
             if name not in self._valueHandlers:
@@ -1408,5 +1417,5 @@
                 i+=1
         except Exception, e:
-            print >> sys.stderr, "Failed to read data: " + str(e)                        
+            print >> sys.stderr, "Failed to read data: " + str(e)
 
         return False
@@ -1440,5 +1449,5 @@
         if inWord:
             arguments.append(word)
-            
+
         names = []
         data = []
@@ -1467,5 +1476,5 @@
                       (value, name, str(e))
                 return False
-                
+
         try:
             self._client.write(data)
@@ -1508,5 +1517,5 @@
         except Exception, e:
             print >> sys.stderr, "Failed to close the connection: " + str(e)
-        
+
     def do_failopen(self, args):
         """Enable/disable the failing of opens."""
@@ -1516,5 +1525,5 @@
             print "Opening will%s fail" % ("" if value else " not",)
         except Exception, e:
-            print >> sys.stderr, "Failed to set open failure: " + str(e)        
+            print >> sys.stderr, "Failed to set open failure: " + str(e)
 
     def help_failopen(self, usage = False):
@@ -1530,5 +1539,5 @@
         else:
             return ["yes", "no"]
-        
+
     def do_quit(self, args):
         """Handle the quit command."""
@@ -1542,5 +1551,5 @@
 else:
     server = Server()
-    server.start()    
-
-#------------------------------------------------------------------------------
+    server.start()
+
+#------------------------------------------------------------------------------
