package com.unis.detectionnum.server.service;

import com.serotonin.modbus4j.exception.ErrorResponseException;
import com.serotonin.modbus4j.exception.ModbusInitException;
import com.serotonin.modbus4j.exception.ModbusTransportException;
import com.unis.detectionnum.common.vo.*;
import com.unis.detectionnum.server.entity.DeviceOperateDO;

import java.io.IOException;
import java.net.Socket;
import java.net.SocketTimeoutException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @Package: com.uins.sljc.server.service
 * @Author: LiuFeng
 * @Description:
 * @Date: Created in 2019/8/15
 */
public interface ScanPointsService {

	Map<String,Object> savePointsData(String ip, Integer port, Integer slaveId,Date startTime) throws ModbusTransportException, ErrorResponseException, ModbusInitException, IOException, InterruptedException;

    /**
     * @Description:根据设备code,设备检测记录id 查询点数数据列表
     * @param pointsQueryVO
     * @return List<ScanPointsVO> 点数数据信息列表
     */
    List<ScanPointsVO> getPointList(ScanPointsQueryVO pointsQueryVO);

    /**
     * @Description:根据设备信息查询设备列表
     * @param deviceInfoQueryVO
     * @return List<DeviceInfoVO> 设备信息列表
     */
	List<DeviceInfoVO> getDeviceInfoList(DeviceInfoQueryVO deviceInfoQueryVO);

	/**
     * @Description:根据设备信息查询设备检测记录列表
     * @param deviceInfoQueryVO
     * @return List<DeviceInfoVO> 设备检测记录列表
     */
	List<DeviceOperateVO> getDeviceOperateList(DeviceInfoQueryVO deviceInfoQueryVO);

	/** 
	 * @Title: test 
	 * @Description: TODO
	 * @param 
	 * @return void
	 * @throws 
	 */
	void test();

	/** 
	 * @Title: recordList 
	 * @Description: TODO
	 * @param scanDataQueryVO
	 * @param @return
	 * @return List<ScanDataRecordVO>
	 * @throws 
	 */
	List<ScanDataRecordVO> recordList(ScanDataQueryVO scanDataQueryVO);


	/** 
	 * @Title: getPointDataInfo 
	 * @Description: TODO
	 * @param operateId
	 * @return Double [] []
	 * @throws 
	 */
	ArrayList<ArrayList<Double>> getPointDataInfo(Map<String, Object> map);

    Map<String, Double> firstSend(Socket socket) throws IOException, InterruptedException;

    void callAlarm(Socket socket) throws IOException, InterruptedException;

    String getSbCodeByBh(String cfbh);

    List<GetXYVO> getNotZList();

    String getOperateId(String sbCode);

    List<GetXYVO> getNoZList(String operateId);

    List<GetXYVO> getNoZList2(String operateId);

    List<String> concatOders(List<GetXYVO> getxy);

    Double midland(Socket socket, Date scanStart, String sbCode, String operateId,double firstScanH,double CfHeight,double zLXGD,double wd,List<GetXYVO> noZList) throws InterruptedException, IOException;

    void midland2(Socket socket, Date scanStart, String sbCode, DeviceOperateDO deviceOperateDO, double firstScanH, double CfHeight, double zLXGD, double wd, List<GetXYVO> noZList) throws InterruptedException, IOException;

    void sendAlarm(AlarmParamVO alarmParamVO,String msg);

    void Completescan(Socket socket, Date scanStart, String sbCode) throws SocketTimeoutException,IOException, InterruptedException;

    void generateAlarm(Socket socket,String sbCode,String operateId,double wd) throws SocketTimeoutException,IOException, InterruptedException;

	public void secondScanByMaxZ(String sbcode, DeviceOperateVO currentOperates, Date scanStart, Socket socket, double cfHeight, double zLXGD, double wd, double secondScanH) throws SocketTimeoutException, IOException, InterruptedException;

	public DeviceOperateVO getOperate(String sbCode, Double h, Date scanStart,Integer sbSmcs,double extentRight,double extentLeft);

	public Map<String,Object> getCfByid(String id);


}
