说明
协议为UDP通信方式,端口固定为29527
-
消息体为json类型字符串,如:
{ "channel": "KY", "command": "getNetInfo", "param": "", "status": "start" }
-
字段说明
- channel:渠道来源,比如KY
- command:执行的指令类型
- param:该指令的传输参数,注意该参数是跟随指令走的,可能是字符串,也可能是JSON
- status:指令状态,比如发起方是“start”, 服务端执行回复结果”success”或”fail”
-
响应:
- 服务端执行command指令后,channel和command是原路返回,status带上结果”success”或”fail”;
- param会根据command指令带上返回的结果;
- param取值时根据command和status区分是String还是JSON。
基础包 - launcher.apk
-
当前版本:V1.0.4_20240627
-
安装命令:
adb install -r launcher_V1.0.4_20240627.apk adb install -r example_20240627.apk
-
卸载默认应用
adb shell pm uninstall --user 0 spon.rdc.new8531v
指令协议【command】说明
command=heart
表示心跳,如果应用端需要判断保活,响应param带上时间戳
-
发送:
{ "channel": "KY", "command": "heart", "param": "", "status": "start" }
-
成功响应
{ "channel": "KY", "command": "heart", "param": "1718877040036", "status": "success" }
command=getNetInfo
-
发送
{ "channel": "KY", "command": "getNetInfo", "param": "", "status": "start" }
-
成功响应
{ "channel": "KY", "command": "getNetInfo", "param": { "isStatic": true, "ip": "192.168.1.13", "mask": "255.255.255.0", "gateway": "192.168.1.1", "dns1": "192.168.1.1", "dns2": "192.168.1.1", "mac": "F4:15:35:05:DD:82" }, "status": "success" }
-
失败响应
{ "channel": "KY", "command": "getNetInfo", "param": "Exception:NullException", "status": "success" }
command=setDynamicIp
表示设置网络为DHCP模式,建议5秒后发重启系统
-
发送
{ "channel": "KY", "command": "setDynamicIp", "param": "", "status": "start" }
-
响应
{ "channel": "KY", "command": "setDynamicIp", "param": "", "status": "success" // 成功:success;失败:fail }
command=setStaticIp
表示设置网络为DHCP模式,建议5秒后发重启系统
-
发送
{ "channel": "KY", "command": "setStaticIp", "param": { "ip": "192.168.1.13", "mask": "255.255.255.0", "gateway": "192.168.1.1", "dns1": "192.168.1.1", "dns2": "192.168.1.1" }, "status": "start" }
-
响应
{ "channel": "KY", "command": "setStaticIp", "param": "Exception:..", "status": "success" // 成功:success;失败:fail }
command=keepLive
表示保活指定的包名,需要重启生效
-
发送
{ "channel": "KY", "command": "keepLive", "param": "com.example.launcher", // 设置保活包名 "status": "start" }
-
响应
{ "channel": "KY", "command": "keepLive", "param": "com.example.launcher", "status": "success" // 成功:success;失败:fail }
command=setBrightness
表示设置屏幕亮度,值为0-255, 该方法可以控制屏幕亮度达到熄屏和亮屏效果。
-
发送
{ "channel": "KY", "command": "setBrightness", "param": "200", // param=200表示亮度值 "status": "start" }
-
响应
{ "channel": "KY", "command": "setBrightness", "param": "200", "status": "success" // 成功:success;失败:fail }
command=getBrightness
表示获取屏幕亮度,值为0-255, 该方法可以控制屏幕亮度达到熄屏和亮屏效果。
-
发送
{ "channel": "KY", "command": "getBrightness", "param": "", "status": "start" }
-
响应
{ "channel": "KY", "command": "getBrightness", "param": "200", // param=200表示亮度值 "status": "success" // 成功:success;失败:fail }
command=function
表示工具类,细分指令从param参数区分
param=reboot
表示重启
-
发送
{ "channel": "KY", "command": "function", "param": "reboot", "status": "start" }
param=get_serial
表示获取序列号
-
发送
{ "channel": "KY", "command": "function", "param": "get_serial", "status": "start" }
-
响应
{ "channel": "KY", "command": "function", "param": "RKDEV20160816186AC", "status": "success" // 成功:success;失败:fail }
param=start_monitor_volume
表示开启系统音量变化监听
-
发送
{ "channel": "KY", "command": "function", "param": "start_monitor_volume", "status": "start" }
-
响应
{ "channel": "KY", "command": "function", "param": "start_monitor_volume", "status": "success" // 成功:success;失败:fail }
param=stop_monitor_volume
表示停止系统音量变化监听
-
发送
{ "channel": "KY", "command": "function", "param": "stop_monitor_volume", "status": "start" }
-
响应
{ "channel": "KY", "command": "function", "param": "stop_monitor_volume", "status": "success" // 成功:success;失败:fail }