mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-23 20:45:10 +08:00
update 电单车协议
This commit is contained in:
@@ -2,6 +2,7 @@ package com.jsowell.pile.domain.ebike.serversend;
|
||||
|
||||
import com.google.common.primitives.Bytes;
|
||||
import com.jsowell.common.YouDianUtils;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.util.BytesUtil;
|
||||
import com.jsowell.pile.domain.ebike.AbsEBikeMessage;
|
||||
import lombok.*;
|
||||
@@ -35,7 +36,7 @@ public class EBikeMessageCmd82 extends AbsEBikeMessage {
|
||||
@Override
|
||||
public byte[] getMessageBytes() {
|
||||
// 包头
|
||||
byte[] headerBytes = BytesUtil.stringToHexBytes(header, 3);
|
||||
byte[] headerBytes = BytesUtil.stringToHexBytes(Constants.EBIKE_HEADER, 3);
|
||||
// 物理ID
|
||||
byte[] physicalIdBytes = YouDianUtils.getPhysicalIdBytes(physicalId);
|
||||
// 消息ID
|
||||
@@ -75,13 +76,13 @@ public class EBikeMessageCmd82 extends AbsEBikeMessage {
|
||||
private int chargeCommand; // 充电命令 (1字节)
|
||||
|
||||
// 告知设备的充电时长/电量, 如是0x0000则说明是充满自停, 其他数值则按照时长/电量充电, 且充满不会自停,
|
||||
private int chargeDurationOrPower; // 充电时长/电量 (2字节)
|
||||
private int chargeTimeOrPower; // 充电时长/电量 (2字节)
|
||||
|
||||
// 生成给桩的交易流水号, 桩协议叫订单编号
|
||||
private String transactionCode; // 订单编号 (16字节)
|
||||
|
||||
// 最大充电时长、过载功率:(只对当前端口当前订单有效,不影响其他端口)动态设置此参数,如果参数为0表示不修改,会使用设备的设置值,默认10小时
|
||||
private int maxChargeDuration; // 最大充电时长 (2字节)
|
||||
private int maxChargeTime; // 最大充电时长 (2字节)
|
||||
private int overloadPower; // 过载功率 (2字节)
|
||||
|
||||
// 二维码灯:0=打开,1=关闭,针对部分有二维码灯的设备有效。此设置是针对下一次插头插入时是否点亮二维码背光灯,保存在内存中,断电重启后就会失效
|
||||
@@ -112,13 +113,13 @@ public class EBikeMessageCmd82 extends AbsEBikeMessage {
|
||||
this.chargeCommand = BytesUtil.bytesToIntLittle(new byte[]{chargeCommandBytes});
|
||||
|
||||
byte[] chargeDurationOrPowerBytes = Arrays.copyOfRange(dataBytes, 7, 9);
|
||||
this.chargeDurationOrPower = BytesUtil.bytesToIntLittle(chargeDurationOrPowerBytes);
|
||||
this.chargeTimeOrPower = BytesUtil.bytesToIntLittle(chargeDurationOrPowerBytes);
|
||||
|
||||
byte[] orderNumberBytes = Arrays.copyOfRange(dataBytes, 9, 25);
|
||||
this.transactionCode = BytesUtil.bcd2StrLittle(orderNumberBytes);
|
||||
|
||||
byte[] maxChargeDurationBytes = Arrays.copyOfRange(dataBytes, 25, 27);
|
||||
this.maxChargeDuration = BytesUtil.bytesToIntLittle(maxChargeDurationBytes);
|
||||
this.maxChargeTime = BytesUtil.bytesToIntLittle(maxChargeDurationBytes);
|
||||
|
||||
byte[] overloadPowerBytes = Arrays.copyOfRange(dataBytes, 27, 29);
|
||||
this.overloadPower = BytesUtil.bytesToIntLittle(overloadPowerBytes);
|
||||
@@ -159,11 +160,11 @@ public class EBikeMessageCmd82 extends AbsEBikeMessage {
|
||||
// 充电命令
|
||||
byte[] chargeCommandBytes = BytesUtil.intToBytesLittle(chargeCommand, 1);
|
||||
// 充电时长/电量
|
||||
byte[] chargeDurationOrPowerBytes = BytesUtil.intToBytesLittle(chargeDurationOrPower, 2);
|
||||
byte[] chargeDurationOrPowerBytes = BytesUtil.intToBytesLittle(chargeTimeOrPower, 2);
|
||||
// 订单编号
|
||||
byte[] orderNumberBytes = BytesUtil.ensureLength(BytesUtil.str2Bcd(transactionCode), 16);
|
||||
// 最大充电时长
|
||||
byte[] maxChargeDurationBytes = BytesUtil.intToBytesLittle(maxChargeDuration, 2);
|
||||
byte[] maxChargeDurationBytes = BytesUtil.intToBytesLittle(maxChargeTime, 2);
|
||||
// 过载功率
|
||||
byte[] overloadPowerBytes = BytesUtil.intToBytesLittle(overloadPower, 2);
|
||||
// 二维码灯
|
||||
|
||||
Reference in New Issue
Block a user