事件与监控
该服务通过端口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 | 当无线 VerseGrip 电池电量低至危险水平时 |
device-sleep | info | 当无线 VerseGrip 进入省电模式时 |
device-busy | warning | 当设备正在被其他会话使用时 |
device-connection-loop | warning | 当检测到端口反复建立/断开连接时 |
安全事件
| 姓名 | 水平 | 发生时间 |
|---|---|---|
device-safety-triggered | 视情况而定 | 固件发送的安全通知(见下文) |
device-calibration-failed | warning | 当已执行 Inkwell 校准但无法使用笔时 |
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 | verse grip 完全未连接 |
pen_asleep | 无线Verse握把已配对,但处于省电模式 |
pen_not_attached | Verse Grip 已就绪,但孔传感器读数低于阈值 |
会话事件
| 姓名 | 水平 | 发生时间 |
|---|---|---|
session-started | notice | 已创建 WebSocket 会话 |
session-stopped | notice | WebSocket 会话已被删除 |
device-low-control-rate | warning | 会话的控制周期已降至建议阈值以下 |
device-critical-control-rate | error | 控制周期已降至危险水平 |
系统事件
| 姓名 | 水平 | 发生时间 |
|---|---|---|
system-rate-report | info | 定期报告主循环的 tick 速率 |
接收活动通知
请参阅“基于级别、名称模式和排除条件进行过滤的可立即运行的 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*"