Vehicle Availability RFC

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