2025-08-09 11:00:12 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* 开源代码,仅供学习和交流研究使用,商用请联系三丙
|
|
|
|
|
|
* 微信:mohan_88888
|
|
|
|
|
|
* 抖音:程序员三丙
|
|
|
|
|
|
* 付费课程知识星球:https://t.zsxq.com/aKtXo
|
|
|
|
|
|
*/
|
|
|
|
|
|
package sanbing.jcpp.protocol.lvneng;
|
|
|
|
|
|
|
|
|
|
|
|
import com.google.protobuf.ByteString;
|
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
import sanbing.jcpp.infrastructure.util.jackson.JacksonUtil;
|
2025-09-09 08:23:59 +00:00
|
|
|
|
import sanbing.jcpp.infrastructure.util.trace.TracerContextUtil;
|
2025-09-12 14:40:18 +08:00
|
|
|
|
import sanbing.jcpp.proto.gen.UplinkProto.UplinkQueueMessage;
|
2025-08-09 11:00:12 +00:00
|
|
|
|
import sanbing.jcpp.protocol.ProtocolContext;
|
|
|
|
|
|
import sanbing.jcpp.protocol.listener.tcp.TcpSession;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2025-09-09 08:23:59 +00:00
|
|
|
|
* @author 九筒
|
2025-08-09 11:00:12 +00:00
|
|
|
|
*/
|
|
|
|
|
|
@Slf4j
|
|
|
|
|
|
public abstract class LvnengUplinkCmdExe extends AbstractLvnengCmdExe {
|
|
|
|
|
|
|
|
|
|
|
|
public abstract void execute(TcpSession tcpSession, LvnengUplinkMessage lvnengUplinkMessage, ProtocolContext ctx);
|
|
|
|
|
|
|
|
|
|
|
|
protected UplinkQueueMessage.Builder uplinkMessageBuilder(String messageKey, TcpSession tcpSession, LvnengUplinkMessage lvnengUplinkMessage) {
|
2025-09-09 08:23:59 +00:00
|
|
|
|
// 从Tracer总获取当前时间
|
|
|
|
|
|
long ts = TracerContextUtil.getCurrentTracer().getTracerTs();
|
|
|
|
|
|
|
2025-08-09 11:00:12 +00:00
|
|
|
|
return UplinkQueueMessage.newBuilder()
|
|
|
|
|
|
.setMessageIdMSB(lvnengUplinkMessage.getId().getMostSignificantBits())
|
|
|
|
|
|
.setMessageIdLSB(lvnengUplinkMessage.getId().getLeastSignificantBits())
|
|
|
|
|
|
.setSessionIdMSB(tcpSession.getId().getMostSignificantBits())
|
|
|
|
|
|
.setSessionIdLSB(tcpSession.getId().getLeastSignificantBits())
|
2025-09-09 08:23:59 +00:00
|
|
|
|
.setTs(ts)
|
2025-08-09 11:00:12 +00:00
|
|
|
|
.setRequestData(ByteString.copyFrom(JacksonUtil.writeValueAsBytes(lvnengUplinkMessage)))
|
|
|
|
|
|
.setMessageKey(messageKey)
|
|
|
|
|
|
.setProtocolName(tcpSession.getProtocolName());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|