Pu Zhibing
2025-03-24 87c2f1ec41e244dfdd4722884fcdf285a1fe9b41
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package com.ruoyi.dataInterchange.model;
 
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufUtil;
import io.netty.buffer.Unpooled;
import lombok.Data;
 
/**
 * 远程录像回放控制请求
 *
 * @author zhibing.pu
 * @Date 2025/3/21 10:30
 */
@Data
public class DOWNPlaybackMsgControl {
    /**
     * 车牌号
     */
    private String vehicleNo;
    /**
     * 车牌颜色
     */
    private Integer vehicleColor;
    /**
     * 子业务类型标识
     */
    private Integer dataType;
    /**
     * 后续数据长度
     */
    private Integer dataLength;
    /**
     * 控制指令
     * 0x00: 正常回放
     * 0x01: 暂停回放
     * 0x02: 结束回放
     * 0x03: 快进回放
     * 0x04: 关键帧快退回放
     * 0x05: 拖动回放
     * 0x06: 关键帧播放
     */
    private Integer controlType;
    /**
     * 快进或快退倍数,回放控制位0x03和0x04时,此字段内容有效,否则置0
     * 0x00: 无效
     * 0x01: 1倍
     * 0x02: 2倍
     * 0x03: 4倍
     * 0x04: 8倍
     * 0x05: 16倍
     */
    private Integer fastTime;
    /**
     * 拖动位置,回放控制为0x05时,此字段内容有效
     */
    private Long dateTime;
    
    
    /**
     * 编码回复报文
     */
    public byte[] encode() {
        ByteBuf byteBuf = Unpooled.buffer(38);
        byte[] bytes1 = this.getVehicleNo().getBytes();
        for (int i = 0; i < 21; i++) {
            if (i < bytes1.length) {
                byteBuf.writeByte(bytes1[i]);
            } else {
                byteBuf.writeByte(0x00);
            }
        }
        byteBuf.writeByte(this.getVehicleColor());
        byteBuf.writeShort(this.getDataType());
        byteBuf.writeInt(this.getDataLength());
        byteBuf.writeChar(this.getControlType());
        byteBuf.writeChar(this.getFastTime());
        if (null != this.getDateTime()) {
            byteBuf.writeLong(this.getDateTime());
        } else {
            byteBuf.writeLong(0x00);
        }
        byte[] bytes = ByteBufUtil.getBytes(byteBuf);
        byteBuf.release();
        return bytes;
    }
    
}