Document metadata

Application name

CSK_Module_FTPClient

Version

4.0.0

Date

2024-08-14

Author

SICK AG

Crowns

CSK_FTPClient

Short description

Module to provide FTP client functionality

Typically the features of this module are used like this (check also main script of this module):
1) Setup the configuration
E. g. via:
CSK_FTPClient.setUsername('tester')
CSK_FTPClient.setPassword('password')
CSK_FTPClient.setPassiveMode(status)

2) Try to connect to the FTP server
CSK_FTPClient.connectFtpClient()

3) If connection was possible, send content to FTP server
E.g. via function "sendData", "sendImage"

4) Optioanlly use Async mode
Per default this module sends the content via FTP and waits till the process was finished.
If it is supported by the device and firmware, it is also possible to use the asynchronous mode.
It will send the content then in its own thread, but other apps can further run in parallel.
CSK_FTPClient.setAsyncMode(status)

5) Register to events to receive data
It is possible to register to events of other apps to put the received data to the FTP server via 'addRegistration'.

Functions

CSK_FTPClient.addRegistration()
Short description

Function to add event registration.

Parameters
Name Type Multiplicity Description

eventName

STRING

1

Name of event to receive data.

dataType

STRING

1

Type of received data.

autoFilename

BOOL

1

Status if filename of received data (via registered events) to put to FTP server should be generated by timestamp.

Sample (auto-generated)
CSK_FTPClient.addRegistration(eventName, dataType, autoFilename)
CSK_FTPClient.addRegistrationViaUI()
Short description

Function to register to preconfigured event via UI.

Sample (auto-generated)
CSK_FTPClient.addRegistrationViaUI()
CSK_FTPClient.clearFlowConfigRelevantConfiguration()
Short description

Function to clear FlowConfig relevant configurations.

Sample (auto-generated)
CSK_FTPClient.clearFlowConfigRelevantConfiguration()
CSK_FTPClient.connectFTPClient()
Short description

Try to connect to FTP server by making use of the predefined configration.

Return values
Name Type Multiplicity Description

connected

BOOL

1

Status of connection success.

Sample (auto-generated)
connected = CSK_FTPClient.connectFTPClient()
CSK_FTPClient.deleteRegistration()
Short description

Function to delete event registration.

Parameters
Name Type Multiplicity Description

eventName

STRING

1

Name of event to deregister from.

Sample (auto-generated)
CSK_FTPClient.deleteRegistration(eventName)
CSK_FTPClient.deleteRegistrationViaUI()
Short description

Function to delete via UI selected event registration.

Sample (auto-generated)
CSK_FTPClient.deleteRegistrationViaUI()
CSK_FTPClient.disconnectFTPClient()
Short description

Disconnect from FTP server

Sample (auto-generated)
CSK_FTPClient.disconnectFTPClient()
CSK_FTPClient.getAsyncMode()
Short description

Get current setting of async transfer mode.

Return values
Name Type Multiplicity Description

status

BOOL

1

Status

Sample (auto-generated)
status = CSK_FTPClient.getAsyncMode()
CSK_FTPClient.getFTPPort()
Short description

Get current setting of FTP port.

Return values
Name Type Multiplicity Description

port

INT

1

Port

Sample (auto-generated)
port = CSK_FTPClient.getFTPPort()
CSK_FTPClient.getFTPServerIP()
Short description

Get current setting of FTP server IP.

Return values
Name Type Multiplicity Description

ip

STRING

1

IP

Sample (auto-generated)
ip = CSK_FTPClient.getFTPServerIP()
CSK_FTPClient.getFTPStatus()
Short description

Get current FTP connection status.

Return values
Name Type Multiplicity Description

status

BOOL

1

Status

Sample (auto-generated)
status = CSK_FTPClient.getFTPStatus()
CSK_FTPClient.getImageName()
Short description

Get suffix of image names to store.

Return values
Name Type Multiplicity Description

imageName

STRING

1

Suffix of image names.

Sample (auto-generated)
imageName = CSK_FTPClient.getImageName()
CSK_FTPClient.getParameters()
Short description

