Document metadata

Application name

CSK_Module_TCPIPClient

Version

3.1.0

Date

2023-09-22

Author

SICK AG

Crowns

CSK_Module_TCPIPClient

Short description

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

CSK_TCPIPClient

Short description

Module to provide TCP/IP client functionality. Other modules can access its features / settings.
This module provides a UI for all relevant features.

Typically the features of this module are used like this (check also main script of this module):
1) Setup the TCP/IP client configuration
See UI

2) Forward content via TCP/IP, also by other modules
To send content via TCP/IP, there are different possibilities.
You can make use of sendDataViaTCPIP() to directly send the content with this function.
It is also possible to preset the content via setCommand() and after that send the preset content via transmitCommando() (e.g. used within the UI).

Additionally it is possible to configure the module to listen / wait for specific events of other modules/apps and to forward their content via TCP/IP.
This can be used e.g. to listen to "OtherModule.OnNewResult"-events and to forward the results via TCP/IP (data will be converted to data type 'string').
To do so make use of "addEventToForward" (via script) or "addEventToForwardViaUI" (event needs to be preset via "setEventToForward").

3) Wait for incoming triggers
It is possible to define trigger commandos to wait for and to forward this on another event, e.g. to another module.
This can be done e.g. via addTriggerEventPair('TRG', 'OnNewTrigger').
By doing this, it will notify the TCPIPClient.OnNewTrigger event if a TRG is received on the client.
INFO: Events will dynamically created and served. Other modules can check via "Script.isServedAsEvent" if event exists.
If there is additional content following the defined trigger command after a ',' it will also be forwarded withint the data content of the event.
The same can be done via the UI step by step (see setTrigger(), setEventName(), or addTriggerEventPairViaUI()).

4) Listen for incoming content
It is also possible to register on the 'OnNewDataReceived' event by other modules to get the communication content.

Functions

CSK_TCPIPClient.addEventToForward()
Short description

Add an event to register to and to forward the content of its first parameter (as string) to TCP/IP server.

Parameters
Name Type Multiplicity Description

event

STRING

1

Name of event to register to.

Sample (auto-generated)
CSK_TCPIPClient.addEventToForward(event)
CSK_TCPIPClient.addEventToForwardViaUI()
Short description

Add event to register to and forward content (first event parameter as string) to TCPI/IP server via UI (event needs to be prefilled on UI / via "setEventToForward").

Sample (auto-generated)
CSK_TCPIPClient.addEventToForwardViaUI()
CSK_TCPIPClient.addTriggerEventPair()
Short description

Add a trigger command to wait for and the related event to call if the trigger command was received.

Parameters
Name Type Multiplicity Description

trigger

STRING

1

Trigger to listen on TCP/IP connection.

event

STRING

1

Name of event to notify if trigger command was received.
Prefix 'TCPIPClient.' will be used in front of the string.

Sample (auto-generated)
CSK_TCPIPClient.addTriggerEventPair(trigger, event)
CSK_TCPIPClient.addTriggerEventPairViaUI()
Short description

Add pair of "trigger" and "event" via UI (parameters are prefilled on UI).

Sample (auto-generated)
CSK_TCPIPClient.addTriggerEventPairViaUI()
CSK_TCPIPClient.deleteEventToForward()
Short description

Remove event to forward content.

Parameters
Name Type Multiplicity Description

event

STRING

1

Eventname

Sample (auto-generated)
CSK_TCPIPClient.deleteEventToForward(event)
CSK_TCPIPClient.deleteEventToForwardViaUI()
Short description

Remove event preselected via UI.

Sample (auto-generated)
CSK_TCPIPClient.deleteEventToForwardViaUI()
CSK_TCPIPClient.deleteTriggerEventPair()
Short description

Remove trigger/event pair via trigger name.

Parameters
Name Type Multiplicity Description

trigger

STRING

1

Trigger command

