![]() |
dnp3 (.NET API) 1.5.2
|
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< Nothing > | Read (AssociationId association, Request request) |
Perform a read on the association. More... | |
Task< Nothing > | ReadWithHandler (AssociationId association, Request request, IReadHandler handler) |
Perform a read on the association. More... | |
Task< Nothing > | Operate (AssociationId association, CommandMode mode, CommandSet command) |
Asynchronously perform a command operation on the association More... | |
Task< Nothing > | SynchronizeTime (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< Nothing > | WriteDeadBands (AssociationId association, WriteDeadBandRequest request) |
Perform a WRITE on the association using the supplied collection of dead-band headers More... | |
Task< Nothing > | SendAndExpectEmptyResponse (AssociationId association, FunctionCode function, Request headers) |
Send the specified request to the association using the supplied function and collection of request headers More... | |
Task< FileInfo > | GetFileInfo (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< Nothing > | CheckLinkStatus (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... | |
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.
|
inline |
Add an association to the channel
address | DNP3 data-link address of the remote outstation |
config | Association configuration |
readHandler | Interface uses to load measurement data |
associationHandler | Association specific callbacks such as time synchronization |
associationInformation | Association information interface |
ParamException |
|
inline |
Add a periodic poll to an association
Each result of the poll will be sent to the IReadHandler of the association.
id | Association on which to add the poll |
request | Request to perform |
period | Period to wait between each poll (in ms) |
ParamException |
|
inline |
Asynchronously perform a link status check
association | Id of the association |
System.Threading.Tasks.Task containing: Result of the link status
The returned Task may fail exceptionally with LinkStatusException
ParamException |
|
inline |
Asynchronously perform a cold restart operation to the association
association | Id of the association |
System.Threading.Tasks.Task containing: Result of the restart task
The returned Task may fail exceptionally with RestartException
ParamException |
|
inlinestatic |
Create a master channel on the specified serial port
The returned master must be gracefully shutdown with MasterChannel.Shutdown() when done.
runtime | Runtime to use to drive asynchronous operations of the master |
config | Generic configuration for the channel |
path | Path to the serial device. Generally /dev/tty0 on Linux and COM1 on Windows. |
serialParams | Serial port settings |
openRetryDelay | delay between attempts to open the serial port |
listener | Listener to receive updates on the status of the serial port |
null
if an error occurredParamException |
|
inlinestatic |
Create a master channel that connects to the specified TCP endpoint(s)
runtime | Runtime to use to drive asynchronous operations of the master |
linkErrorMode | Controls how link errors are handled with respect to the TCP session |
config | Generic configuration for the channel |
endpoints | List of IP endpoints. |
connectStrategy | Controls the timing of (re)connection attempts |
listener | TCP connection listener used to receive updates on the status of the connection |
null
if an error occurredParamException |
|
inlinestatic |
Create a master channel that connects to the specified TCP endpoint(s)
This is just like MasterChannel.CreateTcpChannel but adds the ConnectOptions parameter
runtime | Runtime to use to drive asynchronous operations of the master |
linkErrorMode | Controls how link errors are handled with respect to the TCP session |
config | Generic configuration for the channel |
endpoints | List of IP endpoints. |
connectStrategy | Controls the timing of (re)connection attempts |
connectOptions | Options that control the TCP connection process |
listener | TCP connection listener used to receive updates on the status of the connection |
null
if an error occurredParamException |
|
inlinestatic |
Create a master channel that connects to the specified TCP endpoint(s) and establish a TLS session with the remote.
runtime | Runtime to use to drive asynchronous operations of the master |
linkErrorMode | Controls how link errors are handled with respect to the TCP session |
config | Generic configuration for the channel |
endpoints | List of IP endpoints. |
connectStrategy | Controls the timing of (re)connection attempts |
listener | TCP connection listener used to receive updates on the status of the connection |
tlsConfig | TLS client configuration |
null
if an error occurredParamException |
|
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
runtime | Runtime to use to drive asynchronous operations of the master |
linkErrorMode | Controls how link errors are handled with respect to the TCP session |
config | Generic configuration for the channel |
endpoints | List of IP endpoints. |
connectStrategy | Controls the timing of (re)connection attempts |
connectOptions | Options that control the TCP connection process |
listener | TCP connection listener used to receive updates on the status of the connection |
tlsConfig | TLS client configuration |
null
if an error occurredParamException |
|
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.
pollId | Id of the poll |
ParamException |
|
inline |
stop communications
ParamException |
|
inline |
start communications
ParamException |
|
inline |
Get the decoding level for the channel
ParamException |
|
inline |
Asynchronously retrieve information on a particular file
association | Id of the association |
fileName | Complete path to the remote file |
System.Threading.Tasks.Task containing: Information about the requested file
The returned Task may fail exceptionally with FileException
ParamException |
|
inline |
Asynchronously perform a command operation on the association
association | Id of the association |
mode | Operation mode |
command | Command to send |
System.Threading.Tasks.Task containing: Result of the command task
The returned Task may fail exceptionally with CommandException
ParamException |
|
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.
association | Association on which to perform the read |
request | Request to send |
System.Threading.Tasks.Task containing: Result of the read task
The returned Task may fail exceptionally with ReadException
ParamException |
|
inline |
Asynchronously retrieve a directory listing
association | Id of the association |
dirPath | Complete path to the remote directory |
config | Configuration for the directory read operation |
System.Threading.Tasks.Task containing: System.Collections.Generic.ICollection<T> of FileInfo values
The returned Task may fail exceptionally with FileException
ParamException |
|
inline |
Asynchronously retrieve a directory listing by first obtaining an authentication key
association | Id of the association |
dirPath | Complete path to the remote directory |
config | Configuration for the directory read operation |
userName | User name sent to the outstation |
password | Password sent to the outstation |
System.Threading.Tasks.Task containing: System.Collections.Generic.ICollection<T> of FileInfo values
The returned Task may fail exceptionally with FileException
ParamException |
|
inline |
Start an operation to READ a file from the outstation using a IFileReader to receive data
association | Id of the association |
remoteFilePath | Path of the remote file |
config | Configuration for the read operation |
reader | Interface used to receive file data |
ParamException |
|
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
association | Id of the association |
remoteFilePath | Path of the remote file |
config | Configuration for the read operation |
reader | Interface used to receive file data |
userName | User name sent to the outstation |
password | Password sent to the outstation |
ParamException |
|
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.
association | Association on which to perform the read |
request | Request to send |
handler | Custom IReadHandler to send the data to |
System.Threading.Tasks.Task containing: Result of the read task
The returned Task may fail exceptionally with ReadException
ParamException |
|
inline |
Remove an association from the channel
id | Id of the association |
ParamException |
|
inline |
Add a periodic poll to an association
Each result of the poll will be sent to the IReadHandler of the association.
pollId | Id of the created poll |
ParamException |
|
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.
association | Association on which to perform the request |
function | Function code for the request |
headers | Headers that will be contained in the request |
System.Threading.Tasks.Task containing: Result of operation
The returned Task may fail exceptionally with EmptyResponseException
ParamException |
|
inline |
Set the decoding level for the channel
decodeLevel | Decoding level |
ParamException |
|
inline |
Shutdown a MasterChannel and release all resources
|
inline |
Asynchronously perform a time sync operation to the association
association | Id of the association |
mode | Time sync mode |
System.Threading.Tasks.Task containing: Result of the time synchronization task
The returned Task may fail exceptionally with TimeSyncException
ParamException |
|
inline |
Asynchronously perform a warm restart operation to the association
association | Id of the association |
System.Threading.Tasks.Task containing: Result of the restart task
The returned Task may fail exceptionally with RestartException
ParamException |
|
inline |
Perform a WRITE on the association using the supplied collection of dead-band headers
association | Association on which to perform the WRITE |
request | Request containing headers of analog input dead-bands (group 34) |
System.Threading.Tasks.Task containing: Result of operation
The returned Task may fail exceptionally with EmptyResponseException
ParamException |