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
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/2/24 10:47
 */
@Data
public class UPConnectRsp {
    /**
     * 验证结果
     * 0x00:成功
     * 0x01:IP地址不正确
     * 0x02:接入码不正确
     * 0x03:用户没有注册
     * 0x04:密码错误
     * 0x05:资源紧张,超厚再连接(已经占用)
     * 0xFF::其他
     */
    private int result;
    /**
     * 校验码
     */
    private int verifyCode;
    
    /**
     * 编码登录回复报文
     */
    public byte[] encode() {
        ByteBuf byteBuf = Unpooled.buffer(5);
        byteBuf.writeByte(this.getResult());
        byteBuf.writeInt(this.getVerifyCode());
        byte[] bytes = ByteBufUtil.getBytes(byteBuf);
        byteBuf.release();
        return bytes;
    }
}