Sample (auto-generated)
CSK_TCPIPClient.deleteTriggerEventPair(trigger)
CSK_TCPIPClient.deleteTriggerEventPairViaUI()
Short description

Remove trigger/event pair selected via modules UI.

Sample (auto-generated)
CSK_TCPIPClient.deleteTriggerEventPairViaUI()
CSK_TCPIPClient.loadParameters()
Short description

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

Sample (auto-generated)
CSK_TCPIPClient.loadParameters()
CSK_TCPIPClient.pageCalled()
Short description

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

Return values
Name Type Multiplicity Description

emptyString

STRING

1

Empty string (only needed to simplify binding).

Sample (auto-generated)
emptyString = CSK_TCPIPClient.pageCalled()
CSK_TCPIPClient.selectEventToForwardViaUI()
Short description

Select an event to forward the content of its first parameter to TCP/IP server via UI.

Parameters
Name Type Multiplicity Description

selection

STRING

1

Selected event.

Sample (auto-generated)
CSK_TCPIPClient.selectEventToForwardViaUI(selection)
CSK_TCPIPClient.selectTriggerEventPairViaUI()
Short description

Select a trigger/event pair via UI.

Parameters
Name Type Multiplicity Description

selection

STRING

1

Selected trigger/event pair.

Sample (auto-generated)
CSK_TCPIPClient.selectTriggerEventPairViaUI(selection)
CSK_TCPIPClient.sendDataViaTCPIP()
Short description

Transmit data via currently active TCP/IP connection.

Parameters
Name Type Multiplicity Description

data

STRING

1

Binary string to transmit via TCP/IP.

Sample (auto-generated)
CSK_TCPIPClient.sendDataViaTCPIP(data)
CSK_TCPIPClient.sendParameters()
Short description

Send parameters to CSK_PersistentData module if possible to save them.

Sample (auto-generated)
CSK_TCPIPClient.sendParameters()
CSK_TCPIPClient.setCommand()
Short description

Set command to transmit via TCP/IP if triggered via "transmitCommando() (used in modules UI).

Parameters
Name Type Multiplicity Description

cmd

STRING

1

Command to transmit.

Sample (auto-generated)
CSK_TCPIPClient.setCommand(cmd)
CSK_TCPIPClient.setConnectionStatus()
Short description

Set status of TCP/IP connection.

Parameters
Name Type Multiplicity Description

status

BOOL

1

Status

Sample (auto-generated)
CSK_TCPIPClient.setConnectionStatus(status)
CSK_TCPIPClient.setEventToForward()
Short description

Preset event to register to and forward content to TCP/IP server via UI.

Parameters
Name Type Multiplicity Description

value

STRING

1

Event to register to.

Sample (auto-generated)
CSK_TCPIPClient.setEventToForward(value)
CSK_TCPIPClient.setEventValue()
Short description

Set event for trigger/event pair via UI.

Parameters
Name Type Multiplicity Description

value

STRING

1

Event to notify.

Sample (auto-generated)
CSK_TCPIPClient.setEventValue(value)
CSK_TCPIPClient.setInterface()
Short description

Set interface for the TCP/IP connection.

Parameters
Name Type Multiplicity Description

interface

STRING

1

Interface

Sample (auto-generated)
CSK_TCPIPClient.setInterface(interface)
CSK_TCPIPClient.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

Status

Sample (auto-generated)
CSK_TCPIPClient.setLoadOnReboot(status)
CSK_TCPIPClient.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

Parameter name

Sample (auto-generated)
CSK_TCPIPClient.setParameterName(name)
CSK_TCPIPClient.setPort()
Short description

Set port of TCP/IP connection.

Parameters
Name Type Multiplicity Description

port

INT

1

Port

Sample (auto-generated)
CSK_TCPIPClient.setPort(port)
CSK_TCPIPClient.setRxFraming()
Short description

Set Rx frame of TCP/IP connection (only 'empty' or 'STX-ETX' supported). Will become active with next connection.

Parameters
Name Type Multiplicity Description

