From 618ad65f063c66ffeb387dae5550b25c4b553835 Mon Sep 17 00:00:00 2001 From: hyh Date: Thu, 7 Aug 2025 15:15:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BC=95=E7=94=A8=E7=A9=BA?= =?UTF-8?q?=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/v1/endpoints/adb.py | 16 ++++++++-------- app/api/v1/endpoints/at.py | 10 +++++----- app/api/v1/endpoints/plnk.py | 12 ++++++------ app/api/v1/endpoints/ssh.py | 10 +++++----- .../__pycache__/dispatcher.cpython-310.pyc | Bin 3182 -> 3182 bytes app/schemas/__pycache__/at.cpython-310.pyc | Bin 0 -> 1704 bytes app/schemas/__pycache__/plnk.cpython-310.pyc | Bin 0 -> 2171 bytes .../__pycache__/atx_service.cpython-310.pyc | Bin 0 -> 2016 bytes .../__pycache__/plnk_service.cpython-310.pyc | Bin 0 -> 2080 bytes .../__pycache__/ssh_service.cpython-310.pyc | Bin 4717 -> 4717 bytes logs/app.services.at_service.log | 0 logs/app.services.plnk_service.log | 0 requirements.txt | 2 +- 13 files changed, 25 insertions(+), 25 deletions(-) create mode 100644 app/schemas/__pycache__/at.cpython-310.pyc create mode 100644 app/schemas/__pycache__/plnk.cpython-310.pyc create mode 100644 app/services/__pycache__/atx_service.cpython-310.pyc create mode 100644 app/services/__pycache__/plnk_service.cpython-310.pyc create mode 100644 logs/app.services.at_service.log create mode 100644 logs/app.services.plnk_service.log diff --git a/app/api/v1/endpoints/adb.py b/app/api/v1/endpoints/adb.py index 1001d4b..313ef31 100644 --- a/app/api/v1/endpoints/adb.py +++ b/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" diff --git a/app/api/v1/endpoints/at.py b/app/api/v1/endpoints/at.py index 61acf4a..811d6c3 100644 --- a/app/api/v1/endpoints/at.py +++ b/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" diff --git a/app/api/v1/endpoints/plnk.py b/app/api/v1/endpoints/plnk.py index 98a9871..c272c3d 100644 --- a/app/api/v1/endpoints/plnk.py +++ b/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", diff --git a/app/api/v1/endpoints/ssh.py b/app/api/v1/endpoints/ssh.py index a2532d1..81c7517 100644 --- a/app/api/v1/endpoints/ssh.py +++ b/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" diff --git a/app/core/device/__pycache__/dispatcher.cpython-310.pyc b/app/core/device/__pycache__/dispatcher.cpython-310.pyc index 8eb5a45440767de686d8907d0edddb8cdd70a7e3..1def697318b425be5bdac213e197f167452531d0 100644 GIT binary patch delta 18 YcmaDS@lJv>pO=@50SMl2pO=@50SJz7?6rqM95DyqcgM=)L)y6YTSK3==b^-H5 zpdqBhZMdljp+ZU_6sbwMsI(wjiH|X_WY_jr;E8i)oyMqC>dJdO=bX9i{QhTxYPC$@ zVXgJkZ{!L28=c7qV&piy;uSEIP|YQt*48||t!wD(ZqCcM^BQ@9&>YR5B{a{p_jBz6 z_yt-7zo`5o_y#q>H2P)Me>eTdT zdI@@YT${j=eX<@DkW_>C_9`qW_a zljcZ+TvO);{7HS0Nh5MR7R1qfybnU@7u(7D_k(Mz$?fHA23dW}b|Q;25eB|st!7o4 zmgU(?_c3 z3b-A=Boj8U4q6yq64rP;)L+K@H&HtWVn#zIv9YmU<6xB{=E!EqVV z!`M22Wdt=K$x&7 z_b{0XNr`4iGE9I3inl_mV@!y%ref2yu3{Bcw{vGBUE1EIir<`NllA^!^LoZJ9|k;f$X^+l*5Le#G#Bicayw!i;|kq9Wv$9+gb=d9pI=Y=TRVUDVQ?>E!g+^Dt(B#| z*% Zw~{nxvwP|py#Cb9P$w0wuGfnV<6pK+)olO( literal 0 HcmV?d00001 diff --git a/app/schemas/__pycache__/plnk.cpython-310.pyc b/app/schemas/__pycache__/plnk.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..05843f78352c31775136d311ada75d12d076fdf5 GIT binary patch literal 2171 zcma)7TW{P%6t=zIUGIGp0;Hu}#ic8x@?J%#&# zZRs`v3PsQcMO6tEYSJQ$IIcFx9B?%}_ax&*Kb7toI&KbW_DJt+q z&6)9qtfKsdO7EwGas>XuaS%iys;jismfF@@nu@ySX4-m7Z)aQCcCM9El{XcVA^KT` z=v4h8)5?RMB{|S@LN`Fq69aTZ=mpRVqzHOZ=tWX`Uul%rAe++Ac;R&`r0@8Ix;*=a zLtWCyaO2$|a(vHnxqjRUBd#BF?8wFmy&oJ#Zu}z{P^G03rKNoU2WVxePBh$PM{8wi zj^;^rNC8_8H%1DbOv|7JTHL3ArzkunQWnuAu$P6sGNh0yY_!HpCyqDYevh7tX&A+i zK`zvj&UANSp}TlDz4Lkc>s&JX)uDJ0d`V|AnYz_o{wX=Plzw+R?JT4hZlvFTc~j*j zLPMK5;%HnaR%ER`1vBEuaoV??W0dD3 zr%nAh8jkzHl>V@o%>1%?>wNO(lw5&VKCzt0WHbzXFQm;zg&U^nS#4^Xyl9$jpTsVX z%cglMw%m13-ZY7CnO-9GzBWd^Xv7MFk0SnMp6t;q}0WH@VP^J~Zfbx25McAvf z2J@@HilSgeS+YXj^EO&YEH-E%kUBr#ox3RUO3%$C7k*|2oPg)U*tTgH#(0y-^w(== zCRcwvD~ZDkA>5gXL=o=v(v9@;(w4izs7;;Il!%a~U_^KRdOACk%v{8I3=5n~hi)u^*N#4!wJxO?^p3c-yhaD2R@5f2~^P? zWSSk_K~&>#ED|nXOD|5!I9@zSX<%9|a042^e`EO^tS`Y6SU!&`_BUDOFW^WZy;;~j z&^-%Yq(+F@C3J%VI)Q;7YLx7Zn#{}(Lof-foIRL7}`>`gs zA+^!4cY_KKChe-yWl9hYE z1HirccuB4)V*U@2mtcAiA_q~$s}q;X8Zd%~1Kz@2tLa5>V_Eey(m`ybXm7&p7{LUw zyvVVc1{P7yJO_tzyfK*sA5>Ym*po#C%EY+BZYjAjBp;Ml@tqP>s4D|%U90En#z6ib D*acbs literal 0 HcmV?d00001 diff --git a/app/services/__pycache__/atx_service.cpython-310.pyc b/app/services/__pycache__/atx_service.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1f5ee3b3b21357270f7c1b1077599850d8e381b1 GIT binary patch literal 2016 zcmZuy|7#RS6rY*h+uPf_OJda6re8?EK)L>KEotcwBBH2mg_1%OYP+Ot*PZb^-Mu|$ zb~Onbv5g>#w)jgcHG%<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