This commit is contained in:
parent
b242852434
commit
422930b264
|
|
@ -587,6 +587,88 @@ public class TuohengDeviceTelemetry {
|
|||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* 机场设备自检数据 (来自 /topic/v1/airportFly/+/control/data)
|
||||
*/
|
||||
|
||||
// 升降架状态 - Integer (0=正常)
|
||||
public static final TelemetryKey<Integer> LIFTER_STATUS = TelemetryKey.of(
|
||||
"lifter_status",
|
||||
Integer.class,
|
||||
value -> {
|
||||
if (value == null) return null;
|
||||
if (value instanceof Number) {
|
||||
return ((Number) value).intValue();
|
||||
}
|
||||
return Integer.parseInt(value.toString());
|
||||
}
|
||||
);
|
||||
|
||||
// X轴夹器状态 - Integer (0=正常)
|
||||
public static final TelemetryKey<Integer> HOLDER_X_STATUS = TelemetryKey.of(
|
||||
"holder_x_status",
|
||||
Integer.class,
|
||||
value -> {
|
||||
if (value == null) return null;
|
||||
if (value instanceof Number) {
|
||||
return ((Number) value).intValue();
|
||||
}
|
||||
return Integer.parseInt(value.toString());
|
||||
}
|
||||
);
|
||||
|
||||
// Y轴夹器状态 - Integer (0=正常)
|
||||
public static final TelemetryKey<Integer> HOLDER_Y_STATUS = TelemetryKey.of(
|
||||
"holder_y_status",
|
||||
Integer.class,
|
||||
value -> {
|
||||
if (value == null) return null;
|
||||
if (value instanceof Number) {
|
||||
return ((Number) value).intValue();
|
||||
}
|
||||
return Integer.parseInt(value.toString());
|
||||
}
|
||||
);
|
||||
|
||||
// 控制器状态 - Integer (0=正常)
|
||||
public static final TelemetryKey<Integer> CONTROLLER_STATUS = TelemetryKey.of(
|
||||
"controller_status",
|
||||
Integer.class,
|
||||
value -> {
|
||||
if (value == null) return null;
|
||||
if (value instanceof Number) {
|
||||
return ((Number) value).intValue();
|
||||
}
|
||||
return Integer.parseInt(value.toString());
|
||||
}
|
||||
);
|
||||
|
||||
// 舱门状态 - Integer (0=正常)
|
||||
public static final TelemetryKey<Integer> HATCH_STATUS = TelemetryKey.of(
|
||||
"hatch_status",
|
||||
Integer.class,
|
||||
value -> {
|
||||
if (value == null) return null;
|
||||
if (value instanceof Number) {
|
||||
return ((Number) value).intValue();
|
||||
}
|
||||
return Integer.parseInt(value.toString());
|
||||
}
|
||||
);
|
||||
|
||||
// 无人机状态 - Integer (0=正常)
|
||||
public static final TelemetryKey<Integer> DRONE_STATUS = TelemetryKey.of(
|
||||
"drone_status",
|
||||
Integer.class,
|
||||
value -> {
|
||||
if (value == null) return null;
|
||||
if (value instanceof Number) {
|
||||
return ((Number) value).intValue();
|
||||
}
|
||||
return Integer.parseInt(value.toString());
|
||||
}
|
||||
);
|
||||
|
||||
private TuohengDeviceTelemetry() {
|
||||
// 工具类,禁止实例化
|
||||
}
|
||||
|
|
@ -651,7 +733,14 @@ public class TuohengDeviceTelemetry {
|
|||
TSINGAL,
|
||||
FLIGHT_TIME,
|
||||
MILEAGE,
|
||||
DISTANCE_TO_HOME
|
||||
DISTANCE_TO_HOME,
|
||||
// 机场设备自检数据
|
||||
LIFTER_STATUS,
|
||||
HOLDER_X_STATUS,
|
||||
HOLDER_Y_STATUS,
|
||||
CONTROLLER_STATUS,
|
||||
HATCH_STATUS,
|
||||
DRONE_STATUS
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -438,6 +438,38 @@ public class TuohengBufferDeviceImpl implements IBufferDeviceService {
|
|||
log.info("设置充电状态: {}", chargingStatus);
|
||||
});
|
||||
|
||||
// 设置机场设备自检数据(升降架、X轴夹器、Y轴夹器)
|
||||
log.info("---------- 解析机场设备自检数据 ----------");
|
||||
telemetry.get(TuohengDeviceTelemetry.LIFTER_STATUS)
|
||||
.ifPresent(value -> {
|
||||
Integer lifterStatus = value.getValue();
|
||||
log.info("LIFTER_STATUS 升降架状态原始值: {}", lifterStatus);
|
||||
// 0=正常, 非0=异常
|
||||
String elevatorPosition = (lifterStatus != null && lifterStatus == 0) ? "NORMAL" : "ABNORMAL";
|
||||
dto.setElevatorPosition(elevatorPosition);
|
||||
log.info("设置升降架位置: {}", elevatorPosition);
|
||||
});
|
||||
|
||||
telemetry.get(TuohengDeviceTelemetry.HOLDER_X_STATUS)
|
||||
.ifPresent(value -> {
|
||||
Integer holderXStatus = value.getValue();
|
||||
log.info("HOLDER_X_STATUS X轴夹器状态原始值: {}", holderXStatus);
|
||||
// 0=正常, 非0=异常
|
||||
String xAxisClampStatus = (holderXStatus != null && holderXStatus == 0) ? "NORMAL" : "ABNORMAL";
|
||||
dto.setXAxisClampStatus(xAxisClampStatus);
|
||||
log.info("设置X轴夹器状态: {}", xAxisClampStatus);
|
||||
});
|
||||
|
||||
telemetry.get(TuohengDeviceTelemetry.HOLDER_Y_STATUS)
|
||||
.ifPresent(value -> {
|
||||
Integer holderYStatus = value.getValue();
|
||||
log.info("HOLDER_Y_STATUS Y轴夹器状态原始值: {}", holderYStatus);
|
||||
// 0=正常, 非0=异常
|
||||
String yAxisClampStatus = (holderYStatus != null && holderYStatus == 0) ? "NORMAL" : "ABNORMAL";
|
||||
dto.setYAxisClampStatus(yAxisClampStatus);
|
||||
log.info("设置Y轴夹器状态: {}", yAxisClampStatus);
|
||||
});
|
||||
|
||||
// 填充无人机状态信息
|
||||
if (aircraftIotDeviceId != null) {
|
||||
fillTuohengAircraftStatus(dto, aircraftIotDeviceId);
|
||||
|
|
|
|||
Loading…
Reference in New Issue