namespace ConeCalorimeter.Services;

public interface ITcpDeviceConnectionService : IAsyncDisposable
{
    bool IsConnected { get; }

    string Endpoint { get; }

    string StatusText { get; }

    event EventHandler? ConnectionStatusChanged;

    Task StartAsync();

    Task StopAsync();

    bool TryReadFloat(ushort registerAddress, out double value);

    bool TryReadFloatValues(ushort registerAddress, out ModbusFloatReadResult result);

    bool TryReadInt16(ushort registerAddress, out int value);

    bool TryWriteInt16(ushort registerAddress, short value);

    bool TryWriteFloat(ushort registerAddress, float value);

    bool TryWriteFloat(ushort registerAddress, float value, ModbusFloatByteOrder byteOrder);

    bool TryReadCoil(ushort coilAddress, out bool value);

    bool TryWriteCoil(ushort coilAddress, bool value);
}
