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