活动频道
默认的 WebSocket 事件 URL 是 ws://localhost:10020 是。
端口号可在设置中进行更改。
这是一个低频的单向通信信道,预计可接收系统内的所有事件。 不支持输入消息。
该频道保证每次事件都会发送一条消息。
标准格式
所有事件均遵循以下标准结构:
{
"name": "device-connected",
"category": "device",
"level": "notice",
"data": {},
"message": ""
}
字段说明
| 字段 | 型 | 说明 |
|---|---|---|
name | string | 这是该活动的唯一标识符。 |
category | string | 这是用于筛选和整理的分组标签(请参阅“有效类别”)。 |
level | string | 事件的严重性或重要性(参见有效级别)。 |
data | object | 这是一个包含事件特定详细信息的有效载荷。 |
message | string | 关于该事件的任意、可供人类阅读的说明或背景信息。 |
活动类别
category 该字段将事件分为以下几类:
| 值 | 说明 |
|---|---|
system | 核心或核心系统、全局设置等。 |
input | 外部输入的处理(例如:命令等)。 |
session | 与特定用户会话相关的事件。 |
device | 设备管理、与控制器的交互、SerialPort 通信。 |
module | 子系统或模块化组件的事件。 |
feature | 与特定服务功能或能力相关的事件。 |
活动等级
活动的 level 该字段表示事件的严重程度或重要性:
| 值 | 说明 |
|---|---|
info | 仅提供信息 — 日志、指标或低优先级通知。 |
notice | 状态的变化或值得注意的事件。 |
warning | 虽然出现了某些问题或异常,但系统仍可安全地继续运行。 |
error | 已发生可能影响系统运行或稳定性的问题。 |
critical | 这是一项严重影响系统功能的重大错误。 |
panic | 致命性故障——可能会导致系统崩溃或无法恢复。 |
活动
备注
此列表列出了系统当前报告的事件。目前,我们正在积极设计和扩充事件类型及报告内容。
输入
invalid-io-channel
当 I/O 通道以不受支持或非预期的方式使用时,会发生此情况。
数据
| 字段 | 型 | 说明 |
|---|---|---|
received_data | string | 这是收到的原始数据。 |
{
"name": "invalid-io-channel",
"category": "input",
"level": "warning",
"data": {
"received_data": "<raw_input_here>"
}
}
http-route-deprecated
当 HTTP 路由被标记为“不推荐”且将在未来版本中移除时,会发布此通知。
数据
| 字段 | 型 | 说明 |
|---|---|---|
route | string | 这是一条已不推荐的路线。 |
substitute | string | 这是推荐的替代路线。 |
{
"name": "http-route-deprecated",
"category": "input",
"level": "warning",
"data": {
"route": "/the/old/way",
"substitute": "/the/new/way"
}
}
settings-invalid-key
当设置键无效时,会触发此操作。
数据
| 字段 | 型 | 说明 |
|---|---|---|
key | string | 找不到该键。 |
{
"name": "settings-invalid-key",
"category": "input",
"level": "warning",
"data": {
"key": "devices/none-existent/key"
}
}
command-deprecated
当接收到的命令已被标记为“不推荐使用”,且将在未来版本中被移除时,系统会发出此提示。
| 字段 | 型 | 说明 |
|---|---|---|
command | string | 这是收到的不推荐的命令 |
{
"name": "command-deprecated",
"category": "input",
"level": "warning",
"data": {
"command": "example_cmd"
},
"message": "The command `example_cmd` is deprecated and is replaced by `this_one`."
}
设备
device-connected
表示设备已连接,并处于完全可运行状态。
| 字段 | 型 | 说明 |
|---|---|---|
device_family | string | 设备类型:inverse 或者 verse_grip。 |
device_id | string | 这是设备的唯一标识符。 |
{
"name": "device-connected",
"category": "device",
"level": "notice",
"data": {
"device_family": "inverse",
"device_id": "04BA"
}
}
device-disconnected
表示先前已连接的设备已断开连接。
| 字段 | 型 | 说明 |
|---|---|---|
device_family | string | 设备类型:inverse 或者 verse_grip。 |
device_id | string | 这是设备的唯一标识符。 |
{
"name": "device-disconnected",
"category": "device",
"level": "notice",
"data": {
"device_family": "verse_grip",
"device_id": "61548"
}
}
会话
device-low-control-rate
当设备接收直接控制命令的速率过低,达到安全限制时,系统会发出此提示。这是一条警告,表明速率 已接近截止速率。
| 字段 | 型 | 说明 |
|---|---|---|
session_id | int | 这是目标模拟会话的 ID。 |
device_family | string | 设备类型:inverse 或者 verse_grip。 |
device_id | string | 这是设备的唯一标识符。 |
frequency | int | 这是当前的控制频率(单位:赫兹)。 |
{
"name": "device-low-control-rate",
"category": "session",
"level": "warning",
"data": {
"session_id": 3,
"device_family": "inverse",
"device_id": "1A2B",
"frequency": 260
},
"message": ""
}
device-critical-control-rate
当设备接收直接控制命令的速率过低,且达到安全限制时,系统会发出此提示。
| 字段 | 型 | 说明 |
|---|---|---|
session_id | int | 这是目标模拟会话的 ID。 |
device_family | string | 设备类型:inverse 或者 verse_grip。 |
device_id | string | 这是设备的唯一标识符。 |
frequency | int | 这是当前的控制频率(单位:赫兹)。 |
{
"name": "device-critical-control-rate",
"category": "session",
"level": "error",
"data": {
"session_id": 3,
"device_family": "inverse",
"device_id": "1A2B",
"frequency": 82
},
"message": ""
}
功能
sdf-sdf_hfx-created
当创建 SDF 实体 FX 时,将生成此消息。
| 字段 | 型 | 说明 |
|---|---|---|
session_id | int | 这是目标模拟会话的 ID。 |
device_id | string | 这是设备的唯一标识符。 |
hfx_id | string | 这是创建时使用的 FX ID。 |
{
"name": "sdf-sdf_hfx-created",
"category": "feature",
"level": "notice",
"data": {
"session_id": 3,
"device_id": "1A2B",
"hfx_id": "my_fx_name"
},
"message": ""
}
sdf-sdf_hfx-deleted
当 SDF 实体 FX 被删除时,将生成此消息。
| 字段 | 型 | 说明 |
|---|---|---|
session_id | int | 这是目标模拟会话的 ID。 |
device_id | string | 这是设备的唯一标识符。 |
hfx_id | string | 这是一个已被删除的 FX ID。 |
{
"name": "sdf-sdf_hfx-deleted",
"category": "feature",
"level": "notice",
"data": {
"session_id": 3,
"device_id": "1A2B",
"hfx_id": "my_fx_name"
},
"message": ""
}
sdf-sdf_hfx-updated
当 SDF 实体 FX 更新时,将发布此消息。
| 字段 | 型 | 说明 |
|---|---|---|
session_id | int | 这是目标模拟会话的 ID。 |
device_id | string | 这是设备的唯一标识符。 |
hfx_id | string | 这是更新后的 FX ID。 |
{
"name": "sdf-sdf_hfx-updated",
"category": "feature",
"level": "notice",
"data": {
"session_id": 3,
"device_id": "1A2B",
"hfx_id": "my_fx_name"
},
"message": ""
}
sdf-sdf_hfx-range-entered
当指定设备的光标进入 SDF 实体的范围时,将触发此事件。
| 字段 | 型 | 说明 |
|---|---|---|
session_id | int | 这是目标模拟会话的 ID。 |
device_id | string | 这是设备的唯一标识符。 |
hfx_id | string | 这是FX ID。 |
{
"name": "sdf-sdf_hfx-range-entered",
"category": "feature",
"level": "notice",
"data": {
"session_id": 3,
"device_id": "1A2B",
"hfx_id": "my_fx_name"
},
"message": ""
}
sdf-sdf_hfx-range-exited
当指定设备的光标移出 SDF 实体的范围时,将触发此事件。
| 字段 | 型 | 说明 |
|---|---|---|
session_id | int | 这是目标模拟会话的 ID。 |
device_id | string | 这是设备的唯一标识符。 |
hfx_id | string | 这是FX ID。 |
{
"name": "sdf-sdf_hfx-range-exited",
"category": "feature",
"level": "notice",
"data": {
"session_id": 3,
"device_id": "1A2B",
"hfx_id": "my_fx_name"
},
"message": ""
}