© 2011 webinos consortium, www.webinos.org.
webinos Vehicle interface.
| Interface | Method |
|---|---|
| VehicleError | |
| Address | |
| VehicleEvent | |
| LatLng | |
| POI | |
| SuccessCallback | void onSuccess() |
| ErrorCallback | void onError(VehicleError error) |
| VehicleDataHandler | void handleVehicleData(VehicleEvent data) |
| VehicleInterface | void get(DOMString vehicleDataId, VehicleDataHandler handler, ErrorCallback errorCB) void requestGuidance(SuccessCallback successCallback, ErrorCallback errorCallback, POI [] destinations) void findDestination(DestinationCallback destinationCallback, ErrorCallback errorCallback, DOMString search) |
| Vehicle | |
| DestinationCallback | void handleResults(POI [] pois) |
| ClimateControlEvent | void initClimateControlEvent(boolean bubbles, boolean cancelable, DOMString zone, short desiredTemperature, boolean acStatus, short ventLevel, short ventMode) |
| ControlEvent | void initControlEvent(boolean bubbles, boolean cancelable, DOMString controlId, boolean active) |
| NavigationEvent | void initNavigationEvent(boolean bubbles, boolean cancelable, DOMString navigationEventId, Address destination) |
| ParkSensorsEvent | void initParkSensorsEvent(boolean bubbles, boolean cancelable, DOMString position, short left, short midLeft, short midRight, short right) |
| ShiftEvent | void initShiftEvent(boolean bubbles, boolean cancelable, short gear) |
| TripComputerEvent | void initTripComputerEvent(boolean bubbles, boolean cancelable, float averageConsumption1, float averageConsumption2, float averageSpeed1, float averageSpeed2, float tripDistance, float mileage, float range) |
The webinos vehicle API provides access to specific vehicle data. It is derived 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. Furthermore it offers methods for interacting with the on-board navigation system. The geolocation, speed and acceleration can be retrieved using the geolocation and device orientation API.
The API gives access to vehicle data, which is available on the infotainment vehicle bus (e.g. MOST). The infotainment bus is the only 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 (RPM is currently not provided on the MOST).
The interface defines the vehicle specific error
interface VehicleError : Error{ const short ACCESS_DENIED = 1; const short NOT_AVAILABLE = 2; const short UNKNOWN = 0; };
short ACCESS_DENIED
Constant describes that the access to the requested vehicle feature has been denied.
short NOT_AVAILABLE
Constant describes that the requested vehicle feature is not available.
short UNKNOWN
Constant describes that an unkown error occured while requestung a vehicle feature.
This interface defines the address properties, which can be passed to the navigation system using the requestGuidance() function. The Address interface defined in the v2 of the W3C Geolocation API is used for this purpose.
[NoInterfaceObject]
interface Address{
attribute DOMString country;
attribute DOMString? region;
attribute DOMString? county;
attribute DOMString city;
attribute DOMString street;
attribute DOMString streetNumber;
attribute DOMString? premises;
attribute DOMString additionalInformation;
attribute DOMString postalCode;
};
DOMString country
Attribute is specified by using the two-letter [ISO 3166-1] code.
DOMString? region
Attribute denotes the name of a country subdivision (e.g. the state name in the US).
DOMString? county
Attribute denotes the name of a land area within a larger region.
DOMString city
Attribute reflects the name of the city.
DOMString street
Attribute reflects the name of the street.
DOMString streetNumber
Attribute describes the location's street number.
DOMString? premises
Attribute denotes the details of the premises, such as a building name, block of flats, etc.
DOMString additionalInformation
Attribute contains other address details that are not captured by the rest of the attributes in this interface. Examples include a floor number in a building, an apartment number, the name of an office occupant, etc..
DOMString postalCode
Attribute reflects the postal code of the location (e.g. the zip code in the US).
The interface defines a generic event for vehicle data specific events.
[NoInterfaceObject]
interface VehicleEvent : Event{
};
This interface defines the LatLng properties, which can be passed to the navigation system using the requestGuidance() function. The format is WGS84. Note: The coordinate interface from the Geolocation API v2 includes attributes, which are not feasible for beeing handled by the navigation system (accurancy, alitude accurency, heading, speed). In some special cases (destination is on a bridge, which crosses another street) it might make sense to add the altitude to LatLng interface at a later stage.
[NoInterfaceObject]
interface LatLng{
attribute double latitude;
attribute double longitude;
};
double latitude
Attribute reflect the latitude of a geolocation in WGS84.
double longitude
Attribute reflect the Longitude of a geolocation in WGS84.
This interface defines a Point of Interest (POI). The interface contains the name of a POI and its address and/or geolocation as a LatLng object. Note: The W3C POI WG has published a first working draft for the POI handling. The draft focuses on a XML representation of a POI and does not seem handy for beeing handled by a navigation system.
[NoInterfaceObject]
interface POI{
attribute DOMString? name;
attribute LatLng? position;
attribute Address address;
};
DOMString? name
Attribute denotes the name of the POI.
LatLng? position
Attribute reflects the geolocation of the POI as LatLng object.
Address address
Attribute denotes the address of the POI.
The interface defines the callback for a asynchronous function call insided the vehicle module.
[Callback=FunctionOnly, NoInterfaceObject]
interface SuccessCallback{
void onSuccess();
};
onSuccess
Method is triggered, if function has been succesfully called.
void onSuccess();
The interface defines the callback for a failed asynchronous function call inside the vehilce module.
[Callback=FunctionOnly, NoInterfaceObject]
interface ErrorCallback{
void onError(in VehicleError error);
};
onError
Method is triggered, if asychronous function call fails.
void onError(in VehicleError error);
The interface defines the callback method to receive vehicle data in a non-recurring and asynchronous way.
interface VehicleDataHandler{
void handleVehicleData(in VehicleEvent data);
};
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 {
const DOMString FUEL_UNLEADED = "unleaded";
const DOMString FUEL_PREMIUM = "premium";
const DOMString FUEL_DIESEL = "diesel";
const DOMString TRANSMISSION_AUTOMATIC = "automatic";
const DOMString TRANSMISSION_MANUAL = "manual";
readonly attribute DOMString brand;
readonly attribute DOMString model;
readonly attribute DOMString year;
readonly attribute DOMString fuel;
readonly attribute DOMString transmission;
void get(DOMString vehicleDataId, VehicleDataHandler handler, in ErrorCallback errorCB);
void requestGuidance(in SuccessCallback successCallback, in ErrorCallback errorCallback, POI[] destinations);
void findDestination(DestinationCallback destinationCallback, in ErrorCallback errorCallback, DOMString search);
};
DOMString FUEL_UNLEADED
Constant defines the fuel type unleaded.
DOMString FUEL_PREMIUM
Constant defines the fuel type premium.
DOMString FUEL_DIESEL
Constant defines the fuel type diesel.
DOMString TRANSMISSION_AUTOMATIC
Constant defines the transmission type automatic.
DOMString TRANSMISSION_MANUAL
Constant defines the transmission type manual.
readonly DOMString brand
Attribute denotes brand name of the vehicle.
readonly DOMString model
Attribute reflects model name of the vehicle.
readonly DOMString year
Attribute denotes production year of the vehicle.
readonly DOMString fuel
Attribute reflects fuel type of the vehicle.
readonly DOMString transmission
Attribute denotes transmission type of the vehicle.
get
Method 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(DOMString vehicleDataId, VehicleDataHandler handler, in ErrorCallback errorCB);
webinos.vehicle.get(webinos.vehicle.ClimateControlEvent.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");
}
}
}
requestGuidance
Parameter sets the given POIs as the next destinations for the build-in navigation system. The method handles intermediate stops. The last POI in the array is the final destination.
void requestGuidance(in SuccessCallback successCallback, in ErrorCallback errorCallback,
POI
[] destinations);
var destinations =new Array();
destination.push({name:"BMW AG", address : {street:"Petuelring", streetNumber: "130", postalCode: "80788", city: "MÜNCHEN", country: "DE"}});
destination.push({name:"BMW Forschung und Technik", address:{street: "Hanauer Strasse", streetNumber: "46", postalCode: "80992", city: "MÜNCHEN", country: "DE"}});
webinos.vehicle.requestGuidance(succesCB, null, destinations);
webinos.vehicle.addEventListener(webinos.vehicle.NavigationEvent.DESTINATION_REACHED, handleDestinations, false);
function handleDestinations(event){
if (event.address.street == destination[0].address.street) {
console.log("Reached the HQ");
} else if (event.address.street == destination[1].address.street) {
console.log("Reached the research center");
}
}
findDestination
Queries the navigation system to retrieve POIs for a given search string.
void findDestination(DestinationCallback destinationCallback, in ErrorCallback errorCallback, DOMString search);
var destinations =new Array();
webinos.vehicle.findDestination(destinationCB, errorCB,"BMW");
function destinationCB(pois){
if(destinations.length > 0){
webinos.requestGuidance(successCB, errorCB, destinations);
else{
console.log("No POI found");
}
}
The Vehicle interface describes the part of the Vehicle API accessible through the webinos object.
[NoInterfaceObject] interface Vehicle {
readonly attribute VehicleInterface vehicle;
};
webinoscore::Webinos implements Vehicle;
The interface defines the result callback for the asynchronous findDestination method.
[Callback=FunctionOnly, NoInterfaceObject]
interface DestinationCallback {
void handleResults(in POI[] pois);
};
handleResults
Function is called, when the results for a POI search are retrieved.
void handleResults(in
POI
[] pois);
The interface defines a climate control event. The event provides information about changes to the climate control system inside the vehicle.
[NoInterfaceObject]
interface ClimateControlEvent : VehicleEvent{
const DOMString CLIMATE_ALL = "climate-all";
const DOMString CLIMATE_DRIVER = "climate-driver";
const DOMString CLIMATE_PASSENGER_FRONT = "climate-passenger-front";
const DOMString CLIMATE_PASSENGER_REAR_LEFT = "climate-passenger-rear-left";
const DOMString CLIMATE_PASSENGER_REAR_RIGHT = "climate-passenger-rear-right";
readonly attribute DOMString zone;
readonly attribute unsigned short desiredTemperature;
readonly attribute boolean acStatus;
readonly attribute unsigned short ventLevel;
readonly attribute boolean ventMode;
void initClimateControlEvent(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");
}
DOMString CLIMATE_ALL
Constant defines the single climate zone. This constant is used as an identifier for a ClimateControlEvent and a non-recurring vehicle data request using the method webinos.vehicle.get() for the overall zone.
DOMString CLIMATE_DRIVER
Constant describes the climate zone of the driver. This constant is used as an identifier for a ClimateControlEvent and a non-recurring vehicle data request using the method webinos.vehicle.get() for the driver zone.
DOMString CLIMATE_PASSENGER_FRONT
Constant defines the climate zone of the passenger seat in the front. This constant is used as an identifier for a ClimateControlEvent and a non-recurring vehicle data request using the method webinos.vehicle.get() for the passenger zone in the front.
DOMString CLIMATE_PASSENGER_REAR_LEFT
Constant defines the climate zone of the rear set passenger seat on the left. This constant is used as an identifier for a ClimateControlEvent and a non-recurring vehicle data request using the method webinos.vehicle.get() for the passenger zone in the rear on the left side.
DOMString CLIMATE_PASSENGER_REAR_RIGHT
Constant defines the climate zone of the rear set passenger seat on the right. This constant is used as an identifier for a ClimateControlEvent and a non-recurring vehicle data request using the method webinos.vehicle.get() for the passenger zone in the rear on the right side.
readonly DOMString zone
Attribute defines the zone of the climate control event. The value of this attribute is defined in the constants CLIMATE_*.
readonly unsigned short desiredTemperature
Attribute defines the desired temperature in degree celsius.
readonly boolean acStatus
Attribute defines, if the AC switched on or not.
readonly unsigned short ventLevel
Attribute defines the level of the vents. This value can be 1-9.
readonly boolean ventMode
Attribute defines if the vent is used in automatic mode or not.
initClimateControlEvent
Method is used to set initial values of a climate control event.
void initClimateControlEvent(boolean bubbles, boolean cancelable, DOMString zone, short desiredTemperature, boolean acStatus, short ventLevel, short ventMode);
The interface defines a control event. The event signals a change for a control unit inside the vehicle (e.g. lights, wiper, etc.). The identifiers for the different control events are defined in the constants LIGHTS_* and WHIPER_*
interface ControlEvent : VehicleEvent{ const DOMString LIGHTS_FOG_FRONT = "lights-fog-front"; const DOMString LIGHTS_FOG_REAR = "lights-fog-rear"; const DOMString LIGHTS_SIGNAL_LEFT = "lights-signal-left"; const DOMString LIGHTS_SIGNAL_RIGHT = "lights-signal-right"; const DOMString LIGHTS_SIGNAL_WARN = "lights-signal-warn"; const DOMString LIGHTS_PARKING = "lights-parking"; const DOMString LIGHTS_HIBEAM = "lights-hibeam"; const DOMString LIGHTS_HEAD = "lights-head"; const DOMString WHIPER_FRONT_WASH = "whiper-front-wash"; const DOMString WHIPER_REAR_WASH = "whiper-rear-wash"; const DOMString WHIPER_AUTOMATIC = "whiper-automatic"; const DOMString WHIPER_FRONT_ONCE = "whiper-front-once"; const DOMString WHIPER_REAR_ONCE = "whiper-front-once"; const DOMString WHIPER_FRONT_LEVEL1 = "whiper-front-level1"; const DOMString WHIPER_FRONT_LEVEL2 = "whiper-front-level2"; readonly attribute DOMString conrolId; readonly attribute boolean active; void initControlEvent(boolean bubbles, boolean cancelable, DOMString controlId, boolean active); };
webinos.vehicle.addEventListener("lights-hibeam", lightHandler, false);
function lightHandler(cEvent){
if(cEvent.controlId == "lights-hibeam"){
if(cEvent.active == true){
console.log("Hibeam turned on");
}else{
console.log("Hibeam turned off");
}
}
}
DOMString LIGHTS_FOG_FRONT
Constant indicates a change for the fog light in the front. This constant is used as an identifier for a ControlEvent and a non-recurring vehicle data request using the method webinos.vehicle.get() for the status of fogs light in the front.
DOMString LIGHTS_FOG_REAR
Constant indicates a change for the fog light in the rear. This constant is used as an identifier for a ControlEvent and a non-recurring vehicle data request using the method webinos.vehicle.get() for the status of fogs light in the rear.
DOMString LIGHTS_SIGNAL_LEFT
Constant indicates a change for left turn signal. This constant is used as an identifier for a ControlEvent and a non-recurring vehicle data request using the method webinos.vehicle.get() for the status of the left signal.
DOMString LIGHTS_SIGNAL_RIGHT
Constant indicates a change for right turn signal. This constant is used as an identifier for a ControlEvent and a non-recurring vehicle data request using the method webinos.vehicle.get() for the status of the right signal.
DOMString LIGHTS_SIGNAL_WARN
Constant indicates a change for warn signal. This constant is used as an identifier for a ControlEvent and a non-recurring vehicle data request using the method webinos.vehicle.get() for the status of the warn signal.
DOMString LIGHTS_PARKING
Constant indicates a change for the parking lights. This constant is used as an identifier for a ControlEvent and a non-recurring vehicle data request using the method webinos.vehicle.get() for the status of the parking light.
DOMString LIGHTS_HIBEAM
Constant indicates a change for the hibeam. This constant is used as an identifier for a ControlEvent and a non-recurring vehicle data request using the method webinos.vehicle.get() for the status of the lights hibeam.
DOMString LIGHTS_HEAD
Constant indicates a change for the headlight. This constant is used as an identifier for a ControlEvent and a non-recurring vehicle data request using the method webinos.vehicle.get() for the status of the head light.
DOMString WHIPER_FRONT_WASH
Constant indicates front window is beeing washed. This constant is used as an identifier for a ControlEvent and a non-recurring vehicle data request using the method webinos.vehicle.get() for the status of the whiper front wash.
DOMString WHIPER_REAR_WASH
Constant indicates rear window is beeing washed. This constant is used as an identifier for a ControlEvent and a non-recurring vehicle data request using the method webinos.vehicle.get() for the status of the whiper rear wash.
DOMString WHIPER_AUTOMATIC
Constant indicates whiper is in automatic mode. This constant is used as an identifier for a ControlEvent and a non-recurring vehicle data request using the method webinos.vehicle.get() for the status of the automatic whiper mode.
DOMString WHIPER_FRONT_ONCE
Constant indicates front whiper is beeing used once. This constant is used as an identifier for a ControlEvent and a non-recurring vehicle data request using the method webinos.vehicle.get() for the status of the whiper single mode in the front.
DOMString WHIPER_REAR_ONCE
Constant indicates rear whiper is beeing used once. This constant is used as an identifier for a ControlEvent and a non-recurring vehicle data request using the method webinos.vehicle.get() for the status of the whiper single mode in the rear.
DOMString WHIPER_FRONT_LEVEL1
constant indicates front whiper is on level 1. This constant is used as an identifier for a ControlEvent and a non-recurring vehicle data request using the method webinos.vehicle.get() for the status of the whiper on level 1 in the front.
DOMString WHIPER_FRONT_LEVEL2
constant indicates front whiper is on level 2. This constant is used as an identifier for a ControlEvent and a non-recurring vehicle data request using the method webinos.vehicle.get() for the status of the whiper on level 2 in the front.
readonly DOMString conrolId
Attribute describes the source of the event. The value of the attribute is defined in the constants LIGHTS_* and WHIPER_*.
readonly boolean active
Attribute describes the status of the control unit.
initControlEvent
Method sets initial values of a control event.
void initControlEvent(boolean bubbles, boolean cancelable, DOMString controlId, boolean active);
This interface defines an event related to the built-in park sensors. The identifiers for the different events are defined in the constants PARKSENSENSORS_FRONT and PARKSENSENSORS_REAR. A listener can be registered by vehicle.addEventLister("parksensor-front",listener,false).
interface ParkSensorsEvent : VehicleEvent{ const DOMString PARKSENSENSORS_FRONT = "parksensors-front"; const DOMString PARKSENSENSORS_REAR = "parksensors-rear"; readonly attribute DOMString position; readonly attribute unsigned short left; readonly attribute unsigned short midLeft; readonly attribute unsigned short midRigth; readonly attribute unsigned short rigth; void initParkSensorsEvent(boolean bubbles, boolean cancelable, DOMString position, short left, short midLeft, short midRight, short right); };
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");
}
}
DOMString PARKSENSENSORS_FRONT
Constant defines that the event was emitted by the park sensors in the front. This constant is used as an identifier for a ParkSensorEvent and a non-recurring vehicle data request using the method webinos.vehicle.get() for the status of the park sensors in the front.
DOMString PARKSENSENSORS_REAR
Constant defines that the event was emitted by the park sensors in the rear. This constant is used as an identifier for a ParkSensorEvent and a non-recurring vehicle data request using the method webinos.vehicle.get() for the status of the park sensors in the rear.
readonly DOMString position
Attribute defines the position of the sensor. The value of the attribute is either PARKSENSENSORS_FRONT or PARKSENSENSORS_REAR.
readonly unsigned short left
Attribute 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 midLeft
Attribute 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 midRigth
Attribute 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 rigth
Attribute 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.
initParkSensorsEvent
Method sets initial values of a park sensors event.
void initParkSensorsEvent(boolean bubbles, boolean cancelable, DOMString position, short left, short midLeft, short midRight, short right);
This interface defines a shift event. A listener can be registered by vehicle.addEventLister("shift",listener,false).
interface ShiftEvent : VehicleEvent{ const DOMString SHIFT = "shift"; const short GEAR_ONE = 1; const short GEAR_TWO = 2; const short GEAR_THREE = 3; const short GEAR_FOUR = 4; const short GEAR_FIFE = 5; const short GEAR_SIX = 6; const short GEAR_SEVEN = 7; const short GEAR_EIGHT = 8; const short GEAR_REVERSE = -1; const short GEAR_NEUTRAL = 0; const short GEAR_PARKING = -2; readonly attribute short gear; void initShiftEvent(boolean bubbles, boolean cancelable, short gear); };
// registering an Event for a Shift
webinos.vehicle.addEventListener("shift", shiftHandler);
function shiftHandler(e){
document.getElementById("info").innerHTML = e.gear;
webinos.vehicle.removeEventListener("shift", shiftHandler);
}
DOMString SHIFT
Constant defines shift event. This constant is used as an identifier for a shift event and a non-recurring vehicle data request using the method webinos.vehicle.get() for the gear.
short GEAR_ONE
Constant defines the first gear.
short GEAR_TWO
Constant defines the second gear.
short GEAR_THREE
Constant defines the third gear.
short GEAR_FOUR
Constant defines the fourth gear.
short GEAR_FIFE
Constant defines the fifth gear.
short GEAR_SIX
Constant defines the sixth gear.
short GEAR_SEVEN
Constant defines the seventh gear.
short GEAR_EIGHT
Constant defines the eighth gear.
short GEAR_REVERSE
Constant defines the reverse gear.
short GEAR_NEUTRAL
Constant defines the neutral gear.
short GEAR_PARKING
Constant defines the parking gear.
readonly short gear
Attribute represents the current gear of the vehicle.
initShiftEvent
Method sets initial values a shift event.
void initShiftEvent(boolean bubbles, boolean cancelable, short gear);
The interface defines a trip computer event. A listener can be registered by vehicle.addEventLister("tripcomputer",listener,false).
interface TripComputerEvent : VehicleEvent{ const DOMString TRIPCOMPUTER = "tripcomputer"; readonly attribute float averageConsumption1; readonly attribute float averageConsumption2; readonly attribute float averageSpeed1; readonly attribute float averageSpeed2; readonly attribute float tripDistance; readonly attribute float milage; readonly attribute float range; void initTripComputerEvent(boolean bubbles, boolean cancelable, float averageConsumption1, float averageConsumption2, float averageSpeed1, float averageSpeed2, 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.averageConsumption1;
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.averageConsumption1;
if (data.range < 20){
console.log("You really need " + webinos.vehicle.fuel + "soon.");
}
}
DOMString TRIPCOMPUTER
Constant defines a trip computer event. This constant is used as an identifier for a trip computer event and a non-recurring trip data request using the method webinos.vehicle.get() for trip computer data.
readonly float averageConsumption1
Attrubute reflects the average consumption 1 of the vehicle in l/100kilometers (resets automatically after a trip).
readonly float averageConsumption2
Attrubute reflects the average consumption 2 of the vehicle in l/100kilometers (resets on driver's demand).
readonly float averageSpeed1
Attrubute reflects the average speed of the vehicle in kilometers per hour (resets automatically after a trip).
readonly float averageSpeed2
Attrubute reflects average speed of the vehicle in kilometers per hour (resets on driver's demand).
readonly float tripDistance
Attrubute reflects trip distance in kilometers.
readonly float milage
Attrubute reflects milage in kilometers.
readonly float range
Attrubute reflects the range of the vehicle in kilometers.
initTripComputerEvent
Method sets the initial values of a trip computer event.
void initTripComputerEvent(boolean bubbles, boolean cancelable, float averageConsumption1, float averageConsumption2, float averageSpeed1, float averageSpeed2, float tripDistance, float mileage, float range);
This 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 light sensor type.
Identifies vehicle data related to climate controls.
Identifies the navigation module of a vehicle.
Identifies park sensor modules of a vehicle.
Identifies the trip computer information of a vehicle.
Identifies control data (e.g. whipers and lights) of a vehicle
module vehicle{
interface VehicleError : Error{
const short ACCESS_DENIED = 1;
const short NOT_AVAILABLE = 2;
const short UNKNOWN = 0;
};
[NoInterfaceObject]
interface Address{
attribute DOMString country;
attribute DOMString? region;
attribute DOMString? county;
attribute DOMString city;
attribute DOMString street;
attribute DOMString streetNumber;
attribute DOMString? premises;
attribute DOMString additionalInformation;
attribute DOMString postalCode;
};
[NoInterfaceObject]
interface VehicleEvent : Event{
};
[NoInterfaceObject]
interface LatLng{
attribute double latitude;
attribute double longitude;
};
[NoInterfaceObject]
interface POI{
attribute DOMString? name;
attribute LatLng? position;
attribute Address address;
};
[Callback=FunctionOnly, NoInterfaceObject]
interface SuccessCallback{
void onSuccess();
};
[Callback=FunctionOnly, NoInterfaceObject]
interface ErrorCallback{
void onError(in VehicleError error);
};
interface VehicleDataHandler{
void handleVehicleData(in VehicleEvent data);
};
[NoInterfaceObject]
interface VehicleInterface : EventTarget {
const DOMString FUEL_UNLEADED = "unleaded";
const DOMString FUEL_PREMIUM = "premium";
const DOMString FUEL_DIESEL = "diesel";
const DOMString TRANSMISSION_AUTOMATIC = "automatic";
const DOMString TRANSMISSION_MANUAL = "manual";
readonly attribute DOMString brand;
readonly attribute DOMString model;
readonly attribute DOMString year;
readonly attribute DOMString fuel;
readonly attribute DOMString transmission;
void get(DOMString vehicleDataId, VehicleDataHandler handler, in ErrorCallback errorCB);
void requestGuidance(in SuccessCallback successCallback, in ErrorCallback errorCallback, POI[] destinations);
void findDestination(DestinationCallback destinationCallback, in ErrorCallback errorCallback, DOMString search);
};
[NoInterfaceObject] interface Vehicle {
readonly attribute VehicleInterface vehicle;
};
webinoscore::Webinos implements Vehicle;
[Callback=FunctionOnly, NoInterfaceObject]
interface DestinationCallback {
void handleResults(in POI[] pois);
};
[NoInterfaceObject]
interface ClimateControlEvent : VehicleEvent{
const DOMString CLIMATE_ALL = "climate-all";
const DOMString CLIMATE_DRIVER = "climate-driver";
const DOMString CLIMATE_PASSENGER_FRONT = "climate-passenger-front";
const DOMString CLIMATE_PASSENGER_REAR_LEFT = "climate-passenger-rear-left";
const DOMString CLIMATE_PASSENGER_REAR_RIGHT = "climate-passenger-rear-right";
readonly attribute DOMString zone;
readonly attribute unsigned short desiredTemperature;
readonly attribute boolean acStatus;
readonly attribute unsigned short ventLevel;
readonly attribute boolean ventMode;
void initClimateControlEvent(boolean bubbles, boolean cancelable, DOMString zone, short desiredTemperature, boolean acStatus, short ventLevel, short ventMode);
};
interface ControlEvent : VehicleEvent{
const DOMString LIGHTS_FOG_FRONT = "lights-fog-front";
const DOMString LIGHTS_FOG_REAR = "lights-fog-rear";
const DOMString LIGHTS_SIGNAL_LEFT = "lights-signal-left";
const DOMString LIGHTS_SIGNAL_RIGHT = "lights-signal-right";
const DOMString LIGHTS_SIGNAL_WARN = "lights-signal-warn";
const DOMString LIGHTS_PARKING = "lights-parking";
const DOMString LIGHTS_HIBEAM = "lights-hibeam";
const DOMString LIGHTS_HEAD = "lights-head";
const DOMString WHIPER_FRONT_WASH = "whiper-front-wash";
const DOMString WHIPER_REAR_WASH = "whiper-rear-wash";
const DOMString WHIPER_AUTOMATIC = "whiper-automatic";
const DOMString WHIPER_FRONT_ONCE = "whiper-front-once";
const DOMString WHIPER_REAR_ONCE = "whiper-front-once";
const DOMString WHIPER_FRONT_LEVEL1 = "whiper-front-level1";
const DOMString WHIPER_FRONT_LEVEL2 = "whiper-front-level2";
readonly attribute DOMString conrolId;
readonly attribute boolean active;
void initControlEvent(boolean bubbles, boolean cancelable, DOMString controlId, boolean active);
};
interface NavigationEvent : VehicleEvent{
const DOMString DESTINATION_REACHED = "destination-reached";
const DOMString DESTINATION_CHANGED = "destination-changed";
const DOMString DESTINATION_CANCELLED = "destination-cancelled";
readonly attribute DOMString type;
readonly attribute Address address;
void initNavigationEvent(boolean bubbles, boolean cancelable, DOMString navigationEventId, Address destination);
};
interface ParkSensorsEvent : VehicleEvent{
const DOMString PARKSENSENSORS_FRONT = "parksensors-front";
const DOMString PARKSENSENSORS_REAR = "parksensors-rear";
readonly attribute DOMString position;
readonly attribute unsigned short left;
readonly attribute unsigned short midLeft;
readonly attribute unsigned short midRigth;
readonly attribute unsigned short rigth;
void initParkSensorsEvent(boolean bubbles, boolean cancelable, DOMString position, short left, short midLeft, short midRight, short right);
};
interface ShiftEvent : VehicleEvent{
const DOMString SHIFT = "shift";
const short GEAR_ONE = 1;
const short GEAR_TWO = 2;
const short GEAR_THREE = 3;
const short GEAR_FOUR = 4;
const short GEAR_FIFE = 5;
const short GEAR_SIX = 6;
const short GEAR_SEVEN = 7;
const short GEAR_EIGHT = 8;
const short GEAR_REVERSE = -1;
const short GEAR_NEUTRAL = 0;
const short GEAR_PARKING = -2;
readonly attribute short gear;
void initShiftEvent(boolean bubbles, boolean cancelable, short gear);
};
interface TripComputerEvent : VehicleEvent{
const DOMString TRIPCOMPUTER = "tripcomputer";
readonly attribute float averageConsumption1;
readonly attribute float averageConsumption2;
readonly attribute float averageSpeed1;
readonly attribute float averageSpeed2;
readonly attribute float tripDistance;
readonly attribute float milage;
readonly attribute float range;
void initTripComputerEvent(boolean bubbles, boolean cancelable, float averageConsumption1, float averageConsumption2, float averageSpeed1, float averageSpeed2, float tripDistance, float mileage, float range);
};
};