package com.imdroid.ntripproxy.message;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @author Layton
 * @date 2023/2/2 20:50
 */
@Data
@EqualsAndHashCode(callSuper=true)
public class D341GgaMessage extends NtripMessage {
    @Override
    public void decodeBody(ByteBuf src) {
        fromDevice = true;
        // length, excluding pps,pitch,roll,yaw,shock
        int transMsgLen = src.readableBytes() - NON_NTRIP_HEAD_LEN-DEVICE_ID_OFFSET;

        // 修改d341为d332
        transBuf = Unpooled.buffer();
        transBuf.writeShort(0xd332);//head
        transBuf.writeShort(transMsgLen);//length
        transBuf.writeBytes(src,DEVICE_ID_OFFSET,4);//id
        transBuf.writeBytes(src,GGA_OFFSET,src.readableBytes()-GGA_OFFSET);
    }

}
