Files
agentic-mobile-control/tools/swipe.py
T

32 lines
675 B
Python

from __future__ import annotations
from core.device_manager import DeviceManager
from tools._device import get_driver
def swipe(
start_x: float,
start_y: float,
end_x: float,
end_y: float,
*,
duration_ms: int = 500,
device_id: str | None = None,
manager: DeviceManager | None = None,
) -> dict[str, object]:
get_driver(device_id, manager=manager).swipe(
start_x,
start_y,
end_x,
end_y,
duration_ms,
)
return {
"ok": True,
"action": "swipe",
"start": {"x": start_x, "y": start_y},
"end": {"x": end_x, "y": end_y},
"duration_ms": duration_ms,
}