Please remain skeptical of information from strangers, and be cautious of online transactions to avoid being deceived!
请对陌生人提供的信息保持怀疑,谨慎进行网上交易,以免上当受骗!

Laixi API

官方教程或者视频 & Tutorials or videos provided by Laixi
Post Reply
laixi
Posts: 32
Joined: Mon Nov 18, 2024 9:26 am

Laixi API

Post by laixi »

自动化编程/Laixi API Demo Download
WebSocket API 是常见的,通用的http协议的API接口. 支持各种语言调用,如:按键精灵,易语言,C++,Python,Html,Vue,Node.js 等等…

WebSocket API is a common , generic http protocol API interface . It supports various language calls, such as:

E Language, Java,C++,C#, Go,Python, Html,PHP, Vue, Node.js, etc....

Laixi API Online Test
ws://127.0.0.1:22221/
https://websocketking.com/
下载DEMO/Download DEMO:https://laixi2.cdn.dfyun.com.cn/other/l ... i_demo.zip
websocket.png
websocket.png (13.06 KiB) Viewed 157 times


All Info 获取所有设备信息

{ "action":"List" }
list.png
list.png (34.1 KiB) Viewed 157 times
TIP:
deviceIds Parameters example:all,8318fc66,fa3523ea0510
deviceIds 参数 传all代表所有手机,也可以传 手机连接名.如:8318fc66,fa3523ea0510



Screenshot 截图

{
"action": "screen",
"comm": {
"deviceIds":"all",
"savePath":"d:\\aaa"
}
}
screen.png
screen.png (11.91 KiB) Viewed 157 times
TIP:
deviceIds Parameters example:all,8318fc66,fa3523ea0510
devceIds 参数 传all代表所有手机,也可以传 手机连接名.如:8318fc66,fa3523ea0510


Screen Control 屏幕控制
Screen Send Mouse Action 屏幕发送鼠标操作动作
{
"action": "pointerEvent",
"comm": {
"deviceIds": "fa3523ea0510,8318fc66",
"mask": "0",
"x": "0.5",
"y": "0.5",
"endx": "0",
"endy": "0",
"delta": "1"
}
}

Operational Events

mask 事件类型:
0按下 1移动 2松开 3鼠标右键 4滚轮向上 5滚轮向下 6上滑 7下滑 8左滑 9右滑
x,y 坐标 传百分比 百分比 endx endy 也是
上滑 下滑 左滑 右滑 需要传endx endy 其他事件传0就行
滚轮向上 滚轮向下需要传delta 其他不用传

mask Event type
0 press 1 move 2 release 3 right mouse button 4 wheel up 5 wheel down 6 slide up 7 slide down 8 slide left 9 slide right
x, y coordinates Pass percentage Percentage endx endy also
Slide up Slide down Slide left Slide right Need to pass endx endy Other events just pass 0
Wheel up, wheel down, delta, nothing else.


上滑屏幕 Demo A demo example of a slide-up screen
//先执行按下 mask=0 x=0.5 y=0.5 从中间位置开始
//Perform the press action first mask=0 x=0.5 y=0.5 From the center.

{
"action": "PointerEvent",
"comm": {
"deviceIds":"all",
"mask":"0",
"x":"0.5",
"y":"0.5",
"endx":"0",
"endy":"0",
"delta":"0"
}
}


//执行移动mask=1 y移动到0.2位置 松开前可执行多个移动就会变成拖动
//Next, execute the move mask=1 y move to 0.2
//Multiple moves can be performed before releasing and they become drags.

{
"action": "PointerEvent",
"comm": {
"deviceIds":"all",
"mask":"1",
"x":"0.5",
"y":"0.2",
"endx":"0",
"endy":"0",
"delta":"0"
}
}


//最后松开mask=2 x y 传最后移动到的位置
//Finally release mask=2 x y pass the last position moved to
{
"action": "PointerEvent",
"comm": {
"deviceIds":"all",
"mask":"2",
"x":"0.5",
"y":"0.2",
"endx":"0",
"endy":"0",
"delta":"0"
}
}

TIP:
deviceIds Parameters example:all,8318fc66,fa3523ea0510
deviceIds 参数 传all代表所有手机,也可以传 手机连接名.如:8318fc66,fa3523ea0510


Get Clipboard 获取剪贴板内容

这个指令不支持多个手机deviceIds
This command can only get 1 cell phone

{
"action": "getclipboard",
"comm": {
"deviceIds":"8318fc66"
}
}

Send to clipboard 发送到剪贴板

{
"action": "writeclipboard",
"comm": {
"deviceIds":"all",
"content":"Hi,laixi.app"
}
}


Upload file 文件上传

isAutoInstall 0 Upload only | 1 Upload and install 0 仅上传 1 上传后安装

