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; }
///
/// 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);
}
}