1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/xpcom/system/nsIDeviceSensors.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,51 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#include "nsISupports.idl" 1.9 + 1.10 +interface nsIDOMWindow; 1.11 + 1.12 +[scriptable, uuid(1B406E32-CF42-471E-A470-6FD600BF4C7B)] 1.13 +interface nsIDeviceSensorData : nsISupports 1.14 +{ 1.15 + // Keep in sync with hal/HalSensor.h 1.16 + const unsigned long TYPE_ORIENTATION = 0; 1.17 + const unsigned long TYPE_ACCELERATION = 1; 1.18 + const unsigned long TYPE_PROXIMITY = 2; 1.19 + const unsigned long TYPE_LINEAR_ACCELERATION = 3; 1.20 + const unsigned long TYPE_GYROSCOPE = 4; 1.21 + const unsigned long TYPE_LIGHT = 5; 1.22 + 1.23 + readonly attribute unsigned long type; 1.24 + 1.25 + readonly attribute double x; 1.26 + readonly attribute double y; 1.27 + readonly attribute double z; 1.28 +}; 1.29 + 1.30 +[scriptable, uuid(e46e47c7-55ff-44c4-abce-21b14ba07f86)] 1.31 +interface nsIDeviceSensors : nsISupports 1.32 +{ 1.33 + /** 1.34 + * Returns true if the given window has any listeners of the given type 1.35 + */ 1.36 + bool hasWindowListener(in unsigned long aType, in nsIDOMWindow aWindow); 1.37 + 1.38 + // Holds pointers, not AddRef objects -- it is up to the caller 1.39 + // to call RemoveWindowListener before the window is deleted. 1.40 + 1.41 + [noscript] void addWindowListener(in unsigned long aType, in nsIDOMWindow aWindow); 1.42 + [noscript] void removeWindowListener(in unsigned long aType, in nsIDOMWindow aWindow); 1.43 + [noscript] void removeWindowAsListener(in nsIDOMWindow aWindow); 1.44 +}; 1.45 + 1.46 +%{C++ 1.47 + 1.48 +#define NS_DEVICE_SENSORS_CID \ 1.49 +{ 0xecba5203, 0x77da, 0x465a, \ 1.50 +{ 0x86, 0x5e, 0x78, 0xb7, 0xaf, 0x10, 0xd8, 0xf7 } } 1.51 + 1.52 +#define NS_DEVICE_SENSORS_CONTRACTID "@mozilla.org/devicesensors;1" 1.53 + 1.54 +%}