package com.example.agvcontroller.protocol; import java.io.Serializable; import java.util.ArrayList; import java.util.List; /** * 路径数据包 * Created by vincent on 2023/3/16 */ public class AGV_01_DOWN implements IMessageBody, Serializable { private static final long serialVersionUID = -2786382674008041014L; @Override public byte[] writeToBytes() { String serialNo = Utils.zeroFill(this.serialNo, 16); byte[] serialNoBytes = Utils.reverse(serialNo.getBytes()); //byte pathLen = (byte) actionItems.size(); byte[] pathBytes = new byte[0]; //for (AgvActionItem item : actionItems) { // //byte[] bytes = RadixTools.intToBytes(Integer.parseInt(item.getQrCode())); // //byte[] qrCodeBytes = Utils.reverse(bytes); // //byte actionCodeByte = (byte) item.getActionCmdType().actionCode; // //byte valByte = (byte) item.getVal(); // //byte[] actionBodyBytes = item.getActionBody().writeToBytes(); // //byte[] merge = Utils.merge(qrCodeBytes, actionCodeByte, valByte, actionBodyBytes); // pathBytes = Utils.merge(pathBytes, merge); //} return Utils.merge(serialNoBytes, pathLen, pathBytes); } @Override public void readFromBytes(byte[] messageBodyBytes) { } // 流水号 - 16 private String serialNo; // 路径长度 private int pathLen; // 路径列表 //private List> actionItems = new ArrayList<>(); }