frame

ENUM
CSK_TCPIPClient.Communication_Frame

1

Frame to use.

Sample (auto-generated)
CSK_TCPIPClient.setRxFraming(frame)
CSK_TCPIPClient.setServerAddress()
Short description

Set IP of TCP/IP server.

Parameters
Name Type Multiplicity Description

address

STRING

1

IP

Sample (auto-generated)
CSK_TCPIPClient.setServerAddress(address)
CSK_TCPIPClient.setTrigger()
Short description

Set trigger command for trigger/event pair via UI.

Parameters
Name Type Multiplicity Description

value

STRING

1

Trigger command

Sample (auto-generated)
CSK_TCPIPClient.setTrigger(value)
CSK_TCPIPClient.setTxFraming()
Short description

Set Tx frame of TCP/IP connection (only 'empty' or 'STX-ETX' supported). Will become active with next connection.

Parameters
Name Type Multiplicity Description

frame

ENUM
CSK_TCPIPClient.Communication_Frame

1

Frame to use.

Sample (auto-generated)
CSK_TCPIPClient.setTxFraming(frame)
CSK_TCPIPClient.startTCPIPClient()
Short description

Start TCP/IP client.

Sample (auto-generated)
CSK_TCPIPClient.startTCPIPClient()
CSK_TCPIPClient.stopTCPIPClient()
Short description

Stop TCP/IP client.

Sample (auto-generated)
CSK_TCPIPClient.stopTCPIPClient()
CSK_TCPIPClient.transmitCommando()
Short description

Transmit preset commando via TCP/IP (used in module UI). See also "setCommand".

Sample (auto-generated)
CSK_TCPIPClient.transmitCommando()

Events

CSK_TCPIPClient.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_TCPIPClient.OnDataLoadedOnReboot", "handleOnDataLoadedOnReboot")
CSK_TCPIPClient.OnNewCommand
Short description

Notify command to send.

Callback arguments
Name Type Multiplicity Description

cmd

STRING

1

Command to transmit.

Sample (auto-generated)
function handleOnNewCommand(cmd)
  -- Do something
end

Script.register("CSK_TCPIPClient.OnNewCommand", "handleOnNewCommand")
CSK_TCPIPClient.OnNewConnectionStatus
Short description

Notify configuration setup of TCP/IP connection status.

Callback arguments
Name Type Multiplicity Description

status

BOOL

1

Status

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

Script.register("CSK_TCPIPClient.OnNewConnectionStatus", "handleOnNewConnectionStatus")
CSK_TCPIPClient.OnNewCurrentConnectionStatus
Short description

Notify current status of TCP/IP connection.

Callback arguments
Name Type Multiplicity Description

status

BOOL

1

Status

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

Script.register("CSK_TCPIPClient.OnNewCurrentConnectionStatus", "handleOnNewCurrentConnectionStatus")
CSK_TCPIPClient.OnNewDataReceived
Short description

Notify received data.

Callback arguments
Name Type Multiplicity Description

data

STRING

1

Received data.

Sample (auto-generated)
function handleOnNewDataReceived(data)
  -- Do something
end

Script.register("CSK_TCPIPClient.OnNewDataReceived", "handleOnNewDataReceived")
CSK_TCPIPClient.OnNewEventToForwardList
Short description

Notify list of events to register to and to forward its content to TCP/IP server.

Callback arguments
Name Type Multiplicity Description

list

STRING

1

List

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

Script.register("CSK_TCPIPClient.OnNewEventToForwardList", "handleOnNewEventToForwardList")
CSK_TCPIPClient.OnNewInterface
Short description

Notify selected interface for TCP/IP connection.

Callback arguments
Name Type Multiplicity Description

interface

STRING

1

Interface

Sample (auto-generated)
function handleOnNewInterface(interface)
  -- Do something
end

Script.register("CSK_TCPIPClient.OnNewInterface", "handleOnNewInterface")
CSK_TCPIPClient.OnNewInterfaceList
Short description

