dnp3 (.NET API) 1.5.2
Loading...
Searching...
No Matches
dnp3.MasterChannel Class Reference

Represents a communication channel for a master station More...

Public Member Functions

void Shutdown ()
 Shutdown a MasterChannel and release all resources More...
 
void Enable ()
 start communications More...
 
void Disable ()
 stop communications More...
 
AssociationId AddAssociation (ushort address, AssociationConfig config, IReadHandler readHandler, IAssociationHandler associationHandler, IAssociationInformation associationInformation)
 Add an association to the channel More...
 
void RemoveAssociation (AssociationId id)
 Remove an association from the channel More...
 
void SetDecodeLevel (DecodeLevel decodeLevel)
 Set the decoding level for the channel More...
 
DecodeLevel GetDecodeLevel ()
 Get the decoding level for the channel More...
 
PollId AddPoll (AssociationId id, Request request, TimeSpan period)
 Add a periodic poll to an association More...
 
void RemovePoll (PollId pollId)
 Add a periodic poll to an association More...
 
void DemandPoll (PollId pollId)
 Demand the immediate execution of a poll previously created with MasterChannel.AddPoll. More...
 
void ReadFile (AssociationId association, string remoteFilePath, FileReadConfig config, IFileReader reader)
 Start an operation to READ a file from the outstation using a IFileReader to receive data More...
 
void ReadFileWithAuth (AssociationId association, string remoteFilePath, FileReadConfig config, IFileReader reader, string userName, string password)
 Start an operation to READ a file from the outstation using a IFileReader to receive data More...
 
Task< NothingRead (AssociationId association, Request request)
 Perform a read on the association. More...
 
Task< NothingReadWithHandler (AssociationId association, Request request, IReadHandler handler)
 Perform a read on the association. More...
 
Task< NothingOperate (AssociationId association, CommandMode mode, CommandSet command)
 Asynchronously perform a command operation on the association More...
 
Task< NothingSynchronizeTime (AssociationId association, TimeSyncMode mode)
 Asynchronously perform a time sync operation to the association More...
 
Task< TimeSpan > ColdRestart (AssociationId association)
 Asynchronously perform a cold restart operation to the association More...
 
Task< TimeSpan > WarmRestart (AssociationId association)
 Asynchronously perform a warm restart operation to the association More...
 
Task< NothingWriteDeadBands (AssociationId association, WriteDeadBandRequest request)
 Perform a WRITE on the association using the supplied collection of dead-band headers More...
 
Task< NothingSendAndExpectEmptyResponse (AssociationId association, FunctionCode function, Request headers)
 Send the specified request to the association using the supplied function and collection of request headers More...
 
Task< FileInfoGetFileInfo (AssociationId association, string fileName)
 Asynchronously retrieve information on a particular file More...
 
Task< System.Collections.Generic.ICollection< FileInfo > > ReadDirectory (AssociationId association, string dirPath, DirReadConfig config)
 Asynchronously retrieve a directory listing More...
 
Task< System.Collections.Generic.ICollection< FileInfo > > ReadDirectoryWithAuth (AssociationId association, string dirPath, DirReadConfig config, string userName, string password)
 Asynchronously retrieve a directory listing by first obtaining an authentication key More...
 
Task< NothingCheckLinkStatus (AssociationId association)
 Asynchronously perform a link status check More...
 

Static Public Member Functions

static MasterChannel CreateTcpChannel (Runtime runtime, LinkErrorMode linkErrorMode, MasterChannelConfig config, EndpointList endpoints, ConnectStrategy connectStrategy, IClientStateListener listener)
 Create a master channel that connects to the specified TCP endpoint(s) More...
 
static MasterChannel CreateTcpChannel2 (Runtime runtime, LinkErrorMode linkErrorMode, MasterChannelConfig config, EndpointList endpoints, ConnectStrategy connectStrategy, ConnectOptions connectOptions, IClientStateListener listener)
 Create a master channel that connects to the specified TCP endpoint(s) More...
 