//Uploading files
{
"action": "beginfilesend",
"comm": {
"filePaths":"c:\\laixi\\laixi.apk",
"isAutoInstall":"0",
"deviceIds":"fa3523ea0510,8318fc66"
}
}

//Stop uploading files
{
"action": "stopsendfile",
"comm": {
"deviceIds":"fa3523ea0510,8318fc66"
}
}



PullFile 下载文件到电脑

{
"action": "PullFile",
"comm": {
"deviceIds":"fa3523ea0510",
"phoneFilePath":"/storage/emulated/0/Download/123.png",
"savePath":"C://123.png"
}
}


Execute the ADB 执行ADB命令

{
"action": "adb",
"comm": {
"command":"am start -a android.intent.action.VIEW -d https://www.laixi.app",
"deviceIds":"fa3523ea0510"
}
}

{
"action": "ExecuteBat",
"comm": {
"deviceIds":"all",
"filePath" :"C:\\Scripts\\slide.bat"
}
}

{
"action": "StopBat",
"comm": {
"deviceIds":"all",
"filePath":"C:\\Scripts\\slide.bat"
}
}


Execute Autox.js 执行 Js文件
https://github.com/kkevsekk1/AutoX

{
"action": "ExecuteAutoJs",
"comm": {
"deviceIds":"all",
"filePath" :"C:\\Scripts\\MyScripts.js"
}
}


{
"action": "StopAutoJs",
"comm": {
"deviceIds":"all",
"filePath" :"C:\\Scripts\\MyScripts.js"
}
}


http Down File to Phone

Download files to your phone via http/https
通过http/https 下载文件到手机

{
"action": "HttpDown",
"comm": {
"deviceIds":"all",
"httpurl":"https://home.baidu.com/Public/img/logo.png",
"savepath":"/storage/emulated/0/baidulogo.png"
}
}


Send toast 弹出toast消息

{
"action": "Toast",
"comm": {
"deviceIds":"all",
"content":"Hi,hello world"
}
}


Launch APP 快速启动APP

{
"action": "GetAppInfoByAppName",
"comm": {
"deviceIds":"all",
"appName":"相册"
}
}



input Text 输入文字
{
"action": "writeclipboard",
"comm": {
"deviceIds":"all",
"content":"Hi,laixi.app"
}
}


Modify numbering 修改编号
{
"action": "EditDeviceNo",
"comm": {
"deviceIds":"fa3523ea0510",
"deviceNo":"66"
}
}


EditDeviceName 修改备注名
{
"action": "EditDeviceName",
"comm": {
"deviceIds":"fa3523ea0510",
"deviceName":"New Name"
}
}


master screen 当前是否主控设备
Determine whether the current device is a large screen control state

确定当前设备是否处于大屏幕控制状态(主控)

{
"action": "HostDetail",
}


Creating Group 创建分组
{
"action": "CreateGroup",
"comm": {
"groupName":"NewGroup"
}
}


DeleteGroup 删除分组
{
"action": "DeleteGroup",
"comm": {
"groupId":"6" //Group ID
}
}


Edit Group Name 修改文组

{
"action": "UpdateGroup",
"comm": {
"groupId":"6", //Group ID ,分组ID
"groupName":"New Grup Name"
}


Mobile to group 移动设备到分组
{
"action": "RemoveDeviceGroup",
"comm": {
"deleteGroupId":"6", //Old Group ID
"newGroupId":"7", //New Group ID
"androidIds":"fa3523ea0510,8318fc66" //Devices ID
}
}


Query Group 查询分组

{
"action": "GetGroup"
}



Current Activities 活动APP
{
"action": "CurrentAppInfo",
"comm": {
"deviceIds":"all"
}
}


Make a sound 电脑发出声音
{
"action": "VocieShow",
"comm": {
"deviceIds":"all"
}


shortcut action 快捷操作

type: 1加音量 2减音量 3Back 4home键 6最近任务 14息屏 15开屏
Type: 1volume+ 2.volume- 3Back 4home 6Task 14Turn off the screen 15Turn On the screen

{
"action": "BasisOperate",
"comm": {
"deviceIds":"fa3523ea0510",
"type":"1"
}


small screen display 操作小屏幕效果
Laixi PC Changing the small screen border color. color 0 = Red 红色 1 = Black 黑色 timeOutSecond 为显示多少秒

{
"action": "ChangeUiColor",
"comm": {
"deviceIds": "all",
"color": "0",
"timeOutSecond": "10"
}
}
small screen display of text Laixi PC
{
"action": "ChangeUiColor",
"comm": {
"deviceIds": "all",
"color": "0",
"timeOutSecond": "10"
}
}
}
}
Post Reply