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