30 #ifndef SRC_INC_API_CS101_MASTER_H_
31 #define SRC_INC_API_CS101_MASTER_H_
struct sCS101_ASDU * CS101_ASDU
Application Service Data Unit (ASDU) for the CS101/CS104 application layer.
Definition: iec60870_common.h:216
void(* IEC60870_RawMessageHandler)(void *parameter, uint8_t *msg, int msgSize, bool sent)
Callback handler for sent and received messages.
Definition: iec60870_common.h:105
void(* IEC60870_LinkLayerStateChangedHandler)(void *parameter, int address, LinkLayerState newState)
Callback handler for link layer state changes.
Definition: iec60870_common.h:91
IEC60870_LinkLayerMode
link layer mode for serial link layers
Definition: iec60870_common.h:64
uint8_t QualifierOfInterrogation
Qualifier of interrogation (QUI) according to IEC 60870-5-101:2003 7.2.6.22.
Definition: cs101_information_objects.h:146
void CS101_Master_sendTestCommand(CS101_Master self, int ca)
Send a test command (C_TS_NA_1 typeID: 104)
void CS101_Master_sendLinkLayerTestFunction(CS101_Master self)
Manually send link layer test function.
void CS101_Master_setDIR(CS101_Master self, bool dir)
Set the value of the DIR bit when sending messages (only balanced mode)
void CS101_Master_sendASDU(CS101_Master self, CS101_ASDU asdu)
Send a user specified ASDU.
void CS101_Master_setRawMessageHandler(CS101_Master self, IEC60870_RawMessageHandler handler, void *parameter)
Set the raw message callback (called when a message is sent or received)
void CS101_Master_useSlaveAddress(CS101_Master self, int address)
Set the slave address for the following send functions.
void CS101_Master_destroy(CS101_Master self)
Destroy the master instance and release all resources.
void CS101_Master_stop(CS101_Master self)
Stops the background thread that handles the link layer connections.
void CS101_Master_sendProcessCommand(CS101_Master self, CS101_CauseOfTransmission cot, int ca, InformationObject command)
Send a process command to the controlled (or other) station.
struct sCS101_Master * CS101_Master
CS101_Master type.
Definition: cs101_master.h:55
void CS101_Master_start(CS101_Master self)
Start a background thread that handles the link layer connections.
void CS101_Master_pollSingleSlave(CS101_Master self, int address)
Poll a slave (only unbalanced mode)
void CS101_Master_sendReadCommand(CS101_Master self, int ca, int ioa)
Sends a read command (C_RD_NA_1 typeID: 102)
LinkLayerParameters CS101_Master_getLinkLayerParameters(CS101_Master self)
Returns the link layer parameters object of this master instance.
bool CS101_Master_isChannelReady(CS101_Master self, int address)
Is the channel ready to transmit an ASDU (only unbalanced mode)
void CS101_Master_sendCounterInterrogationCommand(CS101_Master self, CS101_CauseOfTransmission cot, int ca, uint8_t qcc)
send a counter interrogation command
void CS101_Master_setLinkLayerStateChanged(CS101_Master self, IEC60870_LinkLayerStateChangedHandler handler, void *parameter)
Set a callback handler for link layer state changes.
void CS101_Master_run(CS101_Master self)
Receive a new message and run the protocol state machine(s).
void CS101_Master_setIdleTimeout(CS101_Master self, int timeoutInMs)
Set the idle timeout (only for balanced mode)
CS101_Master CS101_Master_create(SerialPort port, const LinkLayerParameters llParameters, const CS101_AppLayerParameters alParameters, IEC60870_LinkLayerMode mode)
Create a new master instance.
void CS101_Master_addSlave(CS101_Master self, int address)
Add a new slave connection.
void CS101_Master_sendInterrogationCommand(CS101_Master self, CS101_CauseOfTransmission cot, int ca, QualifierOfInterrogation qoi)
send an interrogation command
void CS101_Master_setOwnAddress(CS101_Master self, int address)
Set the own link layer address (only balanced mode)
CS101_Master CS101_Master_createEx(SerialPort serialPort, const LinkLayerParameters llParameters, const CS101_AppLayerParameters alParameters, IEC60870_LinkLayerMode linkLayerMode, int queueSize)
Create a new master instance and specify message queue size (for balanced mode)
CS101_AppLayerParameters CS101_Master_getAppLayerParameters(CS101_Master self)
Returns the application layer parameters object of this master instance.
void CS101_Master_setASDUReceivedHandler(CS101_Master self, CS101_ASDUReceivedHandler handler, void *parameter)
Register a callback handler for received ASDUs.
void CS101_Master_sendClockSyncCommand(CS101_Master self, int ca, CP56Time2a time)
Sends a clock synchronization command (C_CS_NA_1 typeID: 103)
Common master side definitions for IEC 60870-5-101/104 These types are used by CS101/CS104 master.
bool(* CS101_ASDUReceivedHandler)(void *parameter, int address, CS101_ASDU asdu)
Callback handler for received ASDUs.
Definition: iec60870_master.h:53
Parameters for serial link layers.
Definition: iec60870_common.h:255
Definition: iec60870_common.h:112
Definition: link_layer_parameters.h:42