IGWv4Application

IGWv4Application automation interface.

Instances supporting this interface may be created using the Application coclass.

e.g.
Javascript:

var obj = new ActiveXObject("GWv4.Application");

VBScript:

Dim obj As Object
Set obj = CreateObject("GWv4.Application")

C++, via C++ Interface:

::CoInitialize(NULL);
IGWv4Application* iface = 0;
HRESULT hr = ::CoCreateInstance(
    CLSID_Application, 
    NULL, 
    CLSCTX_LOCAL_SERVER,
    IID_IApplication,
    (LPVOID*)&iface);

if (iface) {
    iface->Show();
    iface->Release();
}
::CoUninitialize();

C++, via IDispatch:

::CoInitialize(NULL);
HRESULT    hr;
CLSID      clsid;        // CLSID of ActiveX object.
LPUNKNOWN  punk  = NULL; // IUnknown of ActiveX object.
LPDISPATCH pdisp = NULL; // IDispatch of ActiveX object.

// Retrieve CLSID for GWv4.Application from the registry.
// This is {33AE968A-6D0E-4344-BB40-3A137209BA75} which could be 
// used directly for better performance.
hr = CLSIDFromProgID(L"GWv4.Application", &clsid);
if (FAILED(hr)) {
    return hr;
}  
// Create an instance of the ActiveX object.
hr = CoCreateInstance(clsid, NULL, CLSCTX_SERVER, 
                      IID_IUnknown, (void **)&punk);
if (FAILED(hr)) {
    if (punk) punk->Release();
    return hr;
}    
hr = punk->QueryInterface(IID_IDispatch, (void **)&pdisp);
if (FAILED(hr)) {
    punk->Release();
    if (pdisp) pdisp->Release();
    return hr;
}
punk->Release();
// << Use the dispatch interface..
pdisp->Release();    
::CoUninitialize();

Contents

Properties

Property Description
Visible Displays/hides the Application UI.
FullScreen Makes the window fullscreen (or not).
LastErrorString Provides an error string describing the last method failure that occurred, if possible.
Session Not yet implemented.
Tabs Not yet implemented.
Ecu Not yet implemented.
PCLogging Gets an interface to PC logging features.
LogPlayback Gets an interface to Log playback features.
Telemetry Gets an interface for accessing/configuring CAN / Serial telemetry. Not implemented yet.
CalibrationNotes Gets/Sets calibration notes.
IsEcuConnected Determine if the ECU is connected (online).
TabCountTotal Gets the number of tabs in the GWv4 UI.
CurrentBaudRate Gets the number of tabs in the GWv4 UI.
HasActiveTransactions Return number of active ECU Comms transations.

Public Methods

Function Description
CreateFileOptions Create an instance of IGWv4FileOptions that can be used to modify the behaviour of various functions that deal with files in one way or another.
CreateScript Create an instance of IGWv4Script that can be used to compile and execute scripts within GWv4.
CreatePortList Creates an interface for accessing/configuring the various ECU comms ports.
OpenCalibration Opens the calibration file specified by ‘path’.
SaveCalibration Saves the current calibration by its current file name.
SaveCalibrationAs Saves the current calibration with a new file name.
CloseCalibration Closes the currently open calibration.
InstallEcu Installs the ECU definition file from the given path.
ConnectEcu Connect to an ECU.
DisconnectEcu Disconnect from the currently connected ECU (if any).
CreateOptionsMap Create an instance of IDashOptionsMap that can be used to modify the behaviour of various functions that accept options.
InvokeAction Invokes an action with the specified ID.
GenerateHelpInfo Generate Help Information as JSON.
EnumerateWindows Enumerate Windows in the application.
TakeScreenShot Take a screenshot of a window or the whole application.
CloseWindow Close a window (if possible).
FocusWindow Focus & raise a window (if possible).
SetProperties Set mutiple properties on a window / view.
GetProperties Get all properties from a window / view.
SetProperty Set a single property on a window / view.
GetProperty Get a single property from a window / view.
LoadLayout Load a layout (gxt) file.
SaveLayout Save a layout (gxt) file.
ShowTab Show the given tab.
CloseTab Close the given tab.
SimulateEcu Simulate an ECU.
SetSimulationProperty Set a simulator property or Channel value.
Click Simulate a mouse click.
Keyboard Simulate a keyboard.
ClearEcuStatus Clear ECU status messages.
AppendEcuStatus Append to ECU status messages.
NewCalibration Create a new calibration file using the given identity json string.
GetObject Get an object of the specified type (e.g. Channel, Option, Map, Table).

