Represents a connected Master (Client) peer on a CS104.Slave server (MasterConnection in cs104_slave.c).
Provides peer response helpers that can be safely called both inside Slave callbacks
(interrogation_handler, asdu_handler, etc.) and from external processes:
Summary
Functions
Closes the master connection.
Returns the IEC60870.AppLayerParameters of this master connection.
Returns {ip_string, port} of the connected peer.
Checks whether this connection is currently in the active (STARTDT) state.
Checks whether this connection is ready to transmit an ASDU (IMasterConnection_isReady).
Sends an ACTIVATION_CON (or DEACTIVATION_CON if the request was DEACTIVATION) response
mirroring the request ASDU with negative flag set as specified.
Matches IMasterConnection_sendACT_CON in cs104_slave.c.
Sends an ACTIVATION_TERMINATION (:activation_termination) response mirroring the request ASDU.
Matches IMasterConnection_sendACT_TERM in cs104_slave.c.
Sends an ASDU over this specific master connection (or queues it in the high-priority queue). Safe to call from inside Slave callbacks or external processes.
Types
@type t() :: pid()
Functions
@spec close(t()) :: :ok
Closes the master connection.
@spec get_app_layer_parameters(t()) :: IEC60870.AppLayerParameters.t()
Returns the IEC60870.AppLayerParameters of this master connection.
@spec get_peer_address(t()) :: {:ok, {String.t(), non_neg_integer()}} | {:error, term()}
Returns {ip_string, port} of the connected peer.
Checks whether this connection is currently in the active (STARTDT) state.
Checks whether this connection is ready to transmit an ASDU (IMasterConnection_isReady).
@spec send_act_con(t(), IEC60870.ASDU.t(), boolean()) :: :ok | {:error, term()}
Sends an ACTIVATION_CON (or DEACTIVATION_CON if the request was DEACTIVATION) response
mirroring the request ASDU with negative flag set as specified.
Matches IMasterConnection_sendACT_CON in cs104_slave.c.
@spec send_act_term(t(), IEC60870.ASDU.t()) :: :ok | {:error, term()}
Sends an ACTIVATION_TERMINATION (:activation_termination) response mirroring the request ASDU.
Matches IMasterConnection_sendACT_TERM in cs104_slave.c.
@spec send_asdu(t(), IEC60870.ASDU.t()) :: :ok
Sends an ASDU over this specific master connection (or queues it in the high-priority queue). Safe to call from inside Slave callbacks or external processes.