mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
解析0x15 充电握手
This commit is contained in:
@@ -1,14 +1,220 @@
|
|||||||
package com.jsowell.common.core.domain.ykc.device2platform;
|
package com.jsowell.common.core.domain.ykc.device2platform;
|
||||||
|
|
||||||
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
|
import com.jsowell.common.core.domain.ykc.YKCBaseMessage;
|
||||||
|
import com.jsowell.common.util.BytesUtil;
|
||||||
|
import com.jsowell.common.util.YKCUtils;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计费模板验证请求数据
|
* 充电握手
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class Data0x15 extends YKCBaseMessage {
|
public class Data0x15 extends YKCBaseMessage {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 交易流水号
|
||||||
|
*/
|
||||||
|
private String transactionCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 桩编码
|
||||||
|
*/
|
||||||
|
private String pileSn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 枪号
|
||||||
|
*/
|
||||||
|
private String connectorCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BMS 通信协议版本号 当前版本为 V1.1, 表示为: byte3, byte2—0001H;byte1—01H
|
||||||
|
*/
|
||||||
|
private String bmsCommunicationVersion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BMS 电池类型
|
||||||
|
*
|
||||||
|
* 01H:铅酸电池;
|
||||||
|
* 02H:氢电池;
|
||||||
|
* 03H:磷酸铁锂电池;
|
||||||
|
* 04H:锰酸锂电池;
|
||||||
|
* 05H:钴酸锂电池;
|
||||||
|
* 06H:三元材料电池;
|
||||||
|
* 07H:聚合物锂离子电池;
|
||||||
|
* 08H:钛酸锂电池;
|
||||||
|
* FFH:其他
|
||||||
|
*/
|
||||||
|
private String bmsBatteryType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BMS 整车动力蓄电池系统额定容量
|
||||||
|
* 0.1 Ah /位, 0 Ah 偏移量
|
||||||
|
*/
|
||||||
|
private String bmsBatteryCapacity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BMS 整车动力蓄电池系统额定总电压
|
||||||
|
* 0.1V/位, 0V 偏移量
|
||||||
|
*/
|
||||||
|
private String bmsBatteryVoltage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BMS 电池生产厂商名称
|
||||||
|
*/
|
||||||
|
private String bmsBatteryFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BMS 电池组序号
|
||||||
|
*/
|
||||||
|
private String bmsBatteryNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BMS 电池组生产日期年
|
||||||
|
* 1985 年偏移量,
|
||||||
|
* 数据范围: 1985~ 2235 年
|
||||||
|
*/
|
||||||
|
private String bmsProductionDateYear;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BMS 电池组生产日期月
|
||||||
|
* 0 月偏移量,
|
||||||
|
* 数据范围: 1~12 月
|
||||||
|
*/
|
||||||
|
private String bmsProductionDateMonth;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BMS 电池组生产日期日
|
||||||
|
* 0 日偏移量,
|
||||||
|
* 数据范围: 1~31 日
|
||||||
|
*/
|
||||||
|
private String bmsProductionDateDay;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BMS 电池组充电次数
|
||||||
|
* 1 次/位, 0 次偏移量,
|
||||||
|
* 以 BMS 统 计为准
|
||||||
|
*/
|
||||||
|
private String bmsChargingTimes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BMS 电池组产权标识 (<0>: =租赁; <1>: =车自有)
|
||||||
|
*/
|
||||||
|
private String bmsPropertyIdentificationByteArr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BMS 预留位
|
||||||
|
*/
|
||||||
|
private String bmsReservePosition;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BMS 车辆识别码
|
||||||
|
*/
|
||||||
|
private String vinCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BMS 软件版本号
|
||||||
|
*/
|
||||||
|
private String bmsSoftwareVersion;
|
||||||
|
|
||||||
public Data0x15(byte[] messageBytes) {
|
public Data0x15(byte[] messageBytes) {
|
||||||
super(messageBytes);
|
super(messageBytes);
|
||||||
|
|
||||||
|
// 初始startIndex为6, 跳过消息头等6个字节
|
||||||
|
int startIndex = 6;
|
||||||
|
|
||||||
|
// 交易流水号
|
||||||
|
int length = 16;
|
||||||
|
byte[] serialNumByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
|
||||||
|
this.transactionCode = BytesUtil.bcd2Str(serialNumByteArr);
|
||||||
|
|
||||||
|
// 桩编码
|
||||||
|
startIndex += length;
|
||||||
|
length = 7;
|
||||||
|
byte[] pileSnByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
|
||||||
|
this.pileSn = BytesUtil.bcd2Str(pileSnByteArr);
|
||||||
|
|
||||||
|
// 枪号
|
||||||
|
startIndex += length;
|
||||||
|
length = 1;
|
||||||
|
byte[] pileConnectorNumByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
|
||||||
|
this.connectorCode = BytesUtil.bcd2Str(pileConnectorNumByteArr);
|
||||||
|
|
||||||
|
// BMS 通信协议版本号 当前版本为 V1.1, 表示为: byte3, byte2—0001H;byte1—01H
|
||||||
|
startIndex += length;
|
||||||
|
length = 3;
|
||||||
|
byte[] BMSCommunicationProtocolVersionByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
|
||||||
|
this.bmsCommunicationVersion = "V1.1";
|
||||||
|
|
||||||
|
// BMS 电池类型 01H:铅酸电池;02H:氢 电池;03H:磷酸铁锂电池;04H:锰 酸锂电池;05H:钴酸锂电池 ;06H: 三元材料电池;07H:聚合物锂离子 电池;08H:钛酸锂电池;FFH:其他
|
||||||
|
startIndex += length;
|
||||||
|
length = 1;
|
||||||
|
byte[] BMSBatteryTypeByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
|
||||||
|
this.bmsBatteryType = BytesUtil.bcd2Str(BMSBatteryTypeByteArr); // 03
|
||||||
|
|
||||||
|
// BMS 整车动力蓄电池系统额定容量 0.1 Ah /位, 0 Ah 偏移量
|
||||||
|
startIndex += length;
|
||||||
|
length = 2;
|
||||||
|
byte[] BMSBatteryCapacityByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
|
||||||
|
this.bmsBatteryCapacity = String.valueOf(BytesUtil.bytesToIntLittle(BMSBatteryCapacityByteArr) * 0.1); // 171.0
|
||||||
|
|
||||||
|
// BMS 整车动力蓄电池系统额定总电压 0.1V/位, 0V 偏移量
|
||||||
|
startIndex += length;
|
||||||
|
byte[] BMSBatteryVoltageByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
|
||||||
|
this.bmsBatteryVoltage = String.valueOf(BytesUtil.bytesToIntLittle(BMSBatteryVoltageByteArr) * 0.1); // 347.8
|
||||||
|
|
||||||
|
// BMS 电池生产厂商名称
|
||||||
|
startIndex += length;
|
||||||
|
length = 4;
|
||||||
|
byte[] BMSBatteryFactoryByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
|
||||||
|
this.bmsBatteryFactory = BytesUtil.ascii2Str(BMSBatteryFactoryByteArr); // CATL
|
||||||
|
|
||||||
|
// BMS 电池组序号
|
||||||
|
startIndex += length;
|
||||||
|
byte[] BMSBatteryNumByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
|
||||||
|
this.bmsBatteryNum = BytesUtil.bin2HexStr(BMSBatteryNumByteArr);
|
||||||
|
|
||||||
|
// BMS 电池组生产日期年 1985 年偏移量, 数据范围: 1985~ 2235 年
|
||||||
|
startIndex += length;
|
||||||
|
length = 1;
|
||||||
|
byte[] BMSProductionDateYearByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
|
||||||
|
this.bmsProductionDateYear = BytesUtil.bin2HexStr(BMSProductionDateYearByteArr);
|
||||||
|
|
||||||
|
// BMS 电池组生产日期月 0 月偏移量, 数据范围: 1~12 月
|
||||||
|
startIndex += length;
|
||||||
|
byte[] BMSProductionDateMonthByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
|
||||||
|
this.bmsProductionDateMonth = BytesUtil.bin2HexStr(BMSProductionDateMonthByteArr);
|
||||||
|
|
||||||
|
// BMS 电池组生产日期日 0 日偏移量, 数据范围: 1~31 日
|
||||||
|
startIndex += length;
|
||||||
|
byte[] BMSProductionDateDayByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
|
||||||
|
this.bmsProductionDateDay = BytesUtil.bin2HexStr(BMSProductionDateDayByteArr);
|
||||||
|
|
||||||
|
// BMS 电池组充电次数 1 次/位, 0 次偏移量, 以 BMS 统 计为准
|
||||||
|
startIndex += length;
|
||||||
|
length = 3;
|
||||||
|
byte[] BMSChargingTimesByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
|
||||||
|
this.bmsChargingTimes = BytesUtil.bin2HexStr(BMSChargingTimesByteArr);
|
||||||
|
|
||||||
|
// BMS 电池组产权标识 (<0>: =租赁; <1>: =车自有)
|
||||||
|
startIndex += length;
|
||||||
|
length = 1;
|
||||||
|
byte[] BMSPropertyIdentificationByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
|
||||||
|
|
||||||
|
// BMS 预留位
|
||||||
|
startIndex += length;
|
||||||
|
byte[] BMSReservePosition = BytesUtil.copyBytes(messageBytes, startIndex, length);
|
||||||
|
this.bmsReservePosition = BytesUtil.bin2HexStr(BMSReservePosition);
|
||||||
|
|
||||||
|
// BMS 车辆识别码
|
||||||
|
startIndex += length;
|
||||||
|
length = 17;
|
||||||
|
byte[] vinByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
|
||||||
|
this.vinCode = YKCUtils.parseVin(vinByteArr);
|
||||||
|
|
||||||
|
// BMS 软件版本号
|
||||||
|
startIndex += length;
|
||||||
|
length = 8;
|
||||||
|
byte[] BMSSoftwareVersionByteArr = BytesUtil.copyBytes(messageBytes, startIndex, length);
|
||||||
|
this.bmsSoftwareVersion = BytesUtil.bcd2Str(BMSSoftwareVersionByteArr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user