Properties

Visible

Displays/hides the Application UI.

BOOL Visible

The UI will be hidden initially when creating an instance of GWv4.

FullScreen

Makes the window fullscreen (or not).

BOOL FullScreen

Setting this value to TRUE causes the application window to take up the full screen without title bars etc.

When entering fullscreen mode via the COM Automation Interface, the popup ’toaster’ window giving users a way of exiting fullscreen mode is not displayed.

LastErrorString

Provides an error string describing the last method failure that occurred, if possible.

BSTR LastErrorString

Where appropriate, this string is also included in Error exception description strings as a result of IDispatch calls (e.g. when accessed via late binding as with JavaScript).

Session

Not yet implemented.

IDispatch Session

In future this will return an interface to the ‘Session’ object which will give access to data models etc.

Tabs

Not yet implemented.

IDispatch Tabs

In future this will return an interface that gives access/control of the list of tabs, tab groups, views within tabs etc.

Ecu

Not yet implemented.

IDispatch Ecu

In future this will return an interface that gives access/control of the ECU directly.

PCLogging

Gets an interface to PC logging features.

IGWv4PCLogging PCLogging

LogPlayback

Gets an interface to Log playback features.

IDispatch LogPlayback

Telemetry

Gets an interface for accessing/configuring CAN / Serial telemetry. Not implemented yet.

IDispatch Telemetry

CalibrationNotes

Gets/Sets calibration notes.

BSTR CalibrationNotes

IsEcuConnected

Determine if the ECU is connected (online).

BOOL IsEcuConnected

The GIN file should be loaded if this is ’true’. However, it is possible that the calibartion and/or tabs are not downloaded / loaded yet.

TabCountTotal

Gets the number of tabs in the GWv4 UI.

int TabCountTotal

This can be used as a basic check to see if the tabs have been loaded for the current session.

CurrentBaudRate

Gets the number of tabs in the GWv4 UI.

int CurrentBaudRate

This can be used as a basic check to see if the tabs have been loaded for the current session.

HasActiveTransactions

Return number of active ECU Comms transations.

BOOL HasActiveTransactions

When the connection is idle (but connected), this will be zero.

Public Methods

Method: CreateFileOptions

Create an instance of IGWv4FileOptions that can be used to modify the behaviour of various functions that deal with files in one way or another.

HRESULT CreateFileOptions([out, retval] IGWv4FileOptions **options)

See Also: IGWv4FileOptions

Method: CreateScript

Create an instance of IGWv4Script that can be used to compile and execute scripts within GWv4.

HRESULT CreateScript([out, retval] IGWv4Script **script)

See Also: IGWv4Script

Method: CreatePortList

Creates an interface for accessing/configuring the various ECU comms ports.

HRESULT CreatePortList([out, retval] IGWv4Ports **retval)

Method: OpenCalibration

Opens the calibration file specified by ‘path’.

HRESULT OpenCalibration([in] BSTR path, [in] IGWv4FileOptions *options)

Method: SaveCalibration

Saves the current calibration by its current file name.

HRESULT SaveCalibration([in] IGWv4FileOptions *options)

If the calibration does not have a file name then the behaviour of this function will depend upon the ‘options’ parameter and may not be saved as a result.

See IGWv4FileOptions::SaveModifiedDiscard and IGWv4FileOptions::SaveModifiedPrompt

