lib60870.NET
2.2.0
IEC 60870-5-101/104 Protocol Source Code Library for C#/.NET
|
A single connection to a CS 104 (IEC 60870-5-104) server. Implements the Master interface. More...
Public Member Functions | |
Connection (string hostname, int tcpPort=2404) | |
Initializes a new instance of the lib60870.CS104.Connection class. More... | |
Connection (string hostname, APCIParameters apciParameters, ApplicationLayerParameters alParameters) | |
Initializes a new instance of the lib60870.CS104.Connection class. More... | |
Connection (string hostname, int tcpPort, APCIParameters apciParameters, ApplicationLayerParameters alParameters) | |
Initializes a new instance of the lib60870.CS104.Connection class. More... | |
void | SetTlsSecurity (TlsSecurityInformation securityInfo) |
Set the security parameters for TLS More... | |
ConnectionStatistics | GetStatistics () |
Gets the conenction statistics. More... | |
void | SetConnectTimeout (int millies) |
Sets the connect timeout More... | |
override void | SendInterrogationCommand (CauseOfTransmission cot, int ca, byte qoi) |
Sends the interrogation command. More... | |
override void | SendCounterInterrogationCommand (CauseOfTransmission cot, int ca, byte qcc) |
Sends the counter interrogation command (C_CI_NA_1 typeID: 101) More... | |
override void | SendReadCommand (int ca, int ioa) |
Sends a read command (C_RD_NA_1 typeID: 102). More... | |
override void | SendClockSyncCommand (int ca, CP56Time2a time) |
Sends a clock synchronization command (C_CS_NA_1 typeID: 103). More... | |
override void | SendTestCommand (int ca) |
Sends a test command (C_TS_NA_1 typeID: 104). More... | |
override void | SendTestCommandWithCP56Time2a (int ca, ushort tsc, CP56Time2a time) |
Sends a test command with CP56Time2a time (C_TS_TA_1 typeID: 107). More... | |
override void | SendResetProcessCommand (CauseOfTransmission cot, int ca, byte qrp) |
Sends a reset process command (C_RP_NA_1 typeID: 105). More... | |
override void | SendDelayAcquisitionCommand (CauseOfTransmission cot, int ca, CP16Time2a delay) |
Sends a delay acquisition command (C_CD_NA_1 typeID: 106). More... | |
override void | SendControlCommand (CauseOfTransmission cot, int ca, InformationObject sc) |
Sends the control command. More... | |
override void | SendASDU (ASDU asdu) |
Sends an arbitrary ASDU to the connected slave More... | |
override ApplicationLayerParameters | GetApplicationLayerParameters () |
Get the application layer parameters used by this master instance More... | |
void | SendStartDT () |
Start data transmission on this connection More... | |
void | SendStopDT () |
Stop data transmission on this connection More... | |
void | Connect () |
Connect this instance. More... | |
void | ConnectAsync () |
Connects to the server (outstation). This is a non-blocking call. Before using the connection you have to check if the connection is already connected and running. More... | |
X509Certificate | LocalCertificateSelectionCallback (object sender, string targetHost, X509CertificateCollection localCertificates, X509Certificate remoteCertificate, string[] acceptableIssuers) |
void | Cancel () |
void | Close () |
void | SetASDUReceivedHandler (ASDUReceivedHandler handler, object parameter) |
Set the ASDUReceivedHandler. This handler is invoked whenever a new ASDU is received More... | |
void | SetConnectionHandler (ConnectionHandler handler, object parameter) |
Sets the connection handler. The connection handler is called when the connection is established or closed More... | |
override void | SetReceivedRawMessageHandler (RawMessageHandler handler, object parameter) |
Sets the raw message handler. This is a callback to intercept raw messages received. More... | |
override void | SetSentRawMessageHandler (RawMessageHandler handler, object parameter) |
Sets the sent message handler. This is a callback to intercept the sent raw messages More... | |
bool | IsTransmitBufferFull () |
Determines whether the transmit (send) buffer is full. If true the next send command will throw a ConnectionException More... | |
override void | GetFile (int ca, int ioa, NameOfFile nof, IFileReceiver receiver) |
Gets the file. More... | |
void | GetDirectory (int ca) |
Protected Member Functions | |
void | SendStartDT_CON () |
void | SendStopDT_CON () |
void | SendTestFR_ACT () |
void | SendTestFR_CON () |
Protected Attributes | |
int | tcpPort |
Protected Attributes inherited from lib60870.CS101.Master | |
bool | debugOutput |
Properties | |
bool | UseSendMessageQueue [get, set] |
Gets or sets a value indicating whether this lib60870.Connection use send message queue. More... | |
int | SendSequenceNumber [get, set] |
Gets or sets the send sequence number N(S). WARNING: For test purposes only! Do net set in real application! More... | |
bool | CheckSequenceNumbers [get, set] |
int | ReceiveSequenceNumber [get, set] |
Gets or sets the receive sequence number N(R). WARNING: For test purposes only! Do net set in real application! More... | |
bool | Autostart [get, set] |
Gets or sets a value indicating whether this lib60870.Connection is automatically sends a STARTDT_ACT message on startup. More... | |
ApplicationLayerParameters | Parameters [get] |
bool | IsRunning [get] |
Properties inherited from lib60870.CS101.Master | |
bool | DebugOutput [get, set] |
A single connection to a CS 104 (IEC 60870-5-104) server. Implements the Master interface.
lib60870.CS104.Connection.Connection | ( | string | hostname, |
int | tcpPort = 2404 |
||
) |
Initializes a new instance of the lib60870.CS104.Connection class.
hostname | hostname of IP address of the CS 104 server |
tcpPort | TCP port of the CS 104 server |
lib60870.CS104.Connection.Connection | ( | string | hostname, |
APCIParameters | apciParameters, | ||
ApplicationLayerParameters | alParameters | ||
) |
Initializes a new instance of the lib60870.CS104.Connection class.
hostname | hostname of IP address of the CS 104 server |
apciParameters | APCI parameters. |
alParameters | application layer parameters. |
lib60870.CS104.Connection.Connection | ( | string | hostname, |
int | tcpPort, | ||
APCIParameters | apciParameters, | ||
ApplicationLayerParameters | alParameters | ||
) |
Initializes a new instance of the lib60870.CS104.Connection class.
hostname | hostname of IP address of the CS 104 server |
tcpPort | TCP port of the CS 104 server |
apciParameters | APCI parameters. |
alParameters | application layer parameters. |
void lib60870.CS104.Connection.Connect | ( | ) |
Connect this instance.
The function will throw a SocketException if the connection attempt is rejected or timed out.
ConnectionException | description |
void lib60870.CS104.Connection.ConnectAsync | ( | ) |
Connects to the server (outstation). This is a non-blocking call. Before using the connection you have to check if the connection is already connected and running.
ConnectionException | description |
|
virtual |
Get the application layer parameters used by this master instance
Implements lib60870.CS101.Master.
|
virtual |
ConnectionStatistics lib60870.CS104.Connection.GetStatistics | ( | ) |
Gets the conenction statistics.
bool lib60870.CS104.Connection.IsTransmitBufferFull | ( | ) |
Determines whether the transmit (send) buffer is full. If true the next send command will throw a ConnectionException
true
if this instance is send buffer full; otherwise, false
.
|
virtual |
Sends an arbitrary ASDU to the connected slave
asdu | The ASDU to send |
Implements lib60870.CS101.Master.
|
virtual |
Sends a clock synchronization command (C_CS_NA_1 typeID: 103).
ca | Common address |
time | the new time to set |
ConnectionException | description |
Implements lib60870.CS101.Master.
|
virtual |
Sends the control command.
The type ID has to match the type of the InformationObject!
C_SC_NA_1 -> SingleCommand C_DC_NA_1 -> DoubleCommand C_RC_NA_1 -> StepCommand C_SC_TA_1 -> SingleCommandWithCP56Time2a C_SE_NA_1 -> SetpointCommandNormalized C_SE_NB_1 -> SetpointCommandScaled C_SE_NC_1 -> SetpointCommandShort C_BO_NA_1 -> Bitstring32Command
cot | Cause of transmission (use ACTIVATION to start a control sequence) |
ca | Common address |
sc | Information object of the command |
ConnectionException | description |
Implements lib60870.CS101.Master.
|
virtual |
Sends the counter interrogation command (C_CI_NA_1 typeID: 101)
cot | Cause of transmission |
ca | Common address |
qcc | Qualifier of counter interrogation command |
ConnectionException | description |
Implements lib60870.CS101.Master.
|
virtual |
Sends a delay acquisition command (C_CD_NA_1 typeID: 106).
cot | Cause of transmission |
ca | Common address |
delay | delay for acquisition |
ConnectionException | description |
Implements lib60870.CS101.Master.
|
virtual |
Sends the interrogation command.
cot | Cause of transmission |
ca | Common address |
qoi | Qualifier of interrogation (20 = station interrogation) |
ConnectionException | description |
Implements lib60870.CS101.Master.
|
virtual |
Sends a read command (C_RD_NA_1 typeID: 102).
This will send a read command C_RC_NA_1 (102) to the slave/outstation. The COT is always REQUEST (5). It is used to implement the cyclical polling of data application function.
ca | Common address |
ioa | Information object address |
ConnectionException | description |
Implements lib60870.CS101.Master.
|
virtual |
Sends a reset process command (C_RP_NA_1 typeID: 105).
cot | Cause of transmission |
ca | Common address |
qrp | Qualifier of reset process command |
ConnectionException | description |
Implements lib60870.CS101.Master.
void lib60870.CS104.Connection.SendStartDT | ( | ) |
Start data transmission on this connection
void lib60870.CS104.Connection.SendStopDT | ( | ) |
Stop data transmission on this connection
|
virtual |
Sends a test command (C_TS_NA_1 typeID: 104).
Not required and supported by IEC 60870-5-104.
ca | Common address |
ConnectionException | description |
Implements lib60870.CS101.Master.
|
virtual |
Sends a test command with CP56Time2a time (C_TS_TA_1 typeID: 107).
ca | Common address |
tsc | test sequence number |
time | test timestamp |
ConnectionException | description |
Implements lib60870.CS101.Master.
void lib60870.CS104.Connection.SetASDUReceivedHandler | ( | ASDUReceivedHandler | handler, |
object | parameter | ||
) |
Set the ASDUReceivedHandler. This handler is invoked whenever a new ASDU is received
handler | the handler to be called |
parameter | user provided parameter that is passed to the handler |
void lib60870.CS104.Connection.SetConnectionHandler | ( | ConnectionHandler | handler, |
object | parameter | ||
) |
Sets the connection handler. The connection handler is called when the connection is established or closed
handler | the handler to be called |
parameter | user provided parameter that is passed to the handler |
void lib60870.CS104.Connection.SetConnectTimeout | ( | int | millies | ) |
Sets the connect timeout
millies | timeout value in milliseconds (ms) |
|
virtual |
Sets the raw message handler. This is a callback to intercept raw messages received.
handler | Handler/delegate that will be invoked when a message is received |
parameter | will be passed to the delegate |
Implements lib60870.CS101.Master.
|
virtual |
Sets the sent message handler. This is a callback to intercept the sent raw messages
handler | Handler/delegate that will be invoked when a message is sent< |
parameter | will be passed to the delegate |
Implements lib60870.CS101.Master.
void lib60870.CS104.Connection.SetTlsSecurity | ( | TlsSecurityInformation | securityInfo | ) |
Set the security parameters for TLS
securityInfo | Security info. |
|
getset |
Gets or sets a value indicating whether this lib60870.Connection is automatically sends a STARTDT_ACT message on startup.
true
to send STARTDT_ACT message on startup; otherwise, false
.
|
getset |
Gets or sets the receive sequence number N(R). WARNING: For test purposes only! Do net set in real application!
The receive sequence number N(R)
|
getset |
Gets or sets the send sequence number N(S). WARNING: For test purposes only! Do net set in real application!
The send sequence number N(S)
|
getset |
Gets or sets a value indicating whether this lib60870.Connection use send message queue.
If true
the Connection stores the ASDUs to be sent in a Queue when the connection cannot send ASDUs. This is the case when the counterpart (slave/server) is (temporarily) not able to handle new message, or the slave did not confirm the reception of the ASDUs for other reasons. If false
the ASDU will be ignored and a lib60870.ConnectionException will be thrown in this case.
true
if use send message queue; otherwise, false
.