From 9ea58fda7b56411f4e94339a7895029edbe37fdb Mon Sep 17 00:00:00 2001 From: Guoqs <123@jsowell.com> Date: Wed, 31 Jul 2024 11:47:43 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=BF=AE=E6=94=B9=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/domain/ykc/YKCFrameTypeCode.java | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/jsowell-common/src/main/java/com/jsowell/common/core/domain/ykc/YKCFrameTypeCode.java b/jsowell-common/src/main/java/com/jsowell/common/core/domain/ykc/YKCFrameTypeCode.java index b9acbdd1f..b9e2e1920 100644 --- a/jsowell-common/src/main/java/com/jsowell/common/core/domain/ykc/YKCFrameTypeCode.java +++ b/jsowell-common/src/main/java/com/jsowell/common/core/domain/ykc/YKCFrameTypeCode.java @@ -1,9 +1,12 @@ package com.jsowell.common.core.domain.ykc; +import com.google.common.collect.Lists; import com.jsowell.common.util.BytesUtil; import com.jsowell.common.util.StringUtils; import com.jsowell.common.util.YKCUtils; +import java.util.List; + /** * 云快充 帧类型码 * FrameTypeCode @@ -126,11 +129,6 @@ public enum YKCFrameTypeCode { 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) { for (YKCFrameTypeCode item : YKCFrameTypeCode.values()) { if (item.getCode() == code) { @@ -305,6 +303,10 @@ public enum YKCFrameTypeCode { this.responseFrameType = responseFrameType; } + public byte[] getRequestFrameBytes() { + return BytesUtil.intToBytesLittle(requestFrameType, 1); + } + PileAnswersRelation(int requestFrameType, int responseFrameType) { this.requestFrameType = requestFrameType; this.responseFrameType = responseFrameType; @@ -326,6 +328,15 @@ public enum YKCFrameTypeCode { return BytesUtil.intToBytes(getResponseFrameTypeByRequestFrameType(frameType), 1); } + // 需要获取应答的帧类型 + public static List getRequestFrameTypeList() { + List resultList = Lists.newArrayList(); + for (PileAnswersRelation relation : PileAnswersRelation.values()) { + resultList.add(YKCUtils.frameType2Str(relation.getRequestFrameBytes())); + } + return resultList; + } + } }