!15 增加0x92远程重启和0x91远程重启应答

* Merge remote-tracking branch 'refs/remotes/upstream/master' into maste…
* 0x92远程重启和0x91远程重启应答
* 0x92远程重启和0x91远程重启应答测试
* 0x92远程重启和0x91远程重启应答
This commit is contained in:
红中
2025-08-05 11:24:13 +00:00
committed by 三丙
parent b225cadde9
commit 5c2c718d34
10 changed files with 189 additions and 1 deletions

View File

@@ -75,3 +75,11 @@
---
#### 0x1D 充电阶段BMS中止
`68 20 00 18 00 1D 20 23 12 12 00 00 01 01 11 51 11 61 55 53 50 26 20 23 12 12 00 00 10 01 00 00 00 00 5a 23`
#### 0x91 远程重启应答
`68 0C 00 11 00 91 20 23 12 12 00 00 10 01 03 F2`
---

View File

@@ -34,7 +34,9 @@ public enum YunKuaiChongDownlinkCmdEnum {
TRANSACTION_RECORD(0x40),
REMOTE_PARALLEL_START_CHARGING(0xA4);
REMOTE_PARALLEL_START_CHARGING(0xA4),
REMOTE_RE_START_CHARGING(0x92);
private final Integer cmd;

View File

@@ -0,0 +1,49 @@
/**
* 开源代码,仅供学习和交流研究使用,商用请联系三丙
* 微信mohan_88888
* 抖音:程序员三丙
* 付费课程知识星球https://t.zsxq.com/aKtXo
*/
package sanbing.jcpp.protocol.yunkuaichong.v150.cmd;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import lombok.extern.slf4j.Slf4j;
import sanbing.jcpp.proto.gen.ProtocolProto.RestartPileRequest;
import sanbing.jcpp.protocol.ProtocolContext;
import sanbing.jcpp.protocol.listener.tcp.TcpSession;
import sanbing.jcpp.protocol.yunkuaichong.YunKuaiChongDownlinkCmdExe;
import sanbing.jcpp.protocol.yunkuaichong.YunKuaiChongDwonlinkMessage;
import sanbing.jcpp.protocol.yunkuaichong.annotation.YunKuaiChongCmd;
import static sanbing.jcpp.protocol.yunkuaichong.enums.YunKuaiChongDownlinkCmdEnum.REMOTE_RE_START_CHARGING;
/**
* 云快充1.5.0 运营平台远程重启充电桩
*/
@Slf4j
@YunKuaiChongCmd(0x92)
public class YunKuaiChongV150RestartPileDLCmd extends YunKuaiChongDownlinkCmdExe {
@Override
public void execute(TcpSession tcpSession, YunKuaiChongDwonlinkMessage yunKuaiChongDwonlinkMessage, ProtocolContext ctx) {
log.info("{} 云快充1.5.0运营平台远程重启充电桩", tcpSession);
if (!yunKuaiChongDwonlinkMessage.getMsg().hasRestartPileRequest()) {
return;
}
RestartPileRequest restartPileRequest = yunKuaiChongDwonlinkMessage.getMsg().getRestartPileRequest();
String pileCode = restartPileRequest.getPileCode();
int type = restartPileRequest.getType();
ByteBuf msgBody = Unpooled.buffer(8);
// 桩编码
msgBody.writeBytes(encodePileCode(pileCode));
// 0x01立即执行 0x02空闲执行
msgBody.writeInt(type);
encodeAndWriteFlush(REMOTE_RE_START_CHARGING,
msgBody,
tcpSession);
}
}

View File

@@ -0,0 +1,58 @@
/**
* 开源代码,仅供学习和交流研究使用,商用请联系三丙
* 微信mohan_88888
* 抖音:程序员三丙
* 付费课程知识星球https://t.zsxq.com/aKtXo
*/
package sanbing.jcpp.protocol.yunkuaichong.v150.cmd;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import lombok.extern.slf4j.Slf4j;
import sanbing.jcpp.infrastructure.util.codec.BCDUtil;
import sanbing.jcpp.infrastructure.util.trace.TracerContextUtil;
import sanbing.jcpp.proto.gen.ProtocolProto.RestartPileResponse;
import sanbing.jcpp.proto.gen.ProtocolProto.UplinkQueueMessage;
import sanbing.jcpp.protocol.ProtocolContext;
import sanbing.jcpp.protocol.listener.tcp.TcpSession;
import sanbing.jcpp.protocol.yunkuaichong.YunKuaiChongUplinkCmdExe;
import sanbing.jcpp.protocol.yunkuaichong.YunKuaiChongUplinkMessage;
import sanbing.jcpp.protocol.yunkuaichong.annotation.YunKuaiChongCmd;
/**
* 云快充1.5.0 远程重启充电命令回复
*/
@Slf4j
@YunKuaiChongCmd(0x91)
public class YunKuaiChongV150RestartPileResultULCmd extends YunKuaiChongUplinkCmdExe {
@Override
public void execute(TcpSession tcpSession, YunKuaiChongUplinkMessage yunKuaiChongUplinkMessage, ProtocolContext ctx) {
log.info("{} 云快充1.5.0远程重启动充电命令回复", tcpSession);
ByteBuf byteBuf = Unpooled.wrappedBuffer(yunKuaiChongUplinkMessage.getMsgBody());
// 从Tracer总获取当前时间
long ts = TracerContextUtil.getCurrentTracer().getTracerTs();
// 1.桩编号
byte[] pileCodeBytes = new byte[7];
byteBuf.readBytes(pileCodeBytes);
String pileCode = BCDUtil.toString(pileCodeBytes);
// 2.命令执行结果 0x00失败 0x01成功
boolean isSuccess = (byteBuf.readByte() == 0x01);
RestartPileResponse restartPileResponse = RestartPileResponse.newBuilder()
.setTs(ts)
.setPileCode(pileCode)
.setSuccess(isSuccess)
.build();
// 转发到后端
UplinkQueueMessage uplinkQueueMessage = uplinkMessageBuilder(pileCode, tcpSession, yunKuaiChongUplinkMessage)
.setRestartPileResponse(restartPileResponse)
.build();
tcpSession.getForwarder().sendMessage(uplinkQueueMessage);
}
}