rodbus (.NET API) 1.3.1
Loading...
Searching...
No Matches
rodbus.ClientChannel Class Reference

Abstract representation of a client communication channel. More...

Public Member Functions

void Shutdown ()
 Shutdown a ClientChannel and release all resources More...
 
void Enable ()
 Enable channel communications More...
 
void Disable ()
 Disable channel communications More...
 
void SetDecodeLevel (DecodeLevel level)
 Set the decoding level for the channel More...
 
Task< System.Collections.Generic.ICollection< BitValue > > ReadCoils (RequestParam param, AddressRange range)
 Start an asynchronous request to read coils More...
 
Task< System.Collections.Generic.ICollection< BitValue > > ReadDiscreteInputs (RequestParam param, AddressRange range)
 Start an asynchronous request to read discrete inputs More...
 
Task< System.Collections.Generic.ICollection< RegisterValue > > ReadHoldingRegisters (RequestParam param, AddressRange range)
 Start an asynchronous request to read holding registers More...
 
Task< System.Collections.Generic.ICollection< RegisterValue > > ReadInputRegisters (RequestParam param, AddressRange range)
 Start an asynchronous request to read input registers More...
 
Task< NothingWriteSingleCoil (RequestParam param, BitValue value)
 Write a single coil More...
 
Task< NothingWriteSingleRegister (RequestParam param, RegisterValue value)
 Write a single register More...
 
Task< NothingWriteMultipleCoils (RequestParam param, ushort start, System.Collections.Generic.ICollection< bool > items)
 Write multiple coils More...
 
Task< NothingWriteMultipleRegisters (RequestParam param, ushort start, System.Collections.Generic.ICollection< ushort > items)
 Write multiple registers More...
 

Static Public Member Functions

static ClientChannel CreateTcp (Runtime runtime, string host, ushort port, ushort maxQueuedRequests, RetryStrategy retryStrategy, DecodeLevel decodeLevel, IClientStateListener listener)
 Create a new TCP channel instance More...
 
static ClientChannel CreateRtu (Runtime runtime, string path, SerialPortSettings serialParams, ushort maxQueuedRequests, RetryStrategy retryStrategy, DecodeLevel decodeLevel, IPortStateListener listener)
 Create a new RTU channel instance More...
 
static ClientChannel CreateTls (Runtime runtime, string host, ushort port, ushort maxQueuedRequests, RetryStrategy retryStrategy, TlsClientConfig tlsConfig, DecodeLevel decodeLevel, IClientStateListener listener)
 Create a new TLS channel instance More...
 

Detailed Description

Abstract representation of a client communication channel.

The underlying channel may be TCP, TLS, or serial.

Member Function Documentation

◆ CreateRtu()

static ClientChannel rodbus.ClientChannel.CreateRtu ( Runtime  runtime,
string  path,
SerialPortSettings  serialParams,
ushort  maxQueuedRequests,
RetryStrategy  retryStrategy,
DecodeLevel  decodeLevel,
IPortStateListener  listener 
)
inlinestatic

Create a new RTU channel instance

Parameters
runtimeruntime on which to create the channel
pathPath to the serial device. Generally /dev/tty0 on Linux and COM1 on Windows.
serialParamsSerial port settings
maxQueuedRequestsMaximum number of requests to queue before failing the next request
retryStrategyStrategy which controls how long to wait between attempts to open the serial port after failures
decodeLevelDecode levels for this client
listenerListener used to receive updates on the status of the serial port
Returns
Pointer to the created channel
Exceptions
ParamException

◆ CreateTcp()

static ClientChannel rodbus.ClientChannel.CreateTcp ( Runtime  runtime,
string  host,
ushort  port,
ushort  maxQueuedRequests,
RetryStrategy  retryStrategy,
DecodeLevel  decodeLevel,
IClientStateListener  listener 
)
inlinestatic

Create a new TCP channel instance

Parameters
runtimeRuntime on which to create the channel
hostIP (v4/v6) or host name remote endpoint
portremote port
maxQueuedRequestsMaximum number of requests to queue before failing the next request
retryStrategyReconnection timing strategy
decodeLevelDecode levels for this client
listenerTCP connection listener used to receive updates on the status of the channel
Returns
Pointer to the created channel
Exceptions
ParamException

◆ CreateTls()

static ClientChannel rodbus.ClientChannel.CreateTls ( Runtime  runtime,
string  host,
ushort  port,
ushort  maxQueuedRequests,
RetryStrategy  retryStrategy,
TlsClientConfig  tlsConfig,
DecodeLevel  decodeLevel,
IClientStateListener  listener 
)
inlinestatic

Create a new TLS channel instance

