• 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
16/**
17 * @file
18 * @kit BasicServicesKit
19 */
20
21import { BusinessError } from './@ohos.base';
22
23/**
24 * Provides interfaces to control the power of display.
25 *
26 * @namespace brightness
27 * @syscap SystemCapability.PowerManager.DisplayPowerManager
28 * @systemapi
29 * @since 7
30 */
31declare namespace brightness {
32  /**
33   * Sets the screen brightness.
34   *
35   * @param { number } value Brightness value, ranging from 0 to 255.
36   * value parameter must be of type number.
37   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
38   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified;
39   * 2. Incorrect parameter types;
40   * @throws { BusinessError } 4700101 - Failed to connect to the service.
41   * @syscap SystemCapability.PowerManager.DisplayPowerManager
42   * @systemapi
43   * @since 7
44   */
45  function setValue(value: number): void;
46
47  /**
48   * Sets the screen brightness.
49   *
50   * @param { number } value - Brightness value, ranging from 0 to 255.
51   * value parameter must be of type number.
52   * @param { boolean } continuous - This parameter is used in the scenario of continuous adjustment to the brightness.
53   * You are advised to set this parameter to true during the continuous adjustment and
54   * to false at the end of the continuous adjustment for better performance.
55   * continuous parameter must be of type boolean.
56   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
57   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified;
58   * 2. Incorrect parameter types;
59   * @throws { BusinessError } 4700101 - Failed to connect to the service.
60   * @syscap SystemCapability.PowerManager.DisplayPowerManager
61   * @systemapi
62   * @since 11
63   */
64  function setValue(value: number, continuous: boolean): void;
65}
66export default brightness;
67