From 06b27beedcdb1c787ce55d173e6908722b21063a Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Mon, 29 Apr 2024 07:00:00 +0800 Subject: [PATCH] =?UTF-8?q?1078-=E8=AE=BE=E7=BD=AE=E7=BB=88=E7=AB=AF?= =?UTF-8?q?=E5=8F=82=E6=95=B0...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../genersoft/iot/vmp/jt1078/proc/response/J8103.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/proc/response/J8103.java b/src/main/java/com/genersoft/iot/vmp/jt1078/proc/response/J8103.java index 376ca9a7e..3d7e945a3 100644 --- a/src/main/java/com/genersoft/iot/vmp/jt1078/proc/response/J8103.java +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/proc/response/J8103.java @@ -14,6 +14,7 @@ import org.slf4j.LoggerFactory; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.nio.ByteBuffer; import java.nio.charset.Charset; import java.util.Arrays; import java.util.HashMap; @@ -57,13 +58,13 @@ public class J8103 extends Rs { for (Field field : fieldConfigAttributeMap.keySet()) { try{ ConfigAttribute configAttribute = fieldConfigAttributeMap.get(field); - buffer.writeLong(configAttribute.id()); + buffer.writeInt((int) (configAttribute.id() & 0xffff)); switch (configAttribute.type()) { case "Long": buffer.writeByte(4); field.setAccessible(true); - Long longVal = (Long)field.get(config); - buffer.writeLong(longVal); + long longVal = (long)field.get(config); + buffer.writeInt((int) (longVal & 0xffffffffL)); continue; case "String": field.setAccessible(true); @@ -75,13 +76,13 @@ public class J8103 extends Rs { buffer.writeByte(2); field.setAccessible(true); Integer integerVal = (Integer)field.get(config); - buffer.writeInt(integerVal); + buffer.writeShort((short)(integerVal & 0xffff)); continue; case "Short": buffer.writeByte(1); field.setAccessible(true); Short shortVal = (Short)field.get(config); - buffer.writeShort(shortVal); + buffer.writeByte((int) (shortVal & 0xff)); continue; case "IllegalDrivingPeriods": case "CollisionAlarmParams":