package com.dcs.equipment.service;

import com.dcs.equipment.domain.Condition;
import com.dcs.equipment.domain.DeviceRequest;
import com.dcs.hnyz.domain.EquipmentParam;
import com.dcs.hnyz.domain.vo.EquipmentParamFormVO;
import com.intelligt.modbus.jlibmodbus.exception.ModbusIOException;
import com.intelligt.modbus.jlibmodbus.exception.ModbusNumberException;
import com.intelligt.modbus.jlibmodbus.exception.ModbusProtocolException;

import java.util.List;

/**
 * @author wangpx
 * @date: 2025-03-13 09:16
 */
public interface ModbusTcpService {
    /**
     * 数据孪生查询设备数据
     */
    List<EquipmentParamFormVO> getDataTwinEquipmentValues();

    // 判断条件全部满足
    boolean processIfAllConditionsMet(List<EquipmentParam> targets, List<Condition> conditions) throws ModbusProtocolException, ModbusNumberException, ModbusIOException;
    // 判断条件有一个满足
    boolean processIfAnyConditionMet(List<EquipmentParam> targets, List<Condition> conditions) throws ModbusProtocolException, ModbusNumberException, ModbusIOException;
    // modbus tcp 获取数据
    List<Object> getValues(DeviceRequest request) throws ModbusProtocolException, ModbusNumberException, ModbusIOException;
    // 设置多个线圈数据
    void setCoils(DeviceRequest request) throws ModbusProtocolException, ModbusNumberException, ModbusIOException;
    // 设置单个线圈数据
    void setCoil(DeviceRequest request) throws ModbusProtocolException, ModbusNumberException, ModbusIOException;
    // 设置多个寄存器整型数据
    void setIntRegisters(DeviceRequest request) throws ModbusProtocolException, ModbusNumberException, ModbusIOException;
    // 设置单个寄存器整型数据
    void setIntRegister(DeviceRequest request) throws ModbusProtocolException, ModbusNumberException, ModbusIOException;
    // 设置多个寄存器浮点数据
    void setFloatRegisters(DeviceRequest request) throws ModbusProtocolException, ModbusNumberException, ModbusIOException;
    // 设置单个寄存器浮点数据
    void setFloatRegister(DeviceRequest request) throws ModbusProtocolException, ModbusNumberException, ModbusIOException;
}
