feat(telemetry): TelemetryData 新增通用扩展命名空间 extra

供非游戏类数据源(车辆诊断、工业设备等)携带自定义字段,
避免把领域专属字段塞进核心模型。

- 新增 extra: dict[str, Any],to_dict() 同步输出
- 向后兼容:其它解析器(forza/ac/acc/f1/iracing)不受影响
This commit is contained in:
AskaEth committed 2026-10-17 08:22:57 +08:00
1 parent b976d83cf2
commit b7adf0f6f8
1 file changed
+6
+6
View File
@@ -48,6 +48,11 @@ class TelemetryData:
car_name: str = ""
car_class: str = ""
# --- 通用扩展命名空间 ---
# 供非游戏类数据源(车辆诊断、工业设备等)携带自定义字段,避免污染核心模型。
# 例: {"battery_voltage": 13.9, "dtcs": ["P0043"], "bus_stats": {...}}
extra: dict[str, Any] = field(default_factory=dict)
raw: dict[str, Any] = field(default_factory=dict)
def to_dict(self) -> dict[str, Any]:
@@ -82,4 +87,5 @@ class TelemetryData:
"torque": self.torque,
"car_name": self.car_name,
"car_class": self.car_class,
"extra": self.extra,
}