修改枚举

This commit is contained in:
孙小云 2026-01-19 16:41:52 +08:00
parent 64662f6f26
commit a876c6c310
1 changed files with 7 additions and 29 deletions

View File

@ -94,7 +94,8 @@ public class DeviceTelemetry {
/** /**
* 舱内温度 temperature * 舱内温度 temperature
*/ */
public static final TelemetryKey<Double> Temperature = TelemetryKey.of( // 温度 - Double
public static final TelemetryKey<Double> TEMPERATURE = TelemetryKey.of(
"temperature", "temperature",
Double.class, Double.class,
value -> { value -> {
@ -106,10 +107,11 @@ public class DeviceTelemetry {
} }
); );
/** /**
* 舱内湿度 humidity * 舱内湿度 humidity
*/ */
public static final TelemetryKey<Double> Humidity = TelemetryKey.of( public static final TelemetryKey<Double> HUMIDITY = TelemetryKey.of(
"humidity", "humidity",
Double.class, Double.class,
value -> { value -> {
@ -207,31 +209,8 @@ public class DeviceTelemetry {
/** /**
* 以下尚未划分 * 以下尚未划分
*/ */
// 温度 - Double
public static final TelemetryKey<Double> TEMPERATURE = TelemetryKey.of(
"temperature",
Double.class,
value -> {
if (value == null) return null;
if (value instanceof Number) {
return ((Number) value).doubleValue();
}
return Double.parseDouble(value.toString());
}
);
// 湿度 - Double
public static final TelemetryKey<Double> HUMIDITY = TelemetryKey.of(
"humidity",
Double.class,
value -> {
if (value == null) return null;
if (value instanceof Number) {
return ((Number) value).doubleValue();
}
return Double.parseDouble(value.toString());
}
);
@ -254,9 +233,8 @@ public class DeviceTelemetry {
Sub_Device_Online_Status, Sub_Device_Online_Status,
Total_Flight_Sorties, Total_Flight_Sorties,
Drone_Charge_State_State, Drone_Charge_State_State,
Drone_In_Dock, Drone_In_Dock
Temperature,
HUMIDITY
); );
} }