package org.ts.ddcs.DataTemplate;

import org.ts.ddcs.log.LogHelper;
import org.ts.ddcs.Tool.BytesHelp;


/**
 * 2014水文规约
 * 链路维持报-功能码2F
 */
@SuppressWarnings("all")
public class DataTemplate2FExt extends DataTemplateExt {
    private byte[] serialNo;
    private byte[] sendPacketTime;

    @Override
    public byte[] SerialNo() {
        return this.serialNo;
    }

    @Override
    public byte[] SendPacketTime() {
        return this.sendPacketTime;
    }


    @Override
    public String GetViewName() {
        return "链接报";
    }

    @Override
    public void Stream() {
        try {
            if (dataLen > 0) {
                int count = 0;
                this.serialNo = BytesHelp.subBytes(this.dataArea, count, 2); //流水号
                count += 2;
                this.sendPacketTime = BytesHelp.subBytes(this.dataArea, count, 6); // 发报时间
                count += 6;

//                if (count != this.dataArea.length) {
//                    LogHelper.info("******************* 2F DATA ERROR******************* ");
//                }
            }
        } catch (Exception e) {
            LogHelper.error(e);
        }
    }
}