static MasterChannel CreateTlsChannel (Runtime runtime, LinkErrorMode linkErrorMode, MasterChannelConfig config, EndpointList endpoints, ConnectStrategy connectStrategy, IClientStateListener listener, TlsClientConfig tlsConfig)
 Create a master channel that connects to the specified TCP endpoint(s) and establish a TLS session with the remote. More...
 
static MasterChannel CreateTlsChannel2 (Runtime runtime, LinkErrorMode linkErrorMode, MasterChannelConfig config, EndpointList endpoints, ConnectStrategy connectStrategy, ConnectOptions connectOptions, IClientStateListener listener, TlsClientConfig tlsConfig)
 Create a master channel that connects to the specified TCP endpoint(s) and establish a TLS session with the remote. More...
 
static MasterChannel CreateSerialChannel (Runtime runtime, MasterChannelConfig config, string path, SerialSettings serialParams, TimeSpan openRetryDelay, IPortStateListener listener)
 Create a master channel on the specified serial port More...
 

Detailed Description

Represents a communication channel for a master station

To communicate with a particular outstation, you need to add an association with MasterChannel.AddAssociation.

Warning: The class methods that return a value (e.g. as MasterChannel.AddAssociation) cannot be called from within a callback.

Member Function Documentation

◆ AddAssociation()

AssociationId dnp3.MasterChannel.AddAssociation ( ushort  address,
AssociationConfig  config,
IReadHandler  readHandler,
IAssociationHandler  associationHandler,
IAssociationInformation  associationInformation 
)
inline

Add an association to the channel

Parameters
addressDNP3 data-link address of the remote outstation
configAssociation configuration
readHandlerInterface uses to load measurement data
associationHandlerAssociation specific callbacks such as time synchronization
associationInformationAssociation information interface
Returns
Id of the association
Exceptions
ParamException

◆ AddPoll()

PollId dnp3.MasterChannel.AddPoll ( AssociationId  id,
Request  request,
TimeSpan  period 
)
inline

Add a periodic poll to an association

Each result of the poll will be sent to the IReadHandler of the association.

Parameters
idAssociation on which to add the poll
requestRequest to perform
periodPeriod to wait between each poll (in ms)
Returns
Id of the created poll
Exceptions
ParamException

◆ CheckLinkStatus()

Task< Nothing > dnp3.MasterChannel.CheckLinkStatus ( AssociationId  association)
inline

Asynchronously perform a link status check

Parameters
associationId of the association
Returns

System.Threading.Tasks.Task containing: Result of the link status

The returned Task may fail exceptionally with LinkStatusException

Exceptions
ParamException

◆ ColdRestart()

Task< TimeSpan > dnp3.MasterChannel.ColdRestart ( AssociationId  association)
inline

Asynchronously perform a cold restart operation to the association

Parameters
associationId of the association
Returns

System.Threading.Tasks.Task containing: Result of the restart task

The returned Task may fail exceptionally with RestartException

Exceptions
ParamException

◆ CreateSerialChannel()

static MasterChannel dnp3.MasterChannel.CreateSerialChannel ( Runtime  runtime,
MasterChannelConfig  config,
string  path,
SerialSettings  serialParams,
TimeSpan  openRetryDelay,
IPortStateListener  listener 
)
inlinestatic

Create a master channel on the specified serial port

The returned master must be gracefully shutdown with MasterChannel.Shutdown() when done.

Parameters
runtimeRuntime to use to drive asynchronous operations of the master
configGeneric configuration for the channel
pathPath to the serial device. Generally /dev/tty0 on Linux and COM1 on Windows.
serialParamsSerial port settings
openRetryDelaydelay between attempts to open the serial port
listenerListener to receive updates on the status of the serial port
Returns
Handle to the master created, null if an error occurred
Exceptions
ParamException

