update 电单车协议

This commit is contained in:
Guoqs
2024-09-03 16:24:03 +08:00
parent e5100ef65f
commit a6f1b48cd1
3 changed files with 37 additions and 15 deletions

View File

@@ -142,24 +142,26 @@ public class EBikeMessageCmd82 extends AbsEBikeMessage {
// 获取字节数组
public byte[] getBytes() {
// 费率模式
byte[] rateModeBytes = BytesUtil.stringToHexBytes(rateMode, 1);
byte[] rateModeBytes = BytesUtil.intToBytesLittle(Integer.parseInt(rateMode), 1);
// 余额/有效期
byte[] balanceOrValidityBytes = BytesUtil.stringToHexBytes(balanceOrValidity, 4);
byte[] balanceOrValidityBytes = BytesUtil.intToBytesLittle(Integer.parseInt(balanceOrValidity), 4);
// 端口号
byte[] portNumberBytes = YouDianUtils.convertPortNumberToBytes(portNumber);
// 充电命令
byte[] chargeCommandBytes = BytesUtil.stringToHexBytes(chargeCommand, 1);
byte[] chargeCommandBytes = BytesUtil.intToBytesLittle(Integer.parseInt(chargeCommand), 1);
// 充电时长/电量
byte[] chargeDurationOrPowerBytes = BytesUtil.stringToHexBytes(chargeDurationOrPower, 2);
// 订单编号
// byte[] orderNumberBytes = BytesUtil.stringToHexBytes(orderNumber, 16);
byte[] orderNumberBytes = BytesUtil.str2Bcd(orderNumber);
byte[] orderNumberBytes = BytesUtil.ensureLength(BytesUtil.str2Bcd(orderNumber), 16);
// 最大充电时长
byte[] maxChargeDurationBytes = BytesUtil.stringToHexBytes(maxChargeDuration, 2);
// byte[] maxChargeDurationBytes = BytesUtil.stringToHexBytes(maxChargeDuration, 2);
byte[] maxChargeDurationBytes = BytesUtil.intToBytesLittle(Integer.parseInt(maxChargeDuration), 2);
// 过载功率
byte[] overloadPowerBytes = BytesUtil.stringToHexBytes(overloadPower, 2);
// byte[] overloadPowerBytes = BytesUtil.stringToHexBytes(overloadPower, 2);
byte[] overloadPowerBytes = BytesUtil.intToBytesLittle(Integer.parseInt(overloadPower), 2);
// 二维码灯
// byte[] qrCodeLightBytes = BytesUtil.stringToHexBytes(qrCodeLight, 1);
byte[] qrCodeLightBytes = BytesUtil.intToBytesLittle(Integer.parseInt(qrCodeLight), 1);
// 长充模式
// byte[] longChargeModeBytes = BytesUtil.stringToHexBytes(longChargeMode, 1);
// 额外浮充时间