Method: SaveCalibrationAs

Saves the current calibration with a new file name.

HRESULT SaveCalibrationAs([in] BSTR path, [in] IGWv4FileOptions *options)

See IGWv4FileOptions::OverwriteAllow and IGWv4FileOptions::OverwriteSilent

Method: CloseCalibration

Closes the currently open calibration.

HRESULT CloseCalibration([in] IGWv4FileOptions *options)

In practice, currently the ‘options’ parameter has no effect on this function but has been added to support possible future changes to the application.

Method: InstallEcu

Installs the ECU definition file from the given path.

HRESULT InstallEcu([in] BSTR path)

Method: ConnectEcu

Connect to an ECU.

HRESULT ConnectEcu()

Method: DisconnectEcu

Disconnect from the currently connected ECU (if any).

HRESULT DisconnectEcu()

Method: CreateOptionsMap

Create an instance of IDashOptionsMap that can be used to modify the behaviour of various functions that accept options.

HRESULT CreateOptionsMap([out, retval] IGWv4OptionsMap **options)

It is also possible to use JavaScript objects for options instead of an options map.

See Also: IGWv4OptionsMap

Method: InvokeAction

Invokes an action with the specified ID.

HRESULT InvokeAction([in] BSTR action_id, [in, optional] VARIANT options)

With the option “menuItem”, action_id instead chooses an item of the open popup menu: the labels of any sub menus and the item, separated by ‘|’, e.g. “Gauge Layout|Anchors/Positioning”.

Fails, with LastErrorString describing why, if the action is unknown.

Method: GenerateHelpInfo

Generate Help Information as JSON.

HRESULT GenerateHelpInfo([in, optional] VARIANT options, [out, retval] BSTR *result)

Returns

The information as a JSON string. If outputFile is specified in options then the returned string will be blank.

If the ‘options’ parameter has a property ‘outputFile’ then the JSON will be written to that file instead of returned as a string.

Method: EnumerateWindows

Enumerate Windows in the application.

HRESULT EnumerateWindows([in, optional] VARIANT options, [out, retval] BSTR *result)

Returns

The information as a JSON string.

The result is an object whose “windows” array lists the top level windows, or only the window chosen by the option “id”, “name”, “label” or “lastCreatedView”. Each window has “id”, “label”, “name”, “type”, “shown”, “visible” (shown along with all its parents), “helpId” and its position, with child windows in “windows”. Option “depth” limits the levels of child windows: 0 lists none, which is much faster. If the option “outputFile” is given, the JSON is written to that file instead.

Method: TakeScreenShot

Take a screenshot of a window or the whole application.

HRESULT TakeScreenShot([in, optional] VARIANT options, [out, retval] VARIANT *result)

Returns

The information as a JSON string.

If the ‘options’ parameter has a property ‘outputFile’ then the screenshot will be output to that path instead of returned.

options can identify the window through one of the following keys:

  • id
  • name
  • label
  • lastCreatedView == true
  • menu If one of these items are not specified then a screenshot of the main window will be taken.

Other options:

  • print: true/false (default false) - use WM_PRINT instead of blitting the window DC.
  • clipboard: place the screenshot on the Windows clipboard
  • focus: true/false (default true) - focus the window first.
  • cursor: true/false (default false) - draw the mouse cursor.
  • expand: pixels to include around the window.

Screenshots of top-level windows include their drop shadow, with transparency. See the “captureMethod” property of SetProperty for screenshots of hidden windows.

Method: CloseWindow

Close a window (if possible).

HRESULT CloseWindow([in] VARIANT options, [out, retval] VARIANT *result)

Returns

TRUE if OK, false otherwise. This is a variant for posssilbe future changes.

options:

  • id: Window ID for the window to close.
  • menu: set to ’true’ to close the context menu.
  • name: ’name’ of window to close.
  • label: ’label’ of window to close.
  • lastCreatedView: true -> last created view code: result code (e.g. if the window is modal - see e.g. wxID_OK).

Method: FocusWindow

Focus & raise a window (if possible).

HRESULT FocusWindow([in] VARIANT options)

Additional options: movex: move window to x coordinate movey: move window to y coordinate

Method: SetProperties

Set mutiple properties on a window / view.

HRESULT SetProperties([in] VARIANT options, [in] VARIANT props)

Fails if any property is unknown or cannot be set.

Method: GetProperties

Get all properties from a window / view.

HRESULT GetProperties([in] VARIANT options, [out, retval] VARIANT *result)
  • detailed: true/false - if true, return detailed information about the properties.

Returns

a JSON string detailing the properties.

Method: SetProperty

Set a single property on a window / view.

HRESULT SetProperty([in] VARIANT options, [in] BSTR name, [in] VARIANT value)

If a window ID/name/label is not supplied, the main frame will be selected.

Special Properties:

  • “useDefaultSettings”: Set the application settings to defaults for this run.
  • “selection”: string: json style array [[row,col],…n]. ‘col’ is optional. e.g. “[[5,2],[5,3]]” If a number is specified, the whole row is selected.
  • “expand_all”: Boolean - Expand (True)/Collapse (False) the tree grid.
  • “text”: For text editors, sets the text.
  • “maximized”: Boolean - make window maximized (or not). Only for top-level windows.
  • “width_dp”: Width of window, in ‘device’ pixels.
  • “height_dp”: Height of window, in ‘device’ pixels.
  • “pos_x_dp”: X position of window, in ‘device’ pixels.
  • “pos_y_dp”: Y position of window, in ‘device’ pixels.
  • “width_px”: Width of window, in ‘physical’ pixels.
  • “height_px”: Height of window, in ‘physical’ pixels.
  • “pos_x_px”: X position of window, in ‘physical’ pixels.
  • “pos_y_px”: Y position of window, in ‘physical’ pixels.
  • “pinned”: For docked windows, either pins the window to the docking area or puts it in the autohide strip.
  • “path”: For CalBrowser / file picker (AbstractFileBrowseEdit) windows, sets the file path.
  • “identity”: JSON string representing ECU identity for InstalledEcuPicker.
  • “ecu_reset_supress_popup”: Supress the ‘ECU Reset’ popup.
  • “current_tab_id”: For TabControl / PageContainer, the id of child window tpo select.
  • “preferences_page_id”: For application preferences dialog, ID of child page to select.
  • “name_filter”: Set ECU name filter of Calibration File Browser.
  • “version_filter”: Set ECU version filter of Calibration File Browser.
  • “suppress_status_popup”: Set user setting to suppress ECU status popup when connecting.
  • “show_status_in_default_workspace”: Set user setting to show ECU status in default workspace (see also InvokeAction(“actions/viewReset”)).
  • “scroll_x”: Set horizontal scroll position of window.
  • “scroll_y”: Set vertical scroll position of window.
  • “checked”: Boolean - for check boxes.
  • “value”: For spin boxes and the knob dialog.
  • “float”: Boolean - for docked windows, float (True) or dock (False) the window.
  • “file_name”: Set the file name of the Calibration File Browser.
  • “import_path”: For the ECU definition extensions manager, imports the extension file at this path into the calibration.
  • “make_row_visible”: For grids, scroll the given row into view.
  • “expand_levels”: For tree grids, expand the items down to the given number of levels.
  • “captureMethod”: Application property, “screen” (the default) or “printWindow”. With “printWindow”, TakeScreenShot asks Windows to render each window, and Click and Keyboard send window messages. This works on a hidden desktop or while the computer is locked, but window frames can differ and overlapping windows are not shown.

Fails, with LastErrorString describing why, if the property is unknown or does not apply to the window.

Method: GetProperty

Get a single property from a window / view.

HRESULT GetProperty([in] VARIANT options, [in] BSTR name, [out, retval] VARIANT *result)

Returns

The property value.

Special properties

  • applicationDpiPercent: Gets the display scaling value of the application window as a percentage.
  • focusedWindowID: Get the ID of the currently focused window. No window ID required as input.
  • currentWorkPageID: Get the ID of the active work page. No window ID required as input.
  • focusedViewID: Get the ID of the focused dock panel of the specified window.
  • parentViewID: Get the ID of the parent dock panel of the specified window.
  • userDocsPath: Get application folder in user documents.
  • userAppDataPath: Get application data path (e.g. APPDATA%/GEMS/GWv4)
  • commonAppDataPath: Get application common data path (e.g. PROGRAMDATA%/GEMS/GWv4)
  • identity: JSON string representing ECU identity for InstalledEcuPicker.
  • applicationTitle: The title of the main window.
  • cell_x, cell_y, cell_w, cell_h: coordinates of grid cell bounding rectangle (use row/col options), relative to the scrolled view so that the cell can be clicked.
  • cell_text: text of the grid cell at row/col.
  • row_count: number of grid rows.
  • gridFindText: Find an item in a grid, given a text (“text”) string and a column (“col”), with optional starting row (“row”). Returns a selection in JSON format, if text was not found returns empty string.
  • gridFindRow: As gridFindText, but returns the row number, or -1 if the text was not found.
  • captureMethod: “screen” or “printWindow” - see SetProperty.
  • activity: JSON describing what the application is doing, so that a client can wait until it has finished the last step instead of pausing for a fixed time: {“pending”: bool, “idle”: bool, “reason”: string, “cpuCycles”: number}. “pending” is true while work started by an automation call has not been processed, such as deferred calls, events, queued input or paint, or ECU transactions. “idle” is true when nothing at all is waiting, which is rare because periodic updates post messages. “cpuCycles” counts the CPU cycles used by the application, so that background threads can be detected by comparing two readings.

Method: LoadLayout

Load a layout (gxt) file.

HRESULT LoadLayout([in] BSTR path, [in, optional] VARIANT options)

Method: SaveLayout

Save a layout (gxt) file.

HRESULT SaveLayout([in] BSTR path, [in, optional] VARIANT options)

Method: ShowTab

Show the given tab.

HRESULT ShowTab([in] VARIANT tab)

Method: CloseTab

Close the given tab.

HRESULT CloseTab([in] VARIANT tab)

Method: SimulateEcu

Simulate an ECU.

HRESULT SimulateEcu([in] VARIANT options)

Method: SetSimulationProperty

Set a simulator property or Channel value.

HRESULT SetSimulationProperty([in] VARIANT options)

Simulator Properties:

  • BlockSizeIdx
  • EepromSize
  • RomChecksum
  • RomSec
  • BlockSizeValid
  • CRC16Enabled
  • FastCalEnabled
  • Secured
  • LogFile
  • RawSetup
  • RawLog
  • EngineHistoryLog
  • FirmwareFile
  • BootloaderFile
  • CoProFirmwareFile
  • CoProBootloaderFile

Method: Click

Simulate a mouse click.

HRESULT Click([in] VARIANT options)

Fails, without clicking, if the point is not in the visible part of the window or another window covers it. Otherwise the click could go to another application. Moves and releases are not checked, because a drag moves the mouse outside the window where it started.

Method: Keyboard

Simulate a keyboard.

HRESULT Keyboard([in] VARIANT options)

Method: ClearEcuStatus

Clear ECU status messages.

HRESULT ClearEcuStatus([in, optional] VARIANT options)

Method: AppendEcuStatus

Append to ECU status messages.

HRESULT AppendEcuStatus([in] BSTR path, [in, optional] VARIANT options)

Method: NewCalibration

Create a new calibration file using the given identity json string.

HRESULT NewCalibration([in] BSTR identity, [in, optional] VARIANT options)

Method: GetObject

Get an object of the specified type (e.g. Channel, Option, Map, Table).

HRESULT GetObject([in] BSTR type, [in] BSTR name, [in, optional] VARIANT options, [out, retval] IGWv4EcuObject **ret)