|
|
|
@ -1,7 +1,7 @@ |
|
|
|
from fastapi import APIRouter, HTTPException, status, UploadFile, File |
|
|
|
from typing import Optional |
|
|
|
from app.core.device.manager import device_manager |
|
|
|
from app.core.dispatcher import dispatcher |
|
|
|
from app.core.device.dispatcher import device_dispatcher |
|
|
|
from app.schemas.adb import ( |
|
|
|
ClickRequest, InputRequest, ScreenshotResponse, |
|
|
|
InstallRequest, InstallResponse, LogcatRequest, LogcatResponse |
|
|
|
@ -32,7 +32,7 @@ async def click_device(device_id: str, click_request: ClickRequest): |
|
|
|
) |
|
|
|
|
|
|
|
# 执行点击操作 |
|
|
|
result = await dispatcher.execute_operation( |
|
|
|
result = await device_dispatcher.execute_operation( |
|
|
|
device_id=device_id, |
|
|
|
protocol_type=device.protocol_type, |
|
|
|
operation="click", |
|
|
|
@ -73,7 +73,7 @@ async def input_text(device_id: str, input_request: InputRequest): |
|
|
|
|
|
|
|
# 执行输入操作 |
|
|
|
if device.protocol_type == 'adb': |
|
|
|
result = await dispatcher.execute_operation( |
|
|
|
result = await device_dispatcher.execute_operation( |
|
|
|
device_id=device_id, |
|
|
|
protocol_type=device.protocol_type, |
|
|
|
operation="input_text", |
|
|
|
@ -81,7 +81,7 @@ async def input_text(device_id: str, input_request: InputRequest): |
|
|
|
clear_first=input_request.clear_first |
|
|
|
) |
|
|
|
else: # atx |
|
|
|
result = await dispatcher.execute_operation( |
|
|
|
result = await device_dispatcher.execute_operation( |
|
|
|
device_id=device_id, |
|
|
|
protocol_type=device.protocol_type, |
|
|
|
operation="input_text", |
|
|
|
@ -120,7 +120,7 @@ async def get_screenshot(device_id: str): |
|
|
|
) |
|
|
|
|
|
|
|
# 执行截图操作 |
|
|
|
result = await dispatcher.execute_operation( |
|
|
|
result = await device_dispatcher.execute_operation( |
|
|
|
device_id=device_id, |
|
|
|
protocol_type=device.protocol_type, |
|
|
|
operation="screenshot" |
|
|
|
@ -157,7 +157,7 @@ async def install_apk(device_id: str, install_request: InstallRequest): |
|
|
|
) |
|
|
|
|
|
|
|
# 执行安装操作 |
|
|
|
result = await dispatcher.execute_operation( |
|
|
|
result = await device_dispatcher.execute_operation( |
|
|
|
device_id=device_id, |
|
|
|
protocol_type=device.protocol_type, |
|
|
|
operation="install_apk", |
|
|
|
@ -201,7 +201,7 @@ async def get_logcat( |
|
|
|
) |
|
|
|
|
|
|
|
# 执行日志获取操作 |
|
|
|
result = await dispatcher.execute_operation( |
|
|
|
result = await device_dispatcher.execute_operation( |
|
|
|
device_id=device_id, |
|
|
|
protocol_type=device.protocol_type, |
|
|
|
operation="get_logcat", |
|
|
|
@ -234,7 +234,7 @@ async def get_device_info(device_id: str): |
|
|
|
) |
|
|
|
|
|
|
|
# 获取设备信息 |
|
|
|
result = await dispatcher.execute_operation( |
|
|
|
result = await device_dispatcher.execute_operation( |
|
|
|
device_id=device_id, |
|
|
|
protocol_type=device.protocol_type, |
|
|
|
operation="get_device_info" |
|
|
|
|