2 * Samsung Ukraine R&D Center (SRK under a contract between)
3 * LLC "Samsung Electronics Co", Ltd (Seoul, Republic of Korea)
4 * Copyright (C) 2018 Samsung Electronics Co., Ltd. All rights reserved.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License
20 * @brief System information collector
21 * @date Created Feb 26, 2018
22 * @author Mail to: <A HREF="mailto:d.lomtev@samsung.com">Dmytro Lomtev, d.lomtev@samsung.com</A>
25 #include <system/system_info.h>
32 const std::string UNDEFINED_VAL{"undefined"};
35 * @brief getStringSystemProperty returns system property as std::string
36 * @param prop the requested system property key
37 * @return requested system property on success and "undefined" otherwise
39 bool getStringSystemProperty(system_info_key_e prop, std::string& property)
43 if (0 == system_info_get_value_string(prop, &val)) {
53 * @brief getStringPlatformProperty returns platform property as std::string
54 * @param prop the requested platform property key
55 * @return requested platform property on success and "undefined" otherwise
57 bool getStringPlatformProperty(const char* prop, std::string& property)
61 if (0 == system_info_get_platform_string(prop, &val)) {
75 std::string SysInfo::model()
78 if (!getStringSystemProperty(SYSTEM_INFO_KEY_MODEL, prop)
79 && !getStringPlatformProperty("tizen.org/system/model_name", prop)) {
85 std::string SysInfo::type()
88 if (!getStringPlatformProperty("com.samsung/build_config/product_type", prop)
89 && !getStringPlatformProperty("tizen.org/feature/profile", prop)) {
95 std::string SysInfo::osVersion()
98 if (!getStringPlatformProperty("tizen.org/feature/platform.version", prop)) {
104 std::string SysInfo::osName()
107 if (!getStringSystemProperty(SYSTEM_INFO_KEY_PLATFORM_NAME, prop)
108 && !getStringPlatformProperty("tizen.org/system/platform.name", prop)) {
109 prop = UNDEFINED_VAL;
114 std::string SysInfo::swVersion()
117 if (!getStringSystemProperty(SYSTEM_INFO_KEY_TIZEN_VERSION, prop)
118 && !getStringPlatformProperty("tizen.org/system/build.string", prop)) {
119 prop = UNDEFINED_VAL;
124 std::string SysInfo::tizenId()
127 if (!getStringPlatformProperty("tizen.org/system/tizenid", prop)) {
128 prop = UNDEFINED_VAL;