#
whycq
2024-08-15 e54492fb532366faac8aa5d46ad8905ea3ff38d5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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<? extends IActionBody> 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<AgvActionItem<? extends IActionBody>> actionItems = new ArrayList<>();
 
}