Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This set of functions are used in combination with tasks. Some functions provide helper functionality that are only invokable within LUA functions that are executed by task (cf. Section 4.5.2). .
Furthermore, there are functions included that can be used to add and delete task definitions directly within LUA scripts. Using them provides the opportunity to dynamically create task that are not listed within the task definition file. Note that adding and deleting of task can only be done during server start up (e.g. within the callback "OnInitEvent").
<file name="nxa.SourceItemID | nxa.SourceVar">
<h1>Description</h1>
<h1>Signature</h1> string nxa.SourceItemID | nxa.SourceVar () <p>This function can be used to query the ID of the source item that triggered the corresponding task. This function can only be used within LUA functions that are invoked by tasks.</p>
<h1>Parameters</h1> None.
<h1>Return</h1>
<table>
<colgroup> <col/> <col/> </colgroup>
<tbody>
<tr>
<th>Type</th> <th>Description</th>
</tr>
<tr><td>string</td><td>itemID of the source item that triggered the task</td></tr>
</tbody>
</table>
</file>
<file name="nxa.DestinationItemID">
<h1>Description</h1>
<h1>Signature</h1> string nxa.DestinationItemID () <p>This function can be used to query the ID of the destination item that is configured within the corresponding task. This function can only be used within LUA functions that are invoked by tasks.</p>
<h1>Parameters</h1> None.
<h1>Return</h1>
<table>
<colgroup> <col/> <col/> </colgroup>
<tbody>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr><td>string</td><td>itemID of the destination item that is configured within the task</td></tr>
</tbody>
</table>
</file>
<file name="nxa.SetDestinationValue">
<h1>Description</h1>
<h1>Signature</h1> nxa.SetDestinationValue (variant) <p>This function can be used to set a new value for the destination item that is configured within the corresponding task. This function can only be used within LUA functions that are invoked by tasks. Note that the new value will only be set within the server - it will not be forwarded to the field device.</p>
<h1>Parameters</h1>
<table>
<colgroup> <col/> <col/> <col/> <col/> </colgroup>
<tbody>
<tr>
<th>Name</th>
<th>Type</th>
<th>Mandatory/Optional</th>
<th>Description</th>
</tr>
<tr><td></td><td>variant</td><td>M</td><td>new value of the destination item</td></tr>
</tbody>
</table>
<h1>Return</h1> None.
</file>
<file name="nxa.WriteDestinationValue">
<h1>Description</h1>
<h1>Signature</h1> nxa.WriteDestinationValue (variant) <p>This function can be used to write a new value to the destination item that is configured within the corresponding task. Compared to setting a value, a value write will also propagate the value change to the field device. This function can only be used within LUA functions that are invoked by tasks.</p> <h1>Parameters</h1>
<table>
<colgroup> <col/> <col/> <col/> <col/> </colgroup>
<tbody>
<tr>
<th>Name</th>
<th>Type</th>
<th>Mandatory/Optional</th>
<th>Description</th>
</tr>
<tr><td></td><td>variant</td><td>M</td><td>new value of the destination item</td></tr>
</tbody>
</table>
<h1>Return</h1> None.
</file>
<file name="nxa.ReadDestinationValue">
<h1>Description</h1>
<h1>Signature</h1> variant nxa.ReadDestinationValue () <p>This function can be used to read the current value of the destination item that is configured within the corresponding task. This function can only be used within LUA functions that are invoked by tasks.</p>
<h1>Parameters</h1> None.
<h1>Return</h1>
<table>
<colgroup> <col/> <col/> </colgroup>
<tbody>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr><td>variant</td><td>current value of the destination item</td></tr>
</tbody>
</table>
</file>
<file name="nxa.InputValue | nxa.SourceValue">
<h1>Description</h1>
<h1>Signature</h1> variant nxa.InputValue | nxa.SourceValue () <p>This function can be used to query the value of the source item that triggered the corresponding task. This function can only be used within LUA functions that are invoked by tasks.</p>
<h1>Parameters</h1> None.
<h1>Return</h1>
<table>
<colgroup> <col/> <col/> </colgroup>
<tbody>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr><td>variant</td><td>current value of the source item</td></tr>
</tbody>
</table>
</file>
<file name="nxa.ExecuteDelayedScript">
<h1>Description</h1>
<h1>Signature</h1> nxa.ExecuteDelayedScript (string, number) <p>This function executes a LUA script that is specified as String parameter. The execution can optionally be delayed.</p>
<h1>Parameters</h1>
<table>
<colgroup> <col/> <col/> <col/> <col/> </colgroup>
<tbody>
<tr>
<th>Name</th>
<th>Type</th>
<th>Mandatory/Optional</th>
<th>Description</th>
</tr>
<tr><td></td><td>string</td><td>M</td><td>name of the LUA script</td></tr>
<tr><td></td><td>number</td><td>O</td><td>delay in milliseconds (optional)</td></tr>
</tbody>
</table>
<h1>Return</h1> None.
</file>
<file name="nxa.AddWriteTask">
<h1>Description</h1>
<h1>Signature</h1> nxa.AddWriteTask (string, string, bool, bool, bool, number, variant) <p>This function adds a new "WRITE" task definition during runtime.</p>
<h1>Parameters</h1>
<table>
<colgroup> <col/> <col/> <col/> <col/> </colgroup>
<tbody>
<tr>
<th>Name</th>
<th>Type</th>
<th>Mandatory/Optional</th> <th>Description</th>
</tr>
<tr><td></td><td>string</td><td>M</td><td>itemID of the source Server Item that triggers the task</td></tr>
<tr><td></td><td>string</td><td>M</td><td>itemID of the destination Server Item that is changed by the task</td></tr>
<tr><td></td><td>bool</td><td>M</td><td>corresponds to the "OnReceive" parameter of the task definition (cf. Section 4.5.2)</td></tr>
<tr><td></td><td>bool</td><td>M</td><td>corresponds to the "OnSend" parameter of the task definition (cf. Section 4.5.2)</td></tr>
<tr><td></td><td>bool</td><td>M</td><td>corresponds to the "OnSet" parameter of the
task definition (cf. Section 4.5.2)</td></tr>
<tr><td></td><td>number</td><td>M</td><td>time interval in milliseconds that the task will be delayed when triggered</td></tr>
<tr><td></td><td>variant</td><td>O</td><td>if used, this value will be used instead of the value of the source item (optional)</td></tr>
</tbody>
</table>
<h1>Return</h1> None.
</file>
<file name="nxa.AddReadTask">
<h1>Description</h1>
<h1>Signature</h1> nxa.AddReadTask (string, string, bool, bool, bool, number) <p>This function adds a new "READ" task definition during runtime.</p>
<h1>Parameters</h1>
<table>
<colgroup> <col/> <col/> <col/> <col/> </colgroup>
<tbody>
<tr>
<th>Name</th>
<th>Type</th>
<th>Mandatory/Optional</th>
<th>Description</th>
</tr>
<tr><td></td><td>string</td><td>M</td><td>itemID of the source Server Item that triggers the task</td></tr>
<tr><td></td><td>string</td><td>M</td><td>itemID of the Server Item that has to be read</td></tr>
<tr><td></td><td>bool</td><td>M</td><td>corresponds to the "OnReceive" parameter of the task definition (cf. Section 4.5.2)</td></tr>
<tr><td></td><td>bool</td><td>M</td><td>corresponds to the "OnSend" parameter of the task definition (cf. Section 4.5.2)</td></tr>
<tr><td></td><td>bool</td><td>M</td><td>corresponds to the "OnSet" parameter of the task definition (cf. Section 4.5.2)</td></tr>
<tr><td></td><td>number</td><td>M</td><td>time interval in milliseconds that the task will be delayed when triggered</td></tr>
</tbody>
</table>
<h1>Return</h1> None.
</file>
<file name="nxa.AddSetTask">
<h1>Description</h1>
<h1>Signature</h1> nxa.AddSetTask (string, string, bool, bool, bool, number, variant) <p>This function adds a new "SET" task definition during runtime.</p>
<h1>Parameters</h1>
<table>
<colgroup> <col/> <col/> <col/> <col/> </colgroup>
<tbody>
<tr>
<th>Name</th>
<th>Type</th>
<th>Mandatory/Optional</th>
<th>Description</th>
</tr>
<tr><td></td><td>string</td><td>M</td><td>itemID of the source Server Item that triggers the task</td></tr>
<tr><td></td><td>string</td><td>M</td><td>itemID of the destination Server Item that is changed by the task</td></tr>
<tr><td></td><td>bool</td><td>M</td><td>corresponds to the "OnReceive" parameter of the task definition (cf. Section 4.5.2)</td></tr>
<tr><td></td><td>bool</td><td>M</td><td>corresponds to the "OnSend" parameter of the task definition (cf. Section 4.5.2)</td></tr>
<tr><td></td><td>bool</td><td>M</td><td>corresponds to the "OnSet" parameter of the task definition (cf. Section 4.5.2)</td></tr>
<tr><td></td><td>number</td><td>M</td><td>time interval in milliseconds that the task will be delayed when triggered</td></tr>
<tr><td></td><td>variant</td><td>O</td><td>if used, this value will be used instead of the value of the source item (optional)</td></tr>
</tbody>
</table>
<h1>Return</h1> None.
</file>
<file name="nxa.AddScriptTask">
<h1>Description</h1>
<h1>Signature</h1> nxa.AddScriptTask (string, string, bool, bool, bool, number, string, number) <p>This function adds a new "SCRIPT" task definition during runtime.</p>
<h1>Parameters</h1>
<table>
<colgroup> <col/> <col/> <col/> <col/> </colgroup>
<tbody>
<tr>
<th>Name</th>
<th>Type</th>
<th>Mandatory/Optional</th> <th>Description</th>
</tr>
<tr><td></td><td>string</td><td>M</td><td>sourceItemID</td></tr>
<tr><td></td><td>string</td><td>M</td><td>destinationItemID</td></tr>
<tr><td></td><td>bool</td><td>M</td><td>corresponds to the "OnReceive" parameter of the task definition (cf. Section 4.5.2)</td></tr>
<tr><td></td><td>bool</td><td>M</td><td>corresponds to the "OnSend" parameter of the task definition (cf. Section 4.5.2)</td></tr>
<tr><td></td><td>bool</td><td>M</td><td>corresponds to the "OnSet" parameter of the task definition (cf. Section 4.5.2)</td></tr>
<tr><td></td><td>number</td><td>M</td><td>time interval in milliseconds that the task will be delayed when triggered</td></tr>
<tr><td></td><td>string</td><td>M</td><td>LUA script name that will be executed when the task is triggered</td></tr>
<tr><td></td><td>number</td><td>M</td><td>(optional) ModuleID. Needs to be > 5000.
Can be referenced in the nxa.RemoveScriptTask function.</td></tr>
</tbody>
</table>
<h1>Return</h1> None.
</file>
<file name="nxa.AddVarTask">
<h1>Description</h1>
<h1>Signature</h1> bool nxa.AddVarTask (string, string, number) <p>This function can be used to add a task that is triggered if a variable changes its value.</p>
<h1>Parameters</h1>
<table>
<colgroup> <col/> <col/> <col/> <col/> </colgroup>
<tbody>
<tr>
<th>Name</th>
<th>Type</th>
<th>Mandatory/Optional</th>
<th>Description</th>
</tr>
<tr><td></td><td>string</td><td>M</td><td>name of the variable that shall be the trigger for the task.</td></tr>
<tr><td></td><td>string</td><td>M</td><td>name of the LUA function that shall be invoked.</td></tr>
<tr><td></td><td>number</td><td>M</td><td>(optional) delay for executing the function.</td></tr
</tbody>
</table>
<h1>Return</h1>
<table>
<colgroup> <col/> <col/> </colgroup>
<tbody>
<tr>
<th>Type</th> <th>Description</th>
</tr>
<tr><td>bool</td><td>true on success, false otherwise</td></tr>
</tbody>
</table>
</file>
<file name="nxa.RemoveScriptTask">
<h1>Description</h1>
<h1>Signature</h1> nxa.RemoveScriptTask (string, number) <p>Removes all "SCRIPT" tasks matching the provided parameters from the runtime system, even if defined in the definition file.</p>
<h1>Parameters</h1>
<table>
<colgroup> <col/> <col/> <col/> <col/> </colgroup>
<tbody>
<tr>
<th>Name</th>
<th>Type</th>
<th>Mandatory/Optional</th>
<th>Description</th>
</tr>
<tr><td></td><td>string</td><td>M</td><td>sourceItemID</td></tr>
<tr><td></td><td>number</td><td>M</td><td>(optional) ModuleID as set in the nxa.AddScriptTask function.</td></tr>
</tbody>
</table>
<h1>Return</h1> None.
</file>
<file name="nxa.ExecuteXCommandValue">
<h1>Description - INTERNAL DOCUMENTATION</h1>
<h1>Signature</h1> nxa.ExecuteXCommandValue (string) <p>This function is used to execute an XLogic command within LUA. This version takes a single string as parameter which includes all parameters.</p>
<h1>Parameters</h1>
<table>
<colgroup> <col/> <col/> <col/> <col/> </colgroup>
<tbody>
<tr>
<th>Name</th>
<th>Type</th>
<th>Mandatory/Optional</th>
<th>Description</th>
</tr>
<tr><td></td><td>string</td><td>M</td><td>XCommand including all parameters as string</td></tr>
</tbody>
</table>
<h1>Return</h1> None.
</file>
<file name="nxa.ExecuteXCommand">
<h1>Description - INTERNAL DOCUMENTATION</h1>
<h1>Signature</h1> nxa.ExecuteXCommand (string, string, ...) <p>This function is used to execute an XLogic command within LUA. This version takes a single string as parameter which includes all parameters.</p>
<h1>Parameters</h1>
<table>
<colgroup> <col/> <col/> <col/> <col/> </colgroup>
<tbody>
<tr>
<th>Name</th>
<th>Type</th>
<th>Mandatory/Optional</th>
<th>Description</th>
</tr>
<tr><td></td><td>string</td><td>M</td><td>Namd of XCommand. The variable scope is encoded as "'<Scope>:<Name>"'. If no scope is needed only the XCommand name shall be given.</td></tr>
<tr><td></td><td>string</td><td>M</td><td>Inputs, Parameters and Outputs</td></tr>
<tr><td></td><td>...</td></tr>
</tbody>
</table>
<h1>Return</h1> None.
</file>
<file name="nxa.GetFreeTransactionID">
<h1>Description - INTERNAL DOCUMENTATION</h1>
<h1>Signature</h1> number nxa.GetFreeTransactionID () <p>This function returns the next free transaction IDs which can be used to identify a task. The transaction ID is never reused. The transaction ID can be used as last parameter for the functions nxa.SetValue, nxa.WriteValue, nxa.ReadValue, nxa.SetDestinationValue, nxa.WriteDestinationValue, nxa.ReadDestinationValue, nxa.ExecuteDelayedScript</p>
<h1>Parameters</h1> None.
<h1>Return</h1>
<table>
<colgroup> <col/> <col/> </colgroup>
<tbody>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
<tr><td>number</td><td>transaction ID</td></tr>
</tbody>
</table>
</file>
<file name="nxa.CancelTransaction">
<h1>Description - INTERNAL DOCUMENTATION</h1>
<h1>Signature</h1> nxa.CancelTransaction (number) <p>Aborts a currently running task using its transaction
ID.</p> <h1>Parameters</h1>
<table>
<colgroup> <col/> <col/> <col/> <col/> </colgroup>
<tbody>
<tr>
<th>Name</th>
<th>Type</th>
<th>Mandatory/Optional</th>
<th>Description</th>
</tr>
<tr><td></td><td>number</td><td>M</td><td>transaction ID of the task that shall be canceled.</td></tr>
</tbody>
</table>
<h1>Return</h1> None.
</file>