161847f8eSopenharmony_ci/* 261847f8eSopenharmony_ci * Copyright (c) 2022-2023 Huawei Device Co., Ltd. 361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 461847f8eSopenharmony_ci * you may not use this file except in compliance with the License. 561847f8eSopenharmony_ci * You may obtain a copy of the License at 661847f8eSopenharmony_ci * 761847f8eSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 861847f8eSopenharmony_ci * 961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and 1361847f8eSopenharmony_ci * limitations under the License. 1461847f8eSopenharmony_ci */ 1561847f8eSopenharmony_ci 1661847f8eSopenharmony_ci/** 1761847f8eSopenharmony_ci * @file 1861847f8eSopenharmony_ci * @kit BasicServicesKit 1961847f8eSopenharmony_ci */ 2061847f8eSopenharmony_ci 2161847f8eSopenharmony_ci/** 2261847f8eSopenharmony_ci * @interface BrightnessResponse 2361847f8eSopenharmony_ci * @syscap SystemCapability.PowerManager.DisplayPowerManager.Lite 2461847f8eSopenharmony_ci * @since 3 2561847f8eSopenharmony_ci * @deprecated since 7 2661847f8eSopenharmony_ci */ 2761847f8eSopenharmony_ciexport interface BrightnessResponse { 2861847f8eSopenharmony_ci /** 2961847f8eSopenharmony_ci * Screen brightness, which ranges from 1 to 255. 3061847f8eSopenharmony_ci * 3161847f8eSopenharmony_ci * @type { number } 3261847f8eSopenharmony_ci * @syscap SystemCapability.PowerManager.DisplayPowerManager.Lite 3361847f8eSopenharmony_ci * @since 3 3461847f8eSopenharmony_ci * @deprecated since 7 3561847f8eSopenharmony_ci */ 3661847f8eSopenharmony_ci value: number; 3761847f8eSopenharmony_ci} 3861847f8eSopenharmony_ci 3961847f8eSopenharmony_ci/** 4061847f8eSopenharmony_ci * @interface GetBrightnessOptions 4161847f8eSopenharmony_ci * @syscap SystemCapability.PowerManager.DisplayPowerManager.Lite 4261847f8eSopenharmony_ci * @since 3 4361847f8eSopenharmony_ci * @deprecated since 7 4461847f8eSopenharmony_ci */ 4561847f8eSopenharmony_ciexport interface GetBrightnessOptions { 4661847f8eSopenharmony_ci /** 4761847f8eSopenharmony_ci * Called when the current screen brightness is obtained. 4861847f8eSopenharmony_ci * 4961847f8eSopenharmony_ci * @type { ?function } 5061847f8eSopenharmony_ci * @syscap SystemCapability.PowerManager.DisplayPowerManager.Lite 5161847f8eSopenharmony_ci * @since 3 5261847f8eSopenharmony_ci * @deprecated since 7 5361847f8eSopenharmony_ci */ 5461847f8eSopenharmony_ci success?: (data: BrightnessResponse) => void; 5561847f8eSopenharmony_ci 5661847f8eSopenharmony_ci /** 5761847f8eSopenharmony_ci * Called when the current screen brightness fails to be obtained. 5861847f8eSopenharmony_ci * 5961847f8eSopenharmony_ci * @type { ?function } 6061847f8eSopenharmony_ci * @syscap SystemCapability.PowerManager.DisplayPowerManager.Lite 6161847f8eSopenharmony_ci * @since 3 6261847f8eSopenharmony_ci * @deprecated since 7 6361847f8eSopenharmony_ci */ 6461847f8eSopenharmony_ci fail?: (data: string, code: number) => void; 6561847f8eSopenharmony_ci 6661847f8eSopenharmony_ci /** 6761847f8eSopenharmony_ci * Called when the execution is completed. 6861847f8eSopenharmony_ci * 6961847f8eSopenharmony_ci * @type { ?function } 7061847f8eSopenharmony_ci * @syscap SystemCapability.PowerManager.DisplayPowerManager.Lite 7161847f8eSopenharmony_ci * @since 3 7261847f8eSopenharmony_ci * @deprecated since 7 7361847f8eSopenharmony_ci */ 7461847f8eSopenharmony_ci complete?: () => void; 7561847f8eSopenharmony_ci} 7661847f8eSopenharmony_ci 7761847f8eSopenharmony_ci/** 7861847f8eSopenharmony_ci * @interface SetBrightnessOptions 7961847f8eSopenharmony_ci * @syscap SystemCapability.PowerManager.DisplayPowerManager.Lite 8061847f8eSopenharmony_ci * @since 3 8161847f8eSopenharmony_ci * @deprecated since 7 8261847f8eSopenharmony_ci */ 8361847f8eSopenharmony_ciexport interface SetBrightnessOptions { 8461847f8eSopenharmony_ci /** 8561847f8eSopenharmony_ci * Screen brightness. The value is an integer ranging from 1 to 255. 8661847f8eSopenharmony_ci * If the value is less than or equal to 0, value 1 will be used. 8761847f8eSopenharmony_ci * If the value is greater than 255, value 255 will be used. 8861847f8eSopenharmony_ci * If the value contains decimals, the integral part of the value will be used. 8961847f8eSopenharmony_ci * For example, if value is 8.1 is set, value 8 will be used. 9061847f8eSopenharmony_ci * 9161847f8eSopenharmony_ci * @type { number } 9261847f8eSopenharmony_ci * @syscap SystemCapability.PowerManager.DisplayPowerManager.Lite 9361847f8eSopenharmony_ci * @since 3 9461847f8eSopenharmony_ci * @deprecated since 7 9561847f8eSopenharmony_ci */ 9661847f8eSopenharmony_ci value: number; 9761847f8eSopenharmony_ci 9861847f8eSopenharmony_ci /** 9961847f8eSopenharmony_ci * Called when the setting is successful. 10061847f8eSopenharmony_ci * 10161847f8eSopenharmony_ci * @type { ?function } 10261847f8eSopenharmony_ci * @syscap SystemCapability.PowerManager.DisplayPowerManager.Lite 10361847f8eSopenharmony_ci * @since 3 10461847f8eSopenharmony_ci * @deprecated since 7 10561847f8eSopenharmony_ci */ 10661847f8eSopenharmony_ci success?: () => void; 10761847f8eSopenharmony_ci 10861847f8eSopenharmony_ci /** 10961847f8eSopenharmony_ci * Called when the setting fails. 11061847f8eSopenharmony_ci * 11161847f8eSopenharmony_ci * @type { ?function } 11261847f8eSopenharmony_ci * @syscap SystemCapability.PowerManager.DisplayPowerManager.Lite 11361847f8eSopenharmony_ci * @since 3 11461847f8eSopenharmony_ci * @deprecated since 7 11561847f8eSopenharmony_ci */ 11661847f8eSopenharmony_ci fail?: (data: string, code: number) => void; 11761847f8eSopenharmony_ci 11861847f8eSopenharmony_ci /** 11961847f8eSopenharmony_ci * Called when the execution is completed. 12061847f8eSopenharmony_ci * 12161847f8eSopenharmony_ci * @type { ?function } 12261847f8eSopenharmony_ci * @syscap SystemCapability.PowerManager.DisplayPowerManager.Lite 12361847f8eSopenharmony_ci * @since 3 12461847f8eSopenharmony_ci * @deprecated since 7 12561847f8eSopenharmony_ci */ 12661847f8eSopenharmony_ci complete?: () => void; 12761847f8eSopenharmony_ci} 12861847f8eSopenharmony_ci 12961847f8eSopenharmony_ci/** 13061847f8eSopenharmony_ci * @interface BrightnessModeResponse 13161847f8eSopenharmony_ci * @syscap SystemCapability.PowerManager.DisplayPowerManager.Lite 13261847f8eSopenharmony_ci * @since 3 13361847f8eSopenharmony_ci * @deprecated since 7 13461847f8eSopenharmony_ci */ 13561847f8eSopenharmony_ciexport interface BrightnessModeResponse { 13661847f8eSopenharmony_ci /** 13761847f8eSopenharmony_ci * The value can be 0 or 1. 13861847f8eSopenharmony_ci * 0: The screen brightness is manually adjusted. 13961847f8eSopenharmony_ci * 1: The screen brightness is automatically adjusted. 14061847f8eSopenharmony_ci * 14161847f8eSopenharmony_ci * @type { number } 14261847f8eSopenharmony_ci * @syscap SystemCapability.PowerManager.DisplayPowerManager.Lite 14361847f8eSopenharmony_ci * @since 3 14461847f8eSopenharmony_ci * @deprecated since 7 14561847f8eSopenharmony_ci */ 14661847f8eSopenharmony_ci mode: number; 14761847f8eSopenharmony_ci} 14861847f8eSopenharmony_ci 14961847f8eSopenharmony_ci/** 15061847f8eSopenharmony_ci * @interface GetBrightnessModeOptions 15161847f8eSopenharmony_ci * @syscap SystemCapability.PowerManager.DisplayPowerManager.Lite 15261847f8eSopenharmony_ci * @since 3 15361847f8eSopenharmony_ci * @deprecated since 7 15461847f8eSopenharmony_ci */ 15561847f8eSopenharmony_ciexport interface GetBrightnessModeOptions { 15661847f8eSopenharmony_ci /** 15761847f8eSopenharmony_ci * Called when the screen brightness adjustment mode is obtained. 15861847f8eSopenharmony_ci * 15961847f8eSopenharmony_ci * @type { ?function } 16061847f8eSopenharmony_ci * @syscap SystemCapability.PowerManager.DisplayPowerManager.Lite 16161847f8eSopenharmony_ci * @since 3 16261847f8eSopenharmony_ci * @deprecated since 7 16361847f8eSopenharmony_ci */ 16461847f8eSopenharmony_ci success?: (data: BrightnessModeResponse) => void; 16561847f8eSopenharmony_ci 16661847f8eSopenharmony_ci /** 16761847f8eSopenharmony_ci * Called when the screen brightness adjustment mode fails to be obtained. 16861847f8eSopenharmony_ci * 16961847f8eSopenharmony_ci * @type { ?function } 17061847f8eSopenharmony_ci * @syscap SystemCapability.PowerManager.DisplayPowerManager.Lite 17161847f8eSopenharmony_ci * @since 3 17261847f8eSopenharmony_ci * @deprecated since 7 17361847f8eSopenharmony_ci */ 17461847f8eSopenharmony_ci fail?: (data: string, code: number) => void; 17561847f8eSopenharmony_ci 17661847f8eSopenharmony_ci /** 17761847f8eSopenharmony_ci * Called when the execution is completed. 17861847f8eSopenharmony_ci * 17961847f8eSopenharmony_ci * @type { ?function } 18061847f8eSopenharmony_ci * @syscap SystemCapability.PowerManager.DisplayPowerManager.Lite 18161847f8eSopenharmony_ci * @since 3 18261847f8eSopenharmony_ci * @deprecated since 7 18361847f8eSopenharmony_ci */ 18461847f8eSopenharmony_ci complete?: () => void; 18561847f8eSopenharmony_ci} 18661847f8eSopenharmony_ci 18761847f8eSopenharmony_ci/** 18861847f8eSopenharmony_ci * @interface SetBrightnessModeOptions 18961847f8eSopenharmony_ci * @syscap SystemCapability.PowerManager.DisplayPowerManager.Lite 19061847f8eSopenharmony_ci * @since 3 19161847f8eSopenharmony_ci * @deprecated since 7 19261847f8eSopenharmony_ci */ 19361847f8eSopenharmony_ciexport interface SetBrightnessModeOptions { 19461847f8eSopenharmony_ci /** 19561847f8eSopenharmony_ci * The screen brightness mode. 19661847f8eSopenharmony_ci * 0: The screen brightness is manually adjusted. 19761847f8eSopenharmony_ci * 1: The screen brightness is automatically adjusted. 19861847f8eSopenharmony_ci * 19961847f8eSopenharmony_ci * @type { number } 20061847f8eSopenharmony_ci * @syscap SystemCapability.PowerManager.DisplayPowerManager.Lite 20161847f8eSopenharmony_ci * @since 3 20261847f8eSopenharmony_ci * @deprecated since 7 20361847f8eSopenharmony_ci */ 20461847f8eSopenharmony_ci mode: number; 20561847f8eSopenharmony_ci 20661847f8eSopenharmony_ci /** 20761847f8eSopenharmony_ci * Called when the setting is successful. 20861847f8eSopenharmony_ci * 20961847f8eSopenharmony_ci * @type { ?function } 21061847f8eSopenharmony_ci * @syscap SystemCapability.PowerManager.DisplayPowerManager.Lite 21161847f8eSopenharmony_ci * @since 3 21261847f8eSopenharmony_ci * @deprecated since 7 21361847f8eSopenharmony_ci */ 21461847f8eSopenharmony_ci success?: () => void; 21561847f8eSopenharmony_ci 21661847f8eSopenharmony_ci /** 21761847f8eSopenharmony_ci * Called when the setting fails. 21861847f8eSopenharmony_ci * 21961847f8eSopenharmony_ci * @type { ?function } 22061847f8eSopenharmony_ci * @syscap SystemCapability.PowerManager.DisplayPowerManager.Lite 22161847f8eSopenharmony_ci * @since 3 22261847f8eSopenharmony_ci * @deprecated since 7 22361847f8eSopenharmony_ci */ 22461847f8eSopenharmony_ci fail?: (data: string, code: number) => void; 22561847f8eSopenharmony_ci 22661847f8eSopenharmony_ci /** 22761847f8eSopenharmony_ci * Called when the execution is completed. 22861847f8eSopenharmony_ci * 22961847f8eSopenharmony_ci * @type { ?function } 23061847f8eSopenharmony_ci * @syscap SystemCapability.PowerManager.DisplayPowerManager.Lite 23161847f8eSopenharmony_ci * @since 3 23261847f8eSopenharmony_ci * @deprecated since 7 23361847f8eSopenharmony_ci */ 23461847f8eSopenharmony_ci complete?: () => void; 23561847f8eSopenharmony_ci} 23661847f8eSopenharmony_ci 23761847f8eSopenharmony_ci/** 23861847f8eSopenharmony_ci * @interface SetKeepScreenOnOptions 23961847f8eSopenharmony_ci * @syscap SystemCapability.PowerManager.DisplayPowerManager.Lite 24061847f8eSopenharmony_ci * @since 3 24161847f8eSopenharmony_ci * @deprecated since 7 24261847f8eSopenharmony_ci */ 24361847f8eSopenharmony_ciexport interface SetKeepScreenOnOptions { 24461847f8eSopenharmony_ci /** 24561847f8eSopenharmony_ci * Whether to always keep the screen on. 24661847f8eSopenharmony_ci * 24761847f8eSopenharmony_ci * @type { boolean } 24861847f8eSopenharmony_ci * @syscap SystemCapability.PowerManager.DisplayPowerManager.Lite 24961847f8eSopenharmony_ci * @since 3 25061847f8eSopenharmony_ci * @deprecated since 7 25161847f8eSopenharmony_ci */ 25261847f8eSopenharmony_ci keepScreenOn: boolean; 25361847f8eSopenharmony_ci 25461847f8eSopenharmony_ci /** 25561847f8eSopenharmony_ci * Called when the setting is successful. 25661847f8eSopenharmony_ci * 25761847f8eSopenharmony_ci * @type { ?function } 25861847f8eSopenharmony_ci * @syscap SystemCapability.PowerManager.DisplayPowerManager.Lite 25961847f8eSopenharmony_ci * @since 3 26061847f8eSopenharmony_ci * @deprecated since 7 26161847f8eSopenharmony_ci */ 26261847f8eSopenharmony_ci success?: () => void; 26361847f8eSopenharmony_ci 26461847f8eSopenharmony_ci /** 26561847f8eSopenharmony_ci * Called when the setting fails. 26661847f8eSopenharmony_ci * 26761847f8eSopenharmony_ci * @type { ?function } 26861847f8eSopenharmony_ci * @syscap SystemCapability.PowerManager.DisplayPowerManager.Lite 26961847f8eSopenharmony_ci * @since 3 27061847f8eSopenharmony_ci * @deprecated since 7 27161847f8eSopenharmony_ci */ 27261847f8eSopenharmony_ci fail?: (data: string, code: number) => void; 27361847f8eSopenharmony_ci 27461847f8eSopenharmony_ci /** 27561847f8eSopenharmony_ci * Called when the execution is completed. 27661847f8eSopenharmony_ci * 27761847f8eSopenharmony_ci * @type { ?function } 27861847f8eSopenharmony_ci * @syscap SystemCapability.PowerManager.DisplayPowerManager.Lite 27961847f8eSopenharmony_ci * @since 3 28061847f8eSopenharmony_ci * @deprecated since 7 28161847f8eSopenharmony_ci */ 28261847f8eSopenharmony_ci complete?: () => void; 28361847f8eSopenharmony_ci} 28461847f8eSopenharmony_ci 28561847f8eSopenharmony_ci/** 28661847f8eSopenharmony_ci * @syscap SystemCapability.PowerManager.DisplayPowerManager.Lite 28761847f8eSopenharmony_ci * @since 3 28861847f8eSopenharmony_ci * @deprecated since 7 28961847f8eSopenharmony_ci */ 29061847f8eSopenharmony_ciexport default class Brightness { 29161847f8eSopenharmony_ci /** 29261847f8eSopenharmony_ci * Obtains the current screen brightness. 29361847f8eSopenharmony_ci * 29461847f8eSopenharmony_ci * @param { GetBrightnessOptions } options Options. 29561847f8eSopenharmony_ci * @syscap SystemCapability.PowerManager.DisplayPowerManager.Lite 29661847f8eSopenharmony_ci * @since 3 29761847f8eSopenharmony_ci * @deprecated since 7 29861847f8eSopenharmony_ci */ 29961847f8eSopenharmony_ci static getValue(options?: GetBrightnessOptions): void; 30061847f8eSopenharmony_ci 30161847f8eSopenharmony_ci /** 30261847f8eSopenharmony_ci * Sets the screen brightness. 30361847f8eSopenharmony_ci * 30461847f8eSopenharmony_ci * @param { SetBrightnessOptions } options Options. 30561847f8eSopenharmony_ci * @syscap SystemCapability.PowerManager.DisplayPowerManager.Lite 30661847f8eSopenharmony_ci * @since 3 30761847f8eSopenharmony_ci * @deprecated since 7 30861847f8eSopenharmony_ci */ 30961847f8eSopenharmony_ci static setValue(options?: SetBrightnessOptions): void; 31061847f8eSopenharmony_ci 31161847f8eSopenharmony_ci /** 31261847f8eSopenharmony_ci * Obtains the screen brightness adjustment mode. 31361847f8eSopenharmony_ci * 31461847f8eSopenharmony_ci * @param { GetBrightnessModeOptions } options Options. 31561847f8eSopenharmony_ci * @syscap SystemCapability.PowerManager.DisplayPowerManager.Lite 31661847f8eSopenharmony_ci * @since 3 31761847f8eSopenharmony_ci * @deprecated since 7 31861847f8eSopenharmony_ci */ 31961847f8eSopenharmony_ci static getMode(options?: GetBrightnessModeOptions): void; 32061847f8eSopenharmony_ci 32161847f8eSopenharmony_ci /** 32261847f8eSopenharmony_ci * Sets the screen brightness adjustment mode. 32361847f8eSopenharmony_ci * 32461847f8eSopenharmony_ci * @param { SetBrightnessModeOptions } options Options. 32561847f8eSopenharmony_ci * @syscap SystemCapability.PowerManager.DisplayPowerManager.Lite 32661847f8eSopenharmony_ci * @since 3 32761847f8eSopenharmony_ci * @deprecated since 7 32861847f8eSopenharmony_ci */ 32961847f8eSopenharmony_ci static setMode(options?: SetBrightnessModeOptions): void; 33061847f8eSopenharmony_ci 33161847f8eSopenharmony_ci /** 33261847f8eSopenharmony_ci * Sets whether to always keep the screen on. 33361847f8eSopenharmony_ci * 33461847f8eSopenharmony_ci * @param { SetKeepScreenOnOptions } options Options. 33561847f8eSopenharmony_ci * @syscap SystemCapability.PowerManager.DisplayPowerManager.Lite 33661847f8eSopenharmony_ci * @since 3 33761847f8eSopenharmony_ci * @deprecated since 7 33861847f8eSopenharmony_ci */ 33961847f8eSopenharmony_ci static setKeepScreenOn(options?: SetKeepScreenOnOptions): void; 34061847f8eSopenharmony_ci} 341