puzhibing
2025-04-25 0dcba4fd1cb536ab426622e31213d8a0194449ff
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
package com.ruoyi.dataInterchange.model;
 
import com.ruoyi.dataInterchange.pojo.BaseModel;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import lombok.Data;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
 
/**
 * 远程录像回放控制请求应答
 *
 * @author zhibing.pu
 * @Date 2025/3/21 10:37
 */
@Data
@Document(indexName = "up_playback_msg_control_ack")
public class UPPlaybackMsgControlAck extends BaseModel {
    /**
     * 车牌号
     */
    @Field(type = FieldType.Text)
    private String vehicleNo;
    /**
     * 车牌颜色
     */
    @Field(type = FieldType.Integer)
    private Integer vehicleColor;
    /**
     * 子业务类型标识
     */
    @Field(type = FieldType.Integer)
    private Integer dataType;
    /**
     * 后续数据长度
     */
    @Field(type = FieldType.Integer)
    private Integer dataLength;
    /**
     * 应答结果
     * 0x00: 成功
     * 0x01: 失败
     * 0x02: 不支持
     * 0x03: 会话结束
     */
    @Field(type = FieldType.Integer)
    private int result;
    
    
    /**
     * 解析报文
     */
    public UPPlaybackMsgControlAck decode(PlaybackMsg playbackMsg) {
        try {
            byte[] data = playbackMsg.getData();
            ByteBuf byteBuf = Unpooled.wrappedBuffer(data);
            this.vehicleNo = playbackMsg.getVehicleNo();
            this.vehicleColor = playbackMsg.getVehicleColor();
            this.dataType = playbackMsg.getDataType();
            this.dataLength = playbackMsg.getDataLength();
            this.result = byteBuf.readByte();
        }catch (Exception e){
            e.printStackTrace();
        }
        return this;
    }
}