Skip to content

Commit f9784fb

Browse files
authored
Merge pull request #189 from Integration-Automation/dev
dev -> main: remote desktop, operations layer, USB passthrough, executor coverage
2 parents ecfdb03 + 0eb3ce8 commit f9784fb

3 files changed

Lines changed: 499 additions & 5 deletions

File tree

je_auto_control/utils/executor/action_executor.py

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,112 @@ def _remote_send_input(action: Dict[str, Any]) -> Dict[str, Any]:
155155
return remote_desktop_registry.send_input(action)
156156

157157

158+
# --- WebSocket-transport remote desktop ------------------------------------
159+
160+
def _ws_start_host(token: str,
161+
bind: str = "127.0.0.1",
162+
port: int = 0,
163+
fps: float = 10.0,
164+
quality: int = 70,
165+
region: Optional[List[int]] = None,
166+
max_clients: int = 4) -> Dict[str, Any]:
167+
"""Executor adapter: start the singleton WebSocket-transport host."""
168+
return remote_desktop_registry.start_ws_host(
169+
token=token, bind=bind, port=int(port),
170+
fps=float(fps), quality=int(quality),
171+
region=region, max_clients=int(max_clients),
172+
)
173+
174+
175+
def _ws_stop_host() -> Dict[str, Any]:
176+
return remote_desktop_registry.stop_ws_host()
177+
178+
179+
def _ws_host_status() -> Dict[str, Any]:
180+
return remote_desktop_registry.ws_host_status()
181+
182+
183+
def _ws_connect(host: str, port: int, token: str,
184+
path: str = "/",
185+
timeout: float = 5.0) -> Dict[str, Any]:
186+
"""Executor adapter: connect the singleton WS viewer."""
187+
return remote_desktop_registry.connect_ws_viewer(
188+
host=host, port=int(port), token=token,
189+
path=path, timeout=float(timeout),
190+
)
191+
192+
193+
def _ws_disconnect() -> Dict[str, Any]:
194+
return remote_desktop_registry.disconnect_ws_viewer()
195+
196+
197+
def _ws_viewer_status() -> Dict[str, Any]:
198+
return remote_desktop_registry.ws_viewer_status()
199+
200+
201+
def _ws_send_input(action: Dict[str, Any]) -> Dict[str, Any]:
202+
return remote_desktop_registry.ws_send_input(action)
203+
204+
205+
# --- WebRTC-transport remote desktop (manual SDP signaling) ----------------
206+
207+
def _webrtc_start_host(token: str,
208+
read_only: bool = False) -> Dict[str, Any]:
209+
"""Executor adapter: allocate the singleton WebRTC host.
210+
211+
Follow up with ``AC_webrtc_create_offer`` then
212+
``AC_webrtc_accept_answer`` once the viewer's answer SDP arrives.
213+
"""
214+
return remote_desktop_registry.start_webrtc_host(
215+
token=token, read_only=bool(read_only),
216+
)
217+
218+
219+
def _webrtc_create_offer(peer_label: str = "remote viewer") -> Dict[str, Any]:
220+
return remote_desktop_registry.webrtc_create_offer(peer_label=peer_label)
221+
222+
223+
def _webrtc_accept_answer(answer_sdp: str) -> Dict[str, Any]:
224+
return remote_desktop_registry.webrtc_accept_answer(answer_sdp)
225+
226+
227+
def _webrtc_stop_host() -> Dict[str, Any]:
228+
return remote_desktop_registry.stop_webrtc_host()
229+
230+
231+
def _webrtc_host_status() -> Dict[str, Any]:
232+
return remote_desktop_registry.webrtc_host_status()
233+
234+
235+
def _webrtc_start_viewer(token: str,
236+
viewer_id: Optional[str] = None) -> Dict[str, Any]:
237+
"""Executor adapter: allocate the singleton WebRTC viewer."""
238+
return remote_desktop_registry.start_webrtc_viewer(
239+
token=token, viewer_id=viewer_id,
240+
)
241+
242+
243+
def _webrtc_process_offer(offer_sdp: str,
244+
expected_dtls_fingerprint: Optional[str] = None,
245+
) -> Dict[str, Any]:
246+
return remote_desktop_registry.webrtc_process_offer(
247+
offer_sdp,
248+
expected_dtls_fingerprint=expected_dtls_fingerprint,
249+
)
250+
251+
252+
def _webrtc_send_input(action: Dict[str, Any]) -> Dict[str, Any]:
253+
return remote_desktop_registry.webrtc_send_input(action)
254+
255+
256+
def _webrtc_stop_viewer() -> Dict[str, Any]:
257+
return remote_desktop_registry.stop_webrtc_viewer()
258+
259+
260+
def _webrtc_viewer_status() -> Dict[str, Any]:
261+
return remote_desktop_registry.webrtc_viewer_status()
262+
263+
158264
# --- Virtual gamepad (ViGEm) -----------------------------------------------
159265

160266
def _gamepad_press(button: str) -> Dict[str, Any]:
@@ -819,6 +925,31 @@ def __init__(self):
819925
"AC_remote_viewer_status": _remote_viewer_status,
820926
"AC_remote_send_input": _remote_send_input,
821927

928+
# WebSocket-transport remote desktop host
929+
"AC_start_ws_host": _ws_start_host,
930+
"AC_stop_ws_host": _ws_stop_host,
931+
"AC_ws_host_status": _ws_host_status,
932+
933+
# WebSocket-transport remote desktop viewer
934+
"AC_ws_connect": _ws_connect,
935+
"AC_ws_disconnect": _ws_disconnect,
936+
"AC_ws_viewer_status": _ws_viewer_status,
937+
"AC_ws_send_input": _ws_send_input,
938+
939+
# WebRTC-transport host (manual SDP exchange)
940+
"AC_start_webrtc_host": _webrtc_start_host,
941+
"AC_webrtc_create_offer": _webrtc_create_offer,
942+
"AC_webrtc_accept_answer": _webrtc_accept_answer,
943+
"AC_stop_webrtc_host": _webrtc_stop_host,
944+
"AC_webrtc_host_status": _webrtc_host_status,
945+
946+
# WebRTC-transport viewer (manual SDP exchange)
947+
"AC_start_webrtc_viewer": _webrtc_start_viewer,
948+
"AC_webrtc_process_offer": _webrtc_process_offer,
949+
"AC_webrtc_send_input": _webrtc_send_input,
950+
"AC_stop_webrtc_viewer": _webrtc_stop_viewer,
951+
"AC_webrtc_viewer_status": _webrtc_viewer_status,
952+
822953
# Virtual gamepad (ViGEm — drives games that ignore SendInput)
823954
"AC_gamepad_press": _gamepad_press,
824955
"AC_gamepad_release": _gamepad_release,

0 commit comments

Comments
 (0)