update 电单车协议

This commit is contained in:
Guoqs
2024-09-05 15:51:51 +08:00
parent f3d4b13895
commit 8c273e5a39
6 changed files with 218 additions and 18 deletions

View File

@@ -34,28 +34,28 @@ public class EBikeMessageCmd03 extends AbsEBikeMessage {
@Data
public static class SettlementInfo {
private String chargingDuration; // 充电时长, 单位:"秒"
private String maxPower; // 最大功率, 单位:"0.1W"
private String consumedEnergy; // 耗电量, 单位:"0.01度"
private String portNumber; // 端口号
private String startMode; // 在线/离线启动/验证码
private String cardNumberOrVerificationCode; // 卡号/验证码
private String stopReason; // 停止原因
private String orderNumber; // 订单编号
private String secondMaxPower; // 第二最大功率
private int chargingDuration; // 充电时长, 单位:"秒"
private int maxPower; // 最大功率, 单位:"0.1W"
private int consumedEnergy; // 耗电量, 单位:"0.01度"
private int portNumber; // 端口号
private int startMode; // 在线/离线启动/验证码
private int cardNumberOrVerificationCode; // 卡号/验证码
private int stopReason; // 停止原因
private int orderNumber; // 订单编号
private int secondMaxPower; // 第二最大功率
// private String timestamp; // 时间戳 上发指令当时的时间,有时候不准确,该字段属于调试使用,服务器无需关心此字段
// private String placeholderDuration; // 占位时长 充电柜专用,其他设备忽略此字段 表示充满后占用设备的时长,单位为分钟
public SettlementInfo(byte[] dataBytes) {
this.chargingDuration = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 0, 2)) + "";
this.maxPower = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 2, 4)) + "";
this.consumedEnergy = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 4, 6)) + "";
this.portNumber = BytesUtil.bcd2StrLittle(new byte[]{dataBytes[6]});
this.startMode = BytesUtil.bcd2StrLittle(new byte[]{dataBytes[7]});
this.cardNumberOrVerificationCode = BytesUtil.bcd2StrLittle(Arrays.copyOfRange(dataBytes, 8, 12));
this.stopReason = BytesUtil.bcd2StrLittle(new byte[]{dataBytes[12]});
this.orderNumber = BytesUtil.bcd2StrLittle(Arrays.copyOfRange(dataBytes, 13, 29));
this.secondMaxPower = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 29, 31)) + "";
this.chargingDuration = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 0, 2));
this.maxPower = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 2, 4));
this.consumedEnergy = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 4, 6));
this.portNumber = BytesUtil.bytesToIntLittle(new byte[]{dataBytes[6]});
this.startMode = BytesUtil.bytesToIntLittle(new byte[]{dataBytes[7]});
this.cardNumberOrVerificationCode = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 8, 12));
this.stopReason = BytesUtil.bytesToIntLittle(new byte[]{dataBytes[12]});
this.orderNumber = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 13, 29));
this.secondMaxPower = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 29, 31));
// this.timestamp = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 31, 35)) + "";
// this.placeholderDuration = BytesUtil.bytesToIntLittle(Arrays.copyOfRange(dataBytes, 35, 37)) + "";
}