App
Type: App
Scripts have an instance of App pre-defined as a global variable called 'app'.
The App object allows a script to interact with the application, such as setting the view to full-screen mode.
Properties
Property | Description |
---|---|
isConnected
| Indicates if the application is currently connected to an ECU. |
isDarkTheme
| Indicates if the application is running the dark mode UI theme. |
isFreezeChannels
| Indicates if channel freeze is on - the UI will frreze displayed values of channels whilst in this mode. |
isFreezeParameters
| [deprecated] alias of isFreezeChannels. |
isFullScreen
| Indicates if the application is currently in full screen mode. |
Methods
Method | Description |
---|---|
beginUndoScope(name)
| Undo scopes are used to group multiple changes into a single undo action. beginUndoScope starts an undo transaction where all modifications that follow are logically grouped together. Take care to call endUndoScope the same number of times you called beginUndoScope() Generally it is best to use this in a try...finally statement to ensure that the undo scope is closed, even if an exception is thrown: try { app.beginUndoScope("My Undo Scope"); // Name appears in the undo history // Make multiple modifications here ecu.option("Option1").setReal(1); ecu.option("Option2").setReal(2); } finally { app.endUndoScope(); } |
closeAllCanPorts()
| Close all CAN ports opened by scripting. Avoid where possible. |
closeNotification(id)
| Close notification with the given ID. |
confirmDialog(message)
| Pop up a modal confirmation dialog box. Returns 'true' if the user selected 'yes'. |
connectEcu()
| Connects to an ECU using the currently configured port settings. |
convertUnits(value, from, to)
| Convert the units of a value, given the unit script IDs for 'from' and 'to'. Returns the converted value or undefined if the conversion was invalid. |
disconnectEcu()
| Closes the connection to the ECU (if connected). |
endUndoScope()
| Ends an undo scope. Take care to call endUndoScope the same number of times you called beginUndoScope() |
error(message)
| Pop up a modal error dialog box. |
freezeChannels(enable)
| Freezes channel updates on views that allow it. |
freezeParameters(enable)
| [deprecated] alias of freezeChannels. |
fullScreen(enable)
| Enters/exits full screen mode. |
getDisplayUnits(script_unit)
| Get the display units string (for labels etc) from script units ID. e.g. app.getDisplayUnits("angle:degrees") returns ° |
getUnitPreference(user_scalar_name)
| Get the unit preference for the given user scalar name. Returns the unit script ID or undefined if the user scalar name is not found. |
getUserSetting(key[, default_value])
| Get the value of a user setting, stored globally in the application. Keys are separated by forward slashes, e.g. "custom/area/my_setting". Returns 'default_value' if given, or 'undefined', if the setting does not exist. For custom settings, to avoid conflicts with application settings, prefix the setting with a unique string. For example, if you have a setting called "my_setting", prefix it with "my_prefix/" to give "my_prefix/my_setting". |
hasNotification(id)
| Determine if a notification with the given ID exists. |
information(message)
| Pop up a modal information dialog box. |
informationNotification(message, [options, [actions]])
| Show an information notification. HTML is supported in the message. The HTML format is a simplified form, as used by wxHtmlWindow. Returns the notification ID. Options is a table of key/value pairs. The following options are supported:
Actions is an array of items for action buttons. Each item may be be a string or an array with 2 elements. The first element is the action title and the second is a callback function. Alternatively an object may be given for each item with the following properties:
|
listCanPorts()
| List available CAN ports, returns object {text,type,id} |
openCanPort(options { id, rate, data_rate, clear_queues, read:callback(frame), error:callback(e) })
| Open CAN port with given port ID clear_queues defaults to true, which clears the RX and TX queues of the port immediately after opening. |
readDataLog()
| Receive the internal log from the ECU. |
resetChannelMinMax()
| Resets min/max values of channels as displayed on channel lists. |
resetParameterMinMax()
| [deprecated] alias of resetChannelMinMax. |
setLogPlaybackPosition(time)
| Moves the log playback position to the given time (specified in seconds) |
setUnitPreference(user_scalar_name, unit_script_id)
| Set the unit preference for the given user scalar name. Returns true if the unit preference was changed, or false if the unit preference already had the given value. |
errorNotification(message, [options, [actions]])
| Show an error notification. HTML is supported in the message. The HTML format is a simplified form, as used by wxHtmlWindow. Returns the notification ID. Options is a table of key/value pairs. The following options are supported:
Actions is an array of items for action buttons. Each item may be be a string or an array with 2 elements. The first element is the action title and the second is a callback function. Alternatively an object may be given for each item with the following properties:
|
startLogPlayback()
| Starts log playback of the log file loaded into the Log Transport view. |
startPCLogging()
| Start logging data on the PC using the current PC Logging configuration. |
stopLogPlayback()
| Stops log playback, if running. |
stopPCLogging()
| Stops PC logging, if running. |
verifyCal()
| Run the Verify Calibration action to check that the contents of the ECU calibration match that on the PC. |
warning(message)
| Pop up a modal warning dialog box. |
warningNotification(message, [options, [actions]])
| Show a warning notification. HTML is supported in the message. The HTML format is a simplified form, as used by wxHtmlWindow. Returns the notification ID. Options is a table of key/value pairs. The following options are supported:
Actions is an array of items for action buttons. Each item may be be a string or an array with 2 elements. The first element is the action title and the second is a callback function. Alternatively an object may be given for each item with the following properties:
|