Pu Zhibing
2025-03-07 297512bc22b179b7038d96a1ff033eceaed38c4b
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
package com.ruoyi.dataInterchange.util.jtt809.packet.common;
 
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
 
import java.io.Serializable;
 
/**
 * @author tucke
 */
@SuppressWarnings("SpellCheckingInspection")
@AllArgsConstructor
@NoArgsConstructor
@Data
public class OuterPacket implements Serializable {
 
    private static final long serialVersionUID = 1L;
 
    /**
     * 数据长度(包括头标识、数据头、数据体和尾标识)
     */
    private long length;
    /**
     * 报文序列号
     * 占用四个字节,为发送信息的序列号,用于接收方检测是否有信息的丢失,上级平台和下级平台接自己发送数据包的个数计数,互不影响。
     * 程序开始运行时等于零,发送第一帧数据时开始计数,到最大数后自动归零
     */
    private long sn;
    /**
     * 业务数据类型
     */
    private int id;
    /**
     * 下级平台接入码,上级平台给下级平台分配唯一标识码
     */
    private int gnsscenterId;
    /**
     * 协议版本号标识,上下级平台之间采用的标准协议版编号
     * 长度为 3 个字节来表示,0x01 0x02 0x0F 表示的版本号是 v1.2.15,以此类推
     */
    private String version;
    /**
     * 报文加密标识位
     * 0 - 报文不加密
     * 1 - 报文加密, 后继相应业务的数据体采用 ENCRYPT_KEY 对应的密钥进行加密处理
     */
    private byte encryptFlag;
    /**
     * 数据加密解密的密匙,长度为 4 个字节
     */
    private long encryptKey;
    /**
     * 消息体
     */
    private byte[] body;
    /**
     * 数据 CRC 校验码
     */
    private int crcCode;
 
    public OuterPacket(int id, byte[] body) {
        this.id = id;
        this.body = body;
    }
 
    public OuterPacket(int id, int gnsscenterId, byte[] body) {
        this.id = id;
        this.gnsscenterId = gnsscenterId;
        this.body = body;
    }
 
}