This document, the Gen2 core specification, describes the Gen2 messaging layer. The companion specifications for the Gen2 transport protocols detail the mapping of the messaging layer to selected transports. The ontologies based on the Gen2 core specification are defined in documents for each specific domain (e.g. navigation, media, vehicle data).
This document describes the messaging API for Gen2 protocol. This includes the messaging layer and set of rules for structuring data. The separation between payload encoding (transport) and messaging API (core) improves adaptability. Extending and describing multiple transport protocols becomes possible.
The messages are exchanged between a service implementation holding the representation of data and a client using the data. A service is an entity that manages and offers access to data. A client is an entity that works with data managed by a service.
The Gen2 messaging layer uses a RESTful design for all methods exchanged via the interface ().
The Gen2 data structuring rules (VSS Rule set) are the same through all transport protocols. The basis for structuring data hold by a service is a tree.
The acronym 'Gen2' is used to refer to this document, the second generation specification. The acronym 'VSS' is used to refer to the 'Vehicle Signal Specification' which is defined by the GENIVI Alliance. The term 'WebSocket' when used in this document, is as defined in the W3C WebSocket API and the WebSocket Protocol.
The service is intended for use with a tree-like logical taxonomy to represent the vehicle data. An illustrative example of such a tree structure is shown in Figure 1. While it is meant to support conforming taxonomies it was created principally with the Vehicle Signal Specification (VSS) in mind. For more details, see the VSS documentation.
Addressing of elements is done using URIs as defined in [[RFC3986]].
scheme:authority/path?query
The scheme describes the protocol to use to reach the addressed element.
The authority describes where to reach the service holding and managing the data representation. Scheme and authority are defined within the protocol adaptation.
The path consists of the slash delimited node names of the nodes traversed from the tree root to the tree leaf representing the service. E. g. the path expression from traversing the nodes Vehicle, Car, Engine, RPM would be "Vehicle/Car/Engine/RPM".
The query contains further information related to the request, see .
The purpose of the data model is to provide a client with a description of the data that enables the client to make a request for desired vehicle data, and interpret the response. In order to obtain that description, the client MAY request that the server returns the VSS tree content, i. e. the metadata describing the accessible vehicle data. The client is able to request metadata from any point in the signal tree, such that only the metadata for the nodes within the given branch of the tree is returned. For example, only metadata for the chassis branch of the VSS tree is returned when the chassis path is specified. If the path is set to the VSS root, the response contains the metadata for the entire tree. If the server is able to satisfy the request it SHALL return a Response message. If an error occurs the server SHALL return an ErrorResponse message.
A service discovery request has the format of a read, where the path is appended with a query component, see for the details.
The key data components of these messagess are defined below:
To enable e. g. after-market services it SHALL be possible to dynamically add new branches to the VSS tree, and if requested also to delete them at a later point.
Requests of this type are not expected to be frequent for the type of data that is represented in the "vehicle signal domain", which is the current scope of VSS. These requests are therefore partitioned in a separate API, which is described in "Appendix: Dynamic registry API".
Filtering is a mechanism to refine a client request, in order to more precisely control the data in a response. Filtering can be applied in read requests and in subscribe requests.For read requests the filter expression MUST be appended to the request path in the form of a query component following the description in [[RFC3986]]. For subscribe requests the filter expression MUST be carried in the request payload. The filter expression follows the same general rules in both request cases. The query component must have the following structure
reserved-word comparison-operator expression
where
- reserved-word must have the dollar-sign as the first character ($). The availabe reserved words are described in the chapters below.
- comparison-operator is one of either the equal sign (EQ), the greater than sign (GT), or the less than sign (LT).
- expression is a character string with its interpretation given by the preceeding reserved-word and comparison operator.
Filter expressions can consist of multiple query expressions, as described in .
As filtering is implemented on the server side, in vehicles, the filtering complexity is intentionally kept to a low level in order to not load the processing resources too much.
The available read filtering options are presented in the following chapters, and are only applicable to read requests. As described in [[RFC3986]], a question mark must be inserted as a delimiter between the path and the query components.
The service discovery query has the structure
$spec EQ depth
where
- $spec is the reserved word for service discovery filtering.
- the equal sign (EQ) is the only allowed comparison operator for service discovery filtering.
- depth sets the maximum branch depth that is returned in the response, counted from the root node given by the path component in the request.
Depth MUST be a positive integer. If set to zero, it is replaced by the max depth of the subtree.
If the path in a read request does not terminate in a leaf node, then the response will contain values from all leaf nodes in the subtree given by the path. The search filter makes it possible to tailor a subset of this response. The search query has the structure
$path EQ search-expression
where
- $path is the reserved word for search filtering.
- the equal sign (EQ) is the only allowed comparison operator for search filtering.
- search-expression is a path expression that may contain the wildcard character (*) for representation of an unknown node name.
The search-expression is relative to the root node given by the path component in the request. An example could be "*/*/isOpen", which, preceeded with a slash, and concatenated with the request root-path "Vehicle/Cabin/Door" would generate the absolute search expression "Vehicle/Cabin/Door/*/*/isOpen", in which case the response would contain all values from the isOpen nodes in that subtree, but not from the other possible leaf nodes in it.
The search filter can be used also in subscribe requests, see chapter Filter combinations.
If a request, typically when it is addressing a subtree, is only interested in response data with a specific value, then a data value filter can be used.
The data value query has the structure
$data comparison-operator value
where
- $data is the reserved word for data value filtering.
- comparison-operator is one of either the equal sign (EQ), the greater than sign (GT), or the less than sign (LT).
- value is a number following Javascript syntax rules, or a boolean value.
If the data type of the value-expression is different from the data type of the node matching the path, then an error response is returned.
The available subscribe filtering options are presented in the following chapters, and is only applicable to subscribe requests. The filter expression is carried in the request payload in the form of a key-value pair "filter": "filter expression", where "filter" is the key name, and "filter expression" is replaced by the actual expression.
An interval filter is used in a subscribe request when the client wants subscription notifications to be issued by the server at a regular time interval.
The interval query has the structure
$interval EQ value
where
- $interval is the reserved word for interval filtering.
- the equal sign (EQ) is the only allowed comparison operator for interval filtering.
- value is an integer value in milliseconds representing the interval between issued notifications.
A range filter is used when the client wants subscription notifications to be issued by the server when a value enters/exits the defined range.
The range query has the structure
$range comparison-operator value
where
- $range is the reserved word for range filtering.
- comparison-operator is one of either the greater than sign (GT), or the less than sign (LT).
- value is a number following Javascript syntax rules.
A change filter is used when the client wants subscription notifications to be issued by the server when a value has changed more than a defined value since last notification.
The change query has the structure
$change comparison-operator value
where
- $change is the reserved word for change filtering.
- comparison-operator is one of either the greater than sign (GT), or the not equal sign (NEQ).
- value is a number following Javascript syntax rules.
When using the not equal comparison operator it MUST have the value zero, all other values lead to an error response. The usage is interpreted as "for any change", and also supports boolean changes.
Queries of the types descibed below can be aggregated to form more complex queries. The format for this is then
query1 AND query2 AND .. queryN
where
- queryN is any of the query types, following the allowed combinations shown in Table 1.
- N is maximum four.
- AND is the logical AND operator.
Index | Filter name | Allowed combinations |
---|---|---|
1. | Service discovery | None |
2. | Search | 3+4+5+6 |
3. | Data value | 2 |
4. | Interval | 2 |
5. | Range | 2+5+6 |
6. | Change | 2+5 |
An example of a read request URI containing an aggregated query is
Vehicle/Cabin/Door?$pathEQ*/*/isOpenAND$dataEQfalse
which would return data for all locked doors.
In filter combinations where a search expression in the URI is combined with a subscribe filter expression in the payload, the logical AND operator combines them.
This chapter describes the different methods and its arguments that govern the communication between a service and a client.
A timeout for the response of all methods with responses MUST be defined. This timeout is transport protocol specific to reflect the normal behaviour of the transport protocol.
Purpose: obtain a representation of the value addressed by the given path
The service MUST expose a read method. The client MAY use the read method of the service to retrieve values managed by the service. If the service is able to satisfy the request it MUST return a content response. If the service is unable to fulfil the request, then the service MUST return an error response. The client MAY have to authenticate via the authenticate method before being able to access the values.
arguments:
responses:
Purpose: providing altered values to the service for a specified path
The service MAY expose an update method. The client MAY use the update method of the service to request a change to values managed by the service. If the service is able to satisfy the request it MUST return a change response. If an error occurs the service MUST return an error response.
arguments:
responses:
Purpose: providing new values to the service under a specified path
The service MAY expose a create method. The client MAY use the create method of the service to request new values to be managed by the service. If the service is able to satisfy the request it MUST return a change response. If an error occurs the service MUST return an error response.
arguments:
responses:
Purpose: removing all selected values under a specified path
The service MAY expose a delete method. The client MAY use the delete method of the service to request the deletion of existing values managed by the service. If the service is able to satisfy the request it MUST return a change response. If an error occurs the service MUST return an error response.
arguments:
responses:
Purpose: monitor changes made to values under a specified path
The service MAY expose a subscribe method. The client MAY use the subscribe method of the service to request being informed of changes made to values managed by the service. The service MUST issue a notification if the equivalent read content response would change. If the service is able to satisfy the request it MUST return a subscription and contract response. If an error occurs the service MUST return an error response.
arguments:
responses:
Purpose: informs of changes made to values under a subscription
The client MUST expose a notify method if it uses the subscribe method of a service. The service MUST use the notify method of the client to inform of changes made to values managed by the service under the given subscription by sending a content response. The service MUST ignore any response from the client.
arguments:
responses: none
Purpose: stop monitoring the changes made to values under a subscription
The service MUST expose a unsubscribe method if an subscribe method is exposed. The client MAY use the unsubscribe method of the service to cancel being informed of changes made to values managed by the service under the given subscription. The service MUST stop issuing notifications. If the service is able to satisfy the request it MUST return a subscription response. If an error occurs the service MUST return an error response.
arguments:
responses:
An error response MUST include the formal error type. An error response MAY include a textual form of the error type. An error response MUST include an error value if obligatory for the error type. An error response MUST include a timestamp. An error response MUST be actionable.
field | obligation | description | format | example |
---|---|---|---|---|
error type | mandatory | short handle describing the error. | protocol specifc | AuthorizationFailed |
error description | optional | Information describing the error reason. | ^[\w ]{5,255}$ |
Authorization failed for the method. Please set a valid AuthToken and AuthType. |
error value | conditional | Send if set as mandatory for the error type. Describing more details to understand the error type. | string, error type specific | AuthToken valid; Access Level not sufficient. |
timestamp | mandatory | The time when the error occured. | date-time compliant | 2005-11-12T12:01:42.123+01:00 |
These error types MUST be implemented by a service. A transport protocol MAY define additional error types. A transport protocol MUST not alter these error types.
error type | Textual description | values | Solution/Action |
---|---|---|---|
InvalidToken | The AuthToken is not recognized as valid. | none | Check if AuthType is set correctly. Get a new AuthToken. |
AccessLevelNotSufficient | The AuthToken is recognized but does not allow the execution of the requested method. | none | Get a token with a different access level. |
InvalidPath | The given path is not valid. | none | Check the path given in the arguments. |
MissingArgument | An mandatory argument is missing from the method execution. | Missing Argument | Add missing argument. |
InvalidFilter | Filter could not be parsed. | Error Position | Fix filter. |
ValueNotPermited | A value set by the client is not permited. | value | Set the value to a value permited by the service implementation. |
ContractInvalid | The contract submitted is not valid. | Invalid contract statement | Recall method with a valid contract. |
SubscriptionUnknown | The subscription is not known by the service. | none | Check subscription. |
For the communication between service and client several key/value pairs can be given to describe the environment in what the methods () are called. The string describing the key MUST be the same structure as name.
Purpose: authorization makes it possible for a client to authorize itself towards a service.
The authorization key/value pairs consists out of a AuthType and a AuthToken key/value pair. The client MAY use the authorization key/value pairs to transfer an authorization token to the service. The client MUST use either both key/value pairs or none of the two. The service MAY use the token transfered by the AuthToken key/value pair to authenticate the client. The client MUST set the type of the token with the AuthType key/value pair if AuthToken is set. This concept MAY be used for access control. A rejected authorization token MUST result in an error response. If the execution of a method on a service needs authorization the service MUST use the authorization key/value pair.
key | AuthToken |
---|---|
value | ^\w{1,1024}$ |
key | AuthType |
---|---|
value | name compliant |
Purpose: A client can express which schema variants it can support when executing a method. A service can express which schema variant it uses when communicating with the client.
The client MAY set multiple key/value pairs to describe all variants it supports. The client MAY not set any key/value pair. The service MUST set exactly one schema key/value pair to describe the used variant. The client MAY use the [[SemVer]] style to describe degrees of freedom in the version of the schema.
key | Schema |
---|---|
value | schema compliant |
example | w3c.vehicle.v1.5.3 |
The dynamic reqistry API provides the functionality to dynamically add or delete branches of the VSS tree. A branch can only be deleted if it has been dynamically added. In the following an entity requesting dynamic registry services is called a "service manager", and the entity performing these requests is called the "core server", see the figure "Gen2 server reference architecure".