package com.ruoyi.dataInterchange.server;
|
|
import com.alibaba.fastjson.JSON;
|
import com.ruoyi.dataInterchange.model.enu.DataType;
|
import com.ruoyi.dataInterchange.netty.client.ChannelMap;
|
import com.ruoyi.dataInterchange.util.jtt809.packet.common.OuterPacket;
|
import io.netty.channel.ChannelHandlerContext;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.stereotype.Component;
|
|
|
/**
|
* @author zhibing.pu
|
* @Date 2025/3/6 15:46
|
*/
|
@Slf4j
|
@Component
|
public class UPLinkTestReqService {
|
|
|
/**
|
* 住链路连接保持
|
* @param ctx
|
* @param out
|
*/
|
public void linkTest(ChannelHandlerContext ctx, OuterPacket out){
|
int gnsscenterId = out.getGnsscenterId();
|
ChannelMap.addServerChannel(gnsscenterId, ctx.channel().id());
|
OuterPacket rep = new OuterPacket(DataType.UP_LINKTEST_RSP.getCode(), null);
|
log.info("住链路连接保持应答({}):{}", DataType.UP_LINKTEST_RSP.getCode(), JSON.toJSONString(rep));
|
ctx.writeAndFlush(rep);
|
ctx.flush();
|
}
|
}
|