Wago App FTP
Wago App FTP
Wago App FTP
Release 1.3.1.3
1 Description 1
i
2.2.3 FbFTPES_DirRemove (FB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
2.2.4 FbFTPES_FileAppend (FB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
2.2.5 FbFTPES_FileAppendFromMem (FB) . . . . . . . . . . . . . . . . . . . . . . . . . 71
2.2.6 FbFTPES_FileRead (FB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
2.2.7 FbFTPES_FileReadToMem (FB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
2.2.8 FbFTPES_FileRemove (FB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
2.2.9 FbFTPES_FileRename (FB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
2.2.10 FbFTPES_FileWrite (FB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
2.2.11 FbFTPES_FileWriteFromMem (FB) . . . . . . . . . . . . . . . . . . . . . . . . . 85
2.2.12 FbFTPES_List (FB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
2.3 FTPS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
2.3.1 FbFTPS (FB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
FbFTPS.DirCreate (METH) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
FbFTPS.DirRemove (METH) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
FbFTPS.FileAppend (METH) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
FbFTPS.FileAppendFromMem (METH) . . . . . . . . . . . . . . . . . . . . . . . . 98
FbFTPS.FileRead (METH) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
FbFTPS.FileReadToMem (METH) . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
FbFTPS.FileRemove (METH) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
FbFTPS.FileRename (METH) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
FbFTPS.FileWrite (METH) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
FbFTPS.FileWriteFromMem (METH) . . . . . . . . . . . . . . . . . . . . . . . . . 108
FbFTPS.List (METH) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
2.3.2 FbFTPS_DirCreate (FB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
2.3.3 FbFTPS_DirRemove (FB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
2.3.4 FbFTPS_FileAppend (FB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
2.3.5 FbFTPS_FileAppendFromMem (FB) . . . . . . . . . . . . . . . . . . . . . . . . . 118
2.3.6 FbFTPS_FileRead (FB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
2.3.7 FbFTPS_FileReadToMem (FB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
2.3.8 FbFTPS_FileRemove (FB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
2.3.9 FbFTPS_FileRename (FB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
2.3.10 FbFTPS_FileWrite (FB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
2.3.11 FbFTPS_FileWriteFromMem (FB) . . . . . . . . . . . . . . . . . . . . . . . . . . 132
2.3.12 FbFTPS_List (FB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
2.4 SFTP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
2.4.1 FbSFTP (FB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
FbSFTP.DirCreate (METH) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
FbSFTP.DirRemove (METH) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
FbSFTP.FileAppend (METH) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
FbSFTP.FileAppendFromMem (METH) . . . . . . . . . . . . . . . . . . . . . . . . 145
FbSFTP.FileRead (METH) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
FbSFTP.FileReadToMem (METH) . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
FbSFTP.FileRemove (METH) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
FbSFTP.FileRename (METH) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
FbSFTP.FileWrite (METH) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
FbSFTP.FileWriteFromMem (METH) . . . . . . . . . . . . . . . . . . . . . . . . . 154
FbSFTP.List (METH) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
2.4.2 FbSFTP_DirCreate (FB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
2.4.3 FbSFTP_DirRemove (FB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
2.4.4 FbSFTP_FileAppend (FB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
2.4.5 FbSFTP_FileAppendFromMem (FB) . . . . . . . . . . . . . . . . . . . . . . . . . 163
2.4.6 FbSFTP_FileRead (FB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
2.4.7 FbSFTP_FileReadToMem (FB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
2.4.8 FbSFTP_FileRemove (FB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
2.4.9 FbSFTP_FileRename (FB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
2.4.10 FbSFTP_FileWrite (FB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
2.4.11 FbSFTP_FileWriteFromMem (FB) . . . . . . . . . . . . . . . . . . . . . . . . . . 174
2.4.12 FbSFTP_List (FB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
ii
3 80 Status 179
3.1 Status (GVL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
iii
CHAPTER 1
Description
This document is automatically generated. Because of this, the chapter 30 Visualization is not shown in this
document. If you are interested in getting to know more about visualization, we refer to the library manager of
e!Cockpit.
Subject to Changes
WAGO Kontakttechnik GmbH & Co. KG reserves the right to provide for any alterations or modifications. WAGO
Kontakttechnik GmbH & Co. KG owns all rights arising from the granting of patents or from the legal protection
of utility patents. Third-party products are always mentioned without any reference to patent rights. Thus, the
existence of such rights cannot be excluded.
Personnel Qualification
All tasks that are carried out with libraries made for the e!COCKPIT software must only be performed by qualified
electrical specialists instructed in PLC programming according to IEC 61131-3.
All tasks that have an effect on the properties or the behavior of automation hardware or software products must
only be performed by qualified employees with a thorough knowledge of handling the products concerned.
Intended Use of e!COCKPIT Libraries
Libraries created for the e!COCKPIT software are used to simplify the development of application projects in the
IEC 61131-3 programming languages.
For automation tasks, WAGO offers programmable logic controllers in a wide variety of performance classes.
In combination with a wide range of I/O modules, the controllers can process standard types of field signals.
Controllers can be implemented centrally or in decentralized configurations. The controllers offer interfaces for
the most commonly used fieldbuses for use in decentralized configurations. Fieldbus independent I/O modules
are then linked via fieldbus couplers. WAGO controllers offer a runtime environment for user programs called
e!RUNTIME. Software projects for implementation in e!RUNTIME environments can be created in e!COCKPIT.
The programming environment in e!COCKPIT is based on the established CODESYS 3 industrial standard. Users
with a previous knowledge of CODESYS 3 will thus find this environment largely familiar. The following pro-
gramming languages of the IEC 61131-3 standard are available:
• Structured Text (ST)
• Ladder Diagram (LD)
• Function Block Diagram (FBD)
• Instruction List (IL)
• Sequential Function Chart (SFC)
1
WagoAppFTP, Release 1.3.1.3
2
CHAPTER 2
2.1 FTP
2.1.1 FbFTP (FB)
Interface variables
3
WagoAppFTP, Release 1.3.1.3
Function Description
The FbFTP is the base function block for FTP-Client-Services. The Fb provide functions like read and write files,
rename or remove files and create or remove directories.
The inputs of the FbFTP handle the gerneral information for the FTP connection and the outputs signal the process
and the result of the operations. The operations are triggered by call the specific method for the operation. After a
call the methods will return immediately and the FbFTP start the operation.
Example:
VAR
FbFTP : WagoAppFTP.FbFTP;
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
iState : INT;
//List
sListBuffer : STRING(255);
//Write
sTxBuffer : STRING(255) := 'Hello World!';
//Read
sRxBuffer : STRING(255);
END_VAR
FbFTP(
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
tKeepAlive:= T#5S,
2.1. FTP 4
WagoAppFTP, Release 1.3.1.3
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
1:
//Creates the directory 'NewDir' and the file 'HelloWorld.txt'. Writes
˓→the data from sTxBuffer into the new file.
FbFTP.FileWriteFromMem(sRemotePath := 'NewDir/HelloWorld.txt',
˓→pTxBuffer := ADR(sTxBuffer), udiTxNBytes := LENGTH(sTxBuffer), xCreateDirs :=
˓→TRUE);
2:
//Create a new directory. A Path with '//' at the begin starts in the
˓→root directory
FbFTP.DirCreate(sRemotePath := '//root/NewDir/NewDir2');
3:
//Makes a directory.
FbFTP.List(sRemotePath := 'NewDir', pRxBuffer := ADR(sListBuffer),
˓→udiRxBufferSize := SIZEOF(sListBuffer), sFileSpec := '*.txt', xWithDetails :=
˓→TRUE);
4:
//Rename and replace the file.
FbFTP.FileRename(sOldFileName := '//root/NewDir/HelloWorld.txt',
˓→sNewFileName := 'NewDir/NewDir2/Rename.txt');
5:
//Reads the data from the file.
FbFTP.FileReadToMem(sRemotePath := '//root/NewDir/NewDir2/Rename.txt',
˓→pRxBuffer := ADR(sRxBuffer), udiRxBufferSize := SIZEOF(sRxBuffer));
6:
//Removes the file.
FbFTP.FileRemove(sRemotePath := 'NewDir/NewDir2/Rename.txt');
7:
//Removes a directory
FbFTP.DirRemove(sRemotePath := '//root/NewDir/NewDir2');
8:
//Removes a directory
FbFTP.DirRemove(sRemotePath := 'NewDir/');
99:
//Some Error Handling
END_CASE
END_IF
FbFTP.DirCreate (METH)
Interface variables
2.1. FTP 5
WagoAppFTP, Release 1.3.1.3
Function description
This method starts an operation to create a new directory specified by sRemotePath. The method create only
the last directory in the path. If a directory in the path is missing or the driectory, that schould create, already
exists an error occur.
The status and result of the operation are displayed by the outputs of the FbFTP.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY
The Fb is already in process. No new operation can start while xBusy is TRUE Wag-
oTypes.eResultCode.EINVAL The input is invalid =============================
=====================================================================================
Example:
VAR
FbFTP : WagoAppFTP.FbFTP;
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo : BOOL;
END_VAR
FbFTP(
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
2.1. FTP 6
WagoAppFTP, Release 1.3.1.3
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
FbFTP.DirCreate(sRemotePath := '//root/NewDir');
xDo := FALSE;
END_IF
FbFTP.DirRemove (METH)
Interface variables
Function description
This method starts an operation to remove the directory, that is specified by sRemotePath. An error is returned
if the directory does not exists, the dircectory cannot removed (in use, or not empty), or if the user does not have
the appropriate privilege level.
The status and result of the operation are displayed by the outputs of the FbFTP.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY
The Fb is already in process. No new operation can start while xBusy is TRUE Wag-
oTypes.eResultCode.EINVAL The input is invalid =============================
=====================================================================================
Example:
VAR
FbFTP : WagoAppFTP.FbFTP;
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
2.1. FTP 7
WagoAppFTP, Release 1.3.1.3
udiNBytesTransfered: UDINT;
xDo : BOOL;
END_VAR
FbFTP(
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
FbFTP.DirRemove(sRemotePath := '//root/NewDir');
xDo := FALSE;
END_IF
FbFTP.FileAppend (METH)
Interface variables
Function description
2.1. FTP 8
WagoAppFTP, Release 1.3.1.3
This method starts an operation to append a local file specified by sLocalPath to the end of a file on the remote
host specified by sRemotePath. If the remote file dosen´t exit, it will be created.
For ‘’sLocalPath” you can use the following prefixes, known form WagoAppFileDir:
• HOME://
• CARD://
• TEMP://
• ROOT://
The status and result of the operation are displayed by the outputs of the FbFTP.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY The Fb is al-
ready in process. No new operation can start while xBusy is TRUE WagoTypes.eResultCode.EINVAL The input
is invalid WagoTypes.eResultCode.ENOENT The local file dosen´t exist =============================
=====================================================================================
Example:
VAR
FbFTP : WagoAppFTP.FbFTP;
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo : BOOL;
END_VAR
FbFTP(
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
xDo := FALSE;
END_IF
FbFTP.FileAppendFromMem (METH)
Interface variables
2.1. FTP 9
WagoAppFTP, Release 1.3.1.3
Function description
This method starts an operation to append data from the TxBuffer to the end of a file on the remote host specified
by sRemotePath. If the remote file dosen´t exit, it will be created.
The status and result of the operation are displayed by the outputs of the FbFTP.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY
The Fb is already in process. No new operation can start while xBusy is TRUE Wag-
oTypes.eResultCode.EINVAL The input is invalid =============================
=====================================================================================
Example:
VAR
FbFTP : WagoAppFTP.FbFTP;
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo : BOOL;
//Append
sTxBuffer : STRING(255) := 'Hello World!';
END_VAR
FbFTP(
2.1. FTP 10
WagoAppFTP, Release 1.3.1.3
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
xDo := FALSE;
END_IF
FbFTP.FileRead (METH)
Interface variables
Function description
This method starts an operation to reads the data form the remote file, that is specified by the input parameter
sRemotePath, and stored it in the local file, that is specified by the input parameter sLocalPath.
For ‘’sLocalPath” you can use the following prefixes, known form WagoAppFileDir:
• HOME://
• CARD://
2.1. FTP 11
WagoAppFTP, Release 1.3.1.3
• TEMP://
• ROOT://
The status and result of the operation are displayed by the outputs of the FbFTP.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY
The Fb is already in process. No new operation can start while xBusy is TRUE Wag-
oTypes.eResultCode.EINVAL The input is invalid =============================
=====================================================================================
Example:
VAR
FbFTP : WagoAppFTP.FbFTP;
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo : BOOL;
//Read
sRxBuffer : STRING(255);
END_VAR
FbFTP(
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
xDo := FALSE;
END_IF
FbFTP.FileReadToMem (METH)
Interface variables
2.1. FTP 12
WagoAppFTP, Release 1.3.1.3
Function description
This method starts an operation to reads the data form the remote file, that is specified by the input parame-
ter sRemotePath, and stored it in the RxBuffer, that is specified by the input parameter pRxBuffer and
udiRxBufferSize.
The status and result of the operation are displayed by the outputs of the FbFTP.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY
The Fb is already in process. No new operation can start while xBusy is TRUE Wag-
oTypes.eResultCode.EINVAL The input is invalid =============================
=====================================================================================
Example:
VAR
FbFTP : WagoAppFTP.FbFTP;
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo : BOOL;
//Read
sRxBuffer : STRING(255);
END_VAR
FbFTP(
sServer:= '192.168.1.17',
uiPort:= 0,
2.1. FTP 13
WagoAppFTP, Release 1.3.1.3
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
xDo := FALSE;
END_IF
FbFTP.FileRemove (METH)
Interface variables
Function description
This method starts an operation to remove the file, that is specified by sRemotePath. An error is returned if the
file does not exists, the file cannot be removed, or if the user does not have the appropriate privilege level.
The status and result of the operation are displayed by the outputs of the FbFTP.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY
The Fb is already in process. No new operation can start while xBusy is TRUE Wag-
oTypes.eResultCode.EINVAL The input is invalid =============================
=====================================================================================
2.1. FTP 14
WagoAppFTP, Release 1.3.1.3
Example:
VAR
FbFTP : WagoAppFTP.FbFTP;
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo : BOOL;
END_VAR
FbFTP(
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
xDo := FALSE;
END_IF
FbFTP.FileRename (METH)
Interface variables
2.1. FTP 15
WagoAppFTP, Release 1.3.1.3
Function description
This method starts an operation to rename the file, that is defined by the input parameter sOldFileName, to the
name, that is defined by the input parameter sNewFileName.
The status and result of the operation are displayed by the outputs of the FbFTP.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY
The Fb is already in process. No new operation can start while xBusy is TRUE Wag-
oTypes.eResultCode.EINVAL The input is invalid =============================
=====================================================================================
Example:
VAR
FbFTP : WagoAppFTP.FbFTP;
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo : BOOL;
END_VAR
FbFTP(
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
˓→directory
xDo := FALSE;
2.1. FTP 16
WagoAppFTP, Release 1.3.1.3
END_IF
FbFTP.FileWrite (METH)
Interface variables
Function description
This method starts an operation to write the data form the local file, that is specified by the input parameter
sLocalPath, to the remote file, that is specified by the input parameter sRemotePath.
If the remote file exit, it will be overwritten.
For ‘’sLocalPath” you can use the following prefixes, known form WagoAppFileDir:
• HOME://
• CARD://
• TEMP://
• ROOT://
The status and result of the operation are displayed by the outputs of the FbFTP.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY The Fb is al-
ready in process. No new operation can start while xBusy is TRUE WagoTypes.eResultCode.EINVAL The input
is invalid WagoTypes.eResultCode.ENOENT The local file dosen´t exist =============================
=====================================================================================
Example:
VAR
FbFTP : WagoAppFTP.FbFTP;
xBusy: BOOL;
2.1. FTP 17
WagoAppFTP, Release 1.3.1.3
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo : BOOL;
END_VAR
FbFTP(
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
xDo := FALSE;
END_IF
FbFTP.FileWriteFromMem (METH)
Interface variables
2.1. FTP 18
WagoAppFTP, Release 1.3.1.3
Function description
This method starts an operation to write the data from the TxBuffer to a file on the remote host specified by
sRemotePath. If the remote file exit, it will be overwritten.
The status and result of the operation are displayed by the outputs of the FbFTP.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY
The Fb is already in process. No new operation can start while xBusy is TRUE Wag-
oTypes.eResultCode.EINVAL The input is invalid =============================
=====================================================================================
Example:
VAR
FbFTP : WagoAppFTP.FbFTP;
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo : BOOL;
//Append
sTxBuffer : STRING(255) := 'Hello World!';
END_VAR
FbFTP(
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
2.1. FTP 19
WagoAppFTP, Release 1.3.1.3
xDo := FALSE;
END_IF
FbFTP.List (METH)
Interface variables
Function description
This method starts an operation to performs a directory listing. The linsting includ only those files that match the
specification stored in‘‘sFileSpec‘‘. The input parameter pRxBuffer is pointing to the first element of the buffer
and the buffersize is defined by the input parameter udiRxBufferSize.
If more details of the files and direcotries should list, the input parameter xWithDetails must set to true.
The status and result of the operation are displayed by the outputs of the FbFTP.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY
The Fb is already in process. No new operation can start while xBusy is TRUE Wag-
oTypes.eResultCode.EINVAL The input is invalid =============================
=====================================================================================
Example:
VAR
FbFTP : WagoAppFTP.FbFTP;
2.1. FTP 20
WagoAppFTP, Release 1.3.1.3
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo : BOOL;
//List
sListBuffer : STRING(255);
END_VAR
FbFTP(
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
xDo := FALSE;
END_IF
2.1. FTP 21
WagoAppFTP, Release 1.3.1.3
Function description
This functionblock create a new directory specified by sRemotePath. The Fb create only the last directory in
the path. If a directory in the path is missing or the driectory, that schould create, already exists an error occur.
2.1. FTP 22
WagoAppFTP, Release 1.3.1.3
Transition to TRUE on xTrigger triggers the process to create a new directory. The function block resets
xTrigger to FALSE again after it has finished the process. If something went wrong during the process
xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function block is
still processing.
Example
VAR
FbFTP_DirCreate : WagoAppFTP.FbFTP_DirCreate;
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
END_VAR
FbFTP_DirCreate(
xTrigger:= Trigger,
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sRemotePath:= 'NewDir',
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus);
2.1. FTP 23
WagoAppFTP, Release 1.3.1.3
Function description
This functionblock remove remove the directory, that is specified by sRemotePath. An error is returned if the
directory does not exists, the dircectory cannot be removed (in use, or not empty), or if the user does not have the
appropriate privilege level.
2.1. FTP 24
WagoAppFTP, Release 1.3.1.3
Transition to TRUE on xTrigger triggers the process to remove a directory. The function block resets
xTrigger to FALSE again after it has finished the process. If something went wrong during the process
xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function block is
still processing.
Example
VAR
FbFTP_DirRemove : WagoAppFTP.FbFTP_DirRemove;
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
END_VAR
FbFTP_DirRemove(
xTrigger:= Trigger,
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sRemotePath:= 'NewDir',
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus);
2.1. FTP 25
WagoAppFTP, Release 1.3.1.3
2.1. FTP 26
WagoAppFTP, Release 1.3.1.3
Function description
This functionblock append a local file specified by sLocalPath to the end of a file on the remote host specified
by sRemotePath. If the remote file dosen´t exit, it will be created.
Transition to TRUE on xTrigger triggers the process to append the local file to the remote file. The function
block resets xTrigger to FALSE again after it has finished the process. If something went wrong during the
process xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function
block is still processing.
For ‘’sLocalPath” you can use the following prefixes, known form WagoAppFileDir:
• HOME://
• CARD://
• TEMP://
• ROOT://
Example
VAR
FbFTP_FileAppend : WagoAppFTP.FbFTP_FileAppend;
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesTransfered: UDINT;
END_VAR
FbFTP_FileAppend(
xTrigger:= Trigger,
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sLocalPath:= 'HOME://testbench/myfirstfile.txt',
sRemotePath:= 'Append.txt',
xCreateDirs:= FALSE,
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus,
udiNBytesTransfered=> udiNBytesTransfered);
2.1. FTP 27
WagoAppFTP, Release 1.3.1.3
2.1. FTP 28
WagoAppFTP, Release 1.3.1.3
Function description
Thisfunction block append data from the TxBuffer to the end of a file on the remote host specified by
sRemotePath. If the remote file dosen´t exit, it will be created.
Transition to TRUE on xTrigger triggers the process to append the transfer buffer to the remote file. The
function block resets xTrigger to FALSE again after it has finished the process. If something went wrong
during the process xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that
the function block is still processing.
Example
VAR
FbFTP_FileAppendFromMem : WagoAppFTP.FbFTP_FileAppendFromMem;
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesTransfered: UDINT;
FbFTP_FileAppendFromMem(
xTrigger:= Trigger,
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sRemotePath:= 'AppendFromMem.txt',
pTxBuffer:= ADR(sTxBuffer),
udiTxNBytes := LENGTH(sTxBuffer),
xCreateDirs := FALSE,
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus,
udiNBytesTransfered=> udiNBytesTransfered);
2.1. FTP 29
WagoAppFTP, Release 1.3.1.3
2.1. FTP 30
WagoAppFTP, Release 1.3.1.3
Function description
This functionblock reads the data form the remote file, that is specified by the input parameter sRemotePath,
and stored it in the local file, that is specified by the input parameter sLocalPath.
Transition to TRUE on xTrigger triggers the process to read the remote file to a local file. The function block
resets xTrigger to FALSE again after it has finished the process. If something went wrong during the process
xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function block is
still processing.
For ‘’sLocalPath” you can use the following prefixes, known form WagoAppFileDir:
• HOME://
• CARD://
• TEMP://
• ROOT://
Example
VAR
FbFTP_FileRead : WagoAppFTP.FbFTP_FileRead;
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
END_VAR
FbFTP_FileRead(
xTrigger:= Trigger,
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sLocalPath:= 'Read.txt',
sRemotePath:= 'Some.txt',
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
2.1. FTP 31
WagoAppFTP, Release 1.3.1.3
2.1. FTP 32
WagoAppFTP, Release 1.3.1.3
Function description
This functionblock reads the data form the remote file, that is specified by the input parameter sRemotePath,
and stored it in the RxBuffer, that is specified by the input parameter pRxBuffer and udiRxBufferSize. If
the remote file not exist or the parameter pRxBuffer and udiRxBufferSize are 0 then an error occur.
Transition to TRUE on xTrigger triggers the process to remove a remote file. The function block resets
xTrigger to FALSE again after it has finished the process. If something went wrong during the process
xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function block is
still processing.
Example
VAR
FbFTP_FileReadToMem : WagoAppFTP.FbFTP_FileReadToMem;
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
sRxBuffer : STRING(255);
END_VAR
FbFTP_FileReadToMem(
xTrigger:= Trigger,
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sRemotePath:= 'Some.txt',
pRxBuffer:= ADR(sRxBuffer),
udiRxBufferSize:= SIZEOF(sRxBuffer),
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
2.1. FTP 33
WagoAppFTP, Release 1.3.1.3
Function description
This functionblock remove the file, that is specified by sRemotePath. An error is returned if the file does not
exists, the file cannot be removed, or if the user does not have the appropriate privilege level.
2.1. FTP 34
WagoAppFTP, Release 1.3.1.3
Transition to TRUE on xTrigger triggers the process to remove a remote file. The function block resets
xTrigger to FALSE again after it has finished the process. If something went wrong during the process
xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function block is
still processing.
Example
VAR
FbFTP_FileRemove : WagoAppFTP.FbFTP_FileRemove;
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
END_VAR
FbFTP_FileRemove(
xTrigger:= Trigger,
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sRemotePath:= 'AppendFromMem.txt',
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus);
2.1. FTP 35
WagoAppFTP, Release 1.3.1.3
2.1. FTP 36
WagoAppFTP, Release 1.3.1.3
Function description
This functionblock rename the file, that is defined by the input parameter sOldFileName, to the name, that is
defined by the input parameter sNewFileName.
Transition to TRUE on xTrigger triggers the process to rename a remote file. The function block resets
xTrigger to FALSE again after it has finished the process. If something went wrong during the process
xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function block is
still processing.
Example:
VAR
FbFTP_FileRename : WagoAppFTP.FbFTP_FileRename;
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
END_VAR
FbFTP_FileRename(
xTrigger:= Trigger,
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sOldFileName:= 'Test.txt',
sNewFileName:= 'Rename.txt',
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus);
2.1. FTP 37
WagoAppFTP, Release 1.3.1.3
2.1. FTP 38
WagoAppFTP, Release 1.3.1.3
Function description
This functionblock write the data form the local file, that is specified by the input parameter sLocalPath, to the
remote file, that is specified by the input parameter sRemotePath.
Transition to TRUE on xTrigger triggers the process to write the local file to the remote file. The function block
resets xTrigger to FALSE again after it has finished the process. If something went wrong during the process
xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function block is
still processing.
For ‘’sLocalPath” you can use the following prefixes, known form WagoAppFileDir:
• HOME://
• CARD://
• TEMP://
• ROOT://
Example:
VAR
FbFTP_FileWrite : WagoAppFTP.FbFTP_FileWrite;
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesTransfered: UDINT;
END_VAR
FbFTP_FileWrite(
xTrigger:= Trigger,
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sLocalPath:= 'HOME://testbench/myfirstfile.txt',
sRemotePath:= 'Write.txt',
xCreateDirs:= FALSE,
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus,
udiNBytesTransfered=> udiNBytesTransfered);
2.1. FTP 39
WagoAppFTP, Release 1.3.1.3
2.1. FTP 40
WagoAppFTP, Release 1.3.1.3
Function description
This functionblock write the data from the TxBuffer to a file on the remote host specified by sRemotePath.
Transition to TRUE on xTrigger triggers the process to write the transfer buffer to the remote file. The function
block resets xTrigger to FALSE again after it has finished the process. If something went wrong during the
process xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function
block is still processing.
Example:
VAR
FbFTP_FileWriteFromMem : WagoAppFTP.FbFTP_FileWriteFromMem;
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesTransfered: UDINT;
FbFTP_FileWriteFromMem(
xTrigger:= Trigger,
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sRemotePath:= 'Write.txt',
pTxBuffer:= ADR(sTxBuffer),
udiTxNBytes := LENGTH(sTxBuffer),
xCreateDirs := FALSE,
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus,
udiNBytesTransfered=> udiNBytesTransfered);
2.1. FTP 41
WagoAppFTP, Release 1.3.1.3
2.1. FTP 42
WagoAppFTP, Release 1.3.1.3
Function description
This functionblock performs a directory listing. The linsting includ only those files that match the specification
stored in sFileSpec. The input parameter pRxBuffer is pointing to the first element of the buffer and the
buffersize is defined by the input parameter udiRxBufferSize.
If more details of the files and direcotries should list, the input parameter xWithDetails must set to true.
Transition to TRUE on xTrigger triggers the process to make a directory listing. The function block resets
xTrigger to FALSE again after it has finished the process. If something went wrong during the process
xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function block is
still processing.
Example:
VAR
FbFTP_List : WagoAppFTP.FbFTP_List;
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesTransfered: UDINT;
sRxBuffer : STRING(255);
END_VAR
FbFTP_List(
xTrigger:= Trigger,
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sRemotePath:= '',
2.1. FTP 43
WagoAppFTP, Release 1.3.1.3
pRxBuffer:= ADR(sRxBuffer),
udiRxBufferSize:= SIZEOF(sRxBuffer),
sFileSpec:= '',
xWithDetails:= FALSE,
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus,
udiNBytesTransfered=> udiNBytesTransfered);
2.2 FTPES
2.2.1 FbFTPES (FB)
Interface variables
2.2. FTPES 44
WagoAppFTP, Release 1.3.1.3
Function Description
The FbFTPES is the base function block for FTPES-Client-Services. The Fb provide functions like read and write
files, rename or remove files and create or remove directories.
The inputs of the FbFTPES handle the gerneral information for the FTPES connection and the outputs signal the
process and the result of the operations. The operations are triggered by call the specific method for the operation.
After a call the methods will return immediately and the FbFTPES start the operation.
Example:
Example without host and peer verification.
VAR
FbFTPES : WagoAppFTP.FbFTPES;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
iState : INT;
//List
sListBuffer : STRING(255);
//Write
sTxBuffer : STRING(255) := 'Hello World!';
//Read
sRxBuffer : STRING(255);
END_VAR
2.2. FTPES 45
WagoAppFTP, Release 1.3.1.3
FbFTPES(
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
1:
//Creates the directory 'NewDir' and the file 'HelloWorld.txt'. Writes
˓→the data from sTxBuffer into the new file.
FbFTPES.FileWriteFromMem(sRemotePath := 'NewDir/HelloWorld.txt',
˓→pTxBuffer := ADR(sTxBuffer), udiTxNBytes := LENGTH(sTxBuffer), xCreateDirs :=
˓→TRUE);
2:
//Create a new directory. A Path with '//' at the begin starts in the
˓→root directory
FbFTPES.DirCreate(sRemotePath := '//root/NewDir/NewDir2');
3:
//Makes a directory.
FbFTPES.List(sRemotePath := 'NewDir', pRxBuffer := ADR(sListBuffer),
˓→udiRxBufferSize := SIZEOF(sListBuffer), sFileSpec := '*.txt', xWithDetails :=
˓→TRUE);
4:
//Rename and replace the file.
FbFTPES.FileRename(sOldFileName := '//root/NewDir/HelloWorld.txt',
˓→sNewFileName := 'NewDir/NewDir2/Rename.txt');
5:
//Reads the data from the file.
FbFTPES.FileReadToMem(sRemotePath := '//root/NewDir/NewDir2/Rename.txt
˓→', pRxBuffer := ADR(sRxBuffer), udiRxBufferSize := SIZEOF(sRxBuffer));
6:
//Removes the file.
FbFTPES.FileRemove(sRemotePath := 'NewDir/NewDir2/Rename.txt');
7:
//Removes a directory
FbFTPES.DirRemove(sRemotePath := '//root/NewDir/NewDir2');
8:
//Removes a directory
FbFTPES.DirRemove(sRemotePath := 'NewDir/');
2.2. FTPES 46
WagoAppFTP, Release 1.3.1.3
99:
//Some Error Handling
END_CASE
END_IF
FbFTPES.DirCreate (METH)
Interface variables
Function description
This method starts an operation to create a new directory specified by sRemotePath. The method create only
the last directory in the path. If a directory in the path is missing or the driectory, that schould create, already
exists an error occur.
The status and result of the operation are displayed by the outputs of the FbFTPES.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY
The Fb is already in process. No new operation can start while xBusy is TRUE Wag-
oTypes.eResultCode.EINVAL The input is invalid =============================
=====================================================================================
Example:
Example without host and peer verification.
VAR
FbFTPES : WagoAppFTP.FbFTPES;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
2.2. FTPES 47
WagoAppFTP, Release 1.3.1.3
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo : BOOL;
END_VAR
FbFTPES(
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
FbFTPES.DirCreate(sRemotePath := '//root/NewDir');
xDo := FALSE;
END_IF
FbFTPES.DirRemove (METH)
Interface variables
2.2. FTPES 48
WagoAppFTP, Release 1.3.1.3
Function description
This method starts an operation to remove the directory, that is specified by sRemotePath. An error is returned
if the directory does not exists, the dircectory cannot removed (in use, or not empty), or if the user does not have
the appropriate privilege level.
The status and result of the operation are displayed by the outputs of the FbFTPS.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY
The Fb is already in process. No new operation can start while xBusy is TRUE Wag-
oTypes.eResultCode.EINVAL The input is invalid =============================
=====================================================================================
Example:
Example without host and peer verification.
VAR
FbFTPES : WagoAppFTP.FbFTPES;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo : BOOL;
END_VAR
FbFTPES(
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
FbFTPES.DirRemove(sRemotePath := '//root/NewDir');
xDo := FALSE;
2.2. FTPES 49
WagoAppFTP, Release 1.3.1.3
END_IF
FbFTPES.FileAppend (METH)
Interface variables
Function description
This method starts an operation to append a local file specified by sLocalPath to the end of a file on the remote
host specified by sRemotePath. If the remote file dosen´t exit, it will be created.
For ‘’sLocalPath” you can use the following prefixes, known form WagoAppFileDir:
• HOME://
• CARD://
• TEMP://
• ROOT://
The status and result of the operation are displayed by the outputs of the FbFTPES.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY The Fb is al-
ready in process. No new operation can start while xBusy is TRUE WagoTypes.eResultCode.EINVAL The input
is invalid WagoTypes.eResultCode.ENOENT The local file dosen´t exist =============================
=====================================================================================
Example:
Example without host and peer verification.
VAR
FbFTPES : WagoAppFTP.FbFTPES;
2.2. FTPES 50
WagoAppFTP, Release 1.3.1.3
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo : BOOL;
END_VAR
FbFTPES(
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
xDo := FALSE;
END_IF
FbFTPES.FileAppendFromMem (METH)
Interface variables
2.2. FTPES 51
WagoAppFTP, Release 1.3.1.3
Function description
This method starts an operation to append data from the TxBuffer to the end of a file on the remote host specified
by sRemotePath. If the remote file dosen´t exit, it will be created.
The status and result of the operation are displayed by the outputs of the FbFTPES.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY
The Fb is already in process. No new operation can start while xBusy is TRUE Wag-
oTypes.eResultCode.EINVAL The input is invalid =============================
=====================================================================================
Example:
Example without host and peer verification.
VAR
FbFTPES : WagoAppFTP.FbFTPES;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo : BOOL;
//Append
sTxBuffer : STRING(255) := 'Hello World!';
END_VAR
FbFTPES(
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
2.2. FTPES 52
WagoAppFTP, Release 1.3.1.3
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
xDo := FALSE;
END_IF
FbFTPES.FileRead (METH)
Interface variables
Function description
This method starts an operation to reads the data form the remote file, that is specified by the input parameter
sRemotePath, and stored it in the local file, that is specified by the input parameter sLocalPath.
For ‘’sLocalPath” you can use the following prefixes, known form WagoAppFileDir:
• HOME://
• CARD://
• TEMP://
2.2. FTPES 53
WagoAppFTP, Release 1.3.1.3
• ROOT://
The status and result of the operation are displayed by the outputs of the FbFTPES.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY
The Fb is already in process. No new operation can start while xBusy is TRUE Wag-
oTypes.eResultCode.EINVAL The input is invalid =============================
=====================================================================================
Example:
Example without host and peer verification.
VAR
FbFTPES : WagoAppFTP.FbFTPES;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo : BOOL;
END_VAR
FbFTPES(
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
xDo := FALSE;
END_IF
2.2. FTPES 54
WagoAppFTP, Release 1.3.1.3
FbFTPES.FileReadToMem (METH)
Interface variables
Function description
This method starts an operation to reads the data form the remote file, that is specified by the input parame-
ter sRemotePath, and stored it in the RxBuffer, that is specified by the input parameter pRxBuffer and
udiRxBufferSize.
The status and result of the operation are displayed by the outputs of the FbFTPES.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY
The Fb is already in process. No new operation can start while xBusy is TRUE Wag-
oTypes.eResultCode.EINVAL The input is invalid =============================
=====================================================================================
Example:
Example without host and peer verification.
VAR
FbFTPES : WagoAppFTP.FbFTPES;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
2.2. FTPES 55
WagoAppFTP, Release 1.3.1.3
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo : BOOL;
//Read
sRxBuffer : STRING(255);
END_VAR
FbFTPES(
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
xDo := FALSE;
END_IF
FbFTPES.FileRemove (METH)
Interface variables
2.2. FTPES 56
WagoAppFTP, Release 1.3.1.3
Function description
This method starts an operation to remove the file, that is specified by sRemotePath. An error is returned if the
file does not exists, the file cannot be removed, or if the user does not have the appropriate privilege level.
The status and result of the operation are displayed by the outputs of the FbFTPES.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY
The Fb is already in process. No new operation can start while xBusy is TRUE Wag-
oTypes.eResultCode.EINVAL The input is invalid =============================
=====================================================================================
Example:
Example without host and peer verification.
VAR
FbFTPES : WagoAppFTP.FbFTPES;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo : BOOL;
END_VAR
FbFTPES(
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
xDo := FALSE;
END_IF
2.2. FTPES 57
WagoAppFTP, Release 1.3.1.3
FbFTPES.FileRename (METH)
Interface variables
Function description
This method starts an operation to rename the file, that is defined by the input parameter sOldFileName, to the
name, that is defined by the input parameter sNewFileName.
The status and result of the operation are displayed by the outputs of the FbFTPES.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY
The Fb is already in process. No new operation can start while xBusy is TRUE Wag-
oTypes.eResultCode.EINVAL The input is invalid =============================
=====================================================================================
Example:
Example without host and peer verification.
VAR
FbFTPES : WagoAppFTP.FbFTPES;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xDone: BOOL;
2.2. FTPES 58
WagoAppFTP, Release 1.3.1.3
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo : BOOL;
END_VAR
FbFTPES(
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
˓→directory
FbFTPES.FileRename(sOldFileName := '//root/NewDir/HelloWorld.txt',
˓→sNewFileName := 'NewDir/Rename.txt');
xDo := FALSE;
END_IF
FbFTPES.FileWrite (METH)
Interface variables
2.2. FTPES 59
WagoAppFTP, Release 1.3.1.3
Function description
This method starts an operation to write the data form the local file, that is specified by the input parameter
sLocalPath, to the remote file, that is specified by the input parameter sRemotePath.
If the remote file exit, it will be overwritten.
For ‘’sLocalPath” you can use the following prefixes, known form WagoAppFileDir:
• HOME://
• CARD://
• TEMP://
• ROOT://
The status and result of the operation are displayed by the outputs of the FbFTPES.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY The Fb is al-
ready in process. No new operation can start while xBusy is TRUE WagoTypes.eResultCode.EINVAL The input
is invalid WagoTypes.eResultCode.ENOENT The local file dosen´t exist =============================
=====================================================================================
Example:
Example without host and peer verification.
VAR
FbFTPES : WagoAppFTP.FbFTPES;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo : BOOL;
END_VAR
FbFTPES(
sServer:= '192.168.1.17',
2.2. FTPES 60
WagoAppFTP, Release 1.3.1.3
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
xDo := FALSE;
END_IF
FbFTPES.FileWriteFromMem (METH)
Interface variables
Function description
2.2. FTPES 61
WagoAppFTP, Release 1.3.1.3
This method starts an operation to write the data from the TxBuffer to a file on the remote host specified by
sRemotePath. If the remote file exit, it will be overwritten.
The status and result of the operation are displayed by the outputs of the FbFTPES.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY
The Fb is already in process. No new operation can start while xBusy is TRUE Wag-
oTypes.eResultCode.EINVAL The input is invalid =============================
=====================================================================================
Example:
Example without host and peer verification.
VAR
FbFTPES : WagoAppFTP.FbFTPES;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo : BOOL;
END_VAR
FbFTPES(
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
xDo := FALSE;
END_IF
2.2. FTPES 62
WagoAppFTP, Release 1.3.1.3
FbFTPES.List (METH)
Interface variables
Function description
This method starts an operation to performs a directory listing. The linsting includ only those files that match the
specification stored in‘‘sFileSpec‘‘. The input parameter pRxBuffer is pointing to the first element of the buffer
and the buffersize is defined by the input parameter udiRxBufferSize.
If more details of the files and direcotries should list, the input parameter xWithDetails must set to true.
The status and result of the operation are displayed by the outputs of the FbFTPES.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY
The Fb is already in process. No new operation can start while xBusy is TRUE Wag-
oTypes.eResultCode.EINVAL The input is invalid =============================
=====================================================================================
Example:
Example without host and peer verification.
VAR
FbFTPES : WagoAppFTP.FbFTPES;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
2.2. FTPES 63
WagoAppFTP, Release 1.3.1.3
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo : BOOL;
END_VAR
FbFTPES(
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
xDo := FALSE;
END_IF
2.2. FTPES 64
WagoAppFTP, Release 1.3.1.3
Function description
2.2. FTPES 65
WagoAppFTP, Release 1.3.1.3
This functionblock create a new directory specified by sRemotePath. The Fb create only the last directory in
the path. If a directory in the path is missing or the driectory, that schould create, already exists an error occur.
Transition to TRUE on xTrigger triggers the process to create a new directory. The function block resets
xTrigger to FALSE again after it has finished the process. If something went wrong during the process
xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function block is
still processing.
Example
Example without host and peer verification.
VAR
FbFTPES_DirCreate : WagoAppFTP.FbFTPES_DirCreate;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
END_VAR
FbFTPES_DirCreate(
xTrigger:= Trigger,
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sRemotePath:= 'NewDir',
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus);
2.2. FTPES 66
WagoAppFTP, Release 1.3.1.3
Function description
2.2. FTPES 67
WagoAppFTP, Release 1.3.1.3
This functionblock remove remove the directory, that is specified by sRemotePath. An error is returned if the
directory does not exists, the dircectory cannot be removed (in use, or not empty), or if the user does not have the
appropriate privilege level.
Transition to TRUE on xTrigger triggers the process to remove a directory. The function block resets
xTrigger to FALSE again after it has finished the process. If something went wrong during the process
xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function block is
still processing.
Example
Example without host and peer verification.
VAR
FbFTPES_DirRemove : WagoAppFTP.FbFTPES_DirRemove;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
END_VAR
FbFTPES_DirRemove(
xTrigger:= Trigger,
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sRemotePath:= 'NewDir',
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus);
2.2. FTPES 68
WagoAppFTP, Release 1.3.1.3
2.2. FTPES 69
WagoAppFTP, Release 1.3.1.3
Function description
This functionblock append a local file specified by sLocalPath to the end of a file on the remote host specified
by sRemotePath. If the remote file dosen´t exit, it will be created.
Transition to TRUE on xTrigger triggers the process to append the local file to the remote file. The function
block resets xTrigger to FALSE again after it has finished the process. If something went wrong during the
process xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function
block is still processing.
For ‘’sLocalPath” you can use the following prefixes, known form WagoAppFileDir:
• HOME://
• CARD://
• TEMP://
• ROOT://
Example
Example without host and peer verification.
VAR
FbFTPES_FileAppend : WagoAppFTP.FbFTPES_FileAppend;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesTransfered: UDINT;
2.2. FTPES 70
WagoAppFTP, Release 1.3.1.3
END_VAR
FbFTPES_FileAppend(
xTrigger:= Trigger,
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sLocalPath:= 'HOME://testbench/myfirstfile.txt',
sRemotePath:= 'Append.txt',
xCreateDirs:= FALSE,
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus,
udiNBytesTransfered=> udiNBytesTransfered);
2.2. FTPES 71
WagoAppFTP, Release 1.3.1.3
2.2. FTPES 72
WagoAppFTP, Release 1.3.1.3
Function description
Thisfunction block append data from the TxBuffer to the end of a file on the remote host specified by
sRemotePath. If the remote file dosen´t exit, it will be created.
Transition to TRUE on xTrigger triggers the process to append the transfer buffer to the remote file. The
function block resets xTrigger to FALSE again after it has finished the process. If something went wrong
during the process xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that
the function block is still processing.
Example
Example without host and peer verification.
VAR
FbFTPES_FileAppendFromMem : WagoAppFTP.FbFTPES_FileAppendFromMem;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesTransfered: UDINT;
FbFTPES_FileAppendFromMem(
xTrigger:= Trigger,
sServer:= '192.168.1.17',
2.2. FTPES 73
WagoAppFTP, Release 1.3.1.3
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sRemotePath:= 'AppendFromMem.txt',
pTxBuffer:= ADR(sTxBuffer),
udiTxNBytes := LENGTH(sTxBuffer),
xCreateDirs := FALSE,
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus,
udiNBytesTransfered=> udiNBytesTransfered);
2.2. FTPES 74
WagoAppFTP, Release 1.3.1.3
Function
Read a file
Graphical Illustration
Function description
This functionblock reads the data form the remote file, that is specified by the input parameter sRemotePath,
and stored it in the local file, that is specified by the input parameter sLocalPath.
Transition to TRUE on xTrigger triggers the process to read the remote file to a local file. The function block
resets xTrigger to FALSE again after it has finished the process. If something went wrong during the process
xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function block is
still processing.
For ‘’sLocalPath” you can use the following prefixes, known form WagoAppFileDir:
• HOME://
• CARD://
• TEMP://
• ROOT://
Example
Example without host and peer verification.
VAR
FbFTPES_FileRead : WagoAppFTP.FbFTPES_FileRead;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
2.2. FTPES 75
WagoAppFTP, Release 1.3.1.3
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
END_VAR
FbFTPES_FileRead(
xTrigger:= Trigger,
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sLocalPath:= 'Read.txt',
sRemotePath:= 'AppendFromMem.txt',
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
2.2. FTPES 76
WagoAppFTP, Release 1.3.1.3
2.2. FTPES 77
WagoAppFTP, Release 1.3.1.3
Function description
This functionblock reads the data form the remote file, that is specified by the input parameter sRemotePath,
and stored it in the RxBuffer, that is specified by the input parameter pRxBuffer and udiRxBufferSize. If
the remote file not exist or the parameter pRxBuffer and udiRxBufferSize are 0 then an error occur.
Transition to TRUE on xTrigger triggers the process to remove a remote file. The function block resets
xTrigger to FALSE again after it has finished the process. If something went wrong during the process
xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function block is
still processing.
Example
Example without host and peer verification.
VAR
FbFTPES_FileReadToMem : WagoAppFTP.FbFTPES_FileReadToMem;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
sRxBuffer : STRING(255);
END_VAR
FbFTPES_FileReadToMem(
xTrigger:= Trigger,
2.2. FTPES 78
WagoAppFTP, Release 1.3.1.3
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sRemotePath:= 'AppendFromMem.txt',
pRxBuffer:= ADR(sRxBuffer),
udiRxBufferSize:= SIZEOF(sRxBuffer),
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
2.2. FTPES 79
WagoAppFTP, Release 1.3.1.3
Graphical Illustration
Function description
This functionblock remove the file, that is specified by sRemotePath. An error is returned if the file does not
exists, the file cannot be removed, or if the user does not have the appropriate privilege level.
Transition to TRUE on xTrigger triggers the process to remove a remote file. The function block resets
xTrigger to FALSE again after it has finished the process. If something went wrong during the process
xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function block is
still processing.
Example
Example without host and peer verification.
VAR
FbFTPES_FileRemove : WagoAppFTP.FbFTPES_FileRemove;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
END_VAR
FbFTPES_FileRemove(
xTrigger:= Trigger,
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
2.2. FTPES 80
WagoAppFTP, Release 1.3.1.3
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sRemotePath:= 'Append.txt',
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus);
2.2. FTPES 81
WagoAppFTP, Release 1.3.1.3
Function description
This functionblock rename the file, that is defined by the input parameter sOldFileName, to the name, that is
defined by the input parameter sNewFileName.
Transition to TRUE on xTrigger triggers the process to rename a remote file. The function block resets
xTrigger to FALSE again after it has finished the process. If something went wrong during the process
xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function block is
still processing.
Example:
Example without host and peer verification.
VAR
FbFTPES_FileRename : WagoAppFTP.FbFTPES_FileRename;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
END_VAR
FbFTPES_FileRename(
xTrigger:= Trigger,
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
2.2. FTPES 82
WagoAppFTP, Release 1.3.1.3
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sOldFileName:= 'Append.txt',
sNewFileName:= 'Rename.txt',
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus);
2.2. FTPES 83
WagoAppFTP, Release 1.3.1.3
Function description
This functionblock write the data form the local file, that is specified by the input parameter sLocalPath, to the
remote file, that is specified by the input parameter sRemotePath.
Transition to TRUE on xTrigger triggers the process to write the local file to the remote file. The function block
resets xTrigger to FALSE again after it has finished the process. If something went wrong during the process
xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function block is
still processing.
For ‘’sLocalPath” you can use the following prefixes, known form WagoAppFileDir:
• HOME://
• CARD://
• TEMP://
• ROOT://
Example:
Example without host and peer verification.
VAR
FbFTPES_FileWrite : WagoAppFTP.FbFTPES_FileWrite;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesTransfered: UDINT;
2.2. FTPES 84
WagoAppFTP, Release 1.3.1.3
END_VAR
FbFTPES_FileWrite(
xTrigger:= Trigger,
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sLocalPath:= 'HOME://testbench/myfirstfile.txt',
sRemotePath:= 'Write.txt',
xCreateDirs:= FALSE,
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus,
udiNBytesTransfered=> udiNBytesTransfered);
2.2. FTPES 85
WagoAppFTP, Release 1.3.1.3
2.2. FTPES 86
WagoAppFTP, Release 1.3.1.3
Function description
This functionblock write the data from the TxBuffer to a file on the remote host specified by sRemotePath.
Transition to TRUE on xTrigger triggers the process to write the transfer buffer to the remote file. The function
block resets xTrigger to FALSE again after it has finished the process. If something went wrong during the
process xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function
block is still processing.
Example:
Example without host and peer verification.
VAR
FbFTPES_FileWriteFromMem : WagoAppFTP.FbFTPES_FileWriteFromMem;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
FbFTPES_FileWriteFromMem(
xTrigger:= Trigger,
sServer:= '192.168.1.17',
uiPort:= 0,
2.2. FTPES 87
WagoAppFTP, Release 1.3.1.3
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sRemotePath:= 'Write.txt',
pTxBuffer:= ADR(sTxBuffer),
udiTxNBytes := LENGTH(sTxBuffer),
xCreateDirs := FALSE,
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
2.2. FTPES 88
WagoAppFTP, Release 1.3.1.3
2.2. FTPES 89
WagoAppFTP, Release 1.3.1.3
Function description
This functionblock performs a directory listing. The linsting includ only those files that match the specification
stored in sFileSpec. The input parameter pRxBuffer is pointing to the first element of the buffer and the
buffersize is defined by the input parameter udiRxBufferSize.
If more details of the files and direcotries should list, the input parameter xWithDetails must set to true.
Transition to TRUE on xTrigger triggers the process to make a directory listing. The function block resets
xTrigger to FALSE again after it has finished the process. If something went wrong during the process
xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function block is
still processing.
Example:
Example without host and peer verification.
VAR
FbFTPES_List : WagoAppFTP.FbFTPES_List;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesTransfered: UDINT;
sRxBuffer : STRING(255);
END_VAR
2.2. FTPES 90
WagoAppFTP, Release 1.3.1.3
FbFTPES_List(
xTrigger:= Trigger,
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sRemotePath:= '',
pRxBuffer:= ADR(sRxBuffer),
udiRxBufferSize:= SIZEOF(sRxBuffer),
sFileSpec:= '',
xWithDetails:= FALSE,
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus,
udiNBytesTransfered=> udiNBytesTransfered);
2.3 FTPS
2.3.1 FbFTPS (FB)
Interface variables
2.3. FTPS 91
WagoAppFTP, Release 1.3.1.3
Function
This function block provides FTPS-Client-Services.
Graphical Illustration
Function Description
The FbFTPS is the base function block for FTPS-Client-Services. The Fb provide functions like read and write
files, rename or remove files and create or remove directories.
The inputs of the FbFTPS handle the gerneral information for the FTPS connection and the outputs signal the
process and the result of the operations. The operations are triggered by call the specific method for the operation.
After a call the methods will return immediately and the FbFTPS start the operation.
Example:
Example without host and peer verification.
VAR
FbFTPS : WagoAppFTP.FbFTPS;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert := '',
sClientCert_Key := '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
iState : INT;
//List
sListBuffer : STRING(255);
2.3. FTPS 92
WagoAppFTP, Release 1.3.1.3
//Write
sTxBuffer : STRING(255) := 'Hello World!';
//Read
sRxBuffer : STRING(255);
END_VAR
FbFTPS(
sServer:= '172.29.233.1',
uiPort:= 0,
sUser:= 'user',
sPassword:= 'password',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
1:
//Creates the directory 'NewDir' and the file 'HelloWorld.txt'. Writes
˓→the data from sTxBuffer into the new file.
FbFTPS.FileWriteFromMem(sRemotePath := 'NewDir/HelloWorld.txt',
˓→pTxBuffer := ADR(sTxBuffer), udiTxNBytes := LENGTH(sTxBuffer), xCreateDirs :=
˓→TRUE);
2:
//Create a new directory. A Path with '//' at the begin starts in the
˓→root directory
FbFTPS.DirCreate(sRemotePath := 'NewDir/NewDir2');
3:
//Makes a directory.
FbFTPS.List(sRemotePath := 'NewDir', pRxBuffer := ADR(sListBuffer),
˓→udiRxBufferSize := SIZEOF(sListBuffer), sFileSpec := '*.txt', xWithDetails :=
˓→TRUE);
4:
//Rename and replace the file.
FbFTPS.FileRename(sOldFileName := 'NewDir/HelloWorld.txt',
˓→sNewFileName := 'NewDir/NewDir2/Rename.txt');
5:
//Reads the data from the file.
FbFTPS.FileReadToMem(sRemotePath := 'NewDir/NewDir2/Rename.txt',
˓→pRxBuffer := ADR(sRxBuffer), udiRxBufferSize := SIZEOF(sRxBuffer));
6:
//Removes the file.
FbFTPS.FileRemove(sRemotePath := 'NewDir/NewDir2/Rename.txt');
7:
//Removes a directory
2.3. FTPS 93
WagoAppFTP, Release 1.3.1.3
FbFTPS.DirRemove(sRemotePath := 'NewDir/NewDir2');
8:
//Removes a directory
FbFTPS.DirRemove(sRemotePath := 'NewDir/');
99:
//Some Error Handling
END_CASE
END_IF
FbFTPS.DirCreate (METH)
Interface variables
Function description
This method starts an operation to create a new directory specified by sRemotePath. The method create only
the last directory in the path. If a directory in the path is missing or the driectory, that schould create, already
exists an error occur.
The status and result of the operation are displayed by the outputs of the FbFTPS.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY
The Fb is already in process. No new operation can start while xBusy is TRUE Wag-
oTypes.eResultCode.EINVAL The input is invalid =============================
=====================================================================================
Example:
Example without host and peer verification.
VAR
FbFTPS : WagoAppFTP.FbFTPS;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
2.3. FTPS 94
WagoAppFTP, Release 1.3.1.3
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo : BOOL;
END_VAR
FbFTPS(
sServer:= '172.29.233.1',
uiPort:= 0,
sUser:= 'user',
sPassword:= 'password',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
FbFTPS.DirCreate(sRemotePath := '//root/NewDir');
xDo := FALSE;
END_IF
FbFTPS.DirRemove (METH)
Interface variables
2.3. FTPS 95
WagoAppFTP, Release 1.3.1.3
Function description
This method starts an operation to remove the directory, that is specified by sRemotePath. An error is returned
if the directory does not exists, the dircectory cannot removed (in use, or not empty), or if the user does not have
the appropriate privilege level.
The status and result of the operation are displayed by the outputs of the FbFTPS.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY
The Fb is already in process. No new operation can start while xBusy is TRUE Wag-
oTypes.eResultCode.EINVAL The input is invalid =============================
=====================================================================================
Example:
Example without host and peer verification.
VAR
FbFTPS : WagoAppFTP.FbFTPS;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo : BOOL;
END_VAR
FbFTPS(
sServer:= '172.29.233.1',
uiPort:= 0,
sUser:= 'user',
sPassword:= 'password',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
2.3. FTPS 96
WagoAppFTP, Release 1.3.1.3
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
FbFTPS.DirRemove(sRemotePath := '//root/NewDir');
xDo := FALSE;
END_IF
FbFTPS.FileAppend (METH)
Interface variables
Function description
This method starts an operation to append a local file specified by sLocalPath to the end of a file on the remote
host specified by sRemotePath. If the remote file dosen´t exit, it will be created.
For ‘’sLocalPath” you can use the following prefixes, known form WagoAppFileDir:
• HOME://
• CARD://
• TEMP://
• ROOT://
The status and result of the operation are displayed by the outputs of the FbFTPS.
This method has the following return values: =============================
=====================================================================================
2.3. FTPS 97
WagoAppFTP, Release 1.3.1.3
VAR
FbFTPS : WagoAppFTP.FbFTPS;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo : BOOL;
END_VAR
FbFTPS(
sServer:= '172.29.233.1',
uiPort:= 0,
sUser:= 'user',
sPassword:= 'password',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
xDo := FALSE;
END_IF
FbFTPS.FileAppendFromMem (METH)
Interface variables
2.3. FTPS 98
WagoAppFTP, Release 1.3.1.3
Function description
This method starts an operation to append data from the TxBuffer to the end of a file on the remote host specified
by sRemotePath. If the remote file dosen´t exit, it will be created.
The status and result of the operation are displayed by the outputs of the FbFTPS.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY
The Fb is already in process. No new operation can start while xBusy is TRUE Wag-
oTypes.eResultCode.EINVAL The input is invalid =============================
=====================================================================================
Example:
Example without host and peer verification.
VAR
FbFTPS : WagoAppFTP.FbFTPS;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xDone: BOOL;
2.3. FTPS 99
WagoAppFTP, Release 1.3.1.3
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo : BOOL;
//Append
sTxBuffer : STRING(255) := 'Hello World!';
END_VAR
FbFTPS(
sServer:= '172.29.233.1',
uiPort:= 0,
sUser:= 'user',
sPassword:= 'password',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
xDo := FALSE;
END_IF
FbFTPS.FileRead (METH)
Interface variables
Function description
This method starts an operation to reads the data form the remote file, that is specified by the input parameter
sRemotePath, and stored it in the local file, that is specified by the input parameter sLocalPath.
For ‘’sLocalPath” you can use the following prefixes, known form WagoAppFileDir:
• HOME://
• CARD://
• TEMP://
• ROOT://
The status and result of the operation are displayed by the outputs of the FbFTPS.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY
The Fb is already in process. No new operation can start while xBusy is TRUE Wag-
oTypes.eResultCode.EINVAL The input is invalid =============================
=====================================================================================
Example:
Example without host and peer verification.
VAR
FbFTPS : WagoAppFTP.FbFTPS;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo : BOOL;
END_VAR
FbFTPS(
sServer:= '172.29.233.1',
uiPort:= 0,
sUser:= 'user',
sPassword:= 'password',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
xDo := FALSE;
END_IF
FbFTPS.FileReadToMem (METH)
Interface variables
Function description
This method starts an operation to reads the data form the remote file, that is specified by the input parame-
ter sRemotePath, and stored it in the RxBuffer, that is specified by the input parameter pRxBuffer and
udiRxBufferSize.
The status and result of the operation are displayed by the outputs of the FbFTPS.
This method has the following return values: =============================
=====================================================================================
VAR
FbFTPS : WagoAppFTP.FbFTPS;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo : BOOL;
//Read
sRxBuffer : STRING(255);
END_VAR
FbFTPS(
sServer:= '172.29.233.1',
uiPort:= 0,
sUser:= 'user',
sPassword:= 'password',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
xDo := FALSE;
END_IF
FbFTPS.FileRemove (METH)
Interface variables
Function description
This method starts an operation to remove the file, that is specified by sRemotePath. An error is returned if the
file does not exists, the file cannot be removed, or if the user does not have the appropriate privilege level.
The status and result of the operation are displayed by the outputs of the FbFTPS.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY
The Fb is already in process. No new operation can start while xBusy is TRUE Wag-
oTypes.eResultCode.EINVAL The input is invalid =============================
=====================================================================================
Example:
Example without host and peer verification.
VAR
FbFTPS : WagoAppFTP.FbFTPS;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo : BOOL;
END_VAR
FbFTPS(
sServer:= '172.29.233.1',
uiPort:= 0,
sUser:= 'user',
sPassword:= 'password',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
xDo := FALSE;
END_IF
FbFTPS.FileRename (METH)
Interface variables
Function description
This method starts an operation to rename the file, that is defined by the input parameter sOldFileName, to the
name, that is defined by the input parameter sNewFileName.
The status and result of the operation are displayed by the outputs of the FbFTPS.
VAR
FbFTPS : WagoAppFTP.FbFTPS;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo : BOOL;
END_VAR
FbFTPS(
sServer:= '172.29.233.1',
uiPort:= 0,
sUser:= 'user',
sPassword:= 'password',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
˓→directory
xDo := FALSE;
END_IF
FbFTPS.FileWrite (METH)
Interface variables
Function description
This method starts an operation to write the data form the local file, that is specified by the input parameter
sLocalPath, to the remote file, that is specified by the input parameter sRemotePath.
If the remote file exit, it will be overwritten.
For ‘’sLocalPath” you can use the following prefixes, known form WagoAppFileDir:
• HOME://
• CARD://
• TEMP://
• ROOT://
The status and result of the operation are displayed by the outputs of the FbFTPS.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY The Fb is al-
ready in process. No new operation can start while xBusy is TRUE WagoTypes.eResultCode.EINVAL The input
is invalid WagoTypes.eResultCode.ENOENT The local file dosen´t exist =============================
=====================================================================================
Example:
Example without host and peer verification.
VAR
FbFTPS : WagoAppFTP.FbFTPS;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo : BOOL;
END_VAR
FbFTPS(
sServer:= '172.29.233.1',
uiPort:= 0,
sUser:= 'user',
sPassword:= 'password',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
xDo := FALSE;
END_IF
FbFTPS.FileWriteFromMem (METH)
Interface variables
Write a file
Graphical Illustration
Function description
This method starts an operation to write the data from the TxBuffer to a file on the remote host specified by
sRemotePath. If the remote file exit, it will be overwritten.
The status and result of the operation are displayed by the outputs of the FbFTPS.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY
The Fb is already in process. No new operation can start while xBusy is TRUE Wag-
oTypes.eResultCode.EINVAL The input is invalid =============================
=====================================================================================
Example:
Example without host and peer verification.
VAR
FbFTPS : WagoAppFTP.FbFTPS;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo : BOOL;
END_VAR
FbFTPS(
sServer:= '172.29.233.1',
uiPort:= 0,
sUser:= 'user',
sPassword:= 'password',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
xDo := FALSE;
END_IF
FbFTPS.List (METH)
Interface variables
Function description
This method starts an operation to performs a directory listing. The linsting includ only those files that match the
specification stored in‘‘sFileSpec‘‘. The input parameter pRxBuffer is pointing to the first element of the buffer
and the buffersize is defined by the input parameter udiRxBufferSize.
If more details of the files and direcotries should list, the input parameter xWithDetails must set to true.
The status and result of the operation are displayed by the outputs of the FbFTPS.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY
The Fb is already in process. No new operation can start while xBusy is TRUE Wag-
oTypes.eResultCode.EINVAL The input is invalid =============================
=====================================================================================
Example:
Example without host and peer verification.
VAR
FbFTPS : WagoAppFTP.FbFTPS;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo : BOOL;
END_VAR
FbFTPS(
sServer:= '172.29.233.1',
uiPort:= 0,
sUser:= 'user',
sPassword:= 'password',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
xDo := FALSE;
END_IF
Function description
This functionblock create a new directory specified by sRemotePath. The Fb create only the last directory in
the path. If a directory in the path is missing or the driectory, that schould create, already exists an error occur.
Transition to TRUE on xTrigger triggers the process to create a new directory. The function block resets
xTrigger to FALSE again after it has finished the process. If something went wrong during the process
xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function block is
still processing.
Example
Example without host and peer verification.
VAR
FbFTPS_DirCreate : WagoAppFTP.FbFTPS_DirCreate;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
END_VAR
FbFTPS_DirCreate(
xTrigger:= Trigger,
sServer:= '172.29.233.1',
uiPort:= 0,
sUser:= 'user',
sPassword:= 'password',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sRemotePath:= 'NewDir',
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus);
Function description
This functionblock remove remove the directory, that is specified by sRemotePath. An error is returned if the
directory does not exists, the dircectory cannot be removed (in use, or not empty), or if the user does not have the
appropriate privilege level.
Transition to TRUE on xTrigger triggers the process to remove a directory. The function block resets
xTrigger to FALSE again after it has finished the process. If something went wrong during the process
xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function block is
still processing.
Example
Example without host and peer verification.
VAR
FbFTPS_DirRemove : WagoAppFTP.FbFTPS_DirRemove;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
END_VAR
FbFTPS_DirRemove(
xTrigger:= Trigger,
sServer:= '172.29.233.1',
uiPort:= 0,
sUser:= 'user',
sPassword:= 'password',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sRemotePath:= 'NewDir',
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus);
Function description
This functionblock append a local file specified by sLocalPath to the end of a file on the remote host specified
by sRemotePath. If the remote file dosen´t exit, it will be created.
Transition to TRUE on xTrigger triggers the process to append the local file to the remote file. The function
block resets xTrigger to FALSE again after it has finished the process. If something went wrong during the
process xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function
block is still processing.
For ‘’sLocalPath” you can use the following prefixes, known form WagoAppFileDir:
• HOME://
• CARD://
• TEMP://
• ROOT://
Example
Example without host and peer verification.
VAR
FbFTPS_FileAppend : WagoAppFTP.FbFTPS_FileAppend;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesTransfered: UDINT;
END_VAR
FbFTPS_FileAppend(
xTrigger:= Trigger,
sServer:= '172.29.233.1',
uiPort:= 0,
sUser:= 'user',
sPassword:= 'password',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sLocalPath:= 'HOME://testbench/myfirstfile.txt',
sRemotePath:= 'Append.txt',
xCreateDirs:= FALSE,
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus,
udiNBytesTransfered=> udiNBytesTransfered);
Function description
Thisfunction block append data from the TxBuffer to the end of a file on the remote host specified by
sRemotePath. If the remote file dosen´t exit, it will be created.
Transition to TRUE on xTrigger triggers the process to append the transfer buffer to the remote file. The
function block resets xTrigger to FALSE again after it has finished the process. If something went wrong
during the process xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that
the function block is still processing.
Example
Example without host and peer verification.
VAR
FbFTPS_FileAppendFromMem : WagoAppFTP.FbFTPS_FileAppendFromMem;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesTransfered: UDINT;
FbFTPS_FileAppendFromMem(
xTrigger:= Trigger,
sServer:= '172.29.233.1',
uiPort:= 0,
sUser:= 'user',
sPassword:= 'password',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sRemotePath:= 'AppendFromMem.txt',
pTxBuffer:= ADR(sTxBuffer),
udiTxNBytes := LENGTH(sTxBuffer),
xCreateDirs := FALSE,
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus,
udiNBytesTransfered=> udiNBytesTransfered);
Function
Read a file
Graphical Illustration
Function description
This functionblock reads the data form the remote file, that is specified by the input parameter sRemotePath,
and stored it in the local file, that is specified by the input parameter sLocalPath.
Transition to TRUE on xTrigger triggers the process to read the remote file to a local file. The function block
resets xTrigger to FALSE again after it has finished the process. If something went wrong during the process
xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function block is
still processing.
For ‘’sLocalPath” you can use the following prefixes, known form WagoAppFileDir:
• HOME://
• CARD://
• TEMP://
• ROOT://
Example
Example without host and peer verification.
VAR
FbFTPS_FileRead : WagoAppFTP.FbFTPS_FileRead;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
END_VAR
FbFTPS_FileRead(
xTrigger:= Trigger,
sServer:= '172.29.233.1',
uiPort:= 0,
sUser:= 'user',
sPassword:= 'password',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sLocalPath:= 'Read.txt',
sRemotePath:= 'AppendFromMem.txt',
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
Function description
This functionblock reads the data form the remote file, that is specified by the input parameter sRemotePath,
and stored it in the RxBuffer, that is specified by the input parameter pRxBuffer and udiRxBufferSize. If
the remote file not exist or the parameter pRxBuffer and udiRxBufferSize are 0 then an error occur.
Transition to TRUE on xTrigger triggers the process to remove a remote file. The function block resets
xTrigger to FALSE again after it has finished the process. If something went wrong during the process
xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function block is
still processing.
Example
Example without host and peer verification.
VAR
FbFTPS_FileReadToMem : WagoAppFTP.FbFTPS_FileReadToMem;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
sRxBuffer : STRING(255);
END_VAR
FbFTPS_FileReadToMem(
xTrigger:= Trigger,
sServer:= '172.29.233.1',
uiPort:= 0,
sUser:= 'user',
sPassword:= 'password',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sRemotePath:= 'AppendFromMem.txt',
pRxBuffer:= ADR(sRxBuffer),
udiRxBufferSize:= SIZEOF(sRxBuffer),
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
Graphical Illustration
Function description
This functionblock remove the file, that is specified by sRemotePath. An error is returned if the file does not
exists, the file cannot be removed, or if the user does not have the appropriate privilege level.
Transition to TRUE on xTrigger triggers the process to remove a remote file. The function block resets
xTrigger to FALSE again after it has finished the process. If something went wrong during the process
xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function block is
still processing.
Example
Example without host and peer verification.
VAR
FbFTPS_FileRemove : WagoAppFTP.FbFTPS_FileRemove;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
END_VAR
FbFTPS_FileRemove(
xTrigger:= Trigger,
sServer:= '172.29.233.1',
uiPort:= 0,
sUser:= 'user',
sPassword:= 'password',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sRemotePath:= 'Append.txt',
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus);
Function description
This functionblock rename the file, that is defined by the input parameter sOldFileName, to the name, that is
defined by the input parameter sNewFileName.
Transition to TRUE on xTrigger triggers the process to rename a remote file. The function block resets
xTrigger to FALSE again after it has finished the process. If something went wrong during the process
xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function block is
still processing.
Example:
Example without host and peer verification.
VAR
FbFTPS_FileRename : WagoAppFTP.FbFTPS_FileRename;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
END_VAR
FbFTPS_FileRename(
xTrigger:= Trigger,
sServer:= '172.29.233.1',
uiPort:= 0,
sUser:= 'user',
sPassword:= 'password',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sOldFileName:= 'Append.txt',
sNewFileName:= 'Rename.txt',
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus);
Function description
This functionblock write the data form the local file, that is specified by the input parameter sLocalPath, to the
remote file, that is specified by the input parameter sRemotePath.
Transition to TRUE on xTrigger triggers the process to write the local file to the remote file. The function block
resets xTrigger to FALSE again after it has finished the process. If something went wrong during the process
xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function block is
still processing.
For ‘’sLocalPath” you can use the following prefixes, known form WagoAppFileDir:
• HOME://
• CARD://
• TEMP://
• ROOT://
Example:
Example without host and peer verification.
VAR
FbFTPS_FileWrite : WagoAppFTP.FbFTPS_FileWrite;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesTransfered: UDINT;
END_VAR
FbFTPS_FileWrite(
xTrigger:= Trigger,
sServer:= '172.29.233.1',
uiPort:= 0,
sUser:= 'user',
sPassword:= 'password',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sLocalPath:= 'HOME://testbench/myfirstfile.txt',
sRemotePath:= 'Write.txt',
xCreateDirs:= FALSE,
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus,
udiNBytesTransfered=> udiNBytesTransfered);
Function description
This functionblock write the data from the TxBuffer to a file on the remote host specified by sRemotePath.
Transition to TRUE on xTrigger triggers the process to write the transfer buffer to the remote file. The function
block resets xTrigger to FALSE again after it has finished the process. If something went wrong during the
process xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function
block is still processing.
Example:
Example without host and peer verification.
VAR
FbFTPS_FileWriteFromMem : WagoAppFTP.FbFTPS_FileWriteFromMem;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
FbFTPS_FileWriteFromMem(
xTrigger:= Trigger,
sServer:= '172.29.233.1',
uiPort:= 0,
sUser:= 'user',
sPassword:= 'password',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sRemotePath:= 'Write.txt',
pTxBuffer:= ADR(sTxBuffer),
udiTxNBytes := LENGTH(sTxBuffer),
xCreateDirs := FALSE,
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
Function description
This functionblock performs a directory listing. The linsting includ only those files that match the specification
stored in sFileSpec. The input parameter pRxBuffer is pointing to the first element of the buffer and the
buffersize is defined by the input parameter udiRxBufferSize.
If more details of the files and direcotries should list, the input parameter xWithDetails must set to true.
Transition to TRUE on xTrigger triggers the process to make a directory listing. The function block resets
xTrigger to FALSE again after it has finished the process. If something went wrong during the process
xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function block is
still processing.
Example:
Example without host and peer verification.
VAR
FbFTPS_List : WagoAppFTP.FbFTPS_List;
typSSL_Options: WagoAppFTP.WagoTypesCurl.typSSL_Options := (
sCA_Cert:= '',
sCA_Path:= '',
xVerifyPeer:= FALSE,
xVerifyHost:= FALSE,
sClientCert:= '',
sClientCert_Key:= '',
sClientCert_KeyPasswd:= '');
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesTransfered: UDINT;
sRxBuffer : STRING(255);
END_VAR
FbFTPS_List(
xTrigger:= Trigger,
sServer:= '172.29.233.1',
uiPort:= 0,
sUser:= 'user',
sPassword:= 'password',
xActiveMode:= FALSE,
sActivePort:= '',
typSSL_Options := typSSL_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sRemotePath:= '',
pRxBuffer:= ADR(sRxBuffer),
udiRxBufferSize:= SIZEOF(sRxBuffer),
sFileSpec:= '',
xWithDetails:= FALSE,
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus,
udiNBytesTransfered=> udiNBytesTransfered);
2.4 SFTP
2.4.1 FbSFTP (FB)
Interface variables
Function Description
The FbSFTP is the base function block for SFTP-Client-Services. The Fb provide functions like read and write
files, rename or remove files and create or remove directories.
The inputs of the FbSFTP handle the gerneral information for the SFTP connection and the outputs signal the
process and the result of the operations. The operations are triggered by call the specific method for the operation.
After a call the methods will return immediately and the SFTP start the operation.
Example:
Example with authentication with password
VAR
FbSFTP : WagoAppFTP.FbSFTP;
typSSH_Options: WagoTypesCurl.typSSH_Options := (
xAuthPassword:= TRUE, //Authentication with password is enabled
xAuthKey:= FALSE,
sPrivateKey:= '',
sPassphrase:= '',
xAuthHost:= FALSE,
sKnownHosts:= '');
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
iState : INT;
//List
sListBuffer : STRING(255);
//Write
sTxBuffer : STRING(255) := 'Hello World!';
//Read
sRxBuffer : STRING(255);
END_VAR
FbSFTP(
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
typSSH_Options := typSSH_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
1:
//Creates the directory 'NewDir' and the file 'HelloWorld.txt'. Writes
˓→the data from sTxBuffer into the new file.
FbSFTP.FileWriteFromMem(sRemotePath := '/root/NewDir/HelloWorld.txt',
˓→pTxBuffer := ADR(sTxBuffer), udiTxNBytes := LENGTH(sTxBuffer), xCreateDirs :=
˓→TRUE);
2:
//Create a new directory.
FbSFTP.DirCreate(sRemotePath := '/root/NewDir/NewDir2');
3:
//Makes a directory.
FbSFTP.List(sRemotePath := '/root/NewDir', pRxBuffer :=
˓→ADR(sListBuffer), udiRxBufferSize := SIZEOF(sListBuffer), xWithDetails := TRUE);
4:
//Rename and replace the file.
FbSFTP.FileRename(sOldFileName := '/root/NewDir/HelloWorld.txt',
˓→sNewFileName := '/root/NewDir/NewDir2/Rename.txt');
5:
//Reads the data from the file.
FbSFTP.FileReadToMem(sRemotePath := '/root/NewDir/NewDir2/Rename.txt',
˓→pRxBuffer := ADR(sRxBuffer), udiRxBufferSize := SIZEOF(sRxBuffer));
6:
//Removes the file.
FbSFTP.FileRemove(sRemotePath := '/root/NewDir/NewDir2/Rename.txt');
7:
//Removes a directory
FbSFTP.DirRemove(sRemotePath := '/root/NewDir/NewDir2');
8:
//Removes a directory
FbSFTP.DirRemove(sRemotePath := '/root/NewDir/');
99:
//Some Error Handling
END_CASE
END_IF
FbSFTP.DirCreate (METH)
Interface variables
Function description
This method starts an operation to create a new directory specified by sRemotePath. The method create only
the last directory in the path. If a directory in the path is missing or the driectory, that schould create, already
exists an error occur.
The status and result of the operation are displayed by the outputs of the FbSFTP.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY
The Fb is already in process. No new operation can start while xBusy is TRUE Wag-
oTypes.eResultCode.EINVAL The input is invalid =============================
=====================================================================================
Example:
Example with authentication with password
VAR
FbSFTP : WagoAppFTP.FbSFTP;
typSSH_Options: WagoTypesCurl.typSSH_Options := (
xAuthPassword:= TRUE, //Authentication with password is enabled
xAuthKey:= FALSE,
sPrivateKey:= '',
sPassphrase:= '',
xAuthHost:= FALSE,
sKnownHosts:= '');
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo := BOOL;
END_VAR
FbSFTP(
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
typSSH_Options := typSSH_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
xDo := FALSE;
END_IF
FbSFTP.DirRemove (METH)
Interface variables
Function description
This method starts an operation to remove the directory, that is specified by sRemotePath. An error is returned
if the directory does not exists, the dircectory cannot removed (in use, or not empty), or if the user does not have
the appropriate privilege level.
The status and result of the operation are displayed by the outputs of the FbSFTP.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY
The Fb is already in process. No new operation can start while xBusy is TRUE Wag-
oTypes.eResultCode.EINVAL The input is invalid =============================
=====================================================================================
Example:
Example with authentication with password
VAR
FbSFTP : WagoAppFTP.FbSFTP;
typSSH_Options: WagoTypesCurl.typSSH_Options := (
xAuthPassword:= TRUE, //Authentication with password is enabled
xAuthKey:= FALSE,
sPrivateKey:= '',
sPassphrase:= '',
xAuthHost:= FALSE,
sKnownHosts:= '');
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo := BOOL;
END_VAR
FbSFTP(
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
typSSH_Options := typSSH_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
xDo := FALSE;
END_IF
FbSFTP.FileAppend (METH)
Interface variables
Function
Append a local file to a remote file
Graphical Illustration
Function description
This method starts an operation to append a local file specified by sLocalPath to the end of a file on the remote
host specified by sRemotePath. If the remote file dosen´t exit, it will be created.
For ‘’sLocalPath” you can use the following prefixes, known form WagoAppFileDir:
• HOME://
• CARD://
• TEMP://
• ROOT://
The status and result of the operation are displayed by the outputs of the FbSFTP.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY The Fb is al-
ready in process. No new operation can start while xBusy is TRUE WagoTypes.eResultCode.EINVAL The input
is invalid WagoTypes.eResultCode.ENOENT The local file dosen´t exist =============================
=====================================================================================
Example:
Example with authentication with password
VAR
FbSFTP : WagoAppFTP.FbSFTP;
typSSH_Options: WagoTypesCurl.typSSH_Options := (
xAuthPassword:= TRUE, //Authentication with password is enabled
xAuthKey:= FALSE,
sPrivateKey:= '',
sPassphrase:= '',
xAuthHost:= FALSE,
sKnownHosts:= '');
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo := BOOL;
END_VAR
FbSFTP(
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
typSSH_Options := typSSH_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
xDo := FALSE;
END_IF
FbSFTP.FileAppendFromMem (METH)
Interface variables
Function description
This method starts an operation to append data from the TxBuffer to the end of a file on the remote host specified
by sRemotePath. If the remote file dosen´t exit, it will be created.
The status and result of the operation are displayed by the outputs of the FbSFTP.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY
The Fb is already in process. No new operation can start while xBusy is TRUE Wag-
oTypes.eResultCode.EINVAL The input is invalid =============================
=====================================================================================
Example:
Example with authentication with password
VAR
FbSFTP : WagoAppFTP.FbSFTP;
typSSH_Options: WagoTypesCurl.typSSH_Options := (
xAuthPassword:= TRUE, //Authentication with password is enabled
xAuthKey:= FALSE,
sPrivateKey:= '',
sPassphrase:= '',
xAuthHost:= FALSE,
sKnownHosts:= '');
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo := BOOL;
//Append
sTxBuffer : STRING(255) := 'Hello World!';
END_VAR
FbSFTP(
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
typSSH_Options := typSSH_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
xDo := FALSE;
END_IF
FbSFTP.FileRead (METH)
Interface variables
Function description
This method starts an operation to reads the data form the remote file, that is specified by the input parameter
sRemotePath, and stored it in the local file, that is specified by the input parameter sLocalPath.
For ‘’sLocalPath” you can use the following prefixes, known form WagoAppFileDir:
• HOME://
• CARD://
• TEMP://
• ROOT://
The status and result of the operation are displayed by the outputs of the FbSFTP.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY
The Fb is already in process. No new operation can start while xBusy is TRUE Wag-
oTypes.eResultCode.EINVAL The input is invalid =============================
=====================================================================================
Example:
Example with authentication with password
VAR
FbSFTP : WagoAppFTP.FbSFTP;
typSSH_Options: WagoTypesCurl.typSSH_Options := (
xAuthPassword:= TRUE, //Authentication with password is enabled
xAuthKey:= FALSE,
sPrivateKey:= '',
sPassphrase:= '',
xAuthHost:= FALSE,
sKnownHosts:= '');
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo := BOOL;
END_VAR
FbSFTP(
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
typSSH_Options := typSSH_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
xDo := FALSE;
END_IF
FbSFTP.FileReadToMem (METH)
Interface variables
Function description
This method starts an operation to reads the data form the remote file, that is specified by the input parame-
ter sRemotePath, and stored it in the RxBuffer, that is specified by the input parameter pRxBuffer and
udiRxBufferSize.
The status and result of the operation are displayed by the outputs of the FbSFTP.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY
The Fb is already in process. No new operation can start while xBusy is TRUE Wag-
oTypes.eResultCode.EINVAL The input is invalid =============================
=====================================================================================
Example:
Example with authentication with password
VAR
FbSFTP : WagoAppFTP.FbSFTP;
typSSH_Options: WagoTypesCurl.typSSH_Options := (
xAuthPassword:= TRUE, //Authentication with password is enabled
xAuthKey:= FALSE,
sPrivateKey:= '',
sPassphrase:= '',
xAuthHost:= FALSE,
sKnownHosts:= '');
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo := BOOL;
//Read
sRxBuffer : STRING(255);
END_VAR
FbSFTP(
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
typSSH_Options := typSSH_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
xDo := FALSE;
END_IF
FbSFTP.FileRemove (METH)
Interface variables
Function description
This method starts an operation to remove the file, that is specified by sRemotePath. An error is returned if the
file does not exists, the file cannot be removed, or if the user does not have the appropriate privilege level.
The status and result of the operation are displayed by the outputs of the FbSFTP.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY
The Fb is already in process. No new operation can start while xBusy is TRUE Wag-
oTypes.eResultCode.EINVAL The input is invalid =============================
=====================================================================================
Example:
Example with authentication with password
VAR
FbSFTP : WagoAppFTP.FbSFTP;
typSSH_Options: WagoTypesCurl.typSSH_Options := (
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo := BOOL;
END_VAR
FbSFTP(
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
typSSH_Options := typSSH_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
xDo := FALSE;
END_IF
FbSFTP.FileRename (METH)
Interface variables
Function description
This method starts an operation to rename the file, that is defined by the input parameter sOldFileName, to the
name, that is defined by the input parameter sNewFileName.
The status and result of the operation are displayed by the outputs of the FbSFTP.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY
The Fb is already in process. No new operation can start while xBusy is TRUE Wag-
oTypes.eResultCode.EINVAL The input is invalid =============================
=====================================================================================
Example:
Example with authentication with password
VAR
FbSFTP : WagoAppFTP.FbSFTP;
typSSH_Options: WagoTypesCurl.typSSH_Options := (
xAuthPassword:= TRUE, //Authentication with password is enabled
xAuthKey:= FALSE,
sPrivateKey:= '',
sPassphrase:= '',
xAuthHost:= FALSE,
sKnownHosts:= '');
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo := BOOL;
END_VAR
FbSFTP(
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
typSSH_Options := typSSH_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
xDo := FALSE;
END_IF
FbSFTP.FileWrite (METH)
Interface variables
Function description
This method starts an operation to write the data form the local file, that is specified by the input parameter
sLocalPath, to the remote file, that is specified by the input parameter sRemotePath.
If the remote file exit, it will be overwritten.
For ‘’sLocalPath” you can use the following prefixes, known form WagoAppFileDir:
• HOME://
• CARD://
• TEMP://
• ROOT://
The status and result of the operation are displayed by the outputs of the FbSFTP.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY The Fb is al-
ready in process. No new operation can start while xBusy is TRUE WagoTypes.eResultCode.EINVAL The input
is invalid WagoTypes.eResultCode.ENOENT The local file dosen´t exist =============================
=====================================================================================
Example:
Example with authentication with password
VAR
FbSFTP : WagoAppFTP.FbSFTP;
typSSH_Options: WagoTypesCurl.typSSH_Options := (
xAuthPassword:= TRUE, //Authentication with password is enabled
xAuthKey:= FALSE,
sPrivateKey:= '',
sPassphrase:= '',
xAuthHost:= FALSE,
sKnownHosts:= '');
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo := BOOL;
END_VAR
FbSFTP(
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
typSSH_Options := typSSH_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
xDo := FALSE;
END_IF
FbSFTP.FileWriteFromMem (METH)
Interface variables
Function
Write a file
Graphical Illustration
Function description
This method starts an operation to write the data from the TxBuffer to a file on the remote host specified by
sRemotePath. If the remote file exit, it will be overwritten.
The status and result of the operation are displayed by the outputs of the FbSFTP.
This method has the following return values: =============================
=====================================================================================
WagoTypes.eResultCode.OK Success, operation has been started. WagoTypes.eResultCode.EBUSY
The Fb is already in process. No new operation can start while xBusy is TRUE Wag-
oTypes.eResultCode.EINVAL The input is invalid =============================
=====================================================================================
Example:
Example with authentication with password
VAR
FbSFTP : WagoAppFTP.FbSFTP;
typSSH_Options: WagoTypesCurl.typSSH_Options := (
xAuthPassword:= TRUE, //Authentication with password is enabled
xAuthKey:= FALSE,
sPrivateKey:= '',
sPassphrase:= '',
xAuthHost:= FALSE,
sKnownHosts:= '');
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo := BOOL;
//Write
sTxBuffer : STRING(255) := 'Hello World!';
END_VAR
FbSFTP(
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
typSSH_Options := typSSH_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
xDo := FALSE;
END_IF
FbSFTP.List (METH)
Interface variables
Function description
This method starts an operation to performs a directory listing. The input parameter pRxBuffer is pointing to
the first element of the buffer and the buffersize is defined by the input parameter udiRxBufferSize.
If more details of the files and direcotries should list, the input parameter xWithDetails must set to true.
The status and result of the operation are displayed by the outputs of the FbSFTP.
VAR
FbSFTP : WagoAppFTP.FbSFTP;
typSSH_Options: WagoTypesCurl.typSSH_Options := (
xAuthPassword:= TRUE, //Authentication with password is enabled
xAuthKey:= FALSE,
sPrivateKey:= '',
sPassphrase:= '',
xAuthHost:= FALSE,
sKnownHosts:= '');
xBusy: BOOL;
xDone: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
xDo := BOOL;
//List
sListBuffer : STRING(255);
END_VAR
FbSFTP(
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
typSSH_Options := typSSH_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
xBusy=> xBusy,
xDone=> xDone,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
END_IF
Function description
This functionblock create a new directory specified by sRemotePath. The Fb create only the last directory in
the path. If a directory in the path is missing or the driectory, that schould create, already exists an error occur.
Transition to TRUE on xTrigger triggers the process to create a new directory. The function block resets
xTrigger to FALSE again after it has finished the process. If something went wrong during the process
xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function block is
still processing.
Example
Example without host and peer verification.
VAR
FbSFTP_DirCreate : WagoAppFTP.FbSFTP_DirCreate;
typSSH_Options: WagoTypesCurl.typSSH_Options := (
xAuthPassword:= TRUE, //Authentication with password is enabled
xAuthKey:= FALSE,
sPrivateKey:= '',
sPassphrase:= '',
xAuthHost:= FALSE,
sKnownHosts:= '');
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
END_VAR
FbSFTP_DirCreate(
xTrigger:= Trigger,
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
typSSH_Options := typSSH_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sRemotePath:= '/root/NewDir',
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus);
Function*
Remove a directory
Graphical Illustration
Function description
This functionblock remove remove the directory, that is specified by sRemotePath. An error is returned if the
directory does not exists, the dircectory cannot be removed (in use, or not empty), or if the user does not have the
appropriate privilege level.
Transition to TRUE on xTrigger triggers the process to remove a directory. The function block resets
xTrigger to FALSE again after it has finished the process. If something went wrong during the process
xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function block is
still processing.
Example
Example without host and peer verification.
VAR
FbSFTP_DirRemove : WagoAppFTP.FbSFTP_DirRemove;
typSSH_Options: WagoTypesCurl.typSSH_Options := (
xAuthPassword:= TRUE, //Authentication with password is enabled
xAuthKey:= FALSE,
sPrivateKey:= '',
sPassphrase:= '',
xAuthHost:= FALSE,
sKnownHosts:= '');
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
END_VAR
FbSFTP_DirRemove(
xTrigger:= Trigger,
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
typSSH_Options := typSSH_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sRemotePath:= '/root/NewDir',
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus);
Function description
This functionblock append a local file specified by sLocalPath to the end of a file on the remote host specified
by sRemotePath. If the remote file dosen´t exit, it will be created.
Transition to TRUE on xTrigger triggers the process to append the local file to the remote file. The function
block resets xTrigger to FALSE again after it has finished the process. If something went wrong during the
process xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function
block is still processing.
For ‘’sLocalPath” you can use the following prefixes, known form WagoAppFileDir:
• HOME://
• CARD://
• TEMP://
• ROOT://
Example
Example without host and peer verification.
VAR
FbSFTP_FileAppend : WagoAppFTP.FbSFTP_FileAppend;
typSSH_Options: WagoTypesCurl.typSSH_Options := (
xAuthPassword:= TRUE, //Authentication with password is enabled
xAuthKey:= FALSE,
sPrivateKey:= '',
sPassphrase:= '',
xAuthHost:= FALSE,
sKnownHosts:= '');
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesTransfered: UDINT;
END_VAR
FbSFTP_FileAppend(
xTrigger:= Trigger,
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
typSSH_Options:= typSSH_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sLocalPath:= 'HOME://Some.txt',
sRemotePath:= '/root/HelloWorld.txt',
xCreateDirs:= FALSE,
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus,
udiNBytesTransfered=> udiNBytesTransfered);
Function description
Thisfunction block append data from the TxBuffer to the end of a file on the remote host specified by
sRemotePath. If the remote file dosen´t exit, it will be created.
Transition to TRUE on xTrigger triggers the process to append the transfer buffer to the remote file. The
function block resets xTrigger to FALSE again after it has finished the process. If something went wrong
during the process xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that
the function block is still processing.
Example
Example without host and peer verification.
VAR
FbSFTP_FileAppendFromMem : WagoAppFTP.FbSFTP_FileAppendFromMem;
typSSH_Options: WagoTypesCurl.typSSH_Options := (
xAuthPassword:= TRUE, //Authentication with password is enabled
xAuthKey:= FALSE,
sPrivateKey:= '',
sPassphrase:= '',
xAuthHost:= FALSE,
sKnownHosts:= '');
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesTransfered: UDINT;
sTxBuffer : STRING(255);
END_VAR
FbSFTP_FileAppendFromMem(
xTrigger:= Trigger,
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
typSSH_Options := typSSH_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sRemotePath:= '/root/AppendFromMem.txt',
pTxBuffer:= ADR(sTxBuffer),
udiTxNBytes:= LENGTH(sTxBuffer),
xCreateDirs:= FALSE,
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus,
udiNBytesTransfered=> udiNBytesTransfered);
Function description
This functionblock reads the data form the remote file, that is specified by the input parameter sRemotePath,
and stored it in the local file, that is specified by the input parameter sLocalPath.
Transition to TRUE on xTrigger triggers the process to read the remote file to a local file. The function block
resets xTrigger to FALSE again after it has finished the process. If something went wrong during the process
xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function block is
still processing.
For ‘’sLocalPath” you can use the following prefixes, known form WagoAppFileDir:
• HOME://
• CARD://
• TEMP://
• ROOT://
Example
Example without host and peer verification.
VAR
FbSFTP_FileRead : WagoAppFTP.FbSFTP_FileRead;
typSSH_Options: WagoTypesCurl.typSSH_Options := (
xAuthPassword:= TRUE, //Authentication with password is enabled
xAuthKey:= FALSE,
sPrivateKey:= '',
sPassphrase:= '',
xAuthHost:= FALSE,
sKnownHosts:= '');
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
END_VAR
FbSFTP_FileRead(
xTrigger:= Trigger,
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
typSSH_Options := typSSH_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sLocalPath:= 'HOME://Some.txt',
sRemotePath:= '/root/HelloWorld.txt',
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
Function description
This functionblock reads the data form the remote file, that is specified by the input parameter sRemotePath,
and stored it in the RxBuffer, that is specified by the input parameter pRxBuffer and udiRxBufferSize. If
the remote file not exist or the parameter pRxBuffer and udiRxBufferSize are 0 then an error occur.
Transition to TRUE on xTrigger triggers the process to remove a remote file. The function block resets
xTrigger to FALSE again after it has finished the process. If something went wrong during the process
xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function block is
still processing.
Example
Example without host and peer verification.
VAR
FbSFTP_FileReadToMem : WagoAppFTP.FbSFTP_FileReadToMem;
typSSH_Options: WagoTypesCurl.typSSH_Options := (
xAuthPassword:= TRUE, //Authentication with password is enabled
xAuthKey:= FALSE,
sPrivateKey:= '',
sPassphrase:= '',
xAuthHost:= FALSE,
sKnownHosts:= '');
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesToTransfer: UDINT;
udiNBytesTransfered: UDINT;
sRxBuffer : STRING(255);
END_VAR
FbSFTP_FileReadToMem(
xTrigger:= Trigger,
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
typSSH_Options := typSSH_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sRemotePath:= '/root/HelloWorld.txt',
pRxBuffer:= ADR(sRxBuffer),
udiRxBufferSize:= SIZEOF(sRxBuffer),
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus,
udiNBytesToTransfer=> udiNBytesToTransfer,
udiNBytesTransfered=> udiNBytesTransfered);
Function description
This functionblock remove the file, that is specified by sRemotePath. An error is returned if the file does not
exists, the file cannot be removed, or if the user does not have the appropriate privilege level.
Transition to TRUE on xTrigger triggers the process to remove a remote file. The function block resets
xTrigger to FALSE again after it has finished the process. If something went wrong during the process
xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function block is
still processing.
Example
Example without host and peer verification.
VAR
FbSFTP_FileRemove : WagoAppFTP.FbSFTP_FileRemove;
typSSH_Options: WagoTypesCurl.typSSH_Options := (
xAuthPassword:= TRUE, //Authentication with password is enabled
xAuthKey:= FALSE,
sPrivateKey:= '',
sPassphrase:= '',
xAuthHost:= FALSE,
sKnownHosts:= '');
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
END_VAR
FbSFTP_FileRemove(
xTrigger:= Trigger,
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
typSSH_Options := typSSH_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sRemotePath:= '/root/HelloWorld.txt',
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus);
Function description
This functionblock rename the file, that is defined by the input parameter sOldFileName, to the name, that is
defined by the input parameter sNewFileName.
Transition to TRUE on xTrigger triggers the process to rename a remote file. The function block resets
xTrigger to FALSE again after it has finished the process. If something went wrong during the process
xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function block is
still processing.
Example:
Example without host and peer verification.
VAR
FbSFTP_FileRename : WagoAppFTP.FbSFTP_FileRename;
typSSH_Options: WagoTypesCurl.typSSH_Options := (
xAuthPassword:= TRUE, //Authentication with password is enabled
xAuthKey:= FALSE,
sPrivateKey:= '',
sPassphrase:= '',
xAuthHost:= FALSE,
sKnownHosts:= '');
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
END_VAR
FbSFTP_FileRename(
xTrigger:= Trigger,
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
typSSH_Options := typSSH_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sOldFileName:= '/root/HelloWorld.txt',
sNewFileName:= '/root/Rename.txt',
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus);
Function description
This functionblock write the data form the local file, that is specified by the input parameter sLocalPath, to the
remote file, that is specified by the input parameter sRemotePath.
Transition to TRUE on xTrigger triggers the process to write the local file to the remote file. The function block
resets xTrigger to FALSE again after it has finished the process. If something went wrong during the process
xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function block is
still processing.
For ‘’sLocalPath” you can use the following prefixes, known form WagoAppFileDir:
• HOME://
• CARD://
• TEMP://
• ROOT://
Example:
Example without host and peer verification.
VAR
FbSFTP_FileWrite : WagoAppFTP.FbSFTP_FileWrite;
typSSH_Options: WagoTypesCurl.typSSH_Options := (
xAuthPassword:= TRUE, //Authentication with password is enabled
xAuthKey:= FALSE,
sPrivateKey:= '',
sPassphrase:= '',
xAuthHost:= FALSE,
sKnownHosts:= '');
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesTransfered: UDINT;
END_VAR
FbSFTP_FileWrite(
xTrigger:= Trigger,
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
typSSH_Options := typSSH_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sLocalPath:= 'HOME://Some.txt',
sRemotePath:= '/root/HelloWorld.txt',
xCreateDirs:= FALSE,
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus,
udiNBytesTransfered=> udiNBytesTransfered);
Function description
This functionblock write the data from the TxBuffer to a file on the remote host specified by sRemotePath.
Transition to TRUE on xTrigger triggers the process to write the transfer buffer to the remote file. The function
block resets xTrigger to FALSE again after it has finished the process. If something went wrong during the
process xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function
block is still processing.
Example:
Example without host and peer verification.
VAR
FbSFTP_FileWriteFromMem : WagoAppFTP.FbSFTP_FileWriteFromMem;
typSSH_Options: WagoTypesCurl.typSSH_Options := (
xAuthPassword:= TRUE, //Authentication with password is enabled
xAuthKey:= FALSE,
sPrivateKey:= '',
sPassphrase:= '',
xAuthHost:= FALSE,
sKnownHosts:= '');
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesTransfered: UDINT;
sTxBuffer : STRING(255);
END_VAR
FbSFTP_FileWriteFromMem(
xTrigger:= Trigger,
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
typSSH_Options := typSSH_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sRemotePath:= '/root/Write.txt',
pTxBuffer:= ADR(sTxBuffer),
udiTxNBytes := LENGTH(sTxBuffer),
xCreateDirs := FALSE,
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus,
udiNBytesTransfered=> udiNBytesTransfered);
Function description
This functionblock performs a directory listing. The input parameter pRxBuffer is pointing to the first element
of the buffer and the buffersize is defined by the input parameter udiRxBufferSize.
If more details of the files and direcotries should list, the input parameter xWithDetails must set to true.
Transition to TRUE on xTrigger triggers the process to make a directory listing. The function block resets
xTrigger to FALSE again after it has finished the process. If something went wrong during the process
xTrigger resets to FALSE and xError is set to TRUE . The output xBusy indicates that the function block is
still processing.
Example:
Example without host and peer verification.
VAR
FbSFTP_List : WagoAppFTP.FbSFTP_List;
typSSH_Options: WagoTypesCurl.typSSH_Options := (
xAuthPassword:= TRUE, //Authentication with password is enabled
xAuthKey:= FALSE,
sPrivateKey:= '',
sPassphrase:= '',
xAuthHost:= FALSE,
sKnownHosts:= '');
xBusy: BOOL;
xError: BOOL;
oStatus: WagoSysErrorBase.FbResult;
udiNBytesTransfered: UDINT;
sRxBuffer : STRING(255);
END_VAR
FbSFTP_List(
xTrigger:= Trigger,
sServer:= '192.168.1.17',
uiPort:= 0,
sUser:= 'root',
sPassword:= 'wago',
typSSH_Options := typSSH_Options,
tKeepAlive:= T#5S,
tTimeout:= T#5S,
sRemotePath:= '/root',
pRxBuffer:= ADR(sRxBuffer),
udiRxBufferSize:= SIZEOF(sRxBuffer),
xWithDetails:= FALSE,
xBusy=> xBusy,
xError=> xError,
oStatus=> oStatus,
udiNBytesTransfered=> udiNBytesTransfered);
80 Status
179
CHAPTER 4
VersionHistory (GVL)
WagoAppFTP
Date Version Author Change
09.06.2020 1.3.1.3 WAGO / Bugfix: SFTP use the selected port
u013972
25.04.2019 1.3.1.2 WAGO / Bugfix for string termination
u013972
08.01.2019 1.3.1.0 WAGO / Properties: free placeholder added
u015842
24.01.2018 1.3.0.3 WAGO / Change in the documentation
u013972
30.11.2017 1.3.0.2 WAGO / Terminate the string after List()
u013972
07.12.2016 1.3.0.0 WAGO / Add Fbs for SFTP-Client-Services
u013972
21.11.2016 1.2.0.0 WAGO / Refactor the library and add Fbs for FTPS-Client-Services and
u013972 FTPES-Client-Services
17.08.2016 1.1.1.0 WAGO / Check the existing of the local file for write operations
u013972
04.03.2016 1.1.0.0 WAGO / Replace WagoSysErrorBase with WagoSysErrorBase
u013972
30.10.2015 1.0.4.0 WAGO / Release Version
u013972
180
CHAPTER 5
Library Reference
5.1 Analyzation
5.1.1 Library Identification
Placeholder: Analyzation
Default Resolution: Analyzation, 3.5.2.0 (System)
Namespace: Analyzation
Parameter: STRING_LENGTH_ADDRESS = 20
181
WagoAppFTP, Release 1.3.1.3
5.2 IecSfc
5.2.1 Library Identification
Placeholder: IecSfc
Default Resolution: IecSfc, 3.4.2.0 (System)
Namespace: IecSfc
5.3 Standard
5.3.1 Library Identification
Placeholder: Standard
Default Resolution: Standard, * (System)
Namespace: Standard
5.4 WagoAppString
5.4.1 Library Identification
Placeholder: WagoAppString
Default Resolution: WagoAppString, * (WAGO)
Namespace: WagoAppString
5.5 WagoSysCurl
5.5.1 Library Identification
Placeholder: WagoSysCurl
Default Resolution: WagoSysCurl, * (WAGO)
Namespace: WagoSysCurl
5.6 WagoSysErrorBase
5.6.1 Library Identification
Placeholder: WagoSysErrorBase
Default Resolution: WagoSysErrorBase, * (WAGO)
Namespace: WagoSysErrorBase
Parameter: RES_LOG_MAX_FILES = 1
5.7 WagoSysFileDir
5.7.1 Library Identification
Placeholder: WagoSysFileDir
Default Resolution: WagoSysFileDir, * (WAGO)
Namespace: WagoSysFileDir
5.8 WagoSysPlainMem
5.8.1 Library Identification
Placeholder: WagoSysPlainMem
Default Resolution: WagoSysPlainMem, * (WAGO)
Namespace: WagoSysPlainMem
5.9 WagoSysVersion
5.9.1 Library Identification
Name: WagoSysVersion
Version: 1.0.0.0
Company: WAGO
Namespace: WagoSysVersion
5.10 WagoTypesCommon
5.10.1 Library Identification
Placeholder: WagoTypesCommon
Default Resolution: WagoTypesCommon, * (WAGO)
Namespace: WagoTypes
• Key: WagoTypesCommon
• SystemLibrary: False
• Optional: False
5.11 WagoTypesCurl
5.11.1 Library Identification
Placeholder: WagoTypesCurl
Default Resolution: WagoTypesCurl, * (WAGO)
Namespace: WagoTypesCurl
5.12 WagoTypesErrorBase
5.12.1 Library Identification
Placeholder: WagoTypesErrorBase
Default Resolution: WagoTypesErrorBase, * (WAGO)
Namespace: WagoTypesErrorBase