mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 03:25:12 +08:00
解析报文
This commit is contained in:
@@ -20,6 +20,7 @@ public class YKCUtils {
|
||||
* @return
|
||||
*/
|
||||
public static boolean checkMsg(byte[] msg) {
|
||||
// log.info("checkMsg:{}", BytesUtil.binary(msg, 16));
|
||||
// 起始标志
|
||||
byte[] head = BytesUtil.copyBytes(msg, 0, 1);
|
||||
// 数据长度
|
||||
@@ -66,6 +67,11 @@ public class YKCUtils {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
byte[] length = new byte[]{0x22};
|
||||
System.out.println(BytesUtil.bytesToIntLittle(length));
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换电压电流以及起始soc
|
||||
* 精确到小数点后一位;待机置零
|
||||
@@ -127,46 +133,6 @@ public class YKCUtils {
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String frameTypeStr = "0x01";
|
||||
byte[] bytes = frameTypeStr2Bytes(frameTypeStr);
|
||||
System.out.println("转为byte数组:" + Arrays.toString(bytes));
|
||||
String frameType2Str = frameType2Str(bytes);
|
||||
System.out.println("转为Str:" + frameType2Str);
|
||||
|
||||
// String hexString = "681E0000003388000000000027012302081602434533880000000000270101008361";
|
||||
// byte[] byteArray = new byte[hexString.length() / 2];
|
||||
// for (int i = 0; i < byteArray.length; i++) {
|
||||
// int index = i * 2;
|
||||
// int j = Integer.parseInt(hexString.substring(index, index + 2), 16);
|
||||
// byteArray[i] = (byte) j;
|
||||
// }
|
||||
// System.out.println(byteArray);
|
||||
// String binary = BytesUtil.binary(byteArray, 16);
|
||||
// String aaa = DatatypeConverter.printHexBinary(byteArray);
|
||||
// System.out.println(binary);
|
||||
// System.out.println(aaa);
|
||||
|
||||
// String targetCRC = "0abb";
|
||||
// String substring = StringUtils.substring(targetCRC, 0, 2);
|
||||
// String substring1 = StringUtils.substring(targetCRC, 2, 4);
|
||||
// String crc = substring1 + substring;
|
||||
//
|
||||
// String hexString = "4f";
|
||||
// byte[] bytes = new byte[]{0x4f};
|
||||
//
|
||||
// String s = transitionTemperature(bytes);
|
||||
// System.out.println(s);
|
||||
//
|
||||
// byte[] bytess = new byte[]{(byte) 0x80, (byte) 0x1A, 0x06, 0x00};
|
||||
// String s1 = convertDecimalPoint(bytess, 5);
|
||||
// System.out.println(s1);
|
||||
//
|
||||
// String amount = "1000";
|
||||
// byte[] priceByte = getPriceByte(amount, 2);
|
||||
// System.out.println(BytesUtil.bin2HexStr(priceByte));
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换温度
|
||||
* BIN 码 1 整形,偏移量-50;待机置零
|
||||
|
||||
Reference in New Issue
Block a user