action建立连接(主食了开始测量之后的逻辑),add_trasition(调用run_add()函数)加转点。
This commit is contained in:
@@ -191,7 +191,24 @@ def setup_adb_wireless():
|
||||
target_port = 4723
|
||||
print(f"🚀 开始无线 ADB 建链(端口 {target_port})")
|
||||
|
||||
# 获取USB连接的设备
|
||||
# ===== 优先检查是否已有无线连接 =====
|
||||
wireless_connections = check_wireless_connections(target_port)
|
||||
if wireless_connections:
|
||||
print(f"📡 发现 {len(wireless_connections)} 个现有无线连接")
|
||||
for conn_id, ip, port in wireless_connections:
|
||||
if port == target_port:
|
||||
print(f"✅ 已存在目标端口 {target_port} 的无线连接: {conn_id}")
|
||||
# 验证连接是否有效
|
||||
verify_result = run_command("adb devices")
|
||||
if conn_id in verify_result and "device" in verify_result.split(conn_id)[1][:10]:
|
||||
print(f"✅ 连接验证通过")
|
||||
# 启动 Appium(如果未运行)
|
||||
start_appium()
|
||||
return conn_id
|
||||
else:
|
||||
print(f"⚠️ 连接验证失败,准备重新建立")
|
||||
|
||||
# ===== 获取USB连接的设备 =====
|
||||
devices_output = run_command("adb devices")
|
||||
lines = devices_output.splitlines()[1:]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user