WICE Signal Broker API

From WICE Wiki v2.89
Revision as of 08:19, 7 May 2020 by Mathias (talk | contribs)
Jump to navigation Jump to search

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 the 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 <signal name> <value> If the signal name refers to a CAN signal, a CAN frame with the signal set to the specified value will be written on the CAN bus. If the signal name refers to any of the 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.
publish_ub <signal name> <value> If the signal name refers to a CAN signal, a CAN frame with the signal set to the specified value will be written on the CAN bus, and the signal's update-bit will be set in the frame.
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).
update <signal name> <value> Updates the of the named signal (similar to publish for CAN signals, but without sending the frame).
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.