Class ModbusTransport
Inheritance
System.Object
ModbusTransport
Implements
System.IDisposable
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Assembly: NModbus.dll
Syntax
public abstract class ModbusTransport : IModbusTransport, IDisposable
Properties
|
Improve this Doc
View Source
Logger
Gets the logger for this instance.
Declaration
protected IModbusLogger Logger { get; }
Property Value
|
Improve this Doc
View Source
ReadTimeout
Gets or sets the number of milliseconds before a timeout occurs when a read operation does not finish.
Declaration
public int ReadTimeout { get; set; }
Property Value
Type |
Description |
System.Int32 |
|
|
Improve this Doc
View Source
Retries
Number of times to retry sending message after encountering a failure such as an IOException,
TimeoutException, or a corrupt message.
Declaration
public int Retries { get; set; }
Property Value
Type |
Description |
System.Int32 |
|
|
Improve this Doc
View Source
RetryOnOldResponseThreshold
If non-zero, this will cause a second reply to be read if the first is behind the sequence number of the
request by less than this number. For example, set this to 3, and if when sending request 5, response 3 is
read, we will attempt to re-read responses.
Declaration
public uint RetryOnOldResponseThreshold { get; set; }
Property Value
Type |
Description |
System.UInt32 |
|
|
Improve this Doc
View Source
SlaveBusyUsesRetryCount
If set, Slave Busy exception causes retry count to be used. If false, Slave Busy will cause infinite retries
Declaration
public bool SlaveBusyUsesRetryCount { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
StreamResource
Gets the stream resource.
Declaration
public IStreamResource StreamResource { get; }
Property Value
|
Improve this Doc
View Source
WaitToRetryMilliseconds
Gets or sets the number of milliseconds the tranport will wait before retrying a message after receiving
an ACKNOWLEGE or SLAVE DEVICE BUSY slave exception response.
Declaration
public int WaitToRetryMilliseconds { get; set; }
Property Value
Type |
Description |
System.Int32 |
|
|
Improve this Doc
View Source
WriteTimeout
Gets or sets the number of milliseconds before a timeout occurs when a write operation does not finish.
Declaration
public int WriteTimeout { get; set; }
Property Value
Type |
Description |
System.Int32 |
|
Methods
|
Improve this Doc
View Source
BuildMessageFrame(IModbusMessage)
Declaration
public abstract byte[] BuildMessageFrame(IModbusMessage message)
Parameters
Returns
Type |
Description |
System.Byte[] |
|
|
Improve this Doc
View Source
CreateResponse<T>(Byte[])
Declaration
public virtual IModbusMessage CreateResponse<T>(byte[] frame)where T : IModbusMessage, new ()
Parameters
Type |
Name |
Description |
System.Byte[] |
frame |
|
Returns
Type Parameters
|
Improve this Doc
View Source
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
|
Improve this Doc
View Source
Dispose(Boolean)
Releases unmanaged and - optionally - managed resources
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type |
Name |
Description |
System.Boolean |
disposing |
true to release both managed and unmanaged resources; false to release only
unmanaged resources.
|
|
Improve this Doc
View Source
OnShouldRetryResponse(IModbusMessage, IModbusMessage)
Provide hook to check whether receiving a response should be retried
Declaration
public virtual bool OnShouldRetryResponse(IModbusMessage request, IModbusMessage response)
Parameters
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
ReadRequest()
Declaration
public abstract byte[] ReadRequest()
Returns
Type |
Description |
System.Byte[] |
|
|
Improve this Doc
View Source
ReadResponse<T>()
Declaration
public abstract IModbusMessage ReadResponse<T>()where T : IModbusMessage, new ()
Returns
Type Parameters
|
Improve this Doc
View Source
ShouldRetryResponse(IModbusMessage, IModbusMessage)
Check whether we need to attempt to read another response before processing it (e.g. response was from previous request)
Declaration
public bool ShouldRetryResponse(IModbusMessage request, IModbusMessage response)
Parameters
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
UnicastMessage<T>(IModbusMessage)
Declaration
public virtual T UnicastMessage<T>(IModbusMessage message)where T : IModbusMessage, new ()
Parameters
Returns
Type Parameters
|
Improve this Doc
View Source
ValidateResponse(IModbusMessage, IModbusMessage)
Declaration
public void ValidateResponse(IModbusMessage request, IModbusMessage response)
Parameters
|
Improve this Doc
View Source
Write(IModbusMessage)
Declaration
public abstract void Write(IModbusMessage message)
Parameters
Implements
System.IDisposable