|
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 interface MozWakeLockListener; |
|
7 |
|
8 /** |
|
9 * This interface implements navigator.mozPower |
|
10 */ |
|
11 interface MozPowerManager |
|
12 { |
|
13 [Throws] |
|
14 void powerOff(); |
|
15 [Throws] |
|
16 void reboot(); |
|
17 void factoryReset(); |
|
18 |
|
19 /** |
|
20 * The listeners are notified when a resource changes its lock state to: |
|
21 * - unlocked |
|
22 * - locked but not visible |
|
23 * - locked and visible |
|
24 */ |
|
25 void addWakeLockListener(MozWakeLockListener aListener); |
|
26 void removeWakeLockListener(MozWakeLockListener aListener); |
|
27 |
|
28 /** |
|
29 * Query the wake lock state of the topic. |
|
30 * |
|
31 * Possible states are: |
|
32 * |
|
33 * - "unlocked" - nobody holds the wake lock. |
|
34 * |
|
35 * - "locked-foreground" - at least one window holds the wake lock, |
|
36 * and it is visible. |
|
37 * |
|
38 * - "locked-background" - at least one window holds the wake lock, |
|
39 * but all of them are hidden. |
|
40 * |
|
41 * @param aTopic The resource name related to the wake lock. |
|
42 */ |
|
43 [Throws] |
|
44 DOMString getWakeLockState(DOMString aTopic); |
|
45 |
|
46 /** |
|
47 * Is the device's screen currently enabled? This attribute controls the |
|
48 * device's screen, so setting it to false will turn off the screen. |
|
49 */ |
|
50 attribute boolean screenEnabled; |
|
51 |
|
52 /** |
|
53 * How bright is the screen's backlight, on a scale from 0 (very dim) to 1 |
|
54 * (full brightness)? Setting this attribute modifies the screen's |
|
55 * brightness. |
|
56 * |
|
57 * You can read and write this attribute even when the screen is disabled, |
|
58 * but the backlight is off while the screen is disabled. |
|
59 * |
|
60 * If you write a value of X into this attribute, the attribute may not have |
|
61 * the same value X when you later read it. Most screens don't support as |
|
62 * many different brightness levels as there are doubles between 0 and 1, so |
|
63 * we may reduce the value's precision before storing it. |
|
64 * |
|
65 * @throw NS_ERROR_INVALID_ARG if brightness is not in the range [0, 1]. |
|
66 */ |
|
67 [SetterThrows] |
|
68 attribute double screenBrightness; |
|
69 |
|
70 /** |
|
71 * Is it possible that the device's CPU will sleep after the screen is |
|
72 * disabled? Setting this attribute to false will prevent the device |
|
73 * entering suspend state. |
|
74 */ |
|
75 attribute boolean cpuSleepAllowed; |
|
76 }; |