The FB_FtpClient function block is dedicated to unsecured FTP connections. It includes the related FTP functionalities for operations on files and directories. Each instance handles one unsecured FTP connection. In case you attempt to establish a second transfer, the function block responds with ET_Result.UnableToEstablishMutlipleConnections.
The FB_FtpClient function block is the user-interface to interact with the external FTP server via an unsecured connection.
After the function block has been enabled, an unsecured FTP connection is established using the user credentials that are submitted using iq_stCredentials. As soon as the unsecured connection has been established, the function block is capable of processing commands submitted by i_etCommand and a rising edge detected at i_xExecute.
As long as commands are executed, the output q_xBusy is set to TRUE. After a command has been successfully completed, q_xDone is set to TRUE.
Status messages and diagnostic information are provided using the outputs q_xError (TRUE if an error has been detected), q_etResult and q_etResultMsg.
To acknowledge detected errors, disable and re-enable the function block to be able to send a command.
When disabling the function block (i_xEnable = FALSE), it must be called as long as q_xActive = TRUE in order to complete the internal cleanup routines. Afterwards it can be re-enabled.
If a timeout is exceeded after the connection has been established, the execution of the next FTP command (ET_FtpCommand) is detected as an error. To avoid this behavior, enable the function block just before performing the related operations and disable it afterwards.
Input |
Data type |
Description |
---|---|---|
i_xEnable |
BOOL |
Activation and initialization of the function block. Refer to Operation of Function Blocks with the Input i_xEnable and i_xExecute. |
i_xExecute |
BOOL |
The command specified with the input i_etCommand is executed upon rising edge of this input. Refer to Operation of Function Blocks with the Input i_xEnable and i_xExecute. |
i_etCommand |
ET_FtpCommand |
The FTP command that is executed if the input i_xExecute is TRUE. |
Input/Output |
Data type |
Description |
---|---|---|
iq_stCredentials |
ST_Credentials |
Used to pass the structure containing user settings, such as user name or password. |
iq_stContent |
ST_Content |
Used to pass the working directory and, if applicable, the amount and names of files in this directory. |
Output |
Data type |
Description |
---|---|---|
q_xActive |
BOOL |
If the function block is active, the output is set to TRUE. |
q_xReady |
BOOL |
If the initialization is successful, the output is set to TRUE as long as the function block is capable of accepting inputs. |
q_xBusy |
BOOL |
If this output is set to TRUE, the function block executes the command specified at i_etCommand. |
q_xDone |
BOOL |
If this output is set to TRUE, the function block has successfully completed the command specified at i_etCommand. |
q_xError |
BOOL |
If this output is set to TRUE, an error has been detected. For details, refer to q_etResult and q_etResultMsg. |
q_etResult |
ET_Result |
Provides diagnostic and status information. |
q_sResultMsg |
STRING[255] |
Provides additional diagnostic and status information. |