michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: interface MozWakeLockListener; michael@0: michael@0: /** michael@0: * This interface implements navigator.mozPower michael@0: */ michael@0: interface MozPowerManager michael@0: { michael@0: [Throws] michael@0: void powerOff(); michael@0: [Throws] michael@0: void reboot(); michael@0: void factoryReset(); michael@0: michael@0: /** michael@0: * The listeners are notified when a resource changes its lock state to: michael@0: * - unlocked michael@0: * - locked but not visible michael@0: * - locked and visible michael@0: */ michael@0: void addWakeLockListener(MozWakeLockListener aListener); michael@0: void removeWakeLockListener(MozWakeLockListener aListener); michael@0: michael@0: /** michael@0: * Query the wake lock state of the topic. michael@0: * michael@0: * Possible states are: michael@0: * michael@0: * - "unlocked" - nobody holds the wake lock. michael@0: * michael@0: * - "locked-foreground" - at least one window holds the wake lock, michael@0: * and it is visible. michael@0: * michael@0: * - "locked-background" - at least one window holds the wake lock, michael@0: * but all of them are hidden. michael@0: * michael@0: * @param aTopic The resource name related to the wake lock. michael@0: */ michael@0: [Throws] michael@0: DOMString getWakeLockState(DOMString aTopic); michael@0: michael@0: /** michael@0: * Is the device's screen currently enabled? This attribute controls the michael@0: * device's screen, so setting it to false will turn off the screen. michael@0: */ michael@0: attribute boolean screenEnabled; michael@0: michael@0: /** michael@0: * How bright is the screen's backlight, on a scale from 0 (very dim) to 1 michael@0: * (full brightness)? Setting this attribute modifies the screen's michael@0: * brightness. michael@0: * michael@0: * You can read and write this attribute even when the screen is disabled, michael@0: * but the backlight is off while the screen is disabled. michael@0: * michael@0: * If you write a value of X into this attribute, the attribute may not have michael@0: * the same value X when you later read it. Most screens don't support as michael@0: * many different brightness levels as there are doubles between 0 and 1, so michael@0: * we may reduce the value's precision before storing it. michael@0: * michael@0: * @throw NS_ERROR_INVALID_ARG if brightness is not in the range [0, 1]. michael@0: */ michael@0: [SetterThrows] michael@0: attribute double screenBrightness; michael@0: michael@0: /** michael@0: * Is it possible that the device's CPU will sleep after the screen is michael@0: * disabled? Setting this attribute to false will prevent the device michael@0: * entering suspend state. michael@0: */ michael@0: attribute boolean cpuSleepAllowed; michael@0: };