◆ CreateTcpChannel()

static MasterChannel dnp3.MasterChannel.CreateTcpChannel ( Runtime  runtime,
LinkErrorMode  linkErrorMode,
MasterChannelConfig  config,
EndpointList  endpoints,
ConnectStrategy  connectStrategy,
IClientStateListener  listener 
)
inlinestatic

Create a master channel that connects to the specified TCP endpoint(s)

Parameters
runtimeRuntime to use to drive asynchronous operations of the master
linkErrorModeControls how link errors are handled with respect to the TCP session
configGeneric configuration for the channel
endpointsList of IP endpoints.
connectStrategyControls the timing of (re)connection attempts
listenerTCP connection listener used to receive updates on the status of the connection
Returns
Handle to the master created, null if an error occurred
Exceptions
ParamException

◆ CreateTcpChannel2()

static MasterChannel dnp3.MasterChannel.CreateTcpChannel2 ( Runtime  runtime,
LinkErrorMode  linkErrorMode,
MasterChannelConfig  config,
EndpointList  endpoints,
ConnectStrategy  connectStrategy,
ConnectOptions  connectOptions,
IClientStateListener  listener 
)
inlinestatic

Create a master channel that connects to the specified TCP endpoint(s)

This is just like MasterChannel.CreateTcpChannel but adds the ConnectOptions parameter

Parameters
runtimeRuntime to use to drive asynchronous operations of the master
linkErrorModeControls how link errors are handled with respect to the TCP session
configGeneric configuration for the channel
endpointsList of IP endpoints.
connectStrategyControls the timing of (re)connection attempts
connectOptionsOptions that control the TCP connection process
listenerTCP connection listener used to receive updates on the status of the connection
Returns
Handle to the master created, null if an error occurred
Exceptions
ParamException

◆ CreateTlsChannel()

static MasterChannel dnp3.MasterChannel.CreateTlsChannel ( Runtime  runtime,
LinkErrorMode  linkErrorMode,
MasterChannelConfig  config,
EndpointList  endpoints,
ConnectStrategy  connectStrategy,
IClientStateListener  listener,
TlsClientConfig  tlsConfig 
)
inlinestatic

Create a master channel that connects to the specified TCP endpoint(s) and establish a TLS session with the remote.

Parameters
runtimeRuntime to use to drive asynchronous operations of the master
linkErrorModeControls how link errors are handled with respect to the TCP session
configGeneric configuration for the channel
endpointsList of IP endpoints.
connectStrategyControls the timing of (re)connection attempts
listenerTCP connection listener used to receive updates on the status of the connection
tlsConfigTLS client configuration
Returns
Handle to the master created, null if an error occurred
Exceptions
ParamException

◆ CreateTlsChannel2()

static MasterChannel dnp3.MasterChannel.CreateTlsChannel2 ( Runtime  runtime,
LinkErrorMode  linkErrorMode,
MasterChannelConfig  config,
EndpointList  endpoints,
ConnectStrategy  connectStrategy,
ConnectOptions  connectOptions,
IClientStateListener  listener,
TlsClientConfig  tlsConfig 
)
inlinestatic

Create a master channel that connects to the specified TCP endpoint(s) and establish a TLS session with the remote.

This is just like MasterChannel.CreateTlsChannel but adds the ConnectOptions parameter

Parameters
runtimeRuntime to use to drive asynchronous operations of the master
linkErrorModeControls how link errors are handled with respect to the TCP session
configGeneric configuration for the channel
endpointsList of IP endpoints.
connectStrategyControls the timing of (re)connection attempts
connectOptionsOptions that control the TCP connection process
listenerTCP connection listener used to receive updates on the status of the connection
tlsConfigTLS client configuration
Returns
Handle to the master created, null if an error occurred
Exceptions
ParamException

◆ DemandPoll()

void dnp3.MasterChannel.DemandPoll ( PollId  pollId)
inline

