Difference between revisions of "WICE Signal Broker API"

From WICE Wiki v2.89
Jump to navigation Jump to search
Line 1: Line 1:
The WICE Signal Reader module can act as a signal broker for Rapid Prototyping software components or other components running on external hardware connected to the WCU using ethernet or WiFi. The signal broker API is based on a publish/subscribe model, whereby custom client software components can connect a TCP socket (with default port number 31415) to Signal Reader, and subscribe to signals by name using the <code>subscribe</code> command (see below). The client software components can also publish signal values to the broker, using the <code>publish</code> command, for three special-purpose WICE-internal signals (called Dynamic_1, Dynamic_2 and Dynamic_3). The published signals can be used in trigger conditions, monitored and recorded in MDF files, like any other signal. They can also be subscribed to by other custom client software components.
The WICE Signal Reader module can act as a signal broker for Rapid Prototyping software components or other components running on external hardware connected to the WCU using ethernet or WiFi. The signal broker API is based on a publish/subscribe model, whereby custom client software components can connect a TCP socket (with default port number 31415) to Signal Reader, and subscribe to signals by name using the <code>subscribe</code> command (see below). The client software components can also publish signal values to the broker, using the <code>publish</code> command, which gives to opportunity to send CAN frames containing the signal. You can also use <code>publish</code> command for three special-purpose WICE-internal signals (called Dynamic_1, Dynamic_2 and Dynamic_3). The published signals can be used in trigger conditions, monitored and recorded in MDF files, like any other signal. They can also be subscribed to by other custom client software components.


The following API commands are supported on the signal broker socket:
The following API commands are supported on the signal broker socket:
Line 16: Line 16:
|-
|-
|<code>publish <dynamic internal signal name> <value></code>
|<code>publish <dynamic internal signal name> <value></code>
|Assignes the supplied floating point value to the WICE-internal dynamic signal supplied. The signal name, including module name, is WICE_Generic_Internal.Dynamic_<n>, where <n> is from 1 to 3.
|If the signal name refers to a CAN signal, a CAN frame with the signal will be written on the CAN bus. If the signal name refers to any of WICE-internal dynamic signals, the supplied floating point value will be assigned to the signal. The names of the WICE-internal dynamic signals, including module name, is WICE_Generic_Internal.Dynamic_<n>, where <n> is from 1 to 3.
|-
|-
|<code>quit</code>
|<code>quit</code>

Revision as of 10:36, 15 August 2019

The WICE Signal Reader module can act as a signal broker for Rapid Prototyping software components or other components running on external hardware connected to the WCU using ethernet or WiFi. The signal broker API is based on a publish/subscribe model, whereby custom client software components can connect a TCP socket (with default port number 31415) to Signal Reader, and subscribe to signals by name using the subscribe command (see below). The client software components can also publish signal values to the broker, using the publish command, which gives to opportunity to send CAN frames containing the signal. You can also use publish command for three special-purpose WICE-internal signals (called Dynamic_1, Dynamic_2 and Dynamic_3). The published signals can be used in trigger conditions, monitored and recorded in MDF files, like any other signal. They can also be subscribed to by other custom client software components.

The following API commands are supported on the signal broker socket:

Command string Description
list Lists the names of signals available for subscription.
modulenames <on/off> Selects between subscribed signals being reported with or without module names.
onchange <on/off> Selects whether signals are to be reported on the API socket only when changed, or whenever they are read.
publish <dynamic internal signal name> <value> If the signal name refers to a CAN signal, a CAN frame with the signal will be written on the CAN bus. If the signal name refers to any of WICE-internal dynamic signals, the supplied floating point value will be assigned to the signal. The names of the WICE-internal dynamic signals, including module name, is WICE_Generic_Internal.Dynamic_<n>, where <n> is from 1 to 3.
quit Disconnects from API socket.
recorders <setup> Returns the names and states ("running" or "stopped") of all recorders in the supplied Measurement Set-up
setup Returns the name of the active Measurement Set-up
setups Returns the names of all Measurement Set-ups
signal <signal name> Returns information about the named signal: minimum value, maximum value and unit, separated by space.
signals Lists all available signals together with their maximum and minimum value and unit, separated by space.
starttime Returns the time signal reader was started
subscribe <signal name 1> <signal name 2> ...<signal name n> Subscribes to the list of signals supplied. Signal names must include module names.
textvalues <on/off> Selects whether signals that have text table conversions should be reported with or without the text value.
timestamp <on/off> Enables / disables timestamps of subscribed signals. Timestamps are in seconds since Signal Reader was started (reported by the starttime command).
unsubscribe <signal name 1> <signal name 2> ...<signal name n> Unsubscribes the list of signals supplied. Signal names must include module names.
version Returns the Signal Reader version.
vin Returns the Vehicle Identification Number of the vehicle the WCU is installed in, if available.

All command strings in the table above are case sensitive and terminated by a newline character. Tokens are separated by a single space character.

The names and values of signals subscribed to are continuously written to the API socket, one signal per line, with the following syntax:

[timestamp] <signal name> <signal value> [textual value]

All signal values are floating point numbers. Some signals have textual values mapped to the floating point values. For such signals, the textual values are enabled and disabled using the textvalues command.

Commands that return more than one line (e.g. list) terminate the output with an empty line.

Timestamps are enabled and disabled using the timestamp command. The timestamps represent the sampling time of the signal, in seconds since the start of the measurement assignment.