W3C home > Mailing lists > Public > public-autowebplatform@w3.org > April 2014

Vehicle Availability RFC

From: Rees, Kevron <kevron.m.rees@intel.com>
Date: Wed, 9 Apr 2014 12:38:40 -0700
Message-ID: <CAFW5wYYbSnhdY1WsdBJbhfZwc9eegwqATSj8nfofPEPxf-G4Ug@mail.gmail.com>
To: "public-autowebplatform@w3.org" <public-autowebplatform@w3.org>
The purpose of the availability API additions is to allow developers
to not only determine if a particular data is supported, but also tell
them exactly why it isn't supported.  It also handles the scenario
that if an attribute is not available at the moment, applications can
be notified when the attribute becomes available.

enum Availability
{
  "available",
  "not_supported",
  "not_supported_yet",
  "security",
  "policy",
  "other"
}

partial Interface VehicleInterface {

  Availability available();
  short availabilityChangedListener( AvailableCallback callback );
  void removeAvailabilityChangedListener( short handle );
}

Example 1:

if( ( var a = vehicle.vehicleSpeed.available() ) === "available" )
{
  // we can use it.
}
else
{
  // tell us why:
  console.log(a);
}

Example 2:

var canHasVehicleSpeed = vehicle.vehicleSpeed.available() == "available";

vehicle.vehicle.availabilityChangedListener( function (available) {
  canHasVehicleSpeed = available == "available";
});

...

if(canHasVehicleSpeed)
{
   vehicle.vehicleSpeed.get().then(callback);
}


-Kevron
Received on Wednesday, 9 April 2014 19:39:09 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 19:52:52 UTC