|
|
@ -163,22 +163,6 @@ public class HaborClient981A extends HaborClient {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public boolean online() {
|
|
|
|
|
|
|
|
boolean online = super.online();
|
|
|
|
|
|
|
|
if (online) {
|
|
|
|
|
|
|
|
startSendCommonData();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return online;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public boolean offline() {
|
|
|
|
|
|
|
|
boolean offline = super.offline();
|
|
|
|
|
|
|
|
if (offline) {
|
|
|
|
|
|
|
|
stopSendCommonData();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return offline;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**发送常发帧*/
|
|
|
|
/**发送常发帧*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -324,7 +308,7 @@ public class HaborClient981A extends HaborClient {
|
|
|
|
|
|
|
|
|
|
|
|
/** 检查控制指令回报*/
|
|
|
|
/** 检查控制指令回报*/
|
|
|
|
private boolean checkControlResponse(ByteBuf msg) {
|
|
|
|
private boolean checkControlResponse(ByteBuf msg) {
|
|
|
|
if (CommandRecord.WAITING_RESULT == previousControl.getState()) {
|
|
|
|
if (CommandRecord.WAITING_RESULT == previousControl.getStatus()) {
|
|
|
|
log.debug("当前指令{}, uniId:{}, A1帧指令回报: {}", ByteUtils.byteToHex(previousControl.code), previousControl.commandUniId, ByteUtils.byteToHex(msg.getByte(29)));
|
|
|
|
log.debug("当前指令{}, uniId:{}, A1帧指令回报: {}", ByteUtils.byteToHex(previousControl.code), previousControl.commandUniId, ByteUtils.byteToHex(msg.getByte(29)));
|
|
|
|
previousControl.addReceiveFrameCount();
|
|
|
|
previousControl.addReceiveFrameCount();
|
|
|
|
if (msg.getByte(29) == previousControl.code) {
|
|
|
|
if (msg.getByte(29) == previousControl.code) {
|
|
|
@ -348,18 +332,19 @@ public class HaborClient981A extends HaborClient {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** 检查参数装订回报*/
|
|
|
|
/** 检查参数装订回报*/
|
|
|
|
private boolean checkParamBindResponse(ByteBuf msg) {
|
|
|
|
private boolean checkParamBindResponse(ByteBuf msg) {
|
|
|
|
if (CommandRecord.WAITING_RESULT == previousParamBind.getState()) {
|
|
|
|
if (CommandRecord.WAITING_RESULT == previousParamBind.getStatus()) {
|
|
|
|
previousParamBind.addReceiveFrameCount();
|
|
|
|
previousParamBind.addReceiveFrameCount();
|
|
|
|
if (previousParamBind.commandMatch(msg.slice(13,16))) {
|
|
|
|
if (previousParamBind.commandMatch(msg.slice(13,16))) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
boolean notifyResult = previousParamBind.notifyParamBindCommandResult(uavId, uavType,true);
|
|
|
|
boolean notifyResult = previousParamBind.notifyParamBindCommandResult(uavId, uavType,true);
|
|
|
|
log.info("[cac] {} 指令装订成功结果 发送{}", shortInfo(), notifyResult?"成功":"失败");
|
|
|
|
log.info("[cac] {} 参数装订成功结果 发送{}", shortInfo(), notifyResult?"成功":"失败");
|
|
|
|
previousParamBind.clearCommand();
|
|
|
|
previousParamBind.clearCommand();
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
log.warn("[cac] {} 指令装订结果回报处理异常:{}",shortInfo(), e.getMessage());
|
|
|
|
log.warn("[cac] {} 参数装订结果回报处理异常:{}",shortInfo(), e.getMessage());
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
switchToCommonData(); // 恢复常发数据帧
|
|
|
|
switchToCommonData(); // 恢复常发数据帧
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -375,7 +360,7 @@ public class HaborClient981A extends HaborClient {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/**检查参数查询回报*/
|
|
|
|
/**检查参数查询回报*/
|
|
|
|
private boolean checkParamQueryResponse(ByteBuf msg) {
|
|
|
|
private boolean checkParamQueryResponse(ByteBuf msg) {
|
|
|
|
if (CommandRecord.WAITING_RESULT == previousParamQuery.getState()) {
|
|
|
|
if (CommandRecord.WAITING_RESULT == previousParamQuery.getStatus()) {
|
|
|
|
previousParamQuery.addReceiveFrameCount();
|
|
|
|
previousParamQuery.addReceiveFrameCount();
|
|
|
|
if (msg.getByte(13) == previousParamQuery.code) { // fixme 匹配的不是同样的内容
|
|
|
|
if (msg.getByte(13) == previousParamQuery.code) { // fixme 匹配的不是同样的内容
|
|
|
|
try {
|
|
|
|
try {
|
|
|
@ -388,14 +373,14 @@ public class HaborClient981A extends HaborClient {
|
|
|
|
uavQueryResultParam = new UavWeightQueryResultParam981A(msg.slice(13, 16));
|
|
|
|
uavQueryResultParam = new UavWeightQueryResultParam981A(msg.slice(13, 16));
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
log.warn("[cac] {} 指令查询结果回报,未知的指令类型:{}", shortInfo(), ByteUtils.byteToHex(msg.getByte(13)));
|
|
|
|
log.warn("[cac] {} 参数查询结果回报,未知的指令类型:{}", shortInfo(), ByteUtils.byteToHex(msg.getByte(13)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
boolean notifyResult = previousParamQuery.notifyParamQueryCommandResult(uavId, uavType, true, uavQueryResultParam);
|
|
|
|
boolean notifyResult = previousParamQuery.notifyParamQueryCommandResult(uavId, uavType, true, uavQueryResultParam);
|
|
|
|
log.info("[cac] {} 指令查询成功结果 发送{}", shortInfo(), notifyResult?"成功":"失败");
|
|
|
|
log.info("[cac] {} 参数查询成功结果 发送{}", shortInfo(), notifyResult?"成功":"失败");
|
|
|
|
previousParamQuery.clearCommand();
|
|
|
|
previousParamQuery.clearCommand();
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
log.warn("[cac] {} 指令查询结果回报处理异常:{}",shortInfo(), e.getMessage());
|
|
|
|
log.warn("[cac] {} 参数查询结果回报处理异常:{}",shortInfo(), e.getMessage());
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
switchToCommonData(); // 恢复常发数据帧
|
|
|
|
switchToCommonData(); // 恢复常发数据帧
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -412,7 +397,7 @@ public class HaborClient981A extends HaborClient {
|
|
|
|
|
|
|
|
|
|
|
|
/**检查航线装订回报*/
|
|
|
|
/**检查航线装订回报*/
|
|
|
|
private boolean checkRouteBindResponse(ByteBuf msg) {
|
|
|
|
private boolean checkRouteBindResponse(ByteBuf msg) {
|
|
|
|
if (CommandQueueRecord.WAITING_NEXT == previousRouteBind.getState()) {
|
|
|
|
if (CommandQueueRecord.WAITING_NEXT == previousRouteBind.getStatus()) {
|
|
|
|
previousRouteBind.addReceiveFrameCount();
|
|
|
|
previousRouteBind.addReceiveFrameCount();
|
|
|
|
if (previousRouteBind.commandMatch(msg.slice(13, 16))) {
|
|
|
|
if (previousRouteBind.commandMatch(msg.slice(13, 16))) {
|
|
|
|
if (previousRouteBind.completeOrWaitNext()) { // 如果指令列表均已回报,则判定成功,向中心指控回报, 并恢复常发帧
|
|
|
|
if (previousRouteBind.completeOrWaitNext()) { // 如果指令列表均已回报,则判定成功,向中心指控回报, 并恢复常发帧
|
|
|
|