- From: Rees, Kevron <kevron.m.rees@intel.com>
- Date: Wed, 9 Apr 2014 14:51:27 -0700
- To: "andy@cx3marketing.com" <andy@cx3marketing.com>
- Cc: "public-autowebplatform@w3.org" <public-autowebplatform@w3.org>
- Message-ID: <CAFW5wYYFbwGX1KYsPPMaMYYyp3BXJKEWNk6K9WLB-OhtQpWviA@mail.gmail.com>
On Wed, Apr 9, 2014 at 12:57 PM, andy@cx3marketing.com <
andy@cx3marketing.com> wrote:
> Hey Kevron,
> Just so I understand this properly: if the API returns "security" then
> this means "not supported because the OEM thinks this feature is a security
> risk and it isn't implemented" and not "not supported because your
> application does not have adequate security credentials". If the first is
> what you intend, could I recommend still prefixing the security, policy and
> other enums with "not_supported"?
>
That's a good point.
>
> Would it be better to have the availability return a boolean and provide
> an optional way to get the rationale? It seems that it would make the use
> of the API a lot easier for the developer, since there may be quite a few
> availability tests required. If we make them all test === "available", a
> simple typo could silently break the code.
>
> --Andy
>
>
> ___________________________________________
> Andy Gryc | Co-founder
> M: +1 613.618.8730 | E: andy@cx3marketing.com <nyoung@cx3marketing.com>
> W: www.cx3marketing.com
>
> On Apr 9, 2014, at 3:38 PM, Rees, Kevron <kevron.m.rees@intel.com> wrote:
>
> 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
>
>
>
Attachments
- image/png attachment: 91B9EC47-7BEE-4BBC-A80E-9E9A253C42C8.png
Received on Wednesday, 9 April 2014 21:51:56 UTC