Copyright © 2014 the Contributors to the Vehicle Information Access API Specification, published by the Automotive and Web Platform Business Group under the W3C Community Final Specification Agreement (FSA). A human-readable summary is available.
The W3C Vehicle Information API is a proposal that aims to enables connectivity through in-vehicle infotainment systems and vehicle data access protocols. This API can also be leveraged by web applications running on mobile devices that access the data resources of a connected passenger vehicle.
This specification does not dictate or describe the access protocol or transport method used for the data connection. Data may come from numerous sources including OBD-II, CAN, LIN, etc. Bluetooth, WiFi, or cloud connections are all possible.
The purpose of this specification is to promote an API that enables application development in a consistent manner across participating automotive manufacturers. It is recognized, however, that the mechanisms required for access or control of vehicle Properties may differ between automobile manufacturers, makes and models. Furthermore, different automobile manufacturers can expose different Properties that can be read or set by an application.
As a result of these constraints, this specification shall allow for automobile manufacturer-specific extensions or restrictions. Extensions are only permitted for interfaces that are not already described by this API, and must be implemented to conform within the format and guidelines existing in this specification. If a Property is restricted, the automobile manufacturer would omit the optional feature in their implementation (see the Availability
Section).
The target platform supported by the specification is exclusively passenger vehicles. Use of this specification for non-passenger applications (transportation, heavy machinery, marine, airline infotainment, military, etc.) is not prohibited, but is not covered in the design or content of the API and therefore may be insufficient.
Initially, a typical use case of Vehicle Information might be the implementation of a 'Virtual Mechanic' application that provides vehicle status information such as tire pressure, engine oil level, washer fluid level, battery status, etc. Future use case innovations in transportation, safety, navigation, smart energy grid and consumer infotainment and customization are all possible through this specification.
Web developers building interoperable applications based upon this API, will help empower a common web platform across consumer devices and passenger vehicles consistent with the Web of Things.
This specification was published by the Automotive and Web Platform Business Group. It is not a W3C Standard nor is it on the W3C Standards Track. Please note that under the W3C Community Final Specification Agreement (FSA) other conditions apply. Learn more about W3C Community and Business Groups.
Deprecated - Work on this document has been discontinued and it should not be referenced or used as a basis for implementation. The W3C Automotive Working Group has taken a different direction.
If you wish to make comments regarding this document, please send them to public-autowebplatform@w3.org (subscribe, archives).
Navigator
InterfaceVehicle
InterfaceZone
InterfaceVehicleInterfaceCallback
CallbackAvailableCallback
CallbackVehicleInterfaceError
InterfaceVehicleInterface
InterfaceVehicleConfigurationInterface
InterfaceVehicleSignalInterface
InterfaceThis section is non-normative.
The Vehicle Information API provides operations to get access to the vehicle data (henceforth "properties") available from vehicle systems and also to change (write) a number of properties. Vehicle data types are available in the Vehicle Data specification.
An example of use is provided below:
var vehicle = navigator.vehicle; vehicle.vehicleSpeed.get().then(function(vehicleSpeed) { console.log("vehicle speed: " + vehicleSpeed.speed); }, function(error) { console.log("There was an error"); }); var vehicleSpeedSub = vehicle.vehicleSpeed.subscribe(function(vehicleSpeed) { console.log("vehicle speed changed to: " + vehicleSpeed.speed); vehicle.vehicleSpeed.unsubscribe(vehicleSpeedSub); }); var zone = new Zone; var zones = vehicle.climateControl.zones; for(var i in zones) { if(i.equals(zone.driver)) { var value = {}; value["acStatus"] = true; vehicle.climateControl.set(value, zone.driver).then(function(){ console.log("successfully set acStatus"); }, function(error) { console.log("there was an error"); }); } }
As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative.
The key words MUST and OPTIONAL are to be interpreted as described in [RFC2119].
This specification defines conformance criteria that apply to a single product: the user agent that implements the interfaces that it contains.
Implementations that use ECMAScript to implement the APIs defined in this specification MUST implement them in a manner consistent with the ECMAScript Bindings defined in the Web IDL specification [WEBIDL], as this specification uses that specification and terminology.
The
Promise
provide a convenient way to get access to the result of an operation.
It is expected that security of vehicle APIs described in this document is based on permissions dictated by:
No separate permission or access control model will be defined for vehicle APIs. Depending on a specific platform, the user agent used may have to provide tools to generate permissions for application descriptors as required by the OS. Android is an example under which such a descriptor (Android app manifest) has to be generated if the runtime maps its apps to OS-level apps.
Vehicle
InterfaceThe Vehicle
interface
represents the initial entry point for getting access to the vehicle information
services, i.e. Engine Speed and Tire Pressure.
[NoInterfaceObject]
interface Vehicle {
};
Zone
InterfaceThe Zone
interface contains the constants that represent physical zones and logical zones
enum ZonePosition {
"front",
"middle",
"right",
"left",
"rear",
"center"
};
Enumeration description | |
---|---|
front | middle |
middle | the middle position of a row. |
right | left |
left | rear |
rear | center |
center | the center row |
interface Zone {
attribute DOMString[] value;
readonly attribute Zone
driver;
boolean equals (Zone
zone);
boolean contains (Zone
zone);
};
driver
of type Zone
, readonly value
of type array of DOMString, contains
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
zone |
| ✘ | ✘ |
boolean
equals
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
zone |
| ✘ | ✘ |
boolean
VehicleInterfaceCallback
Callbackcallback VehicleInterfaceCallback = void(object value); ();
AvailableCallback
Callbackcallback AvailableCallback = void (Availability available) ();
VehicleInterfaceError
InterfaceVehicleInterfaceError is used to identify the type of error encountered during an opertion
enum VehicleError {
"permission_denied",
"invalid_operation",
"timeout",
"invalid_zone",
"unknown"
};
Enumeration description | |
---|---|
permission_denied | Indicates that the user does not have permission to perform the operation. More details can be obtained through the Data Availability API. |
invalid_operation | Indicates that the operation is not valid. This can be because it isn't supported or has invalid arguments |
timeout | Operation timed out. Timeout length depends upon the implementation |
invalid_zone | Indicates the zone argument is not valid |
unknown | Indicates an error that is not known |
[NoInterfaceObject]
interface VehicleInterfaceError {
readonly attribute VehicleError
error;
readonly attribute DOMString message;
};
error
of type VehicleError
, readonly message
of type DOMString, readonly VehicleInterface
InterfaceThe VehicleInterface
interface represents the base interface to get all vehicle properties.
interface VehicleInterface {
Promise get (optional Zone
zone);
readonly attribute Zone
[] zones;
};
zones
of type array of Zone
, readonly get
VehicleInterfaceError
is passed to the 'reject' callback in the promise.Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
zone |
| ✘ | ✔ |
Promise
vehicle.vehicleSpeed.get().then(resolve); function resolve(data) { //data is of type VehicleSpeed console.log("Speed: " + data.speed); console.log("Time Stamp: " + data.timestamp); }
VehicleConfigurationInterface
InterfaceThe VehicleConfigurationInterface
interface is to be used to provide access to static vehicle information that never changes: external dimensions, identification, transmission type etc...
[NoInterfaceObject]
interface VehicleConfigurationInterface : VehicleInterface
{
};
VehicleSignalInterface
InterfaceThe VehicleSignalInterface
interface represents vehicle signals that, as a rule, and unlike vehicle configurations, can change values, either programmatically
(necessitating support for set method) or due to external events and occurrences, as reflected by subscription management.
[NoInterfaceObject]
interface VehicleSignalInterface : VehicleInterface
{
Promise set (object value, optional Zone
zone);
unsigned short subscribe (VehicleInterfaceCallback
callback, optional Zone
zone);
void unsubscribe (unsigned short handle);
};
set
VehicleInterfaceError
objectParameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
value | object | ✘ | ✘ | |
zone |
| ✘ | ✔ |
Promise
subscribe
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
callback |
| ✘ | ✘ | |
zone |
| ✘ | ✔ |
unsigned short
unsubscribe
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
handle | unsigned short | ✘ | ✘ |
void
var zone = Zone vehicle.door.set({"lock" : true}, zone.driver).then(resolve, reject); function resolve() { /// success } function reject(errorData) { console.log("Error occurred during set: " + errorData.message + " code: " + errorData.error); }
The availability API allows for developers to determine what attributes are available or not and if not, why. It also allows for notifications when the availability changes.
enum Availability {
"available",
"not_supported",
"not_supported_yet",
"not_supported_security_policy",
"not_supported_business_policy",
"not_supported_other"
};
Enumeration description | |
---|---|
available | data is available |
not_supported | not supported by this vehicle |
not_supported_yet | not supported at this time, but may become supported later. |
not_supported_security_policy | not supported because of security policy |
not_supported_business_policy | not supported because of business policy |
not_supported_other | not supported for other reasons |
partial interface VehicleInterface {
Availability
availableForRetrieval (DOMString attributeName);
readonly attribute boolean supported;
short availabilityChangedListener (AvailableCallback
callback);
void removeAvailabilityChangedListener (short handle);
};
supported
of type boolean, readonly availabilityChangedListener
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
callback |
| ✘ | ✘ |
short
availableForRetrieval
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
attributeName | DOMString | ✘ | ✘ |
Availability
removeAvailabilityChangedListener
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
handle | short | ✘ | ✘ |
void
if( ( var a = vehicle.vehicleSpeed.availableForRetrieval("speed") ) === "available" ) { // we can use it. } else { // tell us why: console.log(a); }
partial interface VehicleSignalInterface {
Availability
availableForSubscription (DOMString attributeName);
Availability
availableForSetting (DOMString attributeName);
};
availableForSetting
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
attributeName | DOMString | ✘ | ✘ |
Availability
availableForSubscription
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
attributeName | DOMString | ✘ | ✘ |
Availability
var canHasVehicleSpeed = vehicle.vehicleSpeed.availableForSubscription("speed") === "available"; vehicle.vehicleSpeed.availabilityChangedListener( function (available) { canHasVehicleSpeed = available === "available"; checkVehicleSpeed(); }); function checkVehicleSpeed() { if(canHasVehicleSpeed) { vehicle.vehicleSpeed.get().then(callback); } }
The History API provides a way for applications to access logged data from the vehicle. What data is available and how much is up to the implementation. This section is OPTIONAL.
partial interface VehicleInterface {
Promise getHistory (Date begin, Date end, optional Zone
zone);
readonly attribute boolean isLogged;
readonly attribute Date ? from;
readonly attribute Date ? to;
};
from
of type Date , readonly , nullableisLogged
of type boolean, readonly to
of type Date , readonly , nullablegetHistory
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
begin | Date | ✘ | ✘ | |
end | Date | ✘ | ✘ | |
zone |
| ✘ | ✔ |
Promise
/// check if there is data being logged for vehicleSpeed: if(vehicle.vehicleSpeed.isLogged) { /// get all vehicleSpeed since it was first logged: vehicle.vehicleSpeed.getHistory(vehicle.vehicleSpeed.from, vehicle.vehicleSpeed.to).then( function ( data ) { console.log(data.length); }); }
The primary purpose of this specification is to provide web developers the ability to access and set vehicle information through a simple common set of operations including get, set, subscribe, and unsubscribe. Thus normative use cases pertain to this access and do not cover higher application of business level use cases.