添加拓恒经纬度数据
This commit is contained in:
parent
1caafd787e
commit
97c671f2ed
|
|
@ -135,6 +135,36 @@ public class TuohengDeviceAttributes {
|
||||||
value -> value != null ? value.toString() : null
|
value -> value != null ? value.toString() : null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机场位置属性(手动维护)
|
||||||
|
*/
|
||||||
|
|
||||||
|
// 机场经度 - Double
|
||||||
|
public static final AttributeKey<Double> HOME_LONGITUDE = AttributeKey.of(
|
||||||
|
"home.longitude",
|
||||||
|
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 AttributeKey<Double> HOME_LATITUDE = AttributeKey.of(
|
||||||
|
"home.latitude",
|
||||||
|
Double.class,
|
||||||
|
value -> {
|
||||||
|
if (value == null) return null;
|
||||||
|
if (value instanceof Number) {
|
||||||
|
return ((Number) value).doubleValue();
|
||||||
|
}
|
||||||
|
return Double.parseDouble(value.toString());
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
private TuohengDeviceAttributes() {
|
private TuohengDeviceAttributes() {
|
||||||
// 工具类,禁止实例化
|
// 工具类,禁止实例化
|
||||||
}
|
}
|
||||||
|
|
@ -157,7 +187,9 @@ public class TuohengDeviceAttributes {
|
||||||
SOFTWARE_VERSION,
|
SOFTWARE_VERSION,
|
||||||
HARDWARE_VERSION,
|
HARDWARE_VERSION,
|
||||||
SENDER,
|
SENDER,
|
||||||
DEVICE_ID
|
DEVICE_ID,
|
||||||
|
HOME_LONGITUDE,
|
||||||
|
HOME_LATITUDE
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -216,6 +216,19 @@ public class TuohengBufferDeviceImpl implements IBufferDeviceService {
|
||||||
dto.setFirmwareVersion(value);
|
dto.setFirmwareVersion(value);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 设置机场位置(从属性中获取 home.longitude 和 home.latitude)
|
||||||
|
log.info("---------- 解析机场位置数据 ----------");
|
||||||
|
attributes.get(TuohengDeviceAttributes.HOME_LONGITUDE)
|
||||||
|
.ifPresent(value -> {
|
||||||
|
log.info("HOME_LONGITUDE 机场经度: {}", value);
|
||||||
|
dto.setLongitude(value);
|
||||||
|
});
|
||||||
|
attributes.get(TuohengDeviceAttributes.HOME_LATITUDE)
|
||||||
|
.ifPresent(value -> {
|
||||||
|
log.info("HOME_LATITUDE 机场纬度: {}", value);
|
||||||
|
dto.setLatitude(value);
|
||||||
|
});
|
||||||
|
|
||||||
// 设置在线状态 - 基于心跳时间戳判断离线,基于无人机mode判断工作状态
|
// 设置在线状态 - 基于心跳时间戳判断离线,基于无人机mode判断工作状态
|
||||||
telemetry.get(TuohengDeviceTelemetry.STATUS).ifPresentOrElse(statusValue -> {
|
telemetry.get(TuohengDeviceTelemetry.STATUS).ifPresentOrElse(statusValue -> {
|
||||||
long lastHeartbeatTime = statusValue.getTimestamp();
|
long lastHeartbeatTime = statusValue.getTimestamp();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue