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

Function _connect_device

tests/integration/test_latest_frame_api.py:48–62  ·  view source on GitHub ↗

Wire up project + JS split parser + network driver, then connect.

(api_client, device_simulator)

Source from the content-addressed store, hash-verified

46
47
48def _connect_device(api_client, device_simulator):
49 """Wire up project + JS split parser + network driver, then connect."""
50 api_client.configure_network(host="127.0.0.1", port=9000, socket_type="tcp")
51 time.sleep(0.1)
52 api_client.set_operation_mode("project")
53 api_client.configure_frame_parser(
54 start_sequence="", end_sequence="\n", operation_mode=0, frame_detection=0
55 )
56 api_client.set_frame_parser_code(_JS_SPLIT_PARSER, language=0)
57 api_client.command("project.activate")
58 time.sleep(0.2)
59 api_client.connect_device()
60 assert device_simulator.wait_for_connection(
61 timeout=5.0
62 ), "Serial Studio did not connect to the device simulator within 5 seconds"
63
64
65def _wait_for_frame(api_client, min_sequence: int = 1, timeout: float = 5.0) -> dict:

Calls 7

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

Tested by

no test coverage detected