Function to get all parameters of the client in JSON format.

Return values
Name Type Multiplicity Description

jsonParameters

STRING

1

JSON string with all parameters.

Sample (auto-generated)
jsonParameters = CSK_FTPClient.getParameters()
CSK_FTPClient.getPassiveMode()
Short description

Get current setting of FTP passive connection mode.

Return values
Name Type Multiplicity Description

status

BOOL

1

Status

Sample (auto-generated)
status = CSK_FTPClient.getPassiveMode()
CSK_FTPClient.getPassword()
Short description

Get currently used connection password.

Return values
Name Type Multiplicity Description

password

STRING

1

Password

Sample (auto-generated)
password = CSK_FTPClient.getPassword()
CSK_FTPClient.getStatusModuleActive()
Short description

Function to get status if module is active.

Return values
Name Type Multiplicity Description

status

BOOL

1

Status

Sample (auto-generated)
status = CSK_FTPClient.getStatusModuleActive()
CSK_FTPClient.getUsername()
Short description

Get currently used connection user.

Return values
Name Type Multiplicity Description

user

STRING

1

User

Sample (auto-generated)
user = CSK_FTPClient.getUsername()
CSK_FTPClient.loadParameters()
Short description

Load parameters for this module from the CSK_PersistentData module if possible and use them.

Return values
Name Type Multiplicity Description

success

BOOL

1

Success to load parameters.

Sample (auto-generated)
success = CSK_FTPClient.loadParameters()
CSK_FTPClient.pageCalled()
Short description

Function to register "OnResume" of the module UI (only as helper function).

Return values
Name Type Multiplicity Description

empty

STRING

1

Empty string (only needed to simplify binding).

Sample (auto-generated)
empty = CSK_FTPClient.pageCalled()
CSK_FTPClient.resetModule()
Short description

Function to reset main configuration of module.

Sample (auto-generated)
CSK_FTPClient.resetModule()
CSK_FTPClient.sendData()
Short description

Send data to connected FTP server.

Parameters
Name Type Multiplicity Description

data

AUTO

1

Data to send.

filename

STRING

1

Filename to store send data on FTP server.

Sample (auto-generated)
CSK_FTPClient.sendData(data, filename)
CSK_FTPClient.sendImage()
Short description

Send image.

Parameters
Name Type Multiplicity Description

img

OBJECT
Image

1

Image to send

filename

STRING

?

Sample (auto-generated)
CSK_FTPClient.sendImage(img, filename)
CSK_FTPClient.sendParameters()
Short description

Send parameters to CSK_PersistentData module if possible to save them.

Parameters
Name Type Multiplicity Description

noDataSave

BOOL

?

[Optional] Set to TRUE if the data should NOT be saved immediately after sending.

Sample (auto-generated)
CSK_FTPClient.sendParameters(noDataSave)
CSK_FTPClient.setAsyncMode()
Short description

Set if async FTP sending should be used.
If TRUE it will send the content in its own thread, but other apps can further run in parallel.

Parameters
Name Type Multiplicity Description

status

BOOL

1

Status

Sample (auto-generated)
CSK_FTPClient.setAsyncMode(status)
CSK_FTPClient.setAutoFilename()
Short description

Function to set status if filename of received data (via registered events) to put to FTP server should be generated by timestamp.

Parameters
Name Type Multiplicity Description

status

BOOL

1

Status

Sample (auto-generated)
CSK_FTPClient.setAutoFilename(status)
CSK_FTPClient.setDataType()
Short description

Function to preconfigure type of data which is received via event to store on FTP server.

Parameters
Name Type Multiplicity Description

dataType

STRING

1

Type of data.

Sample (auto-generated)
CSK_FTPClient.setDataType(dataType)
CSK_FTPClient.setFlowConfigPriority()
Short description

Function to configure if FlowConfig should have priority for FlowConfig relevant configuration.

Parameters
Name Type Multiplicity Description

status

BOOL

1

Status

