如果控制消息从数据通道来,则删除其控制通道信息,确保服务器信令也从数据通道发

This commit is contained in:
weidong 2024-08-13 17:24:19 +08:00
parent 27a951df21
commit 8cfdbb89f3
3 changed files with 9 additions and 3 deletions

View File

@ -37,8 +37,6 @@ public class D3F0SelfCheckMessageExecutor implements Executor<D3F0SelfCheckMessa
@Resource(name = "local") @Resource(name = "local")
private DeviceService deviceService; private DeviceService deviceService;
@Autowired @Autowired
private GnssGroupMapper gnssGroupMapper;
@Autowired
RtcmClient rtcmClient; RtcmClient rtcmClient;
@Override @Override
@ -96,7 +94,7 @@ public class D3F0SelfCheckMessageExecutor implements Executor<D3F0SelfCheckMessa
logger.debug("设备" + device.getDeviceId() + ": F9P 最近一次断电时间初始化为 " + device.getLastF9PPowerOffTime()); logger.debug("设备" + device.getDeviceId() + ": F9P 最近一次断电时间初始化为 " + device.getLastF9PPowerOffTime());
} }
// 检查 F9P 最近一次断电时间是否超过 48 小时 若是则发送断电指令 // 检查 F9P 最近一次断电时间是否超过 48 小时 若是则发送断电指令
else if(device.getLastF9PPowerOffTime().isBefore(now.minusHours(48))){ else if(device.getLastF9PPowerOffTime().isBefore(now.minusHours(24))){
logger.debug("设备 "+device.getDeviceId()+" 的 F9P 距离上一次断电已超过48小时发送F9P断电指令"); logger.debug("设备 "+device.getDeviceId()+" 的 F9P 距离上一次断电已超过48小时发送F9P断电指令");
sendF9PPowerOffCommand(device); sendF9PPowerOffCommand(device);
// 更新F9P断电时间用于下一个48小时周期后的判断 // 更新F9P断电时间用于下一个48小时周期后的判断

View File

@ -51,6 +51,10 @@ public class OnlineChannels {
return deviceChannel; return deviceChannel;
} }
public void removeConfigChannel(String deviceId){
configChannels.remove(deviceId);
}
public Optional<DeviceChannel> get(String deviceId) { public Optional<DeviceChannel> get(String deviceId) {
return Optional.ofNullable(dataChannels.get(deviceId)); return Optional.ofNullable(dataChannels.get(deviceId));
} }

View File

@ -40,6 +40,10 @@ public class RtcmUdpHandler extends ChannelInboundHandlerAdapter {
// 消息解析 // 消息解析
BaseMessage message = MessageParser.instance.parse(packet.content()); BaseMessage message = MessageParser.instance.parse(packet.content());
OnlineChannels.INSTANCE.updateDataChannel(message.getId(), ctx.channel(), packet.sender()); OnlineChannels.INSTANCE.updateDataChannel(message.getId(), ctx.channel(), packet.sender());
if(message.getHeader() == 0xd3f0){
//如果控制消息从数据通道来则删除其控制通道信息确保服务器信令也从数据通道发
OnlineChannels.INSTANCE.removeConfigChannel(message.getId());
}
BizExecutors.execute(message); BizExecutors.execute(message);
} catch (UnSupportedMessageException e) { } catch (UnSupportedMessageException e) {
logger.warn("receive un supported message: {}", e.getMessage()); logger.warn("receive un supported message: {}", e.getMessage());