Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
devices_scripting [2020/06/09 15:17] wikiadmin |
devices_scripting [2025/01/03 10:02] (current) wikiadmin |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | **Scripting with TransSECS Devices** | + | ====Scripting with TransSECS Devices==== |
- | To write a value to a server in the devices the format is: | + | [[Scripting for PLC Servers]] |
+ | (Read/Write values | ||
+ | [[" | ||
+ | (Setting Server outputs and values) | ||
- | ''/ | + | [[Checking Quality on an incomingValue Triggering a Script]] |
+ | [[devices_databases|Scripting for Databases]] | ||
+ | (Recipe Management) | ||
- | For example, | + | [[Scripting |
- | <code javascript> | + | |
- | /Devices/ | + | |
- | </ | + | |
- | TransSECS is thread safe and so you can create threads in a script. | + | [[Setting |
- | <code javascript> | + | [[Storing Reports and Events to a Log File]] |
- | var Thread = Java.type(" | + | |
- | var Runnable = Java.type(" | + | |
- | // declare our thread | + | [[FTP File Upload Example]] |
- | this.thread = new Thread(new Runnable(){ | + | |
- | run: function () { | + | |
- | / | + | |
- | print(" | + | |
- | } | + | |
- | }); | + | |
- | + | ||
- | // start our thread | + | |
- | this.thread.start(); | + | |
- | </ | + | |
- | + | ||
- | **Register for Connection Status Notification in TransSECS Host Application** | + | |
- | + | ||
- | In a GEMHost application the TransSECS controller publishes the status of the connection. | + | |
- | + | ||
- | To register for this, add a " | + | |
- | + | ||
- | {{: | + | |
- | + | ||
- | Register for the notification in the " | + | |
- | + | ||
- | <code javascript> | + | |
- | var TransSecsController = Java.type(" | + | |
- | var ConnectionStatusListener = Java.type(" | + | |
- | + | ||
- | print(" | + | |
- | + | ||
- | host=TransSecsController.findController(" | + | |
- | + | ||
- | // create the connection status listener | + | |
- | var connectionStatusListener = new ConnectionStatusListener() { | + | |
- | + | ||
- | | + | |
- | print (" | + | |
- | } | + | |
- | }; | + | |
- | + | ||
- | // add this to the host | + | |
- | host.addConnectionStatusListener(connectionStatusListener); | + | |
- | print(" | + | |
- | </ | + | |
- | + | ||
- | The details of the connection status are [[programmatic_host_connection_status|described here]] | + |