This document is licensed under a Creative Commons Attribution 3.0 License.
This specification defines a Vehicle Information API which offers a simple interface to get access to vehicle data. A typical use case of the Vehicle Information is the implementation of a tachometer application that allows view inforomation from the vehicle such as speed, tire pressure, and engine rotation speed (RPMs).
This document is merely a public working draft of a potential specification. It has no official standing of any kind and does not represent the support or consensus of any standards organisation.
Navigator
InterfaceVehiclePropertyType
InterfaceVehiclePropertyError
InterfaceVehicleSpeed
InterfaceEngineSpeed
InterfaceVehiclePowerMode
InterfaceTripMeters
InterfaceAcceleration
InterfaceTransmission
InterfaceCruiseControlStatus
InterfaceWheelBrake
InterfaceLightStatus
InterfaceInteriorLightStatus
InterfaceHorn
InterfaceFuel
InterfaceExteriorBrightness
InterfaceTemperature
InterfaceRainSensor
InterfaceWindshieldWiper
InterfaceDefrostDictionary
DictionaryHVAC
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. The API also allows users to request data that has been logged previously.
An example of use is provided below:
navigator.vehicle.get("EngineSpeed", onsuccess, onerror); function onsuccess(value) { window.console.log(value.EngineSpeed); } function onerror(e) { window.console.error(e.message); }
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, MUST NOT, REQUIRED, SHOULD, SHOULD NOT, RECOMMENDED, MAY, and OPTIONAL in this specification 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
EventHandler
interface represents a callback used for event
handlers as defined in [HTML5].
The concepts queue a task and fire a simple event are defined in [HTML5].
The terms event handler and event handler event types are defined in [HTML5].
This API must be only exposed to trusted content
The Vehicle Infomration interface represents the initial entry point for getting access to the vehicle information services, i.e. Engine Speed and Tire Pressure.
[NoInterfaceObject]
interface Vehicle {
void getSupported (SupportedPropertiesCallback successCallback, VehiclePropertyErrorCallback errorCallback);
void get (DOMString property, VehiclePropertyCallback success, VehiclePropertyErrorCallback errorCallback);
void set (DOMString property, VehiclePropertyType
value, VehiclePropertyCallback success, VehiclePropertyErrorCallback errorCallback);
void getHistory (DOMString property, Date startTime, Date endTime, VehiclePropertyListCallback success, VehiclePropertyErrorCallback errorCallback);
};
get
property
. Upon
success, the successCallback
will be called with the value.
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
property | DOMString | ✘ | ✘ | requested property to be retrieved |
success | VehiclePropertyCallback | ✘ | ✘ | function to be called when method has completed successfully |
errorCallback | VehiclePropertyErrorCallback | ✘ | ✘ | this function is called when an error has occured |
void
getHistory
property
in series from startTime
to endTime
. Upon success, the successCallback
will be called
with the result.
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
property | DOMString | ✘ | ✘ | requested property to be retrieved |
startTime | Date | ✘ | ✘ | beginning time for request |
endTime | Date | ✘ | ✘ | ending time for request |
success | VehiclePropertyListCallback | ✘ | ✘ | function to be called when method has completed successfully |
errorCallback | VehiclePropertyErrorCallback | ✘ | ✘ | this function is called when an error has occured |
void
getSupported
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
successCallback | SupportedPropertiesCallback | ✘ | ✘ | function to be called when method has completed successfully |
errorCallback | VehiclePropertyErrorCallback | ✘ | ✘ | this function is called when an error has occured |
void
set
property
to value
. Upon
success, the successCallback
will be called with the result.
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
property | DOMString | ✘ | ✘ | requested property to be retrieved |
value |
| ✘ | ✘ | corrisponding value to set |
success | VehiclePropertyCallback | ✘ | ✘ | function to be called when method has completed successfully |
errorCallback | VehiclePropertyErrorCallback | ✘ | ✘ | this function is called when an error has occured |
void
The getSupported
method when invoked MUST run the following steps:
successCallback
and pass into the function the
DOMString array representing the supported properties.
The get
method when invoked MUST
run the following steps:
property
parameter
property
is not supported construct a VehiclePropertyError
object and set the code
members to VehiclePropertyError.PROPERTY_UNAVAILABLE
and
message
member to "Unsupported property".
successCallback
and pass the VehiclePropertyType
as the argument.
The set
method when invoked MUST run
the following steps:
property
parameter to the value indicated in the value
parameter.
property
is not supported construct a VehiclePropertyError
object and set the code
members to VehiclePropertyError.PROPERTY_UNAVAILABLE
and
message
member to "Unsupported property".
successCallback
and pass the VehiclePropertyType
as the argument.
The getHistory
method when invoked MUST run
the following steps:
property
parameter after the time startTime
and after
the time endTime
.
property
is not supported construct a VehiclePropertyError
object and set the code
members to VehiclePropertyError.PROPERTY_UNAVAILABLE
and
message
member to "Unsupported property".
successCallback
and pass the array of VehiclePropertyType
as the argument.
VehiclePropertyType
InterfaceThe VehiclePropertyType
interface represents the base interface for all vehicle properties.
[NoInterfaceObject]
interface VehiclePropertyType : Event {
readonly attribute Date timeStamp;;
};
timeStamp;
of type Date, readonly VehiclePropertyError
InterfaceThe VehiclePropertyError
interface represents the an error returned by the vehicle information system.
manager.
[NoInterfaceObject]
interface VehiclePropertyError {
const unsigned short PERMISSION_DENIED = 1;
const unsigned short PROPERTY_UNAVAILABLE = 2;
const unsigned short TIMEOUT = 3;
const unsigned short UNKNOWN = 10;
readonly attribute unsigned short code;
readonly attribute DOMString message;
};
code
of type unsigned short, readonly message
of type DOMString, readonly PERMISSION_DENIED
of type unsigned shortPROPERTY_UNAVAILABLE
of type unsigned shortTIMEOUT
of type unsigned shortUNKNOWN
of type unsigned shortThe VehiclePropertyCallback is called during the navigator.vehicle.get()
operation
The VehiclePropertyErrorCallback is called during the navigator.vehicle.get()
operation
The VehiclePropertyListCallback is called during the navigator.vehicle.getHistory()
operation
The SupportedPropertiesCallback is called during the navigator.vehicle.getSupported()
operation
VehicleSpeed
InterfaceThe VehicleSpeed
interface represents vehicle speed.
[NoInterfaceObject]
interface VehicleSpeed : VehiclePropertyType
{
readonly attribute unsigned long VehicleSpeed;
};
VehicleSpeed
of type unsigned long, readonly EngineSpeed
InterfaceThe EngineSpeed
interface represents engine speed.
[NoInterfaceObject]
interface EngineSpeed : VehiclePropertyType
{
readonly attribute unsigned long EngineSpeed;
};
EngineSpeed
of type unsigned long, readonly VehiclePowerMode
InterfaceThe VehiclePowerMode
interface represents the current vehidle power mode.
[NoInterfaceObject]
interface VehiclePowerMode : VehiclePropertyType
{
const unsigned short VEHICLEPOWERMODE_OFF = 0;
const unsigned short VEHICLEPOWERMODE_ACCESSORY1 = 1;
const unsigned short VEHICLEPOWERMODE_ACCESSORY2 = 2;
const unsigned short VEHICLEPOWERMODE_RUN = 3;
readonly attribute octet VehiclePowerMode;
};
VehiclePowerMode
of type octet, readonly VEHICLEPOWERMODE_ACCESSORY1
of type unsigned shortVEHICLEPOWERMODE_ACCESSORY2
of type unsigned shortVEHICLEPOWERMODE_OFF
of type unsigned shortVEHICLEPOWERMODE_RUN
of type unsigned shortTripMeters
InterfaceThe TripMeters
interface represents the current trip meters.
[NoInterfaceObject]
interface TripMeters : VehiclePropertyType
{
attribute sequence unsigned long TripMeters;
};
TripMeters
of type sequence unsigned long, Acceleration
InterfaceThe Acceleration
interface represents vehicle acceleration.
[NoInterfaceObject]
interface Acceleration : VehiclePropertyType
{
readonly attribute unsigned long X;
readonly attribute unsigned long Y;
readonly attribute unsigned long Z;
};
X
of type unsigned long, readonly Y
of type unsigned long, readonly Z
of type unsigned long, readonly Transmission
InterfaceThe Transmission
interface represents the current transmssion gear and mode.
[NoInterfaceObject]
interface Transmission : VehiclePropertyType
{
const unsigned short TRANSMISSIONPOSITION_NEUTRAL = 0;
const unsigned short TRANSMISSIONPOSITION_FIRST = 1;
const unsigned short TRANSMISSIONPOSITION_SECOND = 2;
const unsigned short TRANSMISSIONPOSITION_THIRD = 3;
const unsigned short TRANSMISSIONPOSITION_FORTH = 4;
const unsigned short TRANSMISSIONPOSITION_FIFTH = 5;
const unsigned short TRANSMISSIONPOSITION_SIXTH = 6;
const unsigned short TRANSMISSIONPOSITION_SEVENTH = 7;
const unsigned short TRANSMISSIONPOSITION_EIGHTH = 8;
const unsigned short TRANSMISSIONPOSITION_NINTH = 9;
const unsigned short TRANSMISSIONPOSITION_TENTH = 10;
const unsigned short TRANSMISSIONPOSITION_CVT = 64;
const unsigned short TRANSMISSIONPOSITION_REVERSE = 128;
const unsigned short TRANSMISSIONPOSITION_PARK = 255;
const unsigned short TRANSMISSIONMODE_NORMAL = 0;
const unsigned short TRANSMISSIONMODE_SPORT = 1;
const unsigned short TRANSMISSIONMODE_ECONOMY = 2;
const unsigned short TRANSMISSIONMODE_OEMCUSTOM1 = 3;
const unsigned short TRANSMISSIONMODE_OEMCUSTOM2 = 4;
readonly attribute octet GearPosition;
readonly attribute octet Mode;
};
GearPosition
of type octet, readonly Mode
of type octet, readonly TRANSMISSIONMODE_ECONOMY
of type unsigned shortTRANSMISSIONMODE_NORMAL
of type unsigned shortTRANSMISSIONMODE_OEMCUSTOM1
of type unsigned shortTRANSMISSIONMODE_OEMCUSTOM2
of type unsigned shortTRANSMISSIONMODE_SPORT
of type unsigned shortTRANSMISSIONPOSITION_CVT
of type unsigned shortTRANSMISSIONPOSITION_EIGHTH
of type unsigned shortTRANSMISSIONPOSITION_FIFTH
of type unsigned shortTRANSMISSIONPOSITION_FIRST
of type unsigned shortTRANSMISSIONPOSITION_FORTH
of type unsigned shortTRANSMISSIONPOSITION_NEUTRAL
of type unsigned shortTRANSMISSIONPOSITION_NINTH
of type unsigned shortTRANSMISSIONPOSITION_PARK
of type unsigned shortTRANSMISSIONPOSITION_REVERSE
of type unsigned shortTRANSMISSIONPOSITION_SECOND
of type unsigned shortTRANSMISSIONPOSITION_SEVENTH
of type unsigned shortTRANSMISSIONPOSITION_SIXTH
of type unsigned shortTRANSMISSIONPOSITION_TENTH
of type unsigned shortTRANSMISSIONPOSITION_THIRD
of type unsigned shortCruiseControlStatus
InterfaceThe CruiseControlStatus
interface represents cruise control settings.
[NoInterfaceObject]
interface CruiseControlStatus : VehiclePropertyType
{
readonly attribute boolean Activated;
readonly attribute unsigned short Speed;
};
Activated
of type boolean, readonly Speed
of type unsigned short, readonly WheelBrake
InterfaceThe WheelBrake
interface represents wheel brake status.
[NoInterfaceObject]
interface WheelBrake : VehiclePropertyType
{
readonly attribute boolean Engaged;
};
Engaged
of type boolean, readonly LightStatus
InterfaceThe LightStatus
interface represents exterior light statuses.
[NoInterfaceObject]
interface LightStatus : VehiclePropertyType
{
readonly attribute boolean Head;
readonly attribute boolean RightTurn;
readonly attribute boolean LeftTurn;
readonly attribute boolean Brake;
readonly attribute boolean Fog;
readonly attribute boolean Hazard;
readonly attribute boolean Parking;
readonly attribute boolean HighBeam;
};
Brake
of type boolean, readonly Fog
of type boolean, readonly Hazard
of type boolean, readonly Head
of type boolean, readonly HighBeam
of type boolean, readonly LeftTurn
of type boolean, readonly Parking
of type boolean, readonly RightTurn
of type boolean, readonly InteriorLightStatus
InterfaceThe InteriorLightStatus
interface represents interior light status.
[NoInterfaceObject]
interface InteriorLightStatus : VehiclePropertyType
{
readonly attribute boolean Passenger;
readonly attribute boolean Driver;
readonly attribute boolean Center;
};
Center
of type boolean, readonly Driver
of type boolean, readonly Passenger
of type boolean, readonly Horn
InterfaceThe Horn
interface represents horn status.
[NoInterfaceObject]
interface Horn : VehiclePropertyType
{
readonly attribute boolean On;
};
On
of type boolean, readonly Fuel
InterfaceThe Fuel
interface represents vehicle fuel status.
[NoInterfaceObject]
interface Fuel : VehiclePropertyType
{
readonly attribute unsigned short Level;
readonly attribute unsigned short Range;
readonly attribute unsigned short InstantConsumption;
readonly attribute unsigned short InstantEconomy;
attribute unsigned short AverageEconomy;
};
AverageEconomy
of type unsigned short, InstantConsumption
of type unsigned short, readonly InstantEconomy
of type unsigned short, readonly Level
of type unsigned short, readonly Range
of type unsigned short, readonly The EngineOil interface represents engine oil status.
[NoInterfaceObject]
interface Horn : VehiclePropertyType
{
readonly attribute unsigned short Remaining;
readonly attribute long Temperature;
readonly attribute unsigned short Pressure;
};
Pressure
of type unsigned short, readonly Remaining
of type unsigned short, readonly Temperature
of type long, readonly ExteriorBrightness
InterfaceThe ExteriorBrightness
interface represents brightness outside the vehicle.
[NoInterfaceObject]
interface ExteriorBrightness : VehiclePropertyType
{
readonly attribute unsigned long ExteriorBrightness;
};
ExteriorBrightness
of type unsigned long, readonly Temperature
InterfaceThe Temperature
interface represents temperature inside and outside the vehicle.
[NoInterfaceObject]
interface Temperature : VehiclePropertyType
{
readonly attribute signed short Interior;
readonly attribute signed short Exterior;
};
Exterior
of type signed short, readonly Interior
of type signed short, readonly RainSensor
InterfaceThe RainSensor
interface represents intensity of rain.
[NoInterfaceObject]
interface RainSensor : VehiclePropertyType
{
readonly attribute unsigned short RainSensor;
};
RainSensor
of type unsigned short, readonly WindshieldWiper
InterfaceThe WindshieldWiper
interface represents the status of the windshield wiper.
[NoInterfaceObject]
interface WindshieldWiper : VehiclePropertyType
{
const unsigned short WIPERSPEED_OFF = 0;
const unsigned short WIPERSPEED_SLOWEST = 1;
const unsigned short WIPERSPEED_FASTEST = 5;
const unsigned short WIPERSPEED_AUTO = 10;
readonly attribute unsigned short WindshieldWiper;
};
WindshieldWiper
of type unsigned short, readonly WIPERSPEED_AUTO
of type unsigned shortWIPERSPEED_FASTEST
of type unsigned shortWIPERSPEED_OFF
of type unsigned shortWIPERSPEED_SLOWEST
of type unsigned shortDefrostDictionary
Dictionarydictionary DefrostDictionary {
unsigned short window;
boolean defrost;
};
DefrostDictionary
Membersdefrost
of type booleanwindow
of type unsigned shortHVAC
InterfaceThe HVAC
interface to get status and control the vehicle HVAC system.
[NoInterfaceObject]
interface HVAC : VehiclePropertyType
{
const unsigned short AIRFLOWDIRECTION_FRONTPANEL = 0;
const unsigned short AIRFLOWDIRECTION_FLOORDUCT = 1;
const unsigned short AIRFLOWDIRECTION_FRONT = 0x02;
const unsigned short AIRFLOWDIRECTION_DEFROSTER = 0x04;
attribute unsigned short AirflowDirection;
attribute unsigned short FanSpeed;
attribute unsigned short TargetTemperature;
attribute boolean AirConditioning;
attribute boolean AirRecirculation;
attribute boolean Heater;
attribute DefrostDictionary
Defrost;
attribute boolean SteeringWheelHeater;
attribute boolean SeatHeater;
};
AirConditioning
of type boolean, AirRecirculation
of type boolean, AirflowDirection
of type unsigned short, navigator.vehicle.get("HVAC", onsuccess, onerror); function onsuccess(value) { var hvacsettings = value; value.AirflowDirection = value.AIRFLOWDIRECTION_FRONT | value.AIRFLOWDIRECTION_DEFROSTER; navigator.vehicle.set("HVAC", value, onsetsuccess, onerror); } function onerror(e) { window.console.error(e.message); } function onsetsuccess() { window.console.log("success!"); }
Defrost
of type DefrostDictionary
, FanSpeed
of type unsigned short, Heater
of type boolean, SeatHeater
of type boolean, SteeringWheelHeater
of type boolean, TargetTemperature
of type unsigned short, AIRFLOWDIRECTION_DEFROSTER
of type unsigned shortAIRFLOWDIRECTION_FLOORDUCT
of type unsigned shortAIRFLOWDIRECTION_FRONT
of type unsigned shortAIRFLOWDIRECTION_FRONTPANEL
of type unsigned short