Parameters
runtimeRuntime on which to create the channel
hostIP (v4/v6) or host name remote endpoint
portremote port
maxQueuedRequestsMaximum number of requests to queue before failing the next request
retryStrategyReconnection timing strategy
tlsConfigTLS client configuration
decodeLevelDecode levels for this client
listenerTCP connection listener used to receive updates on the status of the channel
Returns
Pointer to the created channel or null if an error occurred
Exceptions
ParamException

◆ Disable()

void rodbus.ClientChannel.Disable ( )
inline

Disable channel communications

Warning: May not be called from within the context of the runtime

Exceptions
ParamException

◆ Enable()

void rodbus.ClientChannel.Enable ( )
inline

Enable channel communications

Warning: May not be called from within the context of the runtime

Exceptions
ParamException

◆ ReadCoils()

Task< System.Collections.Generic.ICollection< BitValue > > rodbus.ClientChannel.ReadCoils ( RequestParam  param,
AddressRange  range 
)
inline

Start an asynchronous request to read coils

Parameters
paramParameters for the request
rangeRange of addresses to read
Returns

System.Threading.Tasks.Task containing: response

The returned Task may fail exceptionally with RequestException

Exceptions
ParamException

◆ ReadDiscreteInputs()

Task< System.Collections.Generic.ICollection< BitValue > > rodbus.ClientChannel.ReadDiscreteInputs ( RequestParam  param,
AddressRange  range 
)
inline

Start an asynchronous request to read discrete inputs

Parameters
paramParameters for the request
rangeRange of addresses to read
Returns

System.Threading.Tasks.Task containing: response

The returned Task may fail exceptionally with RequestException

Exceptions
ParamException

◆ ReadHoldingRegisters()

Task< System.Collections.Generic.ICollection< RegisterValue > > rodbus.ClientChannel.ReadHoldingRegisters ( RequestParam  param,
AddressRange  range 
)
inline

Start an asynchronous request to read holding registers

Parameters
paramParameters for the request
rangeRange of addresses to read
Returns

System.Threading.Tasks.Task containing: response

The returned Task may fail exceptionally with RequestException

Exceptions
ParamException

◆ ReadInputRegisters()

Task< System.Collections.Generic.ICollection< RegisterValue > > rodbus.ClientChannel.ReadInputRegisters ( RequestParam  param,
AddressRange  range 
)
inline

Start an asynchronous request to read input registers

Parameters
paramParameters for the request
rangeRange of addresses to read
Returns

System.Threading.Tasks.Task containing: response

The returned Task may fail exceptionally with RequestException

Exceptions
ParamException

◆ SetDecodeLevel()

void rodbus.ClientChannel.SetDecodeLevel ( DecodeLevel  level)
inline

Set the decoding level for the channel

Parameters
levelDecoding level
Exceptions
ParamException

◆ Shutdown()

void rodbus.ClientChannel.Shutdown ( )
inline

Shutdown a ClientChannel and release all resources

◆ WriteMultipleCoils()

Task< Nothing > rodbus.ClientChannel.WriteMultipleCoils ( RequestParam  param,
ushort  start,
System.Collections.Generic.ICollection< bool >  items 
)
inline

Write multiple coils

Parameters
paramParameters for the request
startStarting address
itemsList of items to write
Returns

System.Threading.Tasks.Task containing: response

The returned Task may fail exceptionally with RequestException

Exceptions
ParamException

◆ WriteMultipleRegisters()

Task< Nothing > rodbus.ClientChannel.WriteMultipleRegisters ( RequestParam  param,
ushort  start,
System.Collections.Generic.ICollection< ushort >  items 
)
inline

Write multiple registers

Parameters
paramParameters for the request
startStarting address
itemsList of items to write
Returns

System.Threading.Tasks.Task containing: response

The returned Task may fail exceptionally with RequestException

Exceptions
ParamException

◆ WriteSingleCoil()

Task< Nothing > rodbus.ClientChannel.WriteSingleCoil ( RequestParam  param,
BitValue  value 
)
inline

Write a single coil

Parameters
paramParameters for the request
valueAddress and value to write
Returns

System.Threading.Tasks.Task containing: response

The returned Task may fail exceptionally with RequestException

Exceptions
ParamException

◆ WriteSingleRegister()

Task< Nothing > rodbus.ClientChannel.WriteSingleRegister ( RequestParam  param,
RegisterValue  value 
)
inline

Write a single register

Parameters
paramParameters for the request
valueAddress and value to write
Returns

System.Threading.Tasks.Task containing: response

The returned Task may fail exceptionally with RequestException

Exceptions
ParamException

The documentation for this class was generated from the following file: