Ecu

Type: Ecu

Represents the ECU.

Properties

PropertyDescription
canRxSetup Return CANRxSetup object
commsOpsPerSec Performance metric: Number of comms operations performed per second. Averaged.
currentBaudRate Get/Set the current baud-rate for the connected ECU. Only applicable if the port in use supports changing the baudrate (e.g works for serial ports but not for ethernet ECUs).
def The EcuDefinition (ECU definition) object used by the ECU.
gin [deprecated] Alias of def property.
isConnected Indicates if the application is currently connected to an ECU.

Methods

MethodDescription
analogChannel(channel) Get the given indexed analog input channel.
category(name) Find a EcuCategory with the given name. Returns null if not found. The search is case insensitive and also checks 'old names'.
channel(name) Find a EcuChannel with the given name. Returns null if not found. The search is case insensitive and also checks 'old names'.
channelTable(name) Find a EcuChannelTable with the given name. Returns null if not found. The search is case insensitive and also checks 'old names'.
clearFileSetting(key)

Clears the setting for the given key, stored in the calibration file

commitCalibration() [deprecated] Alias of storeChanges.
connect() Connects to an ECU using the currently configured port settings.
disconnect() Closes the connection to the ECU (if connected).
ecuString(name) Find a EcuString with the given name. Returns null if not found. The search is case insensitive and also checks 'old names'.
getFileSetting(key[, default_value])

Get the value of an arbitrary setting, stored in the calibration file.

Note that these values are only stored in calibration files and not in the ECU itself. The setting will only be rerievable if the calibration file is matchs to the ECU following connect

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".

isWritePending() Determine if any queued writes to the ECU are pending.
isWritePending(address, size) Determine if a queued write to the given address range is pending.
logMap(name) Find a EcuLogMap with the given name. Returns null if not found. The search is case insensitive and also checks 'old names'.
logMapTarget(name) Find a EcuLogMapTarget with the given name. Returns null if not found. The search is case insensitive and also checks 'old names'.
map(name) Find a EcuMap with the given name. Returns null if not found. The search is case insensitive and also checks 'old names'.
on(eventName, callback) Adds an event listener for the given event name. e.g. view.on("click", function() { ... });
option(name) Find a EcuOption with the given name. Returns null if not found. The search is case insensitive and also checks 'old names'.
region(name) Find a EcuRegion with the given name. Returns null if not found. The search is case insensitive and also checks 'old names'.
removeAllListeners([eventName]) Removes all event listeners for the given event name. If the event name is not given then all listeners for all events are removed.
removeListener(eventName, callback) Removes an event listener for the given event name. e.g. let callback = function() { ... }; ecu.on("scalingChanged", callback); view.removeListener("scalingChanged", callback);
setFileSetting(key, value)

Set the value of a arbitrary setting, stored in the calibration file.

Note that these values are only stored in calibration files and not in the ECU itself. The setting will only be rerievable if the calibration file is matchs to the ECU following connect

Returns true if the setting was changed, or false if the setting already had the given value.

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".

storeChanges() Store changes in the ECU to non-volatile memory.
table(name) Find a EcuTable with the given name. Returns null if not found. The search is case insensitive and also checks 'old names'.
userScalar(name) Find a EcuUserScalar with the given name. Returns null if not found. The search is case insensitive and also checks 'old names'.
waitForEEDone([timeout]) Wait for the 'EE' busy condition to complete following storeChanges call.
waitForWritesDone([timeout]) Wait for any write commands issued to the ECU to complete.

Events

EventDescription
calReset

Called when calibration file was reset (e.g. following loading of a calibration file).

External scripts can bind to the 'calReset' event to be notified when the value changes.

ecu.on("calReset", function() { ... });

change

Called when any calibration / measurement (channel) value was changed.

External scripts can bind to the 'change' event to be notified when the value changes.

ecu.on("change", function() { ... });

changed

Alias of "change" event. Originally the only event was "change" but the documentation was ambiguous.

changed_cal

Called when a calibration (non measurement) value was changed.

External scripts can bind to the 'changed_cal' event to be notified when the value changes.

ecu.on("changed_cal", function() { ... });

changed_cal_details(details)

Called when a calibration (non measurement) value was changed.

External scripts can bind to the 'changed_cal_details' event to be notified when the value changes.

ecu.on("changed_cal_details", function(details) { ... });

'details' is an array of arrays of the form:

[ [ size, address, address_extension ], ... ]

address_extension is used by XCP ECUs and will be omitted if 0

changed_details(details)

Called when any calibration / measurement (channel) value was changed.

External scripts can bind to the 'changed_details' event to be notified when the value changes.

ecu.on("changed_details", function(details) { ... });

'details' is an array of arrays of the form:

[ [ size, address, address_extension ], ... ]

address_extension is used by XCP ECUs and will be omitted if 0

changed_logmap

Called when a logmap value was changed.

External scripts can bind to the 'changed_logmap' event to be notified when the value changes.

ecu.on("changed_logmap", function(name, x, y) { ... });

changed_volatile

Called when a volatile/measurement (non calibration) value was changed.

External scripts can bind to the 'changed_volatile' event to be notified when the value changes.

ecu.on("changed_volatile", function() { ... });

changed_volatile_details(details)

Called when a volatile/measurement (non calibration) value was changed.

External scripts can bind to the 'changed_volatile_details' event to be notified when the value changes.

ecu.on("changed_volatile_details", function(details) { ... });

'details' is an array of arrays of the form:

[ [ size, address, address_extension ], ... ]

address_extension is used by XCP ECUs and will be omitted if 0

commsStatusChanged(state)

Called when the ECU Comms status changed (e.g. went online / offline / error state.

External scripts can bind to the 'commsStatusChanged' event to be notified when the value changes.

ecu.on("commsStatusChanged", function(state) { ... });

'state' is an object with the following boolean properties:

  • active
  • connecting
  • identified
  • secured
  • errors
  • offline

dynamicNamesChanged

Called when any item names were changed. Some calibration items names are based upon calibration values.

External scripts can bind to the 'dynamicNamesChanged' event to be notified when the event occurs.

ecu.on("dynamicNamesChanged", function() { ... });

scalingChanged

Called when scaling factors (user scalars / display units) were changed.

External scripts can bind to the 'scalingChanged' event to be notified when the value changes.

ecu.on("scalingChanged", function() { ... });