W3C home > Mailing lists > Public > public-geolocation@w3.org > July 2010

DeviceOrientation comments

From: Dean Jackson <dino@apple.com>
Date: Thu, 22 Jul 2010 21:53:56 +1000
Message-Id: <A91E908E-368A-4ACB-AB48-D8186CDDA9CA@apple.com>
To: public-geolocation@w3.org
Hi,

Apologies in advance if I'm repeating things here. I haven't read through the entire archives to check for duplicate comments or issues that were already closed.

BTW - I'm commenting on http://dev.w3.org/geo/api/spec-source-orientation.html
which is currently dated 10 March 2010, although I see comments in the email archives suggesting updates since then. 

My main comment/proposal is that Accelerometer Event should include the ability to return rotation around the 3 axes. Along these lines, it would be nice if it also included the direction of gravity so that you could easily determine the acceleration the user is providing.

If this is accepted, then the name of the Event is slightly misleading, because it returns more than acceleration. I propose it be renamed Motion Event.

The specification currently says that implementations "must set the values of the unknown angles to null", yet the values are defined as doubles. Not all languages will be able to do this, so it seems necessary to have some query methods or properties indicating the availability of values. I see a suggestion via email to throw NOT_AVAILABLE (although I think you want NOT_SUPPORTED_ERR), but that means you have to try to read the value to see if it exists (and catch any exceptions).

Lastly, the specification does not provide any way to throttle the rate of incoming events. This could be an implementation detail, but I expect nearly every implementation will want to expose rate control, so it might be worth specifying it. For example, it could be

navigator.motionUpdateInterval = 0.1;  // give no more than 10 events/sec

I'm not sure why there is a need to report the interval of incoming events if it is a constant, and can't really be guaranteed anyway. Without the change above there is no way to control it. Also, DOM Events already have a timestamp, so the user can work out the interval themselves.

Dean

interface MotionEvent : Event {

    readonly attribute double xAcceleration;
    readonly attribute double yAcceleration;
    readonly attribute double zAcceleration;

    readonly attribute double xRotationRate;
    readonly attribute double yRotationRate;
    readonly attribute double zRotationRate;

    readonly attribute boolean rotationRateAvailable;

    void initMotionEvent(in DOMString type,
                                in boolean bubbles,
                                in boolean cancelable,
                                in double xAcceleration,
                                in double yAcceleration,
                                in double zAcceleration,
                                in double xRotationRate,
                                in double yRotationRate,
                                in double zRotationRate,
                                in boolean rotationRateAvailable);
    }
Received on Thursday, 22 July 2010 11:54:31 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 22 March 2012 18:13:50 GMT