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