Changeset 212:fab302d5b7f6 for src/mlx/pyuipc_sim.py
- Timestamp:
- 05/31/12 17:25:32 (12 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/pyuipc_sim.py
r211 r212 25 25 SIM_FS2K2=6 26 26 SIM_FS2K4=7 27 SIM_FSX=8 27 28 28 29 #------------------------------------------------------------------------------ … … 260 261 for i in range(0, Values.HOTKEY_SIZE): 261 262 self.hotkeyTable.append([0, 0, 0, 0]) 263 264 self.pmdg_737ng_switches = 0 265 self.pmdg_737ngx_lts_positionsw = 0 262 266 263 267 def read(self, offset, type): … … 480 484 elif offset==0x3d00: # Name of the current aircraft 481 485 return self.aircraftName 486 elif offset==0x6202: # PMDG 737NG switches 487 return self.pmdg_737ng_switches 488 elif offset==0x6500: # PMDG 737NGX lights position SW 489 return self.pmdg_737ngx_lts_positionsw 482 490 else: 483 491 print "Unhandled offset: %04x" % (offset,) … … 688 696 elif offset==0x3d00: # Name of the current aircraft 689 697 self.aircraftName = value 698 elif offset==0x6202: # PMDG 737NG switches 699 self.pmdg_737ng_switches = value 700 elif offset==0x6500: # PMDG 737NGX lights position SW 701 self.pmdg_737ngx_lts_positionsw = value 690 702 else: 691 703 print "Unhandled offset: %04x" % (offset,) … … 808 820 CALL_READ=1 809 821 CALL_WRITE=2 810 CALL_CLOSE=3 811 CALL_FAILOPEN=4 822 CALL_SETVERSION=3 823 CALL_CLOSE=4 824 CALL_FAILOPEN=5 812 825 CALL_QUIT = 99 813 826 … … 853 866 elif call==CALL_WRITE: 854 867 result = write(args[0]) 868 elif call==CALL_SETVERSION: 869 global fs_version 870 fs_version = args[0] 871 result = None 855 872 elif call==CALL_CLOSE: 856 873 global opened … … 899 916 """Write the given data.""" 900 917 return self._call(CALL_WRITE, data) 918 919 def setVersion(self, version): 920 """Set the FS version to emulate.""" 921 return self._call(CALL_SETVERSION, int(version)) 901 922 902 923 def close(self): … … 1231 1252 lambda value: "0x%08x" % (value,), 1232 1253 lambda word: long(word, 16)) 1254 1255 self._valueHandlers["pmdg_737ng_switches"] = (0x6202, "b", 1256 lambda value: value, 1257 lambda word: int(word)) 1258 1259 self._valueHandlers["pmdg_737ngx_lts_positionsw"] = (0x6500, "b", 1260 lambda value: value, 1261 lambda word: int(word)) 1262 1233 1263 def default(self, line): 1234 1264 """Handle unhandle commands.""" … … 1313 1343 return [key + "=" for key in self._valueHandlers if key.startswith(text)] 1314 1344 1345 def do_setversion(self, args): 1346 """Set the version number to simulate""" 1347 try: 1348 value = int(args) 1349 self._client.setVersion(value) 1350 print "Emulating version %d" % (value,) 1351 except Exception, e: 1352 print >> sys.stderr, "Failed to set the version: " + str(e) 1353 1354 def help_setversion(self, usage = False): 1355 """Help for the setversion command""" 1356 if usage: print "Usage:", 1357 print "setversion <number>" 1358 1315 1359 def do_close(self, args): 1316 1360 """Close an existing connection so that FS will fail.""" … … 1319 1363 print "Connection closed" 1320 1364 except Exception, e: 1321 print >> sys.stderr, "Failed to close the connection: " + str(e) 1365 print >> sys.stderr, "Failed to close the connection: " + str(e) 1322 1366 1323 1367 def do_failopen(self, args): … … 1331 1375 1332 1376 def help_failopen(self, usage = False): 1333 """Help for the failopen c lose"""1377 """Help for the failopen command""" 1334 1378 if usage: print "Usage:", 1335 1379 print "failopen yes|no"
Note:
See TracChangeset
for help on using the changeset viewer.