The idea behind the Node Scripting is to allow execution of custom scripts in remote Nodes. That is, user can specify scripts based on FBlock command syntax and run these on remote nodes by the use of Node Scripting module.
The module is designed and intended for the use of I2C and GPIO commands only. This means that using the Scripting module for any other FBlock INIC commands (MOST, MediaLB, USB, Streaming or Connection for example) is expressly prohibited.
A script is a structure data (see below) composed of:
A Ucs_Ns_ConfigMsg_t message is based on INIC FBlock-Syntax and looks like this:
The user specifies the desired scripts, binds them to the target nodes and then call the function Ucs_Ns_Run() for processing. The result of the operation is reported via the result callback function Ucs_Ns_ResultCb_t, which is passed by user in the arguments list of Ucs_Ns_Run(). In addition to this callback function and the referred UCS instance the function requires a reference to the Node that contains the script(s).
The Ucs_Ns_Run() function starts the process to transmit the script(s) contained in the provided node and then checks for the expected results (specified by customer). The Node Scripting module will start a timer of 2600ms before sending the Tx command of each script. That is, if no incoming messages match the expected result of the script during this time the result code UCS_NS_RES_ERROR is returned via the Ucs_Ns_ResultCb_t user callback function. This error code is also get when the script module couldn't perform the device synchronization of the remote device (this can be read in the detailed error messages, if enabled. See below). Otherwise, if an incoming message matches the expected result, UCS_NS_RES_SUCCESS is returned.
The Ucs_Ns_Run() function will return UCS_RET_ERR_API_LOCKED when attempting to execute a script in a node that is currently busy with other(s) previous script(s). The Ucs_Ns_Run() function is namely locked for a Node when handling script(s) on this node and unlocked after reporting the result of the operation. However processing scripts can be executed on different nodes in parallel.
The detailed error messages can be read when enabling the error trace output in ucs_cfg.h
file as shown below.
The example below outlines the execution of a script within a node with address 0x200. This example is inserted as a guide and may not contain all of the necessary details and information.