事件与监控
该服务通过端口10020 上的专用只读 WebSocket推送系统事件。 这些事件包括安全触发、设备连接、电池警告、 会话生命周期变化以及控制速率异常。
默认网址: ws://localhost:10020
事件 JSON 结构
{
"name": "device-safety-triggered",
"category": "device",
"level": "warning",
"data": { "device_family": "inverse", "device_id": "049D", … },
"message": "FOD stage changed: guard -> hard"
}
| 现场 | 类型 | 说明 |
|---|---|---|
name | 字符串 | 稳定的事件标识符(用于过滤/切换) |
category | 字符串 | device, session, system |
level | 字符串 | info, notice, warning, error, critical, panic |
data | 反对 | 特定事件的有效载荷 |
message | 字符串 | 通俗易懂的描述 |
活动类型
设备事件
| 名称 | 级别 | 当 |
|---|---|---|
device-connected | info | 检测到新设备,已准备就绪 |
device-disconnected | warning | 设备已丢失(已断开连接或超时) |
device-battery-low | warning | 无线VerseGrip电池电量低于阈值 |
device-battery-critical | error | 电量极低 |
device-sleep | info | 无线 VerseGrip 已进入待机模式 |
device-busy | warning | 该设备正在被另一个会话使用 |
device-connection-loop | warning | 检测到端口上出现反复的连接/断开循环 |
安全事件
| 名称 | 级别 | 当 |
|---|---|---|
device-safety-triggered | 因情况而异 | 固件安全通知(见下文) |
device-calibration-failed | warning | 墨水壶校准已触发,但笔无法使用 |
device-safety-triggered 子类型
"(《世界人权宣言》) safety_type 事件数据中的该字段说明了发生了什么:
safety_type | 级别 | 含义 |
|---|---|---|
ebrake_triggered | error | 紧急制动已启动 — 设备已锁定 |
ebrake_released | notice | 紧急制动已解除 |
fod_stage_changed | warning / info | FOD安全阶段已跨越低/高风险界限 |
stall_detected | warning | 检测到电机失速 |
stability_ceiling | warning | 已达到稳定性上限 |
device-calibration-failed 原因
reason | 含义 |
|---|---|
pen_not_connected | 根本没有连接任何诗句握柄 |
pen_asleep | 无线Verse握把已配对,但处于休眠模式 |
pen_not_attached | Verse 握把已就绪,但霍尔传感器读数低于阈值 |
会话事件
| 名称 | 级别 | 当 |
|---|---|---|
session-started | notice | 已建立一个 WebSocket 会话 |
session-stopped | notice | WebSocket 会话已被终止 |
device-low-control-rate | warning | 会话的控制率已降至推荐阈值以下 |
device-critical-control-rate | error | 控制率已降至临界水平 |
系统事件
| 名称 | 级别 | 当 |
|---|---|---|
system-rate-report | info | 主循环定时器周期性报告 |
关注动态
请参考“事件”教程,获取一个可直接运行的 Python 监听器,该监听器支持按级别、名称模式和排除条件进行过滤:
# All events
python 10-haply-inverse-events.py
# Only warnings and above
python 10-haply-inverse-events.py --level warning
# Only device events
python 10-haply-inverse-events.py --name "device-*"
# Exclude battery noise
python 10-haply-inverse-events.py --exclude "*battery*"