Demand the immediate execution of a poll previously created with MasterChannel.AddPoll.

This method returns immediately. The result will be sent to the registered IReadHandler.

This method resets the internal timer of the poll.

Parameters
pollIdId of the poll
Exceptions
ParamException

◆ Disable()

void dnp3.MasterChannel.Disable ( )
inline

stop communications

Exceptions
ParamException

◆ Enable()

void dnp3.MasterChannel.Enable ( )
inline

start communications

Exceptions
ParamException

◆ GetDecodeLevel()

DecodeLevel dnp3.MasterChannel.GetDecodeLevel ( )
inline

Get the decoding level for the channel

Returns
Decode level
Exceptions
ParamException

◆ GetFileInfo()

Task< FileInfo > dnp3.MasterChannel.GetFileInfo ( AssociationId  association,
string  fileName 
)
inline

Asynchronously retrieve information on a particular file

Parameters
associationId of the association
fileNameComplete path to the remote file
Returns

System.Threading.Tasks.Task containing: Information about the requested file

The returned Task may fail exceptionally with FileException

Exceptions
ParamException

◆ Operate()

Task< Nothing > dnp3.MasterChannel.Operate ( AssociationId  association,
CommandMode  mode,
CommandSet  command 
)
inline

Asynchronously perform a command operation on the association

Parameters
associationId of the association
modeOperation mode
commandCommand to send
Returns

System.Threading.Tasks.Task containing: Result of the command task

The returned Task may fail exceptionally with CommandException

Exceptions
ParamException

◆ Read()

Task< Nothing > dnp3.MasterChannel.Read ( AssociationId  association,
Request  request 
)
inline

Perform a read on the association.

The callback will be called once the read is completely received, but the actual values will be sent to the IReadHandler of the association.

Parameters
associationAssociation on which to perform the read
requestRequest to send
Returns

System.Threading.Tasks.Task containing: Result of the read task

The returned Task may fail exceptionally with ReadException

Exceptions
ParamException

◆ ReadDirectory()

Task< System.Collections.Generic.ICollection< FileInfo > > dnp3.MasterChannel.ReadDirectory ( AssociationId  association,
string  dirPath,
DirReadConfig  config 
)
inline

Asynchronously retrieve a directory listing

Parameters
associationId of the association
dirPathComplete path to the remote directory
configConfiguration for the directory read operation
Returns

System.Threading.Tasks.Task containing: System.Collections.Generic.ICollection<T> of FileInfo values

The returned Task may fail exceptionally with FileException

Exceptions
ParamException

◆ ReadDirectoryWithAuth()

Task< System.Collections.Generic.ICollection< FileInfo > > dnp3.MasterChannel.ReadDirectoryWithAuth ( AssociationId  association,
string  dirPath,
DirReadConfig  config,
string  userName,
string  password 
)
inline

Asynchronously retrieve a directory listing by first obtaining an authentication key

Parameters
associationId of the association
dirPathComplete path to the remote directory
configConfiguration for the directory read operation
userNameUser name sent to the outstation
passwordPassword sent to the outstation
Returns

System.Threading.Tasks.Task containing: System.Collections.Generic.ICollection<T> of FileInfo values

The returned Task may fail exceptionally with FileException

Exceptions
ParamException

◆ ReadFile()

void dnp3.MasterChannel.ReadFile ( AssociationId  association,
string  remoteFilePath,
FileReadConfig  config,
IFileReader  reader 
)
inline

Start an operation to READ a file from the outstation using a IFileReader to receive data

Parameters
associationId of the association
remoteFilePathPath of the remote file
configConfiguration for the read operation
readerInterface used to receive file data
Exceptions
ParamException

◆ ReadFileWithAuth()

void dnp3.MasterChannel.ReadFileWithAuth ( AssociationId  association,
string  remoteFilePath,
FileReadConfig  config,
IFileReader  reader,
string  userName,
string  password 
)
inline

