Skip to content

Commit

Permalink
core: ardupilot-manager: Add support for UDP Server endpoints on Mavl…
Browse files Browse the repository at this point in the history
…inkRouter
  • Loading branch information
rafaellehmkuhl committed May 19, 2021
1 parent 6dff6f2 commit 2515366
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ def convert_endpoint(endpoint: Endpoint) -> str:
return f"--tcp-port {endpoint.argument}"
if endpoint.connection_type == EndpointType.TCPClient:
return f"--tcp-endpoint {endpoint.place}:{endpoint.argument}"
if endpoint.connection_type == EndpointType.UDPServer:
return f"{endpoint.place}:{endpoint.argument}"
if endpoint.connection_type == EndpointType.UDPClient:
return f"--endpoint {endpoint.place}:{endpoint.argument}"
raise ValueError(f"Endpoint of type {endpoint.connection_type} not supported on MavlinkRouter.")
Expand Down Expand Up @@ -61,6 +63,7 @@ def binary_name() -> str:
def _validate_endpoint(endpoint: Endpoint) -> None:
valid_connection_types = [
EndpointType.UDPClient,
EndpointType.UDPServer,
EndpointType.TCPServer,
EndpointType.TCPClient,
]
Expand Down
7 changes: 6 additions & 1 deletion core/services/ardupilot_manager/mavlink_proxy/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,12 @@ def test_mavlink_router(valid_output_endpoints: Set[Endpoint], valid_master_endp
assert mavlink_router.name() == "MAVLinkRouter", "Name does not match."
assert re.search(r"\d+", str(mavlink_router.version())) is not None, "Version does not follow pattern."

allowed_output_types = [EndpointType.UDPClient, EndpointType.TCPServer, EndpointType.TCPClient]
allowed_output_types = [
EndpointType.UDPServer,
EndpointType.UDPClient,
EndpointType.TCPServer,
EndpointType.TCPClient
]
allowed_master_types = [EndpointType.UDPServer, EndpointType.Serial, EndpointType.TCPServer]
run_common_routing_tests(
mavlink_router, allowed_output_types, allowed_master_types, valid_output_endpoints, valid_master_endpoints
Expand Down

0 comments on commit 2515366

Please sign in to comment.