1/* 2 * Copyright (c) 2021 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 { AsyncCallback, BusinessError } from './@ohos.base'; 22 23/** 24 * The interface of system parameters class. 25 * 26 * @namespace systemParameter 27 * @syscap SystemCapability.Startup.SystemInfo 28 * @systemapi Hide this for inner system use. 29 * @since 6 30 */ 31declare namespace systemParameter { 32 /** 33 * Gets the value of the attribute with the specified key. 34 * 35 * @param { string } key Key of the system attribute. 36 * @param { string } def Default value. 37 * @returns { string } if the parameter is empty or doesn't exist, empty string will be returned. 38 * @syscap SystemCapability.Startup.SystemInfo 39 * @systemapi Hide this for inner system use. 40 * @since 6 41 * @deprecated since 9 42 */ 43 function getSync(key: string, def?: string): string; 44 45 /** 46 * Gets the value of the attribute with the specified key. 47 * 48 * @param { string } key Key of the system attribute. 49 * @param { AsyncCallback<string> } callback Callback function. 50 * @syscap SystemCapability.Startup.SystemInfo 51 * @systemapi Hide this for inner system use. 52 * @since 6 53 * @deprecated since 9 54 */ 55 function get(key: string, callback: AsyncCallback<string>): void; 56 57 /** 58 * Gets the value of the attribute with the specified key. 59 * 60 * @param { string } key Key of the system attribute. 61 * @param { string } def Default value. 62 * @param { AsyncCallback<string> } callback Callback function. 63 * @syscap SystemCapability.Startup.SystemInfo 64 * @systemapi Hide this for inner system use. 65 * @since 6 66 * @deprecated since 9 67 */ 68 function get(key: string, def: string, callback: AsyncCallback<string>): void; 69 70 /** 71 * Gets the value of the attribute with the specified key. 72 * 73 * @param { string } key Key of the system attribute. 74 * @param { string } def Default value. 75 * @returns { Promise<string> } , which is used to obtain the result asynchronously. 76 * @syscap SystemCapability.Startup.SystemInfo 77 * @systemapi Hide this for inner system use. 78 * @since 6 79 * @deprecated since 9 80 */ 81 function get(key: string, def?: string): Promise<string>; 82 83 /** 84 * Sets a value for the attribute with the specified key. 85 * 86 * @param { string } key Key of the system attribute. 87 * @param { string } value value System attribute value to set. 88 * @syscap SystemCapability.Startup.SystemInfo 89 * @systemapi Hide this for inner system use. 90 * @since 6 91 */ 92 function setSync(key: string, value: string): void; 93 94 /** 95 * Sets a value for the attribute with the specified key. 96 * 97 * @param { string } key Key of the system attribute. 98 * @param { string } value System attribute value to set. 99 * @param { AsyncCallback<void> } callback Callback function. 100 * @syscap SystemCapability.Startup.SystemInfo 101 * @systemapi Hide this for inner system use. 102 * @since 6 103 * @deprecated since 9 104 */ 105 function set(key: string, value: string, callback: AsyncCallback<void>): void; 106 107 /** 108 * Sets a value for the attribute with the specified key. 109 * 110 * @param { string } key Key of the system attribute. 111 * @param { string } value Default value. 112 * @returns { Promise<void> } which is used to obtain the result asynchronously. 113 * @syscap SystemCapability.Startup.SystemInfo 114 * @systemapi Hide this for inner system use. 115 * @since 6 116 * @deprecated since 9 117 */ 118 function set(key: string, value: string): Promise<void>; 119} 120 121export default systemParameter; 122