Sample (auto-generated)
CSK_FTPClient.setFlowConfigPriority(status)
CSK_FTPClient.setFTPPort()
Short description

Set FTP port.

Parameters
Name Type Multiplicity Description

port

INT

1

Port

Sample (auto-generated)
CSK_FTPClient.setFTPPort(port)
CSK_FTPClient.setFTPServerIP()
Short description

Set FTP srever IP.

Parameters
Name Type Multiplicity Description

ip

STRING

1

IP of FTP server.

Sample (auto-generated)
CSK_FTPClient.setFTPServerIP(ip)
CSK_FTPClient.setImageName()
Short description

Set a image name to send the image with a known name to FTP Server.

Parameters
Name Type Multiplicity Description

imageName

STRING

1

Image name

Sample (auto-generated)
CSK_FTPClient.setImageName(imageName)
CSK_FTPClient.setLoadOnReboot()
Short description

Configure if this module should load its saved parameters at app/device boot up.

Parameters
Name Type Multiplicity Description

status

BOOL

1

Set status

Sample (auto-generated)
CSK_FTPClient.setLoadOnReboot(status)
CSK_FTPClient.setParameterName()
Short description

Function to set the name of the parameters if saved/loaded via the CSK_PersistentData module.

Parameters
Name Type Multiplicity Description

name

STRING

1

Name of the parameter

Sample (auto-generated)
CSK_FTPClient.setParameterName(name)
CSK_FTPClient.setPassiveMode()
Short description

Set if passive FTP connection should be used.

Parameters
Name Type Multiplicity Description

status

BOOL

1

Status

Sample (auto-generated)
CSK_FTPClient.setPassiveMode(status)
CSK_FTPClient.setPassword()
Short description

Set FTP connection password.

Parameters
Name Type Multiplicity Description

password

STRING

1

Password

Sample (auto-generated)
CSK_FTPClient.setPassword(password)
CSK_FTPClient.setRegistereEventName()
Short description

Function to preset event name to register to receive content to save on FTP server.

Parameters
Name Type Multiplicity Description

name

STRING

1

Event name.

Sample (auto-generated)
CSK_FTPClient.setRegistereEventName(name)
CSK_FTPClient.setUITableSelection()
Short description

Function to set selection via UI table.

Parameters
Name Type Multiplicity Description

selection

STRING

1

Selection content.

Sample (auto-generated)
CSK_FTPClient.setUITableSelection(selection)
CSK_FTPClient.setUsername()
Short description

Set FTP connection user.

Parameters
Name Type Multiplicity Description

user

STRING

1

Username

Sample (auto-generated)
CSK_FTPClient.setUsername(user)
CSK_FTPClient.setVerboseMode()
Short description

Function to configure verbose mode of FTP connection.

Parameters
Name Type Multiplicity Description

status

BOOL

1

Status

Sample (auto-generated)
CSK_FTPClient.setVerboseMode(status)

Events

CSK_FTPClient.OnDataLoadedOnReboot
Short description

Event to call if module tried to load parameters and should be ready.

Sample (auto-generated)
function handleOnDataLoadedOnReboot()
  -- Do something
end

Script.register("CSK_FTPClient.OnDataLoadedOnReboot", "handleOnDataLoadedOnReboot")
CSK_FTPClient.OnNewIPCheck
Short description

Notify if string has valid IP format (used for UI).

Callback arguments
Name Type Multiplicity Description

status

BOOL

1

Status

Sample (auto-generated)
function handleOnNewIPCheck(status)
  -- Do something
end

Script.register("CSK_FTPClient.OnNewIPCheck", "handleOnNewIPCheck")
CSK_FTPClient.OnNewParameterName
Short description

Notify name of persistent data parameter.

Callback arguments
Name Type Multiplicity Description

name

STRING

1

Parameter name

Sample (auto-generated)
function handleOnNewParameterName(name)
  -- Do something
end

Script.register("CSK_FTPClient.OnNewParameterName", "handleOnNewParameterName")
CSK_FTPClient.OnNewPassiveModeStatus
Short description

