Callback Functions
Callback functions are special functions that execute in the non-real-time part of the controller. For example, if the controller is running in a real-time operating system, it cannot access files directly on the PC. Thus, when the controller encounters a File access function, it pauses the AeroScript program and triggers the execution of the function in the non-real-time environment.
There is a full list of callback functions in the Callback Functions table at the end of this page.
Callback Function Execution
The steps that follow show the order in which the controller executes a callback function:
- The controller pauses the AeroScript program that is currently running.
- The controller generates a callback interrupt.
- The communication service, which runs in the non-real-time environment, gets the callback interrupt and sends a signal to the controller that it received the callback interrupt.
- A host application retrieves the callback data and does the applicable function.
- When the callback function is completed, the host application tells the controller to continue.
- The controller continues to execute the AeroScript program.
IMPORTANT: If this step does not occur in a sufficient quantity of time, the controller will return a CallbackNotRegistered
error. When this error occurs, there is no application registered to handle the callback.
Custom Callback
Use custom callbacks to pass execution to an external process that will be handled by the .NET, C, or Python API. These APIs expose the ability to handle callbacks of a specific callback identification number.
When the custom callback function is called from AeroScript, program execution waits for any registered .NET, C, or Python callback handler to execute. These handlers read the specified input arguments and, if applicable, they do operations based on those arguments.
For Example
The handlers can pass some data as an argument to a file or send data over the network.
Execution of the AeroScript program continues when the callback handler returns in the .NET, C, or Python API. The callback handler can return doubles, integers, strings, or any combination of these values to the AeroScript program.
For information about how to use the Callback()
AeroScript function with the .NET, C, or Python API, see the Handle AeroScript Callbacks section of .NET Tasks, C Tasks, or Python Tasks.
function Callback($id as integer, $integerInputs[] as integer, $realInputs[] as real, $stringInputs[] as string, ref $integerOutputs[] as integer, ref $realOutputs[] as real, ref $stringOutputs[] as string)
Triggers a custom callback to be handled by an external process.
Arguments
$id The id number of the callback.
$integerInputs A list of integers to be provided to the external callback function.
$realInputs A list of reals to be provided to the external callback function.
$stringInputs A list of strings to be provided to the external callback function.
ref $integerOutputs A list of integers returned from the external callback function.
ref $realOutputs A list of reals returned from the external callback function.
ref $stringOutputs A list of strings returned from the external callback function.
Callback Functions
The table that follows includes a full list of callback functions.
Function Name | Description |
---|---|
|
Raises a custom callback that the .NET, C, or Python API handles. See the Handle AeroScript Callbacks section of .NET Tasks, C Tasks, or Python Tasks for more information. |
|
Loads a program to the specified task. See Program Control for more information. |
|
Runs a program on the specified task. See Program Control for more information. |
|
Gets the current time on the controller. See DateTime Functions for more information. |
|
Extracts the specified time component from the given epoch time. See DateTime Functions for more information. |
|
Opens a file for binary or text I/O. See Open and Close a Handle for more information. |
|
Closes the specified file. See Open and Close a Handle for more information. |
|
Sets the current byte offset for reading and writing in the specified file. See File Position for more information. |
|
Gets the current byte offset for reading and writing in the specified file. See File Position for more information. |
|
Returns whether the current reading offset is at the end of the file. See File Position for more information. |
|
Returns the size of the specified file. See File Position for more information. |
|
Reads a line or string from a text file. See Text Files for more information. |
|
Writes a string to a text file. See Text Files for more information. |
|
Returns data from a binary file interpreted as the specified data type. See Reading Binary Files for more information. |
|
Converts data to a specified data type and writes it to the specified file. See Writing Binary Files for more information. |
|
Returns the number of subdirectories within the specified directory. See Directories for more information. |
|
Copies the specified file. See Directories for more information. |
|
Returns the number of files within the specified directory. See Directories for more information. |
|
Deletes the specified file. See Directories for more information. |
|
Returns whether the specified file exists. See Directories for more information. |
|
Returns the name of the file with the specified index within the specified directory. See Directories for more information. |
|
Moves the specified file. See Directories for more information. |
|
Returns the name of the subdirectory with the specified index within the specified directory. See Directories for more information. |
|
Adds an axis, task, or system status signal to the data collection configuration. See Configure Axis Signals, Configure Task Signals, and Configure System Signals for more information. |
|
Resets the data collection configuration. See Configure Data Collection for more information. |
|
Starts real-time data collection. See Start and Stop Data Collection for more information. |
|
Stops real-time data collection. See Start and Stop Data Collection for more information. |
|
Adds an axis, task, or system status signal to the data collection configuration. See Configure Axis Signals, Configure Task Signals, and Configure System Signals for more information. |
|
Adds an Industrial Ethernet mapping signal to the application's data collection configuration. See Configure Industrial Ethernet Signals for more information. |
|
Resets the data collection configuration. See Configure Data Collection for more information. |
|
Configures application data collection. See Configure the Number of Samples and Sample Time for Data Collection for more information. |
|
Enables or disables the operation that automatically saves data collected through the |
|
Loads and activates the specified axis calibration file or galvo power correction file. See Calibration Functions for more information. |
|
Deactivates and unloads the calibration for the specified calibration type. See Calibration Functions for more information. |
|
Turns on all indicators with the specified ID. See |
|
Turns off all indicators with the specified ID. See |
|
Shows a message box that gives you information with a specified severity. See Message Box for more information. |
|
Shows the specified message. See Message Notifications for more information. |
|
Clears all of the application message notifications. See Message Notifications for more information. |
|
Shows a dialog box that you can use to select a file to open. See File Open for more information. |
|
Shows a dialog box that you can use to select a file to save. See File Save for more information. |
|
Shows a message box that retrieves input data. See Message Input for more information. |
|
Shows a list of items that you can select. See Message Menu for more information. |
|
Does a stability analysis on a saved frequency response file and returns the stability metrics. See Stability Analysis for more information. |
|
Triggers a MultisinePlus frequency response transmission on the specified axis. See Frequency Response for more information. |
|
Triggers a Sinusoidal frequency response transmission on the specified axis. See Frequency Response for more information. |
|
Triggers a White Noise frequency response transmission on the specified axis. See Frequency Response for more information. |
|
Triggers a Multisine frequency response transmission on the specified axis. See Frequency Response for more information. |