Notify list of available interfaces for TCP/IP connection.

Callback arguments
Name Type Multiplicity Description

list

STRING

1

List of interfaces.

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

Script.register("CSK_TCPIPClient.OnNewInterfaceList", "handleOnNewInterfaceList")
CSK_TCPIPClient.OnNewLog
Short description

Notfiy latest log.

Callback arguments
Name Type Multiplicity Description

log

STRING

1

Log entries.

Sample (auto-generated)
function handleOnNewLog(log)
  -- Do something
end

Script.register("CSK_TCPIPClient.OnNewLog", "handleOnNewLog")
CSK_TCPIPClient.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_TCPIPClient.OnNewParameterName", "handleOnNewParameterName")
CSK_TCPIPClient.OnNewPort
Short description

Notify port of TCP/IP connection.

Callback arguments
Name Type Multiplicity Description

port

INT

1

Port

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

Script.register("CSK_TCPIPClient.OnNewPort", "handleOnNewPort")
CSK_TCPIPClient.OnNewRxFrame
Short description

Notify RxFrame.

Callback arguments
Name Type Multiplicity Description

frame

STRING

1

frame

Sample (auto-generated)
function handleOnNewRxFrame(frame)
  -- Do something
end

Script.register("CSK_TCPIPClient.OnNewRxFrame", "handleOnNewRxFrame")
CSK_TCPIPClient.OnNewServerIP
Short description

Notify TCP/IP server IP.

Callback arguments
Name Type Multiplicity Description

serverIP

STRING

1

IP

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

Script.register("CSK_TCPIPClient.OnNewServerIP", "handleOnNewServerIP")
CSK_TCPIPClient.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_TCPIPClient.OnNewStatusLoadParameterOnReboot", "handleOnNewStatusLoadParameterOnReboot")
CSK_TCPIPClient.OnNewTestTrigger
Short description

Internal test event to be notified if test trigger cmd was received ('TRG').

Callback arguments
Name Type Multiplicity Description

data

STRING

?

Data content to forward.

Sample (auto-generated)
function handleOnNewTestTrigger(data)
  -- Do something
end

Script.register("CSK_TCPIPClient.OnNewTestTrigger", "handleOnNewTestTrigger")
CSK_TCPIPClient.OnNewTriggerEventPairList
Short description

Notify list of trigger/event pairs.

Callback arguments
Name Type Multiplicity Description

list

STRING

1

List

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

Script.register("CSK_TCPIPClient.OnNewTriggerEventPairList", "handleOnNewTriggerEventPairList")
CSK_TCPIPClient.OnNewTxFrame
Short description

Notify TxFrame.

Callback arguments
Name Type Multiplicity Description

frame

STRING

1

frame

Sample (auto-generated)
function handleOnNewTxFrame(frame)
  -- Do something
end

Script.register("CSK_TCPIPClient.OnNewTxFrame", "handleOnNewTxFrame")
CSK_TCPIPClient.OnPersistentDataModuleAvailable
Short description

Notify status if features of CSK_PersistendData 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_TCPIPClient.OnPersistentDataModuleAvailable", "handleOnPersistentDataModuleAvailable")
CSK_TCPIPClient.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_TCPIPClient.OnUserLevelAdminActive", "handleOnUserLevelAdminActive")
CSK_TCPIPClient.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_TCPIPClient.OnUserLevelMaintenanceActive", "handleOnUserLevelMaintenanceActive")
CSK_TCPIPClient.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_TCPIPClient.OnUserLevelOperatorActive", "handleOnUserLevelOperatorActive")
CSK_TCPIPClient.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_TCPIPClient.OnUserLevelServiceActive", "handleOnUserLevelServiceActive")

Enumerations

CSK_TCPIPClient.Communication_Frame

TCP/IP communication frame.

Items
Value Name Description
empty

empty

No frame.

STX-ETX

STX_ETX

STX / ETX framing.