增加ping指令并获取带版本号的响应

This commit is contained in:
2025-12-01 20:42:21 +08:00
parent d5056af676
commit 2e6a0abac3
17 changed files with 557 additions and 44 deletions

View File

@@ -17,6 +17,16 @@ const (
SensorTypeTemperature SensorType = "温度" // 温度
SensorTypeHumidity SensorType = "湿度" // 湿度
SensorTypeWeight SensorType = "重量" // 重量
SensorTypeOnlineStatus SensorType = "在线状态" // 在线状态
)
// OnlineState 定义了设备的在线状态枚举
type OnlineState string
const (
StateOnline OnlineState = "在线" // 设备在线
StateOffline OnlineState = "离线" // 设备离线
StateAbnormal OnlineState = "异常" // 设备状态异常
)
// SignalMetrics 存储信号强度数据
@@ -49,6 +59,11 @@ type WeightData struct {
WeightKilograms float32 `json:"weight_kilograms"` // 重量值 (公斤)
}
// OnlineStatusData 记录了设备的在线状态
type OnlineStatusData struct {
State OnlineState `json:"state"` // 在线状态
}
// SensorData 存储所有类型的传感器数据,对应数据库中的 'sensor_data' 表。
type SensorData struct {
// Time 是数据记录的时间戳,作为复合主键的一部分。