• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16import {AsyncCallback} from './basic';
17
18/**
19 * Provides interfaces to manage power.
20 *
21 * @syscap SystemCapability.PowerManager.PowerManager.Core
22 * @since 7
23 */
24declare namespace power {
25  /**
26   * Shuts down the system.
27   *
28   * <p>This method requires the ohos.permission.REBOOT permission.
29   *
30   * @param reason Indicates the shutdown reason.
31   * @permission ohos.permission.REBOOT
32   * @systemapi
33   * @since 7
34   */
35  function shutdownDevice(reason: string): void;
36
37  /**
38   * Restarts the system.
39   *
40   * <p>This method requires the ohos.permission.REBOOT permission.
41   *
42   * @param reason Indicates the restart reason. For example, "updater" indicates entering the updater mode
43   * after the restart. If the parameter is not specified, the system enters the normal mode after the restart.
44   * @permission ohos.permission.REBOOT
45   * @since 7
46   */
47  function rebootDevice(reason: string): void;
48
49  /**
50   * Checks whether the screen of a device is on or off.
51   *
52   * @return Returns true if the screen is on; returns false otherwise.
53   * @since 7
54   */
55  function isScreenOn(callback: AsyncCallback<boolean>): void;
56  function isScreenOn(): Promise<boolean>;
57}
58export default power;
59
60