dnp3  0.9.0
Public Member Functions | Static Public Member Functions | List of all members
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)
 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...
 
Task< ReadResultRead (AssociationId association, Request request)
 Perform a read on the association. More...
 
Task< CommandResultOperate (AssociationId association, CommandMode mode, Commands command)
 Asynchronously perform a command operation on the association More...
 
Task< TimeSyncResultSynchronizeTime (AssociationId association, TimeSyncMode mode)
 Asynchronously perform a time sync operation to the association More...
 
Task< RestartResultColdRestart (AssociationId association)
 Asynchronously perform a cold restart operation to the association More...
 
Task< RestartResultWarmRestart (AssociationId association)
 Asynchronously perform a warm restart operation to the association More...
 
Task< LinkStatusResultCheckLinkStatus (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 CreateSerialChannel (Runtime runtime, MasterChannelConfig config, string path, SerialPortSettings 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 
)
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
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<LinkStatusResult> dnp3.MasterChannel.CheckLinkStatus ( AssociationId  association)
inline

Asynchronously perform a link status check

Parameters
associationId of the association
Returns
Result of the link status
Exceptions
ParamException

◆ ColdRestart()

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

Asynchronously perform a cold restart operation to the association

Parameters
associationId of the association
Returns
Result of the restart task
Exceptions
ParamException

◆ CreateSerialChannel()

static MasterChannel dnp3.MasterChannel.CreateSerialChannel ( Runtime  runtime,
MasterChannelConfig  config,
string  path,
SerialPortSettings  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

◆ 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

◆ Operate()

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

Asynchronously perform a command operation on the association

Parameters
associationId of the association
modeOperation mode
commandCommand to send
Returns
Result of the command task
Exceptions
ParamException

◆ Read()

Task<ReadResult> 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
Result of the read task
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

◆ 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<TimeSyncResult> 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
Result of the time synchronization task
Exceptions
ParamException

◆ WarmRestart()

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

Asynchronously perform a warm restart operation to the association

Parameters
associationId of the association
Returns
Result of the restart task
Exceptions
ParamException

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