mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
update
This commit is contained in:
@@ -53,6 +53,63 @@ public class LoginRequestHandler extends AbstractHandler{
|
||||
YKCOperateFactory.register(type, this);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String msg = "8800000000009000020f56312e323035303000898604940121c138531304";
|
||||
byte[] msgBody = BytesUtil.str2Bcd(msg);
|
||||
|
||||
int startIndex = 0;
|
||||
int length = 7;
|
||||
|
||||
// 桩编码
|
||||
byte[] pileSnByte = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String pileSn = BytesUtil.binary(pileSnByte, 16);
|
||||
// log.info("桩号:{}", pileSn);
|
||||
|
||||
// 桩类型 0 表示直流桩, 1 表示交流桩
|
||||
startIndex += length;
|
||||
length = 1;
|
||||
byte[] pileTypeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String pileType = BytesUtil.bcd2Str(pileTypeByteArr);
|
||||
|
||||
// 充电枪数量
|
||||
startIndex += length;
|
||||
byte[] connectorNumByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String connectorNum = BytesUtil.bcd2Str(connectorNumByteArr);
|
||||
|
||||
// 通信协议版本 版本号乘 10,v1.0 表示 0x0A
|
||||
startIndex += length;
|
||||
byte[] communicationVersionByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
// int i = Integer.parseInt(BytesUtil.bcd2Str(communicationVersionByteArr)); // 0F --> 15
|
||||
BigDecimal bigDecimal = new BigDecimal(BytesUtil.bcd2Str(communicationVersionByteArr));
|
||||
BigDecimal communicationVersionTemp = bigDecimal.divide(new BigDecimal(10));
|
||||
String communicationVersion = "v" + communicationVersionTemp;
|
||||
|
||||
// 程序版本
|
||||
startIndex += length;
|
||||
length = 8;
|
||||
byte[] programVersionByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String programVersion = BytesUtil.ascii2Str(programVersionByteArr);
|
||||
log.info("程序版本:{} length:{}", programVersion, programVersion.length());
|
||||
|
||||
// 网络连接类型 0x00 SIM 卡 0x01 LAN 0x02 WAN 0x03 其他
|
||||
startIndex += length;
|
||||
length = 1;
|
||||
byte[] internetConnectionTypeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String internetConnection = BytesUtil.bcd2Str(internetConnectionTypeByteArr);
|
||||
|
||||
// sim卡
|
||||
startIndex += length;
|
||||
length = 10;
|
||||
byte[] simCardNumByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String iccid = BytesUtil.bin2HexStr(simCardNumByteArr);
|
||||
|
||||
// 运营商 0x00 移动 0x02 电信 0x03 联通 0x04 其他
|
||||
startIndex += length;
|
||||
length = 1;
|
||||
byte[] businessTypeByteArr = BytesUtil.copyBytes(msgBody, startIndex, length);
|
||||
String business = BytesUtil.bcd2Str(businessTypeByteArr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
|
||||
log.info("[===执行登录逻辑===] param:{}, channel:{}", JSONObject.toJSONString(ykcDataProtocol), channel.toString());
|
||||
|
||||
Reference in New Issue
Block a user