© 2011-2012 webinos consortium.
The webinos vehicle API provides access to specific vehicle data.
The design is influenced from W3C's DOM Level 3 Events model and defines event types for retrieving information about the vehicle including trip computer data, gears or park sensors.Further more it exposes information about lights, doors, windows and seating setting. The geolocation, speed and acceleration can be retrieved using the geolocation and device orientation API. The gps navigation related functions (see draft version) have been moved the Navigation API.
| Interface | Method |
|---|---|
| VehicleData | |
| VehicleInterface | void get(VehicleDataType vehicleDataId, VehicleDataHandler handler, VehicleErrorCallback errorCB) |
| Webinos | |
| ClimateControlData | void initClimateControlData(boolean bubbles, boolean cancelable, DOMString zone, short desiredTemperature, boolean acStatus, short ventLevel, short ventMode) |
| LightData | void initLightData(VehicleLight lightId, boolean active) |
| ParkSensorsData | void initParkSensorsData(ParkSensorPosition position, short outLeft, short left, short midLeft, short midRight, short right, short outRight) |
| TripComputerData | void initTripComputerData(float averageConsumption, float tripConsumption, float averageSpeed, float tripSpeed, float tripDistance, float mileage, float range) |
| GearData | void initGearData(Gear gear) |
| WiperData | void initWiperData(WiperStatus position) |
| EngineOilData | void initEngineOilData(EngineOilLevel level) |
| SeatData | void initSeatData(SeatPosition position, SeatSetting[] settings) |
| TirePressureData | void initTirePressureData(Short frontLeft, Short frontRight, Short rearRight, Short rearLeft) |
| DoorData | void initDoorData(boolean driver, boolean frontPassenger, boolean behindDriver, boolean behindPassenger, boolean trunkDeck) |
| WindowData | void initWindowData(boolean driver, boolean frontPassenger, short behindDriver, short behindPassenger) |
The API exposes vehicle data, which is available on the infotainment vehicle bus (e.g. MOST). The infotainment bus is usually the access point for the headunit to receveive vehicle data (diagram on vehicle bus architecture). Some data from other busses (high/low speed CAN) are routed into the bus over the central gateway such as speed or gear.
Generic Vehicle Data The interface defines a generic data event for vehicle specific data. It is derived from Event.
[NoInterfaceObject]
interface VehicleData : Event{
};
The interface defines general information about the vehicle and is the object, where the event listener for vehicle related data can be registered. The interface is accessible through the webinos.vehicle object.
[NoInterfaceObject]
interface VehicleInterface : EventTarget {
readonly attribute DOMString brand;
readonly attribute DOMString model;
readonly attribute DOMString year;
readonly attribute Fuel fuel;
readonly attribute Hybrid hybrid;
readonly attribute SteeringWheelPosition steeringwheel;
readonly attribute VehicleTransmission transmission;
void get(VehicleDataType vehicleDataId, VehicleDataHandler handler, VehicleErrorCallback errorCB);
};
readonly
DOMString brandAttribute denotes brand name of the vehicle.
readonly
DOMString modelAttribute reflects model name of the vehicle.
readonly
DOMString yearAttribute denotes production year of the vehicle.
readonly
Fuel fuelAttribute reflects fuel type of the vehicle.
readonly
Hybrid hybridAttribute reflects hybrid type of the vehicle
readonly
SteeringWheelPosition steeringwheelAttribute reflects steering wheel position
readonly
VehicleTransmission transmissionAttribute denotes transmission type of the vehicle.
getMethod allows to request vehicle data in a non-recurring way and is independant from value changes (cf. events). The same identifiers are used for vehicle data as well as for the different vehicle events (ClimateControlEvent, ControlEvent, NavigationEvent, ParkSensorsEvent, ShiftEvent).
void get(VehicleDataType vehicleDataId, VehicleDataHandler handler, VehicleErrorCallback errorCB);
webinos.vehicle.get("climate-all", dataHandler);
function dataHandler(data){
if(data.acStatus){
console.log("Airconditioning is on");
if(data.desiredTemperature < 19){
console.log("This is not so good for your health");
}
}
}
The Vehicle interface describes the part of the Vehicle API accessible through the webinos object.
partial interface Webinos {
readonly attribute VehicleInterface vehicle;
};
The interface defines a climate control event. The event provides information about changes to the climate control system inside the vehicle.
[NoInterfaceObject]
interface ClimateControlData : VehicleData{
readonly attribute VehicleClimateZone zone;
readonly attribute unsigned short desiredTemperature;
readonly attribute boolean acStatus;
readonly attribute unsigned short ventLevel;
readonly attribute boolean ventMode;
void initClimateControlData(boolean bubbles, boolean cancelable, DOMString zone, short desiredTemperature, boolean acStatus, short ventLevel, short ventMode);
};
webinos.vehicle.addEventListener("climate", climateHandler, null);
function climateHandler(data){
console.log(data.zone + " desired temperature is " + data.desiredTemperature + "° C");
}
readonly
VehicleClimateZone zoneAttribute defines the zone of the climate control event.
readonly
unsigned short desiredTemperatureAttribute defines the desired temperature in degree celsius.
readonly
boolean acStatusAttribute defines, if the AC switched on or not.
readonly
unsigned short ventLevelAttribute defines the level of the vents. This value can be 1-9.
readonly
boolean ventModeAttribute defines if the vent is used in automatic mode or not.
initClimateControlDataMethod is used to set initial values of a climate control event.
void initClimateControlData(boolean bubbles, boolean cancelable, DOMString zone, short desiredTemperature, boolean acStatus, short ventLevel, short ventMode);
The interface defines a light data. The event signals a change for a light unit inside the vehicle. The identifiers for the different light events are defined in the enum VehicleLight.
interface LightData : VehicleData{ readonly attribute VehicleLight lightId; readonly attribute boolean active; void initLightData(VehicleLight lightId, boolean active); };
webinos.vehicle.addEventListener("light-hibeam", lightHandler, false);
function lightHandler(cEvent){
if(cEvent.controlId == "hibeam"){
if(cEvent.active == true){
console.log("Hibeam turned on");
}else{
console.log("Hibeam turned off");
}
}
}
readonly
VehicleLight lightIdAttribute describes the source of the event.
readonly
boolean activeAttribute describes the status of the light unit.
initLightDataMethod sets initial values of a control event.
void initLightData(VehicleLight lightId, boolean active);
This interface defines an data related to the built-in park sensors. A listener can be registered by vehicle.addEventLister("parksensor-front",listener,false).
interface ParkSensorsData : VehicleData{ readonly attribute ParkSensorPosition position; readonly attribute unsigned short left; readonly attribute unsigned short midLeft; readonly attribute unsigned short midRigth; readonly attribute unsigned short rigth; void initParkSensorsData(ParkSensorPosition position, short outLeft ,short left, short midLeft, short midRight, short right, short outRight); };
webinos.vehicle.addEventListener("parksensor-front", psHandler, false);
webinos.vehicle.addEventListener("parksensor-rear", psHandler, false);
function psHandler(psEvent){
if(psEvent.left == 20){
console.log("obstacle on the left in" + psEvent.position + " is close");
}
}
readonly
ParkSensorPosition positionAttribute defines the position of the sensor.
readonly
unsigned short leftAttribute reflects the destination to an object sensed by the sensor on the left side in centimeters. Minimum distance is 20 centimeters. Maximum distance is 250 centimeters. A value of -1 indiactes that no object has been sensed.
readonly
unsigned short midLeftAttribute reflects the destination to an object sensed by the sensor on the middle left side in centimeters. Minimum distance is 20 centimeters. Maximum distance is 250 centimeters. A value of -1 indiactes that no object has been sensed.
readonly
unsigned short midRigthAttribute reflects the destination to an object sensed by the sensor on the middle right side in centimeters. Minimum distance is 20 centimeters. Maximum distance is 250 centimeters. A value of -1 indiactes that no object has been sensed.
readonly
unsigned short rigthAttribute reflects the destination to an object sensed by the sensor on the rigth side in centimeters. Minimum distance is 20 centimeters. Maximum distance is 250 centimeters. A value of -1 indiactes that no object has been sensed.
initParkSensorsDataMethod sets initial values of a park sensors event.
void initParkSensorsData(ParkSensorPosition position, short outLeft, short left, short midLeft, short midRight, short right, short outRight);
The interface defines a trip computer data. A listener can be registered by vehicle.addEventLister("tripcomputer",listener,false).
interface TripComputerData : VehicleData{ readonly attribute float averageConsumption; readonly attribute float tripConsumption; readonly attribute float averageSpeed; readonly attribute float tripSpeed; readonly attribute float tripDistance; readonly attribute float mileage; readonly attribute float range; void initTripComputerData(float averageConsumption, float tripConsumption, float averageSpeed, float tripSpeed, float tripDistance, float mileage, float range); };
var latestConsumption = 0;
webinos.vehicle.addEventListener("tripcomputer", tripDataHandler, false);
function tripDataHandler(data){
//Calculating, if the fuel efficiency increased, since the last update
var gap = latestConsumption - data.averageConsumption;
if(gap < 0){
console.log("Thumbs down. You decreased your fuel efficiency");
} else if (gap > 0){
console.log("Thumbs up. You increased your fuel efficiency");
} else {
console.log("nothing changed");
}
latestConsumption = data.averageConsumption;
if (data.range < 20){
console.log("You really need " + webinos.vehicle.fuel + "soon.");
}
}
readonly
float averageConsumptionAttrubute reflects the overall average consumption of the vehicle in l/100kilometers (resets on driver's demand).
readonly
float tripConsumptionAttrubute reflects the average consumption of the vehicle in l/100kilometers on the ongoing journey (resets automatically).
readonly
float averageSpeedAttrubute reflects the overall average speed of the vehicle in kilometers per hour (resets on driver's demand).
readonly
float tripSpeedAttrubute reflects average speed of the vehicle in kilometers per hour on the current trip (resets automatically).
readonly
float tripDistanceAttrubute reflects trip distance in kilometers.
readonly
float mileageAttrubute reflects mileage in kilometers.
readonly
float rangeAttrubute reflects the range of the vehicle in kilometers.
initTripComputerDataMethod sets the initial values of a trip computer event.
void initTripComputerData(float averageConsumption, float tripConsumption, float averageSpeed, float tripSpeed, float tripDistance, float mileage, float range);
This interface defines a gear data. A listener can be registered by vehicle.addEventLister("gear",listener,false).
interface GearData : VehicleData{ attribute Gear gear; void initGearData(Gear gear); };
// registering an Event for a Shift
webinos.vehicle.addEventListener("gear", shiftHandler);
function shiftHandler(e){
document.getElementById("info").innerHTML = e.gear;
webinos.vehicle.removeEventListener("shift", shiftHandler);
}
Gear gearAttribute reflects the current gear.
initGearDataMethod sets the value of the current gear.
void initGearData(Gear gear);
This interface defines wiper data. A listener can be registered by vehicle.addEventLister("gear",listener,false).
interface WiperData : VehicleData{ attribute WiperStatus position; void initWiperData(WiperStatus position); };
// requesting the status of the wiper stick.
vehicle.get("wipers", wiperHandler);
function wiperHandler(e){
document.getElementById("info").innerHTML = e.position;
}
WiperStatus positionAttribute defines the position of the wiper stick.
initWiperDataMethod sets the initial values of a wiper data.
void initWiperData(WiperStatus position);
This interface defines a engine oil data.
interface EngineOilData : VehicleData{ attribute EngineOilLevel level; void initEngineOilData(EngineOilLevel level); };
EngineOilLevel levelAttribute defines the level of the oil in the engine.
initEngineOilDataMethod sets the initial values of a engine oil data.
void initEngineOilData(EngineOilLevel level);
The interface defines the current setting of a given part of a seat.
dictionary SeatSetting{
SeatOption option;
Long value;
};
SeatOption optionrelevant seat part
Long valuevalue of the specified seat part
The interface defines a seating data.
interface SeatData : VehicleData{ readonly attribute SeatPosition position; readonly attribute SeatSetting[] settings; void initSeatData(SeatPosition position, SeatSetting[] settings); };
initSeatDataMethod sets the initial values of a vehicle status event.
void initSeatData(SeatPosition position, SeatSetting[] settings);
The interface defines a tire pressure data.
interface TirePressureData : VehicleData{ readonly attribute unsigned short frontLeft; readonly attribute unsigned short frontRight; readonly attribute unsigned short rearLeft; readonly attribute unsigned short rearRight; void initTirePressureData(Short frontLeft, Short frontRight,Short rearRight,Short rearLeft); };
readonly
unsigned short frontLeftAttribute reflects the pressure of the front left tire in bar.
readonly
unsigned short frontRightAttribute reflects the pressure of the front right tire in bar.
readonly
unsigned short rearLeftAttribute reflects the pressure of the rear left tire in bar.
readonly
unsigned short rearRightAttribute reflects the pressure of the rear left tire in bar.
initTirePressureDataMethod sets the initial values of tire pressure data.
void initTirePressureData(Short frontLeft, Short frontRight, Short rearRight, Short rearLeft);
The interface defines door data.
interface DoorData : VehicleData{ readonly attribute boolean driver; readonly attribute boolean? frontPassenger; readonly attribute boolean? behindDriver; readonly attribute boolean? behindPassenger; readonly attribute boolean? trunkDeck; void initDoorData(boolean driver, boolean frontPassenger,boolean behindDriver,boolean behindPassenger,boolean trunkDeck); };
// checking if driver door is openend.
vehicle.addEventListener("doors", doorHandler);
function doorHandler(doors){
if(doors.driver){
document.getElementById("info").innerHTML = 'Please close driver door';
}
}
readonly
boolean driverAttribute reflects if driver door is opened (true) or closed (false)
readonly
boolean? frontPassengerAttribute reflects if front passenger door is opened (true) or closed (false)
readonly
boolean? behindDriverAttribute reflects if the door behind the driver is opened (true) or closed (false)
readonly
boolean? behindPassengerAttribute reflects if the door behind the front passenger is opened (true) or closed (false).
readonly
boolean? trunkDeckAttribute reflects if the trunk deck is opened (true) or closed (false).
initDoorDataMethod sets the initial values of a vehicle status event.
void initDoorData(boolean driver, boolean frontPassenger, boolean behindDriver, boolean behindPassenger, boolean trunkDeck);
The interface defines window data. WindowData exposes the information of the current position of the different windows of a vehicle.
interface WindowData : VehicleData{ readonly attribute unsigned short driver; readonly attribute unsigned short? frontPassenger; readonly attribute unsigned short? behindDriver; readonly attribute unsigned short? behindPassenger; void initWindowData(boolean driver, boolean frontPassenger,short behindDriver,short behindPassenger); };
// checking if driver window is openend.
vehicle.addEventListener("windows", windowHandler);
function windowsHandler(windows){
if(windows.driver == 0){
document.getElementById("info").innerHTML = 'Window is closed';
} else{
document.getElementById("info").innerHTML = 'Driver window is opened to ' + window.driver + '%' ;
}
}
readonly
unsigned short driverAttribute reflects the position of the driver window (100 = open; 0 = closed)
readonly
unsigned short? frontPassengerAttribute reflects the position of the front passenger window (100 = open; 0 = closed)
readonly
unsigned short? behindDriverAttribute reflects the position of the window behind the driver (100 = open; 0 = closed)
readonly
unsigned short? behindPassengerAttribute reflects the position of the window behind front passenger (100 = open; 0 = closed)
initWindowDataMethod sets the initial values of a vehicle status event.
void initWindowData(boolean driver, boolean frontPassenger, short behindDriver, short behindPassenger);
VehicleErrorCallbackcallback for a failure from get Method
callback VehicleErrorCallback = void (DOMError error);
void VehicleErrorCallback(DOMError error);
VehicleDataHandlercallback method to receive vehicle data in a non-recurring and asynchronous way.
callback VehicleDataHandler = void (VehicleData data);
void VehicleDataHandler(VehicleData data);
FuelPossible values for vehicle fuel
enum Fuel { "unleaded", "premium", "diesel", "electric", "cng" };
unleadedpremiumdieselelectriccngHybridPossible hybrid types
enum Hybrid { "none", "mild", "full"};
nonemildfullSteeringWheelPositionPossible positions of the steering wheel
enum SteeringWheelPosition {"right", "left"};
rightleftVehicleTransmissionPossible values for transmission type
enum VehicleTransmission { "transmission-automatic", "transmission-manual" };
transmission-automatictransmission-manualVehicleClimateZoneClimate zone names
enum VehicleClimateZone { "all", "driver", "passenger", "behind-driver", "behind-passenger"};
alldriverpassengerbehind-driverbehind-passengerVehicleLightType of vehicle light
enum VehicleLight { "fog-front", "fog-rear", "signal-left", "signal-right", "signal-warn", "parking", "hibeam", "head" };
fog-frontfog-rearsignal-leftsignal-rightsignal-warnparkinghibeamheadParkSensorPositionPosition of park sensors
enum ParkSensorPosition { "front", "rear"};
frontrearGearVehicle gears
enum Gear {"R","P","N", "1", "2", "3", "4", "5", "6", "7", "8", "10"};
supported gear values
RPN1234567810WiperStatusStatus of the wipers switch defines the different positions of the wiper switch
enum WiperStatus { "front-wash", "rear-wash", "automatic", "front-once", "rear-once", "front-level1", "front-level2", "notactive" };
front-washrear-washautomaticfront-oncerear-oncefront-level1front-level2notactiveEngineOilStatusLevels of engine oil defines the different levels of engine oil.
enum EngineOilStatus { "OVER_MAX","MAX", "OK", "MIN", "UNDER_MIN", "MEASURING"};
OVER_MAXMAXOKMINUNDER_MINMEASURINGSeatPositionseat position. defines the different positions of a seat
enum SeatPosition { "driver","frontpassaneger", "behindDriver", "behindPassenger"};
driverfrontpassanegerbehindDriverbehindPassengerSeatOptionseat option. defines the different parts of a seat, which can be customized
enum SeatOption { "recline-seatback","slide", "cushion-heigh", "headrest", "back-cushion", "side-cushion"};
recline-seatbackslidecushion-heighheadrestback-cushionside-cushionVehicleDataTypeVehicle event types defines the possible vehicle data, which can be retrieved using the addEventListener or the get method.
enum VehicleDataType {"gear","tripcomputer","parksensors-front", "parksensors-rear", "engineoil","wipers","tirepressure","doors", "windows", "climate-all", "climate-driver", "climate-behind-driver", "climate-passenger", "climate-behind-passenger", "light-fog-front", "light-fog-rear", "light-signal-left", "ligth-signal-right", "light-signal-warn", "light-parking", "light-hibeam", "light-head", "seat-driver", "seat-passenger", "seat-behind-driver", "seat-behind-passenger"};
geartripcomputerparksensors-frontparksensors-rearengineoilwiperstirepressuredoorswindowsclimate-allclimate-driverclimate-behind-driverclimate-passengerclimate-behind-passengerlight-fog-frontlight-fog-rearlight-signal-leftligth-signal-rightlight-signal-warnlight-parkinglight-hibeamlight-headseat-driverseat-passengerseat-behind-driverseat-behind-passengerThis is the list of URIs used to declare this API's features, for use in the widget config.xml and as identifier for service type in service discovery functionality. For each URI, the list of functions covered is provided.
Identifies the static information about the vehicle
Identifies vehicle data related to climate controls.
Identifies park sensor modules of a vehicle.
Identifies the trip computer information of a vehicle.
Identifies light data of a vehicle
Identifies gear data
Identifies information about engine oil level
Identifies information about engine oil level
Identifies information about the tires
Identifies information about the tire pressure
Identifies information about the doors
[NoInterfaceObject]
interface VehicleData : Event{
};
callback VehicleErrorCallback = void (DOMError error);
callback VehicleDataHandler = void (VehicleData data);
enum Fuel { "unleaded", "premium", "diesel", "electric", "cng" };
enum Hybrid { "none", "mild", "full"};
enum SteeringWheelPosition {"right", "left"};
enum VehicleTransmission { "transmission-automatic", "transmission-manual" };
[NoInterfaceObject]
interface VehicleInterface : EventTarget {
readonly attribute DOMString brand;
readonly attribute DOMString model;
readonly attribute DOMString year;
readonly attribute Fuel fuel;
readonly attribute Hybrid hybrid;
readonly attribute SteeringWheelPosition steeringwheel;
readonly attribute VehicleTransmission transmission;
void get(VehicleDataType vehicleDataId, VehicleDataHandler handler, VehicleErrorCallback errorCB);
};
partial interface Webinos {
readonly attribute VehicleInterface vehicle;
};
enum VehicleClimateZone { "all", "driver", "passenger", "behind-driver", "behind-passenger"};
[NoInterfaceObject]
interface ClimateControlData : VehicleData{
readonly attribute VehicleClimateZone zone;
readonly attribute unsigned short desiredTemperature;
readonly attribute boolean acStatus;
readonly attribute unsigned short ventLevel;
readonly attribute boolean ventMode;
void initClimateControlData(boolean bubbles, boolean cancelable, DOMString zone, short desiredTemperature, boolean acStatus, short ventLevel, short ventMode);
};
enum VehicleLight { "fog-front", "fog-rear", "signal-left", "signal-right", "signal-warn", "parking", "hibeam", "head" };
interface LightData : VehicleData{
readonly attribute VehicleLight lightId;
readonly attribute boolean active;
void initLightData(VehicleLight lightId, boolean active);
};
enum ParkSensorPosition { "front", "rear"};
interface ParkSensorsData : VehicleData{
readonly attribute ParkSensorPosition position;
readonly attribute unsigned short left;
readonly attribute unsigned short midLeft;
readonly attribute unsigned short midRigth;
readonly attribute unsigned short rigth;
void initParkSensorsData(ParkSensorPosition position, short outLeft ,short left, short midLeft, short midRight, short right, short outRight);
};
interface TripComputerData : VehicleData{
readonly attribute float averageConsumption;
readonly attribute float tripConsumption;
readonly attribute float averageSpeed;
readonly attribute float tripSpeed;
readonly attribute float tripDistance;
readonly attribute float mileage;
readonly attribute float range;
void initTripComputerData(float averageConsumption, float tripConsumption, float averageSpeed, float tripSpeed, float tripDistance, float mileage, float range);
};
interface GearData : VehicleData{
attribute Gear gear;
void initGearData(Gear gear);
};
enum Gear {"R","P","N", "1", "2", "3", "4", "5", "6", "7", "8", "10"};
enum WiperStatus { "front-wash", "rear-wash", "automatic", "front-once", "rear-once", "front-level1", "front-level2", "notactive" };
interface WiperData : VehicleData{
attribute WiperStatus position;
void initWiperData(WiperStatus position);
};
interface EngineOilData : VehicleData{
attribute EngineOilLevel level;
void initEngineOilData(EngineOilLevel level);
};
enum EngineOilStatus { "OVER_MAX","MAX", "OK", "MIN", "UNDER_MIN", "MEASURING"};
dictionary SeatSetting{
SeatOption option;
Long value;
};
interface SeatData : VehicleData{
readonly attribute SeatPosition position;
readonly attribute SeatSetting[] settings;
void initSeatData(SeatPosition position, SeatSetting[] settings);
};
enum SeatPosition { "driver","frontpassaneger", "behindDriver", "behindPassenger"};
enum SeatOption { "recline-seatback","slide", "cushion-heigh", "headrest", "back-cushion", "side-cushion"};
interface TirePressureData : VehicleData{
readonly attribute unsigned short frontLeft;
readonly attribute unsigned short frontRight;
readonly attribute unsigned short rearLeft;
readonly attribute unsigned short rearRight;
void initTirePressureData(Short frontLeft, Short frontRight,Short rearRight,Short rearLeft);
};
interface DoorData : VehicleData{
readonly attribute boolean driver;
readonly attribute boolean? frontPassenger;
readonly attribute boolean? behindDriver;
readonly attribute boolean? behindPassenger;
readonly attribute boolean? trunkDeck;
void initDoorData(boolean driver, boolean frontPassenger,boolean behindDriver,boolean behindPassenger,boolean trunkDeck);
};
interface WindowData : VehicleData{
readonly attribute unsigned short driver;
readonly attribute unsigned short? frontPassenger;
readonly attribute unsigned short? behindDriver;
readonly attribute unsigned short? behindPassenger;
void initWindowData(boolean driver, boolean frontPassenger,short behindDriver,short behindPassenger);
};
enum VehicleDataType {"gear","tripcomputer","parksensors-front", "parksensors-rear", "engineoil","wipers","tirepressure","doors", "windows", "climate-all", "climate-driver", "climate-behind-driver", "climate-passenger", "climate-behind-passenger", "light-fog-front", "light-fog-rear", "light-signal-left", "ligth-signal-right", "light-signal-warn", "light-parking", "light-hibeam", "light-head", "seat-driver", "seat-passenger", "seat-behind-driver", "seat-behind-passenger"};