package com.pwt.netty.common.charger.client;

import com.pwt.netty.common.charger.RequestData;
import io.netty.buffer.ByteBuf;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/**
 * bms状态包
 */

@Getter
@Setter
@ToString
@EqualsAndHashCode(callSuper = true)
public class BmsStatusData extends RequestData {

    private byte[] data = new byte[77 - 1];


    @Override
    public void encode(ByteBuf byteBuf)
    {
        byteBuf.writeBytes(data);
        byteBuf.writeByte(getEnd());
    }

    @Override
    public void decode(ByteBuf byteBuf)
    {
        byteBuf.readBytes(data);
        byteBuf.skipBytes(1);
    }

    @Override
    public int getProtocolLength() {
        return 77;
    }

    @Override
    public byte getEnd() {
        return 0x16;
    }
}
