161847f8eSopenharmony_ci/* 261847f8eSopenharmony_ci * Copyright (c) 2022 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_ciimport { AsyncCallback, BusinessError } from './@ohos.base'; 2261847f8eSopenharmony_ci 2361847f8eSopenharmony_ci/** 2461847f8eSopenharmony_ci * The interface of system parameters class. 2561847f8eSopenharmony_ci * 2661847f8eSopenharmony_ci * @namespace systemParameterEnhance 2761847f8eSopenharmony_ci * @syscap SystemCapability.Startup.SystemInfo 2861847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 2961847f8eSopenharmony_ci * @since 9 3061847f8eSopenharmony_ci */ 3161847f8eSopenharmony_cideclare namespace systemParameterEnhance { 3261847f8eSopenharmony_ci /** 3361847f8eSopenharmony_ci * Gets the value of the attribute with the specified key. 3461847f8eSopenharmony_ci * 3561847f8eSopenharmony_ci * @param { string } key Key of the system attribute, cannot exceed 128 characters, 3661847f8eSopenharmony_ci * only allow alphanumeric, plus '.', '-', '@', ':', or '_', don't allow '..'. 3761847f8eSopenharmony_ci * @param { string } def Default value. 3861847f8eSopenharmony_ci * @returns { string } the value of the parameter. 3961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 4061847f8eSopenharmony_ci * 2.incorrect parameter types; 3.parameter verification failed. 4161847f8eSopenharmony_ci * @throws { BusinessError } 14700101 - System parameter not found. 4261847f8eSopenharmony_ci * @throws { BusinessError } 14700103 - The operation on the system permission is denied. 4361847f8eSopenharmony_ci * @throws { BusinessError } 14700104 - System internal error such as out memory or deadlock. 4461847f8eSopenharmony_ci * @syscap SystemCapability.Startup.SystemInfo 4561847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 4661847f8eSopenharmony_ci * @since 9 4761847f8eSopenharmony_ci */ 4861847f8eSopenharmony_ci function getSync(key: string, def?: string): string; 4961847f8eSopenharmony_ci 5061847f8eSopenharmony_ci /** 5161847f8eSopenharmony_ci * Gets the value of the attribute with the specified key. 5261847f8eSopenharmony_ci * 5361847f8eSopenharmony_ci * @param { string } key Key of the system attribute, cannot exceed 128 characters, 5461847f8eSopenharmony_ci * only allow alphanumeric, plus '.', '-', '@', ':', or '_', don't allow '..'. 5561847f8eSopenharmony_ci * @param { AsyncCallback<string> } callback Callback function. 5661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 5761847f8eSopenharmony_ci * 2.incorrect parameter types; 3.parameter verification failed. 5861847f8eSopenharmony_ci * @throws { BusinessError } 14700101 - System parameter not found. 5961847f8eSopenharmony_ci * @throws { BusinessError } 14700103 - The operation on the system permission is denied. 6061847f8eSopenharmony_ci * @throws { BusinessError } 14700104 - System internal error such as out memory or deadlock. 6161847f8eSopenharmony_ci * @syscap SystemCapability.Startup.SystemInfo 6261847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 6361847f8eSopenharmony_ci * @since 9 6461847f8eSopenharmony_ci */ 6561847f8eSopenharmony_ci function get(key: string, callback: AsyncCallback<string>): void; 6661847f8eSopenharmony_ci 6761847f8eSopenharmony_ci /** 6861847f8eSopenharmony_ci * Gets the value of the attribute with the specified key. 6961847f8eSopenharmony_ci * 7061847f8eSopenharmony_ci * @param { string } key Key of the system attribute, cannot exceed 128 characters, 7161847f8eSopenharmony_ci * only allow alphanumeric, plus '.', '-', '@', ':', or '_', don't allow '..'. 7261847f8eSopenharmony_ci * @param { string } def Default value. 7361847f8eSopenharmony_ci * @param { AsyncCallback<string> } callback Callback function. 7461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 7561847f8eSopenharmony_ci * 2.incorrect parameter types; 3.parameter verification failed. 7661847f8eSopenharmony_ci * @throws { BusinessError } 14700101 - System parameter not found. 7761847f8eSopenharmony_ci * @throws { BusinessError } 14700103 - The operation on the system permission is denied. 7861847f8eSopenharmony_ci * @throws { BusinessError } 14700104 - System internal error such as out memory or deadlock. 7961847f8eSopenharmony_ci * @syscap SystemCapability.Startup.SystemInfo 8061847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 8161847f8eSopenharmony_ci * @since 9 8261847f8eSopenharmony_ci */ 8361847f8eSopenharmony_ci function get(key: string, def: string, callback: AsyncCallback<string>): void; 8461847f8eSopenharmony_ci 8561847f8eSopenharmony_ci /** 8661847f8eSopenharmony_ci * Gets the value of the attribute with the specified key. 8761847f8eSopenharmony_ci * 8861847f8eSopenharmony_ci * @param { string } key Key of the system attribute, cannot exceed 128 characters, 8961847f8eSopenharmony_ci * only allow alphanumeric, plus '.', '-', '@', ':', or '_', don't allow '..'. 9061847f8eSopenharmony_ci * @param { string } def Default value. 9161847f8eSopenharmony_ci * @returns { Promise<string> }, which is used to obtain the result asynchronously. 9261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 9361847f8eSopenharmony_ci * 2.incorrect parameter types; 3.parameter verification failed. 9461847f8eSopenharmony_ci * @throws { BusinessError } 14700101 - System parameter not found. 9561847f8eSopenharmony_ci * @throws { BusinessError } 14700103 - The operation on the system permission is denied. 9661847f8eSopenharmony_ci * @throws { BusinessError } 14700104 - System internal error such as out memory or deadlock. 9761847f8eSopenharmony_ci * @syscap SystemCapability.Startup.SystemInfo 9861847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 9961847f8eSopenharmony_ci * @since 9 10061847f8eSopenharmony_ci */ 10161847f8eSopenharmony_ci function get(key: string, def?: string): Promise<string>; 10261847f8eSopenharmony_ci 10361847f8eSopenharmony_ci /** 10461847f8eSopenharmony_ci * Sets a value for the attribute with the specified key. 10561847f8eSopenharmony_ci * 10661847f8eSopenharmony_ci * @param { string } key Key of the system attribute, cannot exceed 128 characters, 10761847f8eSopenharmony_ci * only allow alphanumeric, plus '.', '-', '@', ':', or '_', don't allow '..'. 10861847f8eSopenharmony_ci * @param { string } value System attribute value to set, cannot exceed 96 characters. 10961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 11061847f8eSopenharmony_ci * 2.incorrect parameter types; 3.parameter verification failed. 11161847f8eSopenharmony_ci * @throws { BusinessError } 14700102 - Invalid system parameter value. 11261847f8eSopenharmony_ci * @throws { BusinessError } 14700103 - The operation on the system permission is denied. 11361847f8eSopenharmony_ci * @throws { BusinessError } 14700104 - System internal error such as out memory or deadlock. 11461847f8eSopenharmony_ci * @syscap SystemCapability.Startup.SystemInfo 11561847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 11661847f8eSopenharmony_ci * @since 9 11761847f8eSopenharmony_ci */ 11861847f8eSopenharmony_ci function setSync(key: string, value: string): void; 11961847f8eSopenharmony_ci 12061847f8eSopenharmony_ci /** 12161847f8eSopenharmony_ci * Sets a value for the attribute with the specified key. 12261847f8eSopenharmony_ci * 12361847f8eSopenharmony_ci * @param { string } key Key of the system attribute, cannot exceed 128 characters, 12461847f8eSopenharmony_ci * only allow alphanumeric, plus '.', '-', '@', ':', or '_', don't allow '..'. 12561847f8eSopenharmony_ci * @param { string } value System attribute value to set, cannot exceed 96 characters. 12661847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback Callback function. 12761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 12861847f8eSopenharmony_ci * 2.incorrect parameter types; 3.parameter verification failed. 12961847f8eSopenharmony_ci * @throws { BusinessError } 14700102 - Invalid system parameter value. 13061847f8eSopenharmony_ci * @throws { BusinessError } 14700103 - The operation on the system permission is denied. 13161847f8eSopenharmony_ci * @throws { BusinessError } 14700104 - System internal error such as out memory or deadlock. 13261847f8eSopenharmony_ci * @syscap SystemCapability.Startup.SystemInfo 13361847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 13461847f8eSopenharmony_ci * @since 9 13561847f8eSopenharmony_ci */ 13661847f8eSopenharmony_ci function set(key: string, value: string, callback: AsyncCallback<void>): void; 13761847f8eSopenharmony_ci 13861847f8eSopenharmony_ci /** 13961847f8eSopenharmony_ci * Sets a value for the attribute with the specified key. 14061847f8eSopenharmony_ci * 14161847f8eSopenharmony_ci * @param { string } key Key of the system attribute, cannot exceed 128 characters, 14261847f8eSopenharmony_ci * only allow alphanumeric, plus '.', '-', '@', ':', or '_', don't allow '..'. 14361847f8eSopenharmony_ci * @param { string } value Default value, cannot exceed 96 characters. 14461847f8eSopenharmony_ci * @returns { Promise<void> }, which is used to obtain the result asynchronously. 14561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 14661847f8eSopenharmony_ci * 2.incorrect parameter types; 3.parameter verification failed. 14761847f8eSopenharmony_ci * @throws { BusinessError } 14700102 - Invalid system parameter value. 14861847f8eSopenharmony_ci * @throws { BusinessError } 14700103 - The operation on the system permission is denied. 14961847f8eSopenharmony_ci * @throws { BusinessError } 14700104 - System internal error such as out memory or deadlock. 15061847f8eSopenharmony_ci * @syscap SystemCapability.Startup.SystemInfo 15161847f8eSopenharmony_ci * @systemapi Hide this for inner system use. 15261847f8eSopenharmony_ci * @since 9 15361847f8eSopenharmony_ci */ 15461847f8eSopenharmony_ci function set(key: string, value: string): Promise<void>; 15561847f8eSopenharmony_ci} 15661847f8eSopenharmony_ci 15761847f8eSopenharmony_ciexport default systemParameterEnhance; 158