Browse Source

修复引用空间

master
hyh 4 months ago
parent
commit
618ad65f06
  1. 16
      app/api/v1/endpoints/adb.py
  2. 10
      app/api/v1/endpoints/at.py
  3. 12
      app/api/v1/endpoints/plnk.py
  4. 10
      app/api/v1/endpoints/ssh.py
  5. BIN
      app/core/device/__pycache__/dispatcher.cpython-310.pyc
  6. BIN
      app/schemas/__pycache__/at.cpython-310.pyc
  7. BIN
      app/schemas/__pycache__/plnk.cpython-310.pyc
  8. BIN
      app/services/__pycache__/atx_service.cpython-310.pyc
  9. BIN
      app/services/__pycache__/plnk_service.cpython-310.pyc
  10. BIN
      app/services/__pycache__/ssh_service.cpython-310.pyc
  11. 0
      logs/app.services.at_service.log
  12. 0
      logs/app.services.plnk_service.log
  13. 2
      requirements.txt

16
app/api/v1/endpoints/adb.py

@ -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"

10
app/api/v1/endpoints/at.py

@ -1,6 +1,6 @@
from fastapi import APIRouter, HTTPException, status
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.at import ATCommandRequest, ATCommandResponse
from app.utils.log import get_logger
@ -28,7 +28,7 @@ async def send_at_command(device_id: str, at_request: ATCommandRequest):
)
# 发送AT指令
result = await dispatcher.execute_operation(
result = await device_dispatcher.execute_operation(
device_id=device_id,
protocol_type=device.protocol_type,
operation="send_at_command",
@ -68,7 +68,7 @@ async def send_multiple_at_commands(device_id: str, commands: list, delay_betwee
)
# 发送多个AT指令
result = await dispatcher.execute_operation(
result = await device_dispatcher.execute_operation(
device_id=device_id,
protocol_type=device.protocol_type,
operation="send_multiple_commands",
@ -112,7 +112,7 @@ async def test_at_connection(device_id: str):
)
# 测试连接
result = await dispatcher.execute_operation(
result = await device_dispatcher.execute_operation(
device_id=device_id,
protocol_type=device.protocol_type,
operation="test_connection"
@ -153,7 +153,7 @@ async def get_at_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"

12
app/api/v1/endpoints/plnk.py

@ -1,6 +1,6 @@
from fastapi import APIRouter, HTTPException, status
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.plnk import PLNKRequest, PLNKResponse
from app.utils.log import get_logger
@ -28,7 +28,7 @@ async def send_plnk_data(device_id: str, plnk_request: PLNKRequest):
)
# 发送PLNK数据
result = await dispatcher.execute_operation(
result = await device_dispatcher.execute_operation(
device_id=device_id,
protocol_type=device.protocol_type,
operation="send_plnk_data",
@ -68,7 +68,7 @@ async def get_plnk_connection_status(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_connection_status"
@ -105,7 +105,7 @@ async def test_plnk_connection(device_id: str):
)
# 测试连接
result = await dispatcher.execute_operation(
result = await device_dispatcher.execute_operation(
device_id=device_id,
protocol_type=device.protocol_type,
operation="test_connection"
@ -140,7 +140,7 @@ async def send_hex_data(device_id: str, hex_data: str, timeout: int = 30):
# 根据协议类型选择不同的发送方式
if device.protocol_type == 'plnk':
result = await dispatcher.execute_operation(
result = await device_dispatcher.execute_operation(
device_id=device_id,
protocol_type=device.protocol_type,
operation="send_plnk_data",
@ -152,7 +152,7 @@ async def send_hex_data(device_id: str, hex_data: str, timeout: int = 30):
# 对于AT协议,将十六进制转换为ASCII
try:
ascii_data = bytes.fromhex(hex_data.replace(' ', '')).decode('ascii', errors='ignore')
result = await dispatcher.execute_operation(
result = await device_dispatcher.execute_operation(
device_id=device_id,
protocol_type=device.protocol_type,
operation="send_at_command",

10
app/api/v1/endpoints/ssh.py

@ -1,6 +1,6 @@
from fastapi import APIRouter, HTTPException, status
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.ssh import SSHExecRequest, SSHExecResponse
from app.utils.log import get_logger
@ -28,7 +28,7 @@ async def exec_ssh_command(device_id: str, exec_request: SSHExecRequest):
)
# 执行SSH命令
result = await dispatcher.execute_operation(
result = await device_dispatcher.execute_operation(
device_id=device_id,
protocol_type=device.protocol_type,
operation="exec_command",
@ -68,7 +68,7 @@ async def upload_file(device_id: str, local_path: str, remote_path: str):
)
# 执行文件上传
result = await dispatcher.execute_operation(
result = await device_dispatcher.execute_operation(
device_id=device_id,
protocol_type=device.protocol_type,
operation="upload_file",
@ -107,7 +107,7 @@ async def download_file(device_id: str, remote_path: str, local_path: str):
)
# 执行文件下载
result = await dispatcher.execute_operation(
result = await device_dispatcher.execute_operation(
device_id=device_id,
protocol_type=device.protocol_type,
operation="download_file",
@ -146,7 +146,7 @@ async def test_ssh_connection(device_id: str):
)
# 测试连接
result = await dispatcher.execute_operation(
result = await device_dispatcher.execute_operation(
device_id=device_id,
protocol_type=device.protocol_type,
operation="test_connection"

BIN
app/core/device/__pycache__/dispatcher.cpython-310.pyc

Binary file not shown.

BIN
app/schemas/__pycache__/at.cpython-310.pyc

Binary file not shown.

BIN
app/schemas/__pycache__/plnk.cpython-310.pyc

Binary file not shown.

BIN
app/services/__pycache__/atx_service.cpython-310.pyc

Binary file not shown.

BIN
app/services/__pycache__/plnk_service.cpython-310.pyc

Binary file not shown.

BIN
app/services/__pycache__/ssh_service.cpython-310.pyc

Binary file not shown.

0
logs/app.services.at_service.log

0
logs/app.services.plnk_service.log

2
requirements.txt

@ -10,7 +10,7 @@ pydantic-settings==2.10.1
tornado==6.4
# 设备控制相关
adbutils==2.0.0
adbutils==2.10.0
uiautomator2==2.16.23
pyserial==3.5

Loading…
Cancel
Save