Notify passive mode status.

Callback arguments
Name Type Multiplicity Description

status

BOOL

1

Status

Sample (auto-generated)
function handleOnNewPassiveModeStatus(status)
  -- Do something
end

Script.register("CSK_FTPClient.OnNewPassiveModeStatus", "handleOnNewPassiveModeStatus")
CSK_FTPClient.OnNewPassword
Short description

Notify password.

Callback arguments
Name Type Multiplicity Description

password

STRING

1

Password

Sample (auto-generated)
function handleOnNewPassword(password)
  -- Do something
end

Script.register("CSK_FTPClient.OnNewPassword", "handleOnNewPassword")
CSK_FTPClient.OnNewPort
Short description

Notify FTP connection port.

Callback arguments
Name Type Multiplicity Description

port

INT

1

Port

Sample (auto-generated)
function handleOnNewPort(port)
  -- Do something
end

Script.register("CSK_FTPClient.OnNewPort", "handleOnNewPort")
CSK_FTPClient.OnNewServerIP
Short description

Notify FTP server IP.

Callback arguments
Name Type Multiplicity Description

serverIP

STRING

1

IP of FTP server.

Sample (auto-generated)
function handleOnNewServerIP(serverIP)
  -- Do something
end

Script.register("CSK_FTPClient.OnNewServerIP", "handleOnNewServerIP")
CSK_FTPClient.OnNewStatusAsyncMode
Short description

Notify if asynchronous FTP transfer is used.

Callback arguments
Name Type Multiplicity Description

status

BOOL

1

Status

Sample (auto-generated)
function handleOnNewStatusAsyncMode(status)
  -- Do something
end

Script.register("CSK_FTPClient.OnNewStatusAsyncMode", "handleOnNewStatusAsyncMode")
CSK_FTPClient.OnNewStatusAutoFilename
Short description

Notify if filename should be generated by timestamp.

Callback arguments
Name Type Multiplicity Description

status

BOOL

1

Status

Sample (auto-generated)
function handleOnNewStatusAutoFilename(status)
  -- Do something
end

Script.register("CSK_FTPClient.OnNewStatusAutoFilename", "handleOnNewStatusAutoFilename")
CSK_FTPClient.OnNewStatusConnected
Short description

Notify FTP connection status.

Callback arguments
Name Type Multiplicity Description

status

BOOL

1

Status

Sample (auto-generated)
function handleOnNewStatusConnected(status)
  -- Do something
end

Script.register("CSK_FTPClient.OnNewStatusConnected", "handleOnNewStatusConnected")
CSK_FTPClient.OnNewStatusCSKStyle
Short description

Notify UI style to use for CSK modules.

Callback arguments
Name Type Multiplicity Description

theme

STRING

1

UI style

Sample (auto-generated)
function handleOnNewStatusCSKStyle(theme)
  -- Do something
end

Script.register("CSK_FTPClient.OnNewStatusCSKStyle", "handleOnNewStatusCSKStyle")
CSK_FTPClient.OnNewStatusDataType
Short description

Notify preset type of data for registered event.

Callback arguments
Name Type Multiplicity Description

dataType

STRING

1

Type of data.

Sample (auto-generated)
function handleOnNewStatusDataType(dataType)
  -- Do something
end

Script.register("CSK_FTPClient.OnNewStatusDataType", "handleOnNewStatusDataType")
CSK_FTPClient.OnNewStatusFlowConfigPriority
Short description

Notify if FlowConfig should have priority for FlowConfig relevant configurations.

Callback arguments
Name Type Multiplicity Description

status

BOOL

1

Status

Sample (auto-generated)
function handleOnNewStatusFlowConfigPriority(status)
  -- Do something
end

Script.register("CSK_FTPClient.OnNewStatusFlowConfigPriority", "handleOnNewStatusFlowConfigPriority")
CSK_FTPClient.OnNewStatusLoadParameterOnReboot
Short description

Notify status if parameters should be loaded on app/device boot up.

Callback arguments
Name Type Multiplicity Description

