mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-22 20:15:06 +08:00
update 电单车协议
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package com.jsowell.common;
|
||||
|
||||
import com.google.common.primitives.Bytes;
|
||||
import com.jsowell.common.enums.ebike.EBikeTypeEnum;
|
||||
import com.jsowell.common.util.BytesUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@@ -88,6 +90,18 @@ public class YouDianUtils {
|
||||
return BytesUtil.intToBytesLittle(calculatedChecksum);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取物理IDbyte数组
|
||||
* @param deviceNumber
|
||||
* @return
|
||||
*/
|
||||
public static byte[] getPhysicalIdBytes(int deviceNumber) {
|
||||
byte[] physicalIdBytes = BytesUtil.intToBytes(deviceNumber, 3);
|
||||
// 拼接识别码, 12路插座
|
||||
byte[] concat = Bytes.concat(EBikeTypeEnum.socket_12way.getBytes(), physicalIdBytes);
|
||||
return BytesUtil.reverse(concat);
|
||||
}
|
||||
|
||||
// public static String convertPortNumberToHex(int portNumber) {
|
||||
// if (portNumber < 1 || portNumber > 16) {
|
||||
// throw new IllegalArgumentException("Port number must be between 1 and 16.");
|
||||
|
||||
Reference in New Issue
Block a user