package org.ts.ddcs.DataTemplate;


import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.ts.ddcs.log.LogHelper;
import org.ts.ddcs.Tool.BytesHelp;

/**
 * 0x11
 * 水资源 时钟同步
 */

@SuppressWarnings("all")
public class DataTemplateSzyC11 extends DataTemplateSzy2012 {

    private String dataInfo;

    @Override
    public  void  Stream(){
        try {
            if(this.dataArea.length>0){
                int count =0;
                JSONObject jsonData = new JSONObject();
                jsonData.put("func", "11");
                JSONArray datas = new JSONArray();

                datas.add("20" + BytesHelp.byte2HexStr(BytesHelp.subBytes(this.dataArea,count,5)));
                count +=5;


                count +=1;

                byte[] pw = BytesHelp.subBytes(this.dataArea,count,2);
                count +=2;
                byte[] tm = BytesHelp.subBytes(this.dataArea,count,4);
                count+=4;
                byte[] delay= BytesHelp.subBytes(this.dataArea,count,1);
                count+=1;
                jsonData.put("data", datas);
                this.dataInfo = jsonData.toJSONString();
                if (count != this.dataArea.length){
                    LogHelper.info("******************* 11 DATA ERROR******************* ");
                }
            }
        }catch (Exception e){
            LogHelper.error(e);
        }
    }

    @Override
    public String getDataInfo() {
        return dataInfo;
    }
}
