mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 11:35:12 +08:00
update 电单车协议
This commit is contained in:
@@ -40,7 +40,7 @@ public abstract class AbstractEBikeHandler implements InitializingBean {
|
||||
byte[] head = dataProtocol.getHead();
|
||||
|
||||
// 长度 = 物理ID(4) + 消息ID(2) + 命令(1) + 数据(n) + 校验(2),每包最多256字节
|
||||
byte[] length = BytesUtil.intToBytes(9 + messageBody.length);
|
||||
byte[] length = BytesUtil.intToBytesLittle(9 + messageBody.length);
|
||||
|
||||
// 物理id
|
||||
byte[] physicalId = dataProtocol.getPhysicalId();
|
||||
|
||||
@@ -39,7 +39,7 @@ public class GetServerTimeHandler extends AbstractEBikeHandler {
|
||||
|
||||
// 获取当前服务器10位时间戳
|
||||
byte[] timeBytes = BytesUtil.getIntBytes((int) (System.currentTimeMillis() / 1000));
|
||||
System.out.println("data: " + BytesUtil.bytesToIntLittle(timeBytes));
|
||||
// System.out.println("data: " + BytesUtil.bytesToIntLittle(timeBytes));
|
||||
return getResult(dataProtocol, timeBytes);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.jsowell.netty.handler.electricbicycles;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.core.domain.ebike.EBikeDataProtocol;
|
||||
import com.jsowell.netty.factory.EBikeOperateFactory;
|
||||
import com.jsowell.pile.domain.ebike.AbsEBikeMessage;
|
||||
@@ -36,6 +37,6 @@ public class HeartbeatHandler extends AbstractEBikeHandler {
|
||||
EBikeMessageCmd21 message = (EBikeMessageCmd21) AbsEBikeMessage.parseMessage(dataProtocol.getBytes());
|
||||
EBikeMessageCmd21.DeviceHeartbeat deviceHeartbeat = message.getDeviceHeartbeat();
|
||||
log.info("设备心跳包:{}", JSON.toJSONString(message));
|
||||
return new byte[0];
|
||||
return getResult(dataProtocol, Constants.zeroByteArray);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user