package com.zd.laboratory.socket.service.impl;


import com.zd.laboratory.socket.constant.JXCTPacket;
import com.zd.laboratory.socket.service.BaseRouter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import java.text.DecimalFormat;


/**
 * @author liubo
 *     @desc    : 传感器上报数据内容
 *     FE DC 0E 01 8C 8D 85 14 EF 08 00 00 00 00 4F 3D 40 AC DB
 */
@Service
public class SensorReportBody implements BaseRouter {
    private static Logger log = LoggerFactory.getLogger(SensorReportBody.class);

    /**
     * //0x03	0xXX数据上报内容
     * //命令解析：
     */
    public SensorReportBody() {
        routerMap.put("08", this);
    }

    DecimalFormat sdf = new DecimalFormat("##############0.0000");

    @Override
    public String routePacket(JXCTPacket tracketPacket) {

        long startPacketTime = System.currentTimeMillis();

        String commad = tracketPacket.body.substring(0, 2);
        log.info(tracketPacket.deviceNumber + " commad:" + commad);
        if ("00".equals(commad)) {
            log.info(tracketPacket.deviceNumber + "仅上报数据");
        } else if ("01".equals(commad)) {
            log.info(tracketPacket.deviceNumber + "上报数据+调光");
        }

        return null;
    }


}
