Skip to main content
Search

External Event Task

The "External event task" mechanism can be used to trigger a task via an external event. "Unix Domain Sockets" are used for process separation. The corresponding socket file is located in on the target system according to the name chosen by the user for the external event:

/var/run/codesysextension/eventtasks/<EventName>.sock

Creating a task of the "External event" type

  1. Create an external event.

    In the device tree, select Task Configuration and in the context menu click Manage external events (1). In the Manage external events dialog (2), add the new event. The name must not contain spaces or special characters.

    _rtslext_img_add_event.png
    _rtslext_img_add_event2.png
  2. Configure a task as a new External Event Task:

    In the Task Configuration list box, select a task. In the Type list box, select the recently available External task type (3). Assign the desired External event (4) to the task.

    _rtslext_img_taskconfiguration1.png
    _rtslex_img_taskconfiguration2.png

The provided sample project ExternalEventTask.project contains the configuration described above. The task is assigned to the MYEVENT1 external event and the file /var/run/codesysextension/eventtasks/MYEVENT1.sock is created on the system.

With the "socat" command-line tool, you can very easily operate this interface, for example with the following command:

$ socat - UNIX-CLIENT:/var/run/codesysextension/eventtasks/MYEVENT1.sock

This establishes a socket connection in the terminal window and allows you to send individual messages to the socket.

With each message, the task which is configured in the PLC is triggered. The contents of the message are not relevant for triggering the external event. The message length is specified as 1 byte.

Usage of the interface only as a member of the Linux codesysuser user group

Yes

Process separation

Yes