update 修改名称

This commit is contained in:
Guoqs
2024-07-31 11:47:43 +08:00
parent c05ce03bf5
commit 9ea58fda7b

View File

@@ -1,9 +1,12 @@
package com.jsowell.common.core.domain.ykc; package com.jsowell.common.core.domain.ykc;
import com.google.common.collect.Lists;
import com.jsowell.common.util.BytesUtil; import com.jsowell.common.util.BytesUtil;
import com.jsowell.common.util.StringUtils; import com.jsowell.common.util.StringUtils;
import com.jsowell.common.util.YKCUtils; import com.jsowell.common.util.YKCUtils;
import java.util.List;
/** /**
* 云快充 帧类型码 * 云快充 帧类型码
* FrameTypeCode * FrameTypeCode
@@ -126,11 +129,6 @@ public enum YKCFrameTypeCode {
return BytesUtil.intToBytesLittle(code, 1); return BytesUtil.intToBytesLittle(code, 1);
} }
public static void main(String[] args) {
byte[] bytes = BytesUtil.intToBytesLittle(9999, 1);
System.out.println(YKCUtils.frameType2Str(bytes));
}
public static YKCFrameTypeCode fromCode(byte code) { public static YKCFrameTypeCode fromCode(byte code) {
for (YKCFrameTypeCode item : YKCFrameTypeCode.values()) { for (YKCFrameTypeCode item : YKCFrameTypeCode.values()) {
if (item.getCode() == code) { if (item.getCode() == code) {
@@ -305,6 +303,10 @@ public enum YKCFrameTypeCode {
this.responseFrameType = responseFrameType; this.responseFrameType = responseFrameType;
} }
public byte[] getRequestFrameBytes() {
return BytesUtil.intToBytesLittle(requestFrameType, 1);
}
PileAnswersRelation(int requestFrameType, int responseFrameType) { PileAnswersRelation(int requestFrameType, int responseFrameType) {
this.requestFrameType = requestFrameType; this.requestFrameType = requestFrameType;
this.responseFrameType = responseFrameType; this.responseFrameType = responseFrameType;
@@ -326,6 +328,15 @@ public enum YKCFrameTypeCode {
return BytesUtil.intToBytes(getResponseFrameTypeByRequestFrameType(frameType), 1); return BytesUtil.intToBytes(getResponseFrameTypeByRequestFrameType(frameType), 1);
} }
// 需要获取应答的帧类型
public static List<String> getRequestFrameTypeList() {
List<String> resultList = Lists.newArrayList();
for (PileAnswersRelation relation : PileAnswersRelation.values()) {
resultList.add(YKCUtils.frameType2Str(relation.getRequestFrameBytes()));
}
return resultList;
}
} }
} }