设置环境温度

This commit is contained in:
孙小云 2026-01-21 17:51:26 +08:00
parent 04c6f23da7
commit 68cdcd4c9a
2 changed files with 36 additions and 1 deletions

View File

@ -40,6 +40,24 @@ public class DeviceTelemetry {
}
);
/**
* 环境温度 environment_temperature
*/
// 温度 - Double
public static final TelemetryKey<Double> Environment_Temperature = TelemetryKey.of(
"environment_temperature",
Double.class,
value -> {
if (value == null) return null;
if (value instanceof Number) {
return ((Number) value).doubleValue();
}
return Double.parseDouble(value.toString());
}
);
/**
* 备降点经度
*/
@ -427,7 +445,8 @@ public class DeviceTelemetry {
Height_Limit,
Distance_Limit_Status_Distance_Limit,
Alternate_land_point_Latitude,
Alternate_land_point_Longitude
Alternate_land_point_Longitude,
Environment_Temperature
);
}

View File

@ -174,7 +174,23 @@ public class BufferDeviceImpl implements IBufferDeviceService
}
});
// 设置环境数据
// 风速单位米每秒
telemetryMap.get(DeviceTelemetry.Wind_Speed)
.ifPresent(telemetryValue -> dto.setWindSpeed(telemetryValue.getValue()));
// 降雨量枚举值0-无雨1-小雨2-中雨3-大雨
telemetryMap.get(DeviceTelemetry.Rainfall)
.ifPresent(telemetryValue -> {
Integer rainfallCode = telemetryValue.getValue();
if (rainfallCode != null) {
dto.setRainfall(rainfallCode.doubleValue());
}
});
// 环境温度环境温度
telemetryMap.get(DeviceTelemetry.Environment_Temperature)
.ifPresent(telemetryValue -> dto.setEnvironmentTemperature(telemetryValue.getValue()));
return dto;
}