Updated Python client to support "switch" argument in SIMU command.
This commit is contained in:
@@ -81,11 +81,11 @@ class XPlaneConnect(object):
|
|||||||
Args:
|
Args:
|
||||||
pause: True to pause the simulation; False to resume.
|
pause: True to pause the simulation; False to resume.
|
||||||
'''
|
'''
|
||||||
pause_val = 0
|
pause = int(pause)
|
||||||
if pause:
|
if pause < 0 or pause > 2:
|
||||||
pause_val = 1
|
raise ValueError("Invalid argument for pause command.")
|
||||||
|
|
||||||
buffer = struct.pack("<4sxB", "SIMU", pause_val)
|
buffer = struct.pack("<4sxB", "SIMU", pause)
|
||||||
self.sendUDP(buffer)
|
self.sendUDP(buffer)
|
||||||
|
|
||||||
# X-Plane UDP Data
|
# X-Plane UDP Data
|
||||||
|
|||||||
@@ -161,6 +161,16 @@ class XPCTests(unittest.TestCase):
|
|||||||
expected = 0.0
|
expected = 0.0
|
||||||
do_test()
|
do_test()
|
||||||
|
|
||||||
|
# Test 3
|
||||||
|
value = 1
|
||||||
|
expected = 1.0
|
||||||
|
do_test()
|
||||||
|
|
||||||
|
# Test 4
|
||||||
|
value = 2
|
||||||
|
expected = 0.0
|
||||||
|
do_test()
|
||||||
|
|
||||||
|
|
||||||
def test_sendCTRL(self):
|
def test_sendCTRL(self):
|
||||||
# Setup
|
# Setup
|
||||||
|
|||||||
Reference in New Issue
Block a user