using System;
namespace NModbus.IO
{
///
/// Represents a serial resource.
/// Implementor - http://en.wikipedia.org/wiki/Bridge_Pattern
///
public interface IStreamResource : IDisposable
{
///
/// Indicates that no timeout should occur.
///
int InfiniteTimeout { get; }
///
/// Gets or sets the number of milliseconds before a timeout occurs when a read operation does not finish.
///
int ReadTimeout { get; set; }
///
/// Gets or sets the number of milliseconds before a timeout occurs when a write operation does not finish.
///
int WriteTimeout { get; set; }
///
/// Purges the receive buffer.
///
void DiscardInBuffer();
///
/// Reads a number of bytes from the input buffer and writes those bytes into a byte array at the specified offset.
///
/// The byte array to write the input to.
/// The offset in the buffer array to begin writing.
/// The number of bytes to read.
/// The number of bytes read.
int Read(byte[] buffer, int offset, int count);
///
/// Writes a specified number of bytes to the port from an output buffer, starting at the specified offset.
///
/// The byte array that contains the data to write to the port.
/// The offset in the buffer array to begin writing.
/// The number of bytes to write.
void Write(byte[] buffer, int offset, int count);
}
}