2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 * @author Taejeong Lee <taejeong.lee@samsung.com>
20 #include "SystemInfo.h"
21 #include <Commons/Exception.h>
25 #include <iniparser.h>
29 #define DEVICE_INFO_PATH "/etc/info.ini"
31 namespace WrtDeviceApis {
32 namespace SystemInfo {
33 SystemInfo& SystemInfo::getInstance()
35 static SystemInfo instance;
39 SystemInfo::~SystemInfo()
43 SystemInfo::SystemInfo()
47 string SystemInfo::getDeviceModelName()
49 // copied from settings-beat package
53 const char* szBinVer = NULL;
55 dictionary* dic = iniparser_load(DEVICE_INFO_PATH);
57 szBinVer = (char*)iniparser_getstr(dic, "Version:Build");
59 char* str = strdup(szBinVer);
66 sscanf(str, "%s %s", szBin, szEmul);
73 iniparser_freedict(dic);
77 if (!strncmp(szEmul, "emul", 4)) {
80 return string(string("GT-")+string(szBin));
84 string SystemInfo::getDeviceVersion()
86 // copied from settings-beat package
89 dictionary* dic = iniparser_load(DEVICE_INFO_PATH);
91 result = gettext("IDS_ST_HEADER_UNAVAILABLE");
94 strdup((char*)iniparser_getstr(dic, "Version:Build"));
95 char* pPos = szBinVer;
97 if ('.' == *pPos) *pPos = '\0';
100 result = string("Tizen") +
101 string((char*)iniparser_getstr(dic, "Version:Major")) +
103 string((char*)iniparser_getstr(dic, "Version:Minor")) +
104 string(" (") + string(szBinVer) + string(")");
110 iniparser_freedict(dic);