修复控制功能

This commit is contained in:
2025-10-21 18:19:19 +08:00
parent bb8029b498
commit a0fe54d504
3 changed files with 11 additions and 7 deletions

3
.idea/workspace.xml generated
View File

@@ -5,7 +5,8 @@
</component>
<component name="ChangeListManager">
<list default="true" id="eceeff5e-51c1-459c-a911-d21ec090a423" name="Changes" comment="20250904-初步功能已完成">
<change beforePath="$PROJECT_DIR$/Module/DeviceInfo.py" beforeDir="false" afterPath="$PROJECT_DIR$/Module/DeviceInfo.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Module/FlaskService.py" beforeDir="false" afterPath="$PROJECT_DIR$/Module/FlaskService.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />

View File

@@ -17,7 +17,7 @@ from Entity.ResultData import ResultData
from Utils.ControlUtils import ControlUtils
from Utils.ThreadManager import ThreadManager
from script.ScriptManager import ScriptManager
from Entity.Variables import addModelToAnchorList
from Entity.Variables import addModelToAnchorList, wdaFunctionPort
import Entity.Variables as ev
from Utils.JsonUtils import JsonUtils
@@ -185,7 +185,7 @@ def launchApp():
def toHome():
body = request.get_json()
udid = body.get("udid")
client = wda.USBClient(udid)
client = wda.USBClient(udid, wdaFunctionPort)
client.home()
return ResultData(data="").toJson()
@@ -195,7 +195,10 @@ def toHome():
def tapAction():
body = request.get_json()
udid = body.get("udid")
client = wda.USBClient(udid)
client = wda.USBClient(udid, wdaFunctionPort)
print("-----------------------")
print(client)
print("-----------------------")
session = client.session()
session.appium_settings({"snapshotMaxDepth": 0})
x = body.get("x")
@@ -210,7 +213,7 @@ def swipeAction():
body = request.get_json()
udid = body.get("udid")
direction = body.get("direction")
client = wda.USBClient(udid)
client = wda.USBClient(udid, wdaFunctionPort)
session = client.session()
session.appium_settings({"snapshotMaxDepth": 0})
@@ -232,7 +235,7 @@ def longPressAction():
udid = body.get("udid")
x = body.get("x")
y = body.get("y")
client = wda.USBClient(udid)
client = wda.USBClient(udid, wdaFunctionPort)
session = client.session()
session.appium_settings({"snapshotMaxDepth": 5})
session.tap_hold(x, y, 1.0)
@@ -375,7 +378,7 @@ def addTempAnchorData():
def getChatTextInfo():
data = request.get_json()
udid = data.get("udid")
client = wda.USBClient(udid)
client = wda.USBClient(udid, wdaFunctionPort)
session = client.session()
xml = session.source()
try: