package org.ts.ddcs.DataItemTemplate;

import org.ts.ddcs.Tool.BytesHelp;

/**
 * 0x4A
 * 高锰酸盐指数
 */
@SuppressWarnings("all")
public class DataItemTemplateCODMN extends DataItemTemplate{
    @Override
    public byte[] Stream(byte[] data) {
        byte[] remain = data;
        if(this.macth){
            return remain;
        }
        int count=0;
        String fetureCode = BytesHelp.byte2HexStr(remain,count,1);
        count +=1;
        if(fetureCode.equals(this.feture)){
            byte[] len =  BytesHelp.subBytes(remain, count, 1);
            count +=1;
            int dataTotalLen = len[0]>>3;
            int decimalLen = len[0]&7;
            this.bigDecimalValue = BytesHelp.toDecimal(remain,count,dataTotalLen,decimalLen);
            count += dataTotalLen;
            remain =  BytesHelp.subBytes(remain, count, remain.length-count);
            this.macth=true;
        }
        return remain;
    }
}
