待机配置

This commit is contained in:
2024-11-05 18:39:03 +08:00
parent ccfe0d311b
commit 8e2bf7f59b
15 changed files with 384 additions and 132 deletions

133
readme.md
View File

@@ -8,44 +8,64 @@ Topic: `server/${location}/${point}/play`
Payload:
```json
```json lines
{
"timeout": 30, // 设备超时时长(s)
"power": true, // 是否需要整体电源控制
"bgm": "", // 游戏中背景音乐(file://本地文件地址、http://远程文件地址)
"volume": 0.5, // 整体设备音量(0-1)
"default-print": "", // 屏幕默认打印(设备待机时展示文本)
"tts": { // 文本转语音整体控制
"start": "", // 开始语音
"end": "", // 结束语音
"stop": "", // 终止语音
"timer": [ // 固定节点语音
{
"time": 10, // 时间节点(s)
"value": "" // 语音文字
}
]
// 设备超时时长(s)
"timeout": 30,
// 是否需要整体电源控制
"power": true,
// 游戏中背景音乐(支持 file:// 本地文件地址、 http(s):// 远程文件地址)
"bgm": "",
// 整体设备音量(0-1)
"volume": 0.5,
// 屏幕默认打印(设备待机时展示文本)
"default-print": "",
// 文本转语音整体控制
"tts": {
// 开始语音
"start": "",
// 结束语音
"end": "",
// 终止语音
"stop": "",
// 固定节点语音
"timer": [
{
// 时间节点(s)
"time": 10,
// 语音文字
"value": ""
},
...
]
},
// 屏幕打印控制
"print": [
{
// 时间节点(s)
"time": 10,
// 展示文字
"text": "",
// 持续时长(s)
"duration": 10
},
"print": [ // 屏幕打印控制
{
"time": 10, // 时间节点(s)
"text": "", // 展示文字
"duration": 10 // 持续时长(s)
}
],
"game": {} // 根据具体游戏特定
...
],
// 根据具体游戏特定
"game": {}
}
```
[游戏节点报文](./game.md)
#### 例: 入口欢迎播报
```json
```json lines
{
"volume": 1,
"tts": {
"start": "欢迎前来挑战!"
}
"volume": 1,
"tts": {
"start": "欢迎前来挑战!"
}
}
```
@@ -57,10 +77,12 @@ Topic: `device/${location}/${point}/status`
Payload:
```bash
0 # 0 待机; 1 使用中; -1 状态异常
```text
0
```
> 0 待机; 1 使用中; -1 状态异常
## 3. 接收指令
### 终止
@@ -69,18 +91,61 @@ Topic: `server/${location}/${point}/command`
Payload:
```bash
```text
stop
```
### 终止后台
Topic: `server/${location}/${point}/command`
Payload:
```text
stop-bg
```
### 查询状态
Topic: `server/${location}/${point}/command`
Payload:
```bash
```text
status
```
设备接收到该指令会立即向 `device/${location}/${point}/status` 发送一次当前状态
> 设备接收到该指令会立即向 `device/${location}/${point}/status` 发送一次当前状态
## 4. 后台执行
Topic: `server/${location}/${point}/bg`
Payload:
```json lines
{
// 开始时间戳(s), default 0, 0表示立即执行
"start": 1730793361,
// 结束时间戳(s), default 0, 0表示无限执行
"end": 1730793368,
// 执行项
"items": [
{
// 开始时间戳(s), 默认根的时间戳, 只有在根执行时间内才会执行
"start": 1730793361,
// 结束时间戳(s), 默认根的时间戳, 只有在根执行时间内才会执行
"end": 1730793368,
// 间隔时间(s), default 0
"interval": 0,
// 事件类型(0: 音频; 1: 视频; 2: 网页; 3: TTS; 4: 继电器), default 0
"type": 3,
// 事件数据(TTS为文字, 继电器为端口号, 其他都为地址链接。支持 file:// 本地文件地址、 http(s):// 远程文件地址)
"data": "",
},
...
]
}
```
> 同一个类型的后台任务只能有一个,当有新的任务到达时会覆盖之前的任务