status

BOOL

1

Status

Sample (auto-generated)
function handleOnNewStatusLoadParameterOnReboot(status)
  -- Do something
end

Script.register("CSK_FTPClient.OnNewStatusLoadParameterOnReboot", "handleOnNewStatusLoadParameterOnReboot")
CSK_FTPClient.OnNewStatusModuleIsActive
Short description

Notify if module can be used on device.

Callback arguments
Name Type Multiplicity Description

status

BOOL

1

Status

Sample (auto-generated)
function handleOnNewStatusModuleIsActive(status)
  -- Do something
end

Script.register("CSK_FTPClient.OnNewStatusModuleIsActive", "handleOnNewStatusModuleIsActive")
CSK_FTPClient.OnNewStatusModuleVersion
Short description

Notify version of module.

Callback arguments
Name Type Multiplicity Description

version

STRING

1

Version

Sample (auto-generated)
function handleOnNewStatusModuleVersion(version)
  -- Do something
end

Script.register("CSK_FTPClient.OnNewStatusModuleVersion", "handleOnNewStatusModuleVersion")
CSK_FTPClient.OnNewStatusRegisteredEventName
Short description

Notify preset name of event to register for incoming data.

Callback arguments
Name Type Multiplicity Description

eventName

STRING

1

Name of event.

Sample (auto-generated)
function handleOnNewStatusRegisteredEventName(eventName)
  -- Do something
end

Script.register("CSK_FTPClient.OnNewStatusRegisteredEventName", "handleOnNewStatusRegisteredEventName")
CSK_FTPClient.OnNewStatusRegistrationList
Short description

Notify JSON list of registered events incl. related type of data.

Callback arguments
Name Type Multiplicity Description

list

STRING

1

List of content.

Sample (auto-generated)
function handleOnNewStatusRegistrationList(list)
  -- Do something
end

Script.register("CSK_FTPClient.OnNewStatusRegistrationList", "handleOnNewStatusRegistrationList")
CSK_FTPClient.OnNewStatusVerboseMode
Short description

Notify if FTP connection is running in verbose mode.

Callback arguments
Name Type Multiplicity Description

status

BOOL

1

Status

Sample (auto-generated)
function handleOnNewStatusVerboseMode(status)
  -- Do something
end

Script.register("CSK_FTPClient.OnNewStatusVerboseMode", "handleOnNewStatusVerboseMode")
CSK_FTPClient.OnNewUsername
Short description

Notify FTP username.

Callback arguments
Name Type Multiplicity Description

username

STRING

1

Username

Sample (auto-generated)
function handleOnNewUsername(username)
  -- Do something
end

Script.register("CSK_FTPClient.OnNewUsername", "handleOnNewUsername")
CSK_FTPClient.OnPersistentDataModuleAvailable
Short description

Notify status if features of CSK_PersistentData module are available.

Callback arguments
Name Type Multiplicity Description

status

BOOL

1

Status

Sample (auto-generated)
function handleOnPersistentDataModuleAvailable(status)
  -- Do something
end

Script.register("CSK_FTPClient.OnPersistentDataModuleAvailable", "handleOnPersistentDataModuleAvailable")
CSK_FTPClient.OnUserLevelAdminActive
Short description

Status of Admin userlevel. Used internally in combination with the CSK_UserManagement module if available.

Callback arguments
Name Type Multiplicity Description

status

BOOL

1

Status

Sample (auto-generated)
function handleOnUserLevelAdminActive(status)
  -- Do something
end

Script.register("CSK_FTPClient.OnUserLevelAdminActive", "handleOnUserLevelAdminActive")
CSK_FTPClient.OnUserLevelMaintenanceActive
Short description

Status of Maintenance userlevel. Used internally in combination with the CSK_UserManagement module if available.

Callback arguments
Name Type Multiplicity Description

status

BOOL

1

Status

Sample (auto-generated)
function handleOnUserLevelMaintenanceActive(status)
  -- Do something
end

