修改枚举

This commit is contained in:
孙小云 2026-01-19 16:58:30 +08:00
parent b134358cdc
commit b78437444b
1 changed files with 31 additions and 1 deletions

View File

@ -23,6 +23,34 @@ public class DeviceTelemetry {
* 无人机独状态
*/
//wind_speed{"unit_name":"米每秒 / m/s"} float
public static final TelemetryKey<Double> Wind_Speed = TelemetryKey.of(
"wind_speed",
Double.class,
value -> {
if (value == null) return null;
if (value instanceof Number) {
return ((Number) value).doubleValue();
}
return Double.parseDouble(value.toString());
}
);
//rainfall {"0":"无雨","1":"小雨","2":"中雨","3":"大雨"} enum_int
public static final TelemetryKey<Integer> Rainfall = TelemetryKey.of(
"rainfall",
Integer.class,
value -> {
if (value == null) return null;
if (value instanceof Number) {
return ((Number) value).intValue();
}
return Integer.parseInt(value.toString());
}
);
/**
* 网络类型 {"1":"4G","2":"以太网"}
*/
@ -266,7 +294,9 @@ public class DeviceTelemetry {
Drone_Charge_State_State,
Drone_In_Dock,
Acc_Time,
Network_State_Type
Network_State_Type,
Wind_Speed,
Rainfall
);
}