using ProtocalGeneral;

namespace ModBusTcp;

public interface IModBus<T_buffer>
{
    bool Initialize(string name, ITcpConnectNority tcpConnect);

    T_buffer GetBuffer(ushort index, ushort count, byte slaveAddress = 1);
    bool SetUshort(ushort index, ushort value, byte slaveAddress = 1);
    bool SetValue<T>(ushort index, T value, byte slaveAddress = 1) where T : struct;
    bool SetFloat(ushort index, float value, byte slaveAddress = 1);
    bool Open(string ip, ushort port, bool notify = true);
    bool Close();
}
