using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace AMWD.Protocols.Modbus.Common.Contracts
{
///
/// Represents a Modbus connection.
///
public interface IModbusConnection : IDisposable
{
///
/// The connection type name.
///
string Name { get; }
///
/// Gets or sets the idle time after that the connection is closed.
///
///
/// Set to to disable idle closing the connection.
///
/// Set to to close the connection immediately after each request.
///
TimeSpan IdleTimeout { get; set; }
///
/// Gets or sets the maximum time until the connect attempt is given up.
///
TimeSpan ConnectTimeout { get; set; }
///
/// Gets or sets the before a time-out occurs when a read/receive operation does not finish.
///
TimeSpan ReadTimeout { get; set; }
///
/// Gets or sets the before a time-out occurs when a write/send operation does not finish.
///
TimeSpan WriteTimeout { get; set; }
///
/// Invokes a Modbus request.
///
/// The Modbus request serialized in bytes.
/// A function to validate whether the response is complete.
/// A cancellation token used to propagate notification that this operation should be canceled.
/// A list of s containing the response.
Task> InvokeAsync(IReadOnlyList request, Func, bool> validateResponseComplete, CancellationToken cancellationToken = default);
}
}