1/* 2 * Copyright (c) 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 * @syscap SystemCapability.PowerManager.DisplayPowerManager 18 * @since 3 19 * @deprecated since 7 20 */ 21export interface BrightnessResponse { 22 /** 23 * Screen brightness, which ranges from 1 to 255. 24 * @since 3 25 * @deprecated since 7 26 */ 27 value: number; 28} 29 30/** 31 * @syscap SystemCapability.PowerManager.DisplayPowerManager 32 * @since 3 33 * @deprecated since 7 34 */ 35export interface GetBrightnessOptions { 36 /** 37 * Called when the current screen brightness is obtained. 38 * @since 3 39 * @deprecated since 7 40 */ 41 success?: (data: BrightnessResponse) => void; 42 43 /** 44 * Called when the current screen brightness fails to be obtained. 45 * @since 3 46 * @deprecated since 7 47 */ 48 fail?: (data: string, code: number) => void; 49 50 /** 51 * Called when the execution is completed. 52 * @since 3 53 * @deprecated since 7 54 */ 55 complete?: () => void; 56} 57 58/** 59 * @syscap SystemCapability.PowerManager.DisplayPowerManager 60 * @since 3 61 * @deprecated since 7 62 */ 63export interface SetBrightnessOptions { 64 /** 65 * Screen brightness. The value is an integer ranging from 1 to 255. 66 * If the value is less than or equal to 0, value 1 will be used. 67 * If the value is greater than 255, value 255 will be used. 68 * If the value contains decimals, the integral part of the value will be used. 69 * For example, if value is 8.1 is set, value 8 will be used. 70 * @since 3 71 * @deprecated since 7 72 */ 73 value: number; 74 75 /** 76 * Called when the setting is successful. 77 * @since 3 78 * @deprecated since 7 79 */ 80 success?: () => void; 81 82 /** 83 * Called when the setting fails. 84 * @since 3 85 * @deprecated since 7 86 */ 87 fail?: (data: string, code: number) => void; 88 89 /** 90 * Called when the execution is completed. 91 * @since 3 92 * @deprecated since 7 93 */ 94 complete?: () => void 95} 96 97/** 98 * @syscap SystemCapability.PowerManager.DisplayPowerManager 99 * @since 3 100 * @deprecated since 7 101 */ 102export interface BrightnessModeResponse { 103 /** 104 * The value can be 0 or 1. 105 * 0: The screen brightness is manually adjusted. 106 * 1: The screen brightness is automatically adjusted. 107 * @since 3 108 * @deprecated since 7 109 */ 110 mode: number; 111} 112 113/** 114 * @syscap SystemCapability.PowerManager.DisplayPowerManager 115 * @since 3 116 * @deprecated since 7 117 */ 118export interface GetBrightnessModeOptions { 119 /** 120 * Called when the screen brightness adjustment mode is obtained. 121 * @since 3 122 * @deprecated since 7 123 */ 124 success?: (data: BrightnessModeResponse) => void; 125 126 /** 127 * Called when the screen brightness adjustment mode fails to be obtained. 128 * @since 3 129 * @deprecated since 7 130 */ 131 fail?: (data: string, code: number) => void; 132 133 /** 134 * Called when the execution is completed. 135 * @since 3 136 * @deprecated since 7 137 */ 138 complete?: () => void; 139} 140 141/** 142 * @syscap SystemCapability.PowerManager.DisplayPowerManager 143 * @since 3 144 * @deprecated since 7 145 */ 146export interface SetBrightnessModeOptions { 147 /** 148 * The screen brightness mode. 149 * 0: The screen brightness is manually adjusted. 150 * 1: The screen brightness is automatically adjusted. 151 * @since 3 152 * @deprecated since 7 153 */ 154 mode: number; 155 156 /** 157 * Called when the setting is successful. 158 * @since 3 159 * @deprecated since 7 160 */ 161 success?: () => void; 162 163 /** 164 * Called when the setting fails. 165 * @since 3 166 * @deprecated since 7 167 */ 168 fail?: (data: string, code: number) => void; 169 170 /** 171 * Called when the execution is completed. 172 * @since 3 173 * @deprecated since 7 174 */ 175 complete?: () => void 176} 177 178/** 179 * @syscap SystemCapability.PowerManager.DisplayPowerManager 180 * @since 3 181 * @deprecated since 7 182 */ 183export interface SetKeepScreenOnOptions { 184 /** 185 * Whether to always keep the screen on. 186 * @since 3 187 * @deprecated since 7 188 */ 189 keepScreenOn: boolean; 190 191 /** 192 * Called when the setting is successful. 193 * @since 3 194 * @deprecated since 7 195 */ 196 success?: () => void; 197 198 /** 199 * Called when the setting fails. 200 * @since 3 201 * @deprecated since 7 202 */ 203 fail?: (data: string, code: number) => void; 204 205 /** 206 * Called when the execution is completed. 207 * @since 3 208 * @deprecated since 7 209 */ 210 complete?: () => void 211} 212 213/** 214 * @syscap SystemCapability.PowerManager.DisplayPowerManager 215 * @since 3 216 * @deprecated since 7 217 */ 218export default class Brightness { 219 /** 220 * Obtains the current screen brightness. 221 * @param options Options. 222 * @since 3 223 * @deprecated since 7 224 */ 225 static getValue(options?: GetBrightnessOptions): void; 226 227 /** 228 * Sets the screen brightness. 229 * @param options Options. 230 * @since 3 231 * @deprecated since 7 232 */ 233 static setValue(options?: SetBrightnessOptions): void; 234 235 /** 236 * Obtains the screen brightness adjustment mode. 237 * @param options Options. 238 * @since 3 239 * @deprecated since 7 240 */ 241 static getMode(options?: GetBrightnessModeOptions): void; 242 243 /** 244 * Sets the screen brightness adjustment mode. 245 * @param options Options. 246 * @since 3 247 * @deprecated since 7 248 */ 249 static setMode(options?: SetBrightnessModeOptions): void; 250 251 /** 252 * Sets whether to always keep the screen on. 253 * @param options Options. 254 * @since 3 255 * @deprecated since 7 256 */ 257 static setKeepScreenOn(options?: SetKeepScreenOnOptions): void; 258}