Changeset 640:93acd05a8c64


Ignore:
Timestamp:
06/18/15 18:06:18 (9 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Added some test code for the X-Plane connection

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/xplane.py

    r611 r640  
    19041904
    19051905AircraftModel.registerSpecial(FJSDH8DModel)
     1906
     1907#------------------------------------------------------------------------------
     1908
     1909# if __name__ == "__main__":
     1910#     class ConnectionListener:
     1911#         def connected(self, fsType, descriptor):
     1912#             """Called when a connection has been established to the flight
     1913#             simulator of the given type."""
     1914#             print "fs.ConnectionListener.connected, fsType:", fsType, ", descriptor:", descriptor
     1915
     1916#         def connectionFailed(self):
     1917#             """Called when the connection could not be established."""
     1918#             print "fs.ConnectionListener.connectionFailed"
     1919
     1920#         def disconnected(self):
     1921#             """Called when a connection to the flight simulator has been broken."""
     1922#             print "fs.ConnectionListener.disconnected"
     1923
     1924#     class Config:
     1925#         def __init__(self):
     1926#             self.onlineACARS = False
     1927#             self.realIASSmoothingLength = 2
     1928#             self.realVSSmoothingLength = 2
     1929#             self.enableSounds = False
     1930#             self.usingFS2Crew = False
     1931
     1932#         def isMessageTypeFS(self, type):
     1933#             return True
     1934
     1935
     1936
     1937#     class GUI:
     1938#         def __init__(self):
     1939#             self.config = Config()
     1940#             self.entranceExam = False
     1941#             self.zfw = 30000.0
     1942
     1943#         def resetFlightStatus(self):
     1944#             pass
     1945
     1946#         def setRating(self, value):
     1947#             pass
     1948
     1949#         def insertFlightLogLine(self, index, ts, text, isFault):
     1950#             pass
     1951
     1952#         def setStage(self, stage):
     1953#             pass
     1954
     1955
     1956#     from i18n import setLanguage
     1957
     1958#     setLanguage("/home/vi/munka/repules/mlx", "en")
     1959
     1960#     from logger import Logger
     1961#     from flight import Flight
     1962#     from acft import DH8D
     1963
     1964#     gui = GUI()
     1965
     1966#     logger = Logger(gui)
     1967
     1968#     flight = Flight(logger, gui)
     1969#     acft = DH8D(flight)
     1970
     1971#     Watchdog()
     1972
     1973#     connectionListener = ConnectionListener()
     1974#     simulator = Simulator(connectionListener, connectAttempts = 3)
     1975
     1976#     simulator.connect(acft)
     1977
     1978#     time.sleep(2)
     1979
     1980#     simulator.startMonitoring()
     1981
     1982#     simulator.sendMessage("[MLX] Flight stage: Taxi", duration = 3)
     1983
     1984#     time.sleep(4)
     1985
     1986#     simulator.sendMessage("[MLX] Free gates: 1, 2, 3, 4, 5, 6, 25, 26, 27, 32, 33, 34, 35, 36, 37, 38, 39, 42, 43, 45, 107, 108, 109, R113, R114, R115, R116, R117, R210, R211, R212, R212A, R220, R221, R222, R223, R224, R225, R226, R227, R270, R271, R272, R274, R275, R276, R277, R278, R278A, R279", duration = 20)
     1987#     #simulator.sendMessage("[MLX] Free gates: 1, 2, 3, 4, 5, 6, 25, 26, 27, 32, 33, 34, 35, 36, 37, 38, 39, 42, 43, 45, 107, 108, 109, R113, R114, R115, R116", duration = 20)
     1988#     #simulator.sendMessage("[MLX] Free gates: 1, 2, 3, 4, 5, 6, 25, 26, 27, 32, 33, 34, 35, 36, 37, 38, 39, 42, 43, 45, 107, 108, 109, R113, R114, R115", duration = 20)
     1989
     1990#     time.sleep(30)
     1991
     1992#     simulator.sendMessage("[MLX] Hello", duration = 3)
     1993
     1994#     time.sleep(10)
Note: See TracChangeset for help on using the changeset viewer.