mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
update 获取字节数组
This commit is contained in:
@@ -61,13 +61,20 @@ public class YKCDataProtocol {
|
||||
this.crcByte = new byte[]{msg[msg.length - 2], msg[msg.length - 1]};
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字节数组
|
||||
*/
|
||||
public byte[] getBytes() {
|
||||
return Bytes.concat(this.head, this.length, this.serialNumber, this.encryptFlag, this.frameType, this.msgBody, this.crcByte);
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换为十六进制字符串
|
||||
*
|
||||
* @return 报文
|
||||
*/
|
||||
public String getHEXString() {
|
||||
byte[] bytes = Bytes.concat(this.head, this.length, this.serialNumber, this.encryptFlag, this.frameType, this.msgBody, this.crcByte);
|
||||
byte[] bytes = getBytes();
|
||||
return BytesUtil.binary(bytes, 16);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user