MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / _attach_via_network

Function _attach_via_network

tests/integration/test_mqtt_scripting.py:78–93  ·  view source on GitHub ↗
(api_client, device_simulator)

Source from the content-addressed store, hash-verified

76
77
78def _attach_via_network(api_client, device_simulator) -> None:
79 api_client.configure_network(host="127.0.0.1", port=9000, socket_type="tcp")
80 time.sleep(0.1)
81 api_client.set_operation_mode("project")
82 api_client.configure_frame_parser(
83 start_sequence="/*", end_sequence="*/", operation_mode=0, frame_detection=1
84 )
85 try:
86 api_client.command("project.activate")
87 except APIError:
88 pass
89 time.sleep(0.2)
90 api_client.connect_device()
91 assert device_simulator.wait_for_connection(
92 timeout=5.0
93 ), "Serial Studio did not connect to the device simulator"
94
95
96def _wait_for_publisher_connected(api_client, timeout: float = 8.0) -> bool:

Calls 6

configure_networkMethod · 0.80
set_operation_modeMethod · 0.80
commandMethod · 0.80
connect_deviceMethod · 0.80
wait_for_connectionMethod · 0.45

Tested by

no test coverage detected