Start an operation to READ a file from the outstation using a IFileReader to receive data

This variant first requests an authentication key from the outstation using the supplied credentials

Parameters
associationId of the association
remoteFilePathPath of the remote file
configConfiguration for the read operation
readerInterface used to receive file data
userNameUser name sent to the outstation
passwordPassword sent to the outstation
Exceptions
ParamException

◆ ReadWithHandler()

Task< Nothing > dnp3.MasterChannel.ReadWithHandler ( AssociationId  association,
Request  request,
IReadHandler  handler 
)
inline

Perform a read on the association.

The callback will be called once the read is completely received, but the actual values will be sent to the IReadHandler passed as a parameter.

Parameters
associationAssociation on which to perform the read
requestRequest to send
handlerCustom IReadHandler to send the data to
Returns

System.Threading.Tasks.Task containing: Result of the read task

The returned Task may fail exceptionally with ReadException

Exceptions
ParamException

◆ RemoveAssociation()

void dnp3.MasterChannel.RemoveAssociation ( AssociationId  id)
inline

Remove an association from the channel

Parameters
idId of the association
Exceptions
ParamException

◆ RemovePoll()

void dnp3.MasterChannel.RemovePoll ( PollId  pollId)
inline

Add a periodic poll to an association

Each result of the poll will be sent to the IReadHandler of the association.

Parameters
pollIdId of the created poll
Exceptions
ParamException

◆ SendAndExpectEmptyResponse()

Task< Nothing > dnp3.MasterChannel.SendAndExpectEmptyResponse ( AssociationId  association,
FunctionCode  function,
Request  headers 
)
inline

Send the specified request to the association using the supplied function and collection of request headers

This is useful for constructing various types of WRITE and FREEZE operations where an empty response is expected from the outstation, and the only indication of success are bits in IIN.2.

The request will fail if 1) The response contains object headers or 2) One of the error bits in IIN.2 is set.

Parameters
associationAssociation on which to perform the request
functionFunction code for the request
headersHeaders that will be contained in the request
Returns

System.Threading.Tasks.Task containing: Result of operation

The returned Task may fail exceptionally with EmptyResponseException

Exceptions
ParamException

◆ SetDecodeLevel()

void dnp3.MasterChannel.SetDecodeLevel ( DecodeLevel  decodeLevel)
inline

Set the decoding level for the channel

Parameters
decodeLevelDecoding level
Exceptions
ParamException

◆ Shutdown()

void dnp3.MasterChannel.Shutdown ( )
inline

Shutdown a MasterChannel and release all resources

◆ SynchronizeTime()

Task< Nothing > dnp3.MasterChannel.SynchronizeTime ( AssociationId  association,
TimeSyncMode  mode 
)
inline

Asynchronously perform a time sync operation to the association

Parameters
associationId of the association
modeTime sync mode
Returns

System.Threading.Tasks.Task containing: Result of the time synchronization task

The returned Task may fail exceptionally with TimeSyncException

Exceptions
ParamException

◆ WarmRestart()

Task< TimeSpan > dnp3.MasterChannel.WarmRestart ( AssociationId  association)
inline

Asynchronously perform a warm restart operation to the association

Parameters
associationId of the association
Returns

System.Threading.Tasks.Task containing: Result of the restart task

The returned Task may fail exceptionally with RestartException

Exceptions
ParamException

◆ WriteDeadBands()

Task< Nothing > dnp3.MasterChannel.WriteDeadBands ( AssociationId  association,
WriteDeadBandRequest  request 
)
inline

Perform a WRITE on the association using the supplied collection of dead-band headers

Parameters
associationAssociation on which to perform the WRITE
requestRequest containing headers of analog input dead-bands (group 34)
Returns

System.Threading.Tasks.Task containing: Result of operation

The returned Task may fail exceptionally with EmptyResponseException

Exceptions
ParamException

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