package com.ard.work.component.netty.command.register;// RegisterMessage.java
|
|
import com.ard.work.component.netty.command.BaseCmd;
|
import io.netty.buffer.ByteBuf;
|
import lombok.Data;
|
|
/**
|
* 注册命令
|
*
|
* @author 刘苏义
|
* @date 2024/10/22 16:36
|
*/
|
@Data
|
public class RegisterReplyCmd extends BaseCmd {
|
private byte success;
|
|
public RegisterReplyCmd(byte success) {
|
setDataHeader((short) 0x6A77); // 设置帧头
|
setDataLength((short) (6)); // 数据长度
|
setCmdCode((byte) 0x01); // 设置命令编号
|
this.success = success;
|
}
|
|
@Override
|
public void encode(ByteBuf out) {
|
out.writeShort(getDataHeader()); // 写入数据头
|
out.writeShort(getDataLength()); // 写入数据长度
|
out.writeByte(getCmdCode()); // 写入命令码
|
out.writeByte(success); // 写入用户编号
|
}
|
}
|