From a42814eaa86c2167764b73a22ca0b1a0bebd32b6 Mon Sep 17 00:00:00 2001 From: whycq <913841844@qq.com> Date: 星期一, 20 一月 2025 14:58:56 +0800 Subject: [PATCH] # --- app/src/main/java/com/example/agvcontroller/protocol/AGV_F0_UP.java | 103 +++++++-------------------------------------------- 1 files changed, 14 insertions(+), 89 deletions(-) diff --git a/app/src/main/java/com/example/agvcontroller/protocol/AGV_F0_UP.java b/app/src/main/java/com/example/agvcontroller/protocol/AGV_F0_UP.java index ba3a925..8ebe5ca 100644 --- a/app/src/main/java/com/example/agvcontroller/protocol/AGV_F0_UP.java +++ b/app/src/main/java/com/example/agvcontroller/protocol/AGV_F0_UP.java @@ -1,11 +1,16 @@ package com.example.agvcontroller.protocol; +import com.example.agvcontroller.socket.RadixTools; + import java.io.Serializable; +/** + * Created by vincent on 2023/3/15 + */ public class AGV_F0_UP implements IMessageBody, Serializable { - private static final long serialVersionUID = 8403019742104020004L; + private static final long serialVersionUID = -5588066188890649095L; @Override public byte[] writeToBytes() { @@ -14,28 +19,12 @@ @Override public void readFromBytes(byte[] bytes) { - this.password = ""; - this.carType = 0; - this.baseVersion = ""; - this.bothData = ""; - this.softwareVersion = ""; - this.optData = ""; - this.totalTime = 0; - this.totalDistance = 0; - this.batteryType = 0; - this.maxChargeCurrent = 0; - this.batteryVoltage = 0; - this.remainingBattery = 0; - this.soh = 0; - this.groundCode = ""; - this.qrCode = ""; - this.offsetX = 0; - this.offsetY = 0; - this.groundCodeOffset0 = 0; - this.status = 0; - this.faultFlag = 0; - this.intrusionCount = 0; - this.spareSpaceCount = 0; + // password + this.password = RadixTools.bytesToHexStr(Utils.sliceWithReverse(bytes, 0, 4)); + // type + this.type = Utils.sliceWithReverse(bytes, 4, 1)[0]; + + } @Override @@ -43,73 +32,9 @@ return ""; } - // 瀵嗙爜 private String password; - // 璁惧绫诲瀷 - private int carType; - - // 纭欢鐗堟湰 - private String baseVersion; - - // 鍑哄巶鏃ユ湡 - private String bothData; - - // 杞欢鐗堟湰 - private String softwareVersion; - - // 鍙戝竷鏃ユ湡 - private String optData; - - // 绱宸ヤ綔鏃堕棿 - private int totalTime; - - // 绱琛岃蛋璺濈 - private int totalDistance; - // 鐢垫睜绫诲瀷 - private int batteryType; - - // 鏈�澶у厖鐢电數娴� - private int maxChargeCurrent; - - // 鐢垫睜鐢靛帇 - private int batteryVoltage; - - // 鍓╀綑鐢甸噺 - private int remainingBattery; - - // soh - private int soh; - - // 鍦伴潰鐮� - private String groundCode; - - //鍦伴潰鐮両D - private String qrCode; - - //鍦伴潰鐮佸亸绉粁 - private int offsetX; - - //鍦伴潰鐮佸亸绉粂 - private int offsetY; - - //鍦伴潰鐮佸亸绉晃� - private int groundCodeOffset0; - - //褰撳墠鐘舵�� - private int status; - - // 鏁呴殰鏍囧織 - private int faultFlag; - - // 鍏ヤ镜妫�娴嬫鏁� - private int intrusionCount; - - // 鏆傚瓨璐т綅鏁伴噺 - private int spareSpaceCount; - - - - + private byte type; } + -- Gitblit v1.9.1