Difference between revisions of "WICE Signal Broker API"
Robin.karhu (talk | contribs) |
|||
(12 intermediate revisions by one other user not shown) | |||
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 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 following API commands are supported on the signal broker socket: | The following API commands are supported on the signal broker socket: | ||
Line 8: | Line 8: | ||
|<code>list</code> | |<code>list</code> | ||
|Lists the names of signals available for subscription. | |Lists the names of signals available for subscription. | ||
|- | |||
|<code>ccp <on/off></code> | |||
|Enables or disables CCP communication in Signal Reader. | |||
|- | |||
|<code>diagnostics <on/off></code> | |||
|Enables or disables UDS diagnostics in Signal Reader. | |||
|- | |- | ||
|<code>modulenames <on/off></code> | |<code>modulenames <on/off></code> | ||
Line 15: | Line 21: | ||
|Selects whether signals are to be reported on the API socket only when changed, or whenever they are read. | |Selects whether signals are to be reported on the API socket only when changed, or whenever they are read. | ||
|- | |- | ||
|<code>publish < | |<code>publish <signal name> <value></code> | ||
| | |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. | ||
|- | |||
|<code>publish_ub <signal name> <value></code> | |||
|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. | |||
|- | |- | ||
|<code>quit</code> | |<code>quit</code> | ||
Line 29: | Line 38: | ||
|<code>setups</code> | |<code>setups</code> | ||
|Returns the names of all Measurement Set-ups | |Returns the names of all Measurement Set-ups | ||
|- | |||
|<code>signal <signal name></code> | |||
|Returns information about the named signal: minimum value, maximum value and unit, separated by space. | |||
|- | |||
|<code>signals</code> | |||
|Lists all available signals together with their maximum and minimum value and unit, separated by space. | |||
|- | |- | ||
|<code>starttime</code> | |<code>starttime</code> | ||
Line 36: | Line 51: | ||
|Subscribes to the list of signals supplied. Signal names must include module names. | |Subscribes to the list of signals supplied. Signal names must include module names. | ||
|- | |- | ||
|<code>textvalues</code> | |<code>textvalues <on/off></code> | ||
|Selects whether signals that have text table conversions should be reported with or without the text value. | |Selects whether signals that have text table conversions should be reported with or without the text value. | ||
|- | |- | ||
|<code>timestamp <on/off></code> | |<code>timestamp <on/off></code> | ||
|Enables / disables timestamps of subscribed signals. Timestamps are in seconds since Signal Reader was started (reported by the starttime command). | |Enables / disables timestamps of subscribed signals. Timestamps are in seconds since Signal Reader was started (reported by the starttime command). | ||
|- | |||
|<code>update <signal name> <value></code> | |||
|Updates the value of the named signal (similar to ''publish'' for CAN signals, but without sending the frame). | |||
|- | |- | ||
|<code>unsubscribe <signal name 1> <signal name 2> ...<signal name n></code> | |<code>unsubscribe <signal name 1> <signal name 2> ...<signal name n></code> | ||
Line 50: | Line 68: | ||
|<code>vin</code> | |<code>vin</code> | ||
|Returns the Vehicle Identification Number of the vehicle the WCU is installed in, if available. | |Returns the Vehicle Identification Number of the vehicle the WCU is installed in, if available. | ||
|- | |||
|<code>xcp <on/off></code> | |||
|Enables or disables XCP communication in Signal Reader. | |||
|} | |} | ||
Line 58: | Line 79: | ||
<code>[timestamp] <signal name> <signal value> [textual value]</code> | <code>[timestamp] <signal name> <signal value> [textual value]</code> | ||
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 <code>textvalues</code> command. | |||
Commands that return more than one line (e.g. <code>list</code>) terminate the output with an empty line. | |||
Timestamps are enabled and disabled using the <code>timestamp</code> command. The timestamps represent the sampling time of the signal, in seconds since the start of the measurement task. |
Latest revision as of 14:22, 29 November 2021
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. |
ccp <on/off>
|
Enables or disables CCP communication in Signal Reader. |
diagnostics <on/off>
|
Enables or disables UDS diagnostics in Signal Reader. |
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 value 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. |
xcp <on/off>
|
Enables or disables XCP communication in Signal Reader. |
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 task.