Script.register("CSK_FTPClient.OnUserLevelMaintenanceActive", "handleOnUserLevelMaintenanceActive")
CSK_FTPClient.OnUserLevelOperatorActive
Short description

Status of Operator userlevel. Used internally in combination with the CSK_UserManagement module if available.

Callback arguments
Name Type Multiplicity Description

status

BOOL

1

Status

Sample (auto-generated)
function handleOnUserLevelOperatorActive(status)
  -- Do something
end

Script.register("CSK_FTPClient.OnUserLevelOperatorActive", "handleOnUserLevelOperatorActive")
CSK_FTPClient.OnUserLevelServiceActive
Short description

Status of Service userlevel. Used internally in combination with the CSK_UserManagement module if available.

Callback arguments
Name Type Multiplicity Description

status

BOOL

1

Status

Sample (auto-generated)
function handleOnUserLevelServiceActive(status)
  -- Do something
end

Script.register("CSK_FTPClient.OnUserLevelServiceActive", "handleOnUserLevelServiceActive")

CSK_Module_FTPClient

Short description

This is an automatically generated CROWN (description not necessary).

Overview

FTPClient_FC

Short description

Crown to provide CSK_FlowConfig relevant features.

Overview

FTPClient_FC.Put

Short description

Set source of incoming data to put to FTP server.

Overview

Functions

FTPClient_FC.Put.create()
Short description

Internally used CSK_FlowConfig create function.

Parameters
Name Type Multiplicity Description

dataType1

ENUM
CSK_FTPClient.DataType

?

Data type of data1 ('DATA' per default). 'DATA' = Store STRING data as .dat file 'JPG' = Store data as JPG image file.

dataType2

ENUM
CSK_FTPClient.DataType

?

Data type of data2 ('DATA' per default). 'DATA' = Store STRING data as .dat file 'JPG' = Store data as JPG image file.

dataType3

ENUM
CSK_FTPClient.DataType

?

Data type of data3 ('DATA' per default). 'DATA' = Store STRING data as .dat file 'JPG' = Store data as JPG image file.

dataType4

ENUM
CSK_FTPClient.DataType

?

Data type of data4 ('DATA' per default). 'DATA' = Store STRING data as .dat file 'JPG' = Store data as JPG image file.

autoName1

BOOL

?

Status if filename should be generated by date/time or is provided via source of data1 (TRUE per default).

autoName2

BOOL

?

Status if filename should be generated by date/time or is provided via source of data2 (TRUE per default).

autoName3

BOOL

?

Status if filename should be generated by date/time or is provided via source of data3 (TRUE per default).

autoName4

BOOL

?

Status if filename should be generated by date/time or is provided via source of data4 (TRUE per default).

Return values
Name Type Multiplicity Description

handle

HANDLE

1

Handle to internally used FlowConfig instance.

Sample (auto-generated)
handle = FTPClient_FC.Put.create(dataType1, dataType2, dataType3, dataType4, autoName1, autoName2, autoName3, autoName4)
FTPClient_FC.Put.put()
Short description

Set source of incoming data to put to FTP server.

Parameters
Name Type Multiplicity Description

handle

HANDLE

1

Handle to internally used FlowConfig instance.

data1

STRING

?

Source of data to put to FTP server. Parameter: 1: Data (STRING or IMAGE) 2: Optional name to store data (STRING)

data2

STRING

?

Source of data to put to FTP server. Parameter: 1: Data (STRING or IMAGE) 2: Optional name to store data (STRING)

data3

STRING

?

Source of data to put to FTP server. Parameter: 1: Data (STRING or IMAGE) 2: Optional name to store data (STRING)

data4

STRING

?

Source of data to put to FTP server. Parameter: 1: Data (STRING or IMAGE) 2: Optional name to store data (STRING)

Sample (auto-generated)
FTPClient_FC.Put.put(handle, data1, data2, data3, data4)

Enumerations

CSK_FTPClient.DataType

Type of data to save on FTP server.

Items
Value Name Description
DATA

DATA

Store STRING data as .dat file

JPG

JPG

Store data as JPG image file.