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 #include "parameter_ex.h"
16 #include <cstdint>
17
18 #include "parameter.h"
19 #include "parameters.h"
20
21 namespace OHOS {
22 namespace HiviewDFX {
23 namespace Parameter {
GetString(const std::string & key,const std::string & defaultValue)24 std::string GetString(const std::string& key, const std::string& defaultValue)
25 {
26 return OHOS::system::GetParameter(key, defaultValue);
27 }
28
GetInteger(const std::string & key,const int64_t defaultValue)29 int64_t GetInteger(const std::string& key, const int64_t defaultValue)
30 {
31 return OHOS::system::GetIntParameter(key, defaultValue);
32 }
33
GetUnsignedInteger(const std::string & key,const uint64_t defaultValue)34 uint64_t GetUnsignedInteger(const std::string& key, const uint64_t defaultValue)
35 {
36 return OHOS::system::GetUintParameter(key, defaultValue);
37 }
38
GetBoolean(const std::string & key,const bool defaultValue)39 bool GetBoolean(const std::string& key, const bool defaultValue)
40 {
41 return OHOS::system::GetBoolParameter(key, defaultValue);
42 }
43
SetProperty(const std::string & key,const std::string & defaultValue)44 bool SetProperty(const std::string& key, const std::string& defaultValue)
45 {
46 return OHOS::system::SetParameter(key, defaultValue);
47 }
48
WaitParamSync(const char * key,const char * value,int timeout)49 int WaitParamSync(const char *key, const char *value, int timeout)
50 {
51 return WaitParameter(key, value, timeout);
52 }
53 } // namespace Parameter
54 } // namespace HiviewDFX
55 } // namespace OHOS
56