2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2009-08-21 18:42:37 +04:00
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
|
|
|
|
interface nsIDOMWindow;
|
|
|
|
|
2015-12-18 01:14:51 +03:00
|
|
|
[scriptable, uuid(0462247e-fe8c-4aa5-b675-3752547e485f)]
|
2012-03-25 04:29:57 +04:00
|
|
|
interface nsIDeviceSensorData : nsISupports
|
2009-08-21 18:42:37 +04:00
|
|
|
{
|
2012-03-21 10:36:17 +04:00
|
|
|
// Keep in sync with hal/HalSensor.h
|
2015-12-18 01:14:51 +03:00
|
|
|
|
|
|
|
// 1. TYPE_ORIENTATION: absolute device orientation, not spec-conform and
|
|
|
|
// deprecated on Android.
|
|
|
|
// 2. TYPE_ROTATION_VECTOR: absolute device orientation affected by drift.
|
|
|
|
// 3. TYPE_GAME_ROTATION_VECTOR: relative device orientation less affected by drift.
|
|
|
|
// Preferred fallback priorities on Android are [3, 2, 1] for the general case
|
|
|
|
// and [2, 1] if absolute orientation (compass heading) is required.
|
2012-03-21 10:36:17 +04:00
|
|
|
const unsigned long TYPE_ORIENTATION = 0;
|
|
|
|
const unsigned long TYPE_ACCELERATION = 1;
|
|
|
|
const unsigned long TYPE_PROXIMITY = 2;
|
|
|
|
const unsigned long TYPE_LINEAR_ACCELERATION = 3;
|
|
|
|
const unsigned long TYPE_GYROSCOPE = 4;
|
2012-05-02 20:43:45 +04:00
|
|
|
const unsigned long TYPE_LIGHT = 5;
|
2015-12-15 04:03:56 +03:00
|
|
|
const unsigned long TYPE_ROTATION_VECTOR = 6;
|
|
|
|
const unsigned long TYPE_GAME_ROTATION_VECTOR = 7;
|
2011-06-20 09:36:17 +04:00
|
|
|
|
|
|
|
readonly attribute unsigned long type;
|
|
|
|
|
|
|
|
readonly attribute double x;
|
|
|
|
readonly attribute double y;
|
|
|
|
readonly attribute double z;
|
2009-08-21 18:42:37 +04:00
|
|
|
};
|
|
|
|
|
2012-10-21 08:40:56 +04:00
|
|
|
[scriptable, uuid(e46e47c7-55ff-44c4-abce-21b14ba07f86)]
|
2012-03-25 04:29:57 +04:00
|
|
|
interface nsIDeviceSensors : nsISupports
|
2009-08-21 18:42:37 +04:00
|
|
|
{
|
2012-10-21 08:40:56 +04:00
|
|
|
/**
|
|
|
|
* Returns true if the given window has any listeners of the given type
|
|
|
|
*/
|
|
|
|
bool hasWindowListener(in unsigned long aType, in nsIDOMWindow aWindow);
|
2012-06-11 03:44:50 +04:00
|
|
|
|
2011-07-07 09:56:32 +04:00
|
|
|
// Holds pointers, not AddRef objects -- it is up to the caller
|
|
|
|
// to call RemoveWindowListener before the window is deleted.
|
2012-06-11 03:44:50 +04:00
|
|
|
|
2012-03-25 04:29:49 +04:00
|
|
|
[noscript] void addWindowListener(in unsigned long aType, in nsIDOMWindow aWindow);
|
|
|
|
[noscript] void removeWindowListener(in unsigned long aType, in nsIDOMWindow aWindow);
|
|
|
|
[noscript] void removeWindowAsListener(in nsIDOMWindow aWindow);
|
2009-08-21 18:42:37 +04:00
|
|
|
};
|
2013-11-05 18:16:25 +04:00
|
|
|
|
|
|
|
%{C++
|
|
|
|
|
|
|
|
#define NS_DEVICE_SENSORS_CID \
|
|
|
|
{ 0xecba5203, 0x77da, 0x465a, \
|
|
|
|
{ 0x86, 0x5e, 0x78, 0xb7, 0xaf, 0x10, 0xd8, 0xf7 } }
|
|
|
|
|
|
|
|
#define NS_DEVICE_SENSORS_CONTRACTID "@mozilla.org/devicesensors;1"
|
|
|
|
|
|
|
|
%}
|