docs: 更新包文档,匹配 ADB 隧道架构和当前 API

This commit is contained in:
zyj
2026-03-10 15:52:38 +08:00
parent 8a0b1e6e98
commit 21b0862e9f
8 changed files with 188 additions and 91 deletions

View File

@@ -233,6 +233,20 @@ func PushFile(addr, serial, localPath, remotePath string, mode int, debug bool)
return s.SyncPushFile(localPath, remotePath, mode, debug)
}
// PushData 通过 ADB 推送内存数据到设备
// 与 PushFile 功能相同,但数据来源是 []byte 而非本地文件
// 适用于通过 go:embed 嵌入的资源文件
func PushData(addr, serial string, data []byte, remotePath string, mode int, debug bool) (int64, error) {
conn, err := ConnectToDevice(addr, serial, 15*time.Second)
if err != nil {
return 0, err
}
defer conn.Close()
s := InitSync(conn)
return s.SyncPushData(data, remotePath, mode, debug)
}
// ---------- ADB 隧道(与 Python uiautomator2 完全一致) ----------
// CreateTunnel 建立到设备指定端口的 ADB 隧道