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
package com.ruoyi.dataInterchange.model;
 
import com.ruoyi.dataInterchange.util.jtt809.common.Jtt809Util;
import io.netty.buffer.ByteBuf;
import lombok.Data;
 
/**
 * 主链路登录请求
 *
 * @author zhibing.pu
 * @Date 2025/2/24 10:43
 */
@Data
public class UPConnectReq {
    /**
     * 用户名
     */
    private int userId;
    /**
     * 密码
     */
    private String password;
    /**
     * 下级平台提供对应的从链路服务端IP地址
     */
    private String downLinkIp;
    /**
     * 下级平台提供对应的从链路服务端端口号
     */
    private int downLinkPort;
    
    
    /**
     * 解析登录报文
     */
    public UPConnectReq decode(ByteBuf byteBuf) {
        try {
            this.userId = byteBuf.readInt();
            this.password = Jtt809Util.readGBKString(byteBuf, 8);
            this.downLinkIp = Jtt809Util.readGBKString(byteBuf, 32);
            this.downLinkPort = byteBuf.readUnsignedShort();
        }catch (Exception e){
            e.printStackTrace();
        }
        return this;
    }
    
    
}