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

Function _connect_network

tests/integration/test_source_configure.py:45–70  ·  view source on GitHub ↗

Configure network driver via project.source.update, then connect.

(api_client, device_simulator)

Source from the content-addressed store, hash-verified

43
44
45def _connect_network(api_client, device_simulator):
46 """Configure network driver via project.source.update, then connect."""
47 # Set network bus type first so activeUiDriver() returns m_networkUi
48 api_client.command("io.setBusType", {"busType": 1})
49 time.sleep(0.1)
50
51 api_client.source_configure(
52 0,
53 {
54 "address": "127.0.0.1",
55 "tcpPort": 9000,
56 "socketTypeIndex": 0,
57 },
58 )
59 time.sleep(0.1)
60
61 api_client.configure_frame_parser(
62 start_sequence="/*", end_sequence="*/", operation_mode=0, frame_detection=1
63 )
64 api_client.command("project.activate")
65 time.sleep(0.2)
66
67 api_client.connect_device()
68 assert device_simulator.wait_for_connection(
69 timeout=5.0
70 ), "Serial Studio did not connect to the device simulator within 5 seconds"
71
72
73def _send_json_frame(api_client, device_simulator, values: list):

Calls 5

commandMethod · 0.80
source_configureMethod · 0.80
connect_deviceMethod · 0.80
wait_for_connectionMethod · 0.45

Tested by

no test coverage detected