Files
RemoteControl/思路.txt
2024-09-27 01:09:52 +08:00

65 lines
2.0 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

实现的功能:
当我离家还有500米的时候提前打开家里的空调 和 客厅灯 等设备。
实现的思路:
数据格式:
1客户端 Android App 上报GPS数据格式
socketId: clent1
{
type: 1, // 表示客户端App12 表示客户端App23 表示服务器
data: {
Longitude: "",
Latitude: ""
}
}
2服务器推送通知给 客户端 Flutter App的数据格式
socketId: clent2
{
type: 3,
data: "start"
}
家的经纬度:
117.326156
31.792494
需要三个角色:
1clientApp_1GPS经纬度上报端 Android开发
就是我随身用的手机需要用flutter开发一个app安装在手机里运行期间发现GPS位置改变就通过
接口 提交最新的经纬度坐标给 服务器
问题App放入后台后为了防止被手机系统杀掉需要加入手机白名单在后台每隔两秒不断请求最新GPS位置上报服务器
状态:已实现
2服务器距离判断消息转发 Node.js + Redis
接受 clientApp_1 给的最新坐标判断离家家是有固定GPS经纬度的所以可以计算距离。
如果小于等于 500 米范围发送WebSocket 通知给 clientApp_2
问题:为家里的路由器,专门编译 Node.js 部署本后端。路由器需要开通公网IP或花生壳
替代方案:用客户服务器部署后端
状态:未开始
3clientApp_2执行端 Flutter
固定在小爱音箱附近,常年通电后台运行的手机,主要用来接收 服务器的 通知
然后播放指定语音唤醒小爱,并播放 小爱 训练计划 中自定义的命令指令!
问题:如何系统级保活是个大问题?
思路:需要加入手机厂商的系统白名单
状态:未开始
自定义的命令指令:
命令:我快要到家了
动作:
1打开空调设置温度 28度风速最大
2打开客厅灯
3打开书房灯