2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FSys_SystemInfoImpl.cpp
20 * @brief This is the implementation file for _SystemInfoImpl class.
24 #include <media/sound_manager.h>
28 #include <system_info.h>
29 #include <telephony_network.h>
30 #include <locations.h>
32 #include <FBaseColIMapEnumerator.h>
33 #include <FBaseInteger.h>
34 #include <FBaseSysLog.h>
35 #include <FBaseUtilStringUtil.h>
36 #include <FBaseUtilStringTokenizer.h>
37 #include <FIoRegistry.h>
38 #include <FSysIDeviceEventListener.h>
39 #include <FSysIScreenEventListener.h>
40 #include <FSysIChargingEventListener.h>
41 #include <FSysIBatteryEventListener.h>
43 #include <FBase_NativeError.h>
44 #include <FIo_RegistryImpl.h>
45 #include <FSys_DeviceId.h>
46 #include <FSys_SystemInfoImpl.h>
48 using namespace Tizen::Base;
49 using namespace Tizen::Base::Collection;
50 using namespace Tizen::Base::Utility;
51 using namespace Tizen::Io;
53 namespace Tizen { namespace System
56 static const wchar_t* _REGISTRY_PATH = L"/usr/etc/system-info.ini";
57 static const wchar_t* _SYSTEM_INFO_SESSION = L"SystemInfo";
60 static const wchar_t* _BLUETOOTH = L"http://tizen.org/feature/network.bluetooth";
61 static const wchar_t* _BLUETOOTH_SUPPORTED = L"BluetoothSupported";
64 static const wchar_t* _CAMERA = L"http://tizen.org/feature/camera";
65 static const wchar_t* _CAMERA_FRONT = L"http://tizen.org/feature/camera.front";
66 static const wchar_t* _CAMERA_FRONT_FLASH = L"http://tizen.org/feature/camera.front.flash";
67 static const wchar_t* _CAMERA_BACK = L"http://tizen.org/feature/camera.back";
68 static const wchar_t* _CAMERA_BACK_FLASH = L"http://tizen.org/feature/camera.back.flash";
69 static const wchar_t* _CAMERA_COUNT = L"CameraCount";
72 static const wchar_t* _DATABASE_ENCRYPTION = L"http://tizen.org/feature/database.encryption";
73 static const char* _DATABASE_LIBRARY_PATH = "/usr/lib/libsqlite3.so.0";
74 static const char* _DATABASE_ENCRYPTION_SYMBOL = "sqlite3_key";
77 static const wchar_t* _DUID = L"http://tizen.org/system/duid";
78 static const wchar_t* _DEVICE_ID = L"DUID";
81 static const wchar_t* _FMRADIO = L"http://tizen.org/feature/fmradio";
82 static const wchar_t* _FM_RADIO_SUPPORTED = L"FmRadioSupported";
85 static const wchar_t* _KEYBOARD_TYPE = L"KeyboardType";
86 static const wchar_t* _INPUT_KEYBOARD = L"http://tizen.org/feature/input.keyboard";
87 static const wchar_t* _INPUT_KEYBOARD_LAYOUT = L"http://tizen.org/feature/input.keyboard.layout";
90 static const wchar_t* _LOCATION = L"http://tizen.org/feature/location";
91 static const wchar_t* _GPS_SUPPORTED = L"GPSSupported";
92 static const wchar_t* _LOCATION_GPS = L"http://tizen.org/feature/location.gps";
93 static const wchar_t* _WPS_SUPPORTED = L"WPSSupported";
94 static const wchar_t* _LOCATION_WPS = L"http://tizen.org/feature/location.wps";
97 static const wchar_t* _MICROPHONE = L"http://tizen.org/feature/microphone";
100 static const wchar_t* _MODELNAME = L"http://tizen.org/system/model_name";
101 static const wchar_t* _MODEL_NAME = L"ModelName";
104 static const wchar_t* _MULTIPOINTTOUCH_POINTCOUNT = L"http://tizen.org/feature/multi_point_touch.point_count";
105 static const wchar_t* _MULTIPOINT_TOUCH_COUNT = L"MultiPointTouchCount";
108 static const wchar_t* _NFC = L"http://tizen.org/feature/nfc";
109 static const wchar_t* _NETWORK_NFC = L"http://tizen.org/feature/network.nfc";
110 static const wchar_t* _NFC_SUPPORTED = L"NFCSupported";
113 static const wchar_t* _OPENGLES_TEXTUREFORMAT_UTC = L"http://tizen.org/feature/opengles.texture_format.utc";
114 static const wchar_t* _OPENGLES_TEXTUREFORMAT_PTC = L"http://tizen.org/feature/opengles.texture_format.ptc";
115 static const wchar_t* _OPENGLES_TEXTUREFORMAT_ETC = L"http://tizen.org/feature/opengles.texture_format.etc";
116 static const wchar_t* _OPENGLES_TEXTUREFORMAT_3DC = L"http://tizen.org/feature/opengles.texture_format.3dc";
117 static const wchar_t* _OPENGLES_TEXTUREFORMAT_ATC = L"http://tizen.org/feature/opengles.texture_format.atc";
118 static const wchar_t* _OPENGLES_TEXTUREFORMAT_PVRTC = L"http://tizen.org/feature/opengles.texture_format.pvrtc";
120 static const wchar_t* _OPENGLES_VERSION_1_1 = L"http://tizen.org/feature/opengles.version.1_1";
121 static const wchar_t* _OPENGLES_VERSION_2_0 = L"http://tizen.org/feature/opengles.version.2_0";
122 static const wchar_t* _OPENGL_ES_VERSION = L"OpenGLESVersion";
125 static const wchar_t* _PLATFORM_NAME = L"http://tizen.org/system/platform.name";
128 static const wchar_t* _PLATFORM_CORE_CPU_ARCH_ARMV6 = L"http://tizen.org/feature/platform.core.cpu.arch.armv6";
129 static const wchar_t* _PLATFORM_CORE_CPU_ARCH_ARMV7 = L"http://tizen.org/feature/platform.core.cpu.arch.armv7";
130 static const wchar_t* _PLATFORM_CORE_CPU_ARCH_X86 = L"http://tizen.org/feature/platform.core.cpu.arch.x86";
133 static const wchar_t* _PLATFORM_CORE_FPU_ARCH_VFPV2 = L"http://tizen.org/feature/platform.core.fpu.arch.vfpv2";
134 static const wchar_t* _PLATFORM_CORE_FPU_ARCH_VFPV3 = L"http://tizen.org/feature/platform.core.fpu.arch.vfpv3";
135 static const wchar_t* _PLATFORM_CORE_FPU_ARCH_SSE2 = L"http://tizen.org/feature/platform.core.fpu.arch.sse2";
136 static const wchar_t* _PLATFORM_CORE_FPU_ARCH_SSE3 = L"http://tizen.org/feature/platform.core.fpu.arch.sse3";
137 static const wchar_t* _PLATFORM_CORE_FPU_ARCH_SSSE3 = L"http://tizen.org/feature/platform.core.fpu.arch.ssse3";
140 static const wchar_t* _SCREEN_BPP = L"http://tizen.org/feature/screen.bpp";
141 static const wchar_t* _SCREEN_BITS_PER_PIXEL = L"ScreenBitsPerPixel";
142 static const wchar_t* _SCREEN_DESKTOPMODE = L"http://tizen.org/feature/screen.desktop_mode";
143 static const wchar_t* _SCREEN_DPI = L"http://tizen.org/feature/screen.dpi";
144 static const wchar_t* _SCREEN_HEIGHT = L"http://tizen.org/feature/screen.height";
145 static const wchar_t* _SCREENHEIGHT = L"ScreenHeight";
146 static const wchar_t* _SCREEN_WIDTH = L"http://tizen.org/feature/screen.width";
147 static const wchar_t* _SCREENWIDTH = L"ScreenWidth";
148 static const wchar_t* _SCREENDPI = L"ScreenDPI";
151 static const wchar_t* _SCREEN_OUTPUT_HDMI = L"http://tizen.org/feature/screen.output.hdmi";
152 static const wchar_t* _SCREEN_OUTPUT_RCA = L"http://tizen.org/feature/screen.output.rca";
153 static const wchar_t* _TV_OUT_SUPPORTED = L"TvOutSupported";
156 static const wchar_t* _SENSOR_ACCELEROMETER = L"http://tizen.org/feature/sensor.accelerometer";
157 static const wchar_t* _SENSOR_ACCELEROMETER_WAKEUP = L"http://tizen.org/feature/sensor.accelerometer.wakeup";
158 static const wchar_t* _SENSOR_BAROMETER = L"http://tizen.org/feature/sensor.barometer";
159 static const wchar_t* _SENSOR_BAROMETER_WAKEUP = L"http://tizen.org/feature/sensor.barometer.wakeup";
160 static const wchar_t* _SENSOR_MAGNETOMETER = L"http://tizen.org/feature/sensor.magnetometer";
161 static const wchar_t* _SENSOR_MAGNETOMETER_WAKEUP = L"http://tizen.org/feature/sensor.magnetometer.wakeup";
162 static const wchar_t* _SENSOR_GYROSCOPE = L"http://tizen.org/feature/sensor.gyroscope";
163 static const wchar_t* _SENSOR_GYROSCOPE_WAKEUP = L"http://tizen.org/feature/sensor.gyroscope.wakeup";
164 static const wchar_t* _SENSOR_PHOTOMETER = L"http://tizen.org/feature/sensor.photometer";
165 static const wchar_t* _SENSOR_PHOTOMETER_WAKEUP = L"http://tizen.org/feature/sensor.photometer.wakeup";
166 static const wchar_t* _SENSOR_TILTMETER = L"http://tizen.org/feature/sensor.tiltmeter";
167 static const wchar_t* _SENSOR_TILTMETER_WAKEUP = L"http://tizen.org/feature/sensor.tiltmeter.wakeup";
168 static const wchar_t* _SENSOR_PROXIMITY = L"http://tizen.org/feature/sensor.proximity";
169 static const wchar_t* _SENSOR_PROXIMITY_WAKEUP = L"http://tizen.org/feature/sensor.proximity.wakeup";
172 static const wchar_t* _SIP_VOIP = L"http://tizen.org/feature/sip.voip";
175 static const wchar_t* _SOUND_MEDIA_VOLUME_MAX = L"http://tizen.org/system/sound.media.volume.resolution.max";
176 static const wchar_t* _MAX_MEDIA_SOUND_VOLUME = L"MaxMediaSoundVolume";
177 static const wchar_t* _SOUND_NOTIFICATION_VOLUME_MAX = L"http://tizen.org/system/sound.notification.volume.resolution.max";
178 static const wchar_t* _MAX_NOTIFICATION_SOUND_VOLUME = L"MaxNotificationSoundVolume";
179 static const wchar_t* _SOUND_RINGTONE_VOLUME_MAX = L"http://tizen.org/system/sound.ringtone.volume.resolution.max";
180 static const wchar_t* _MAX_RINGTONE_SOUND_VOLUME = L"MaxRingtoneSoundVolume";
181 static const wchar_t* _SOUND_SYSTEM_VOLUME_MAX = L"http://tizen.org/system/sound.system.volume.resolution.max";
182 static const wchar_t* _MAX_SYSTEM_SOUND_VOLUME = L"MaxSystemSoundVolume";
185 static const wchar_t* _SPEECH_RECOGNITION = L"http://tizen.org/feature/speech.recognition";
188 static const wchar_t* _TELEPHONY = L"http://tizen.org/feature/network.telephony";
189 static const wchar_t* _TELEPHONY_SERVICE_GSM = L"http://tizen.org/feature/network.telephony.service.gsm";
190 static const wchar_t* _TELEPHONY_SERVICE_GPRS = L"http://tizen.org/feature/network.telephony.service.gprs";
191 static const wchar_t* _TELEPHONY_SERVICE_EDGE = L"http://tizen.org/feature/network.telephony.service.edge";
192 static const wchar_t* _TELEPHONY_SERVICE_UMTS = L"http://tizen.org/feature/network.telephony.service.umts";
193 static const wchar_t* _TELEPHONY_SERVICE_HSDPA = L"http://tizen.org/feature/network.telephony.service.hsdpa";
194 static const wchar_t* _TELEPHONY_SERVICE_HSUPA = L"http://tizen.org/feature/network.telephony.service.hsupa";
195 static const wchar_t* _TELEPHONY_SERVICE_HSPA = L"http://tizen.org/feature/network.telephony.service.hspa";
196 static const wchar_t* _TELEPHONY_SERVICE_LTE = L"http://tizen.org/feature/network.telephony.service.lte";
197 static const wchar_t* _TELEPHONY_SERVICE_CDMA = L"http://tizen.org/feature/network.telephony.service.cdma";
198 static const wchar_t* _NETWORK_TYPE = L"NetworkType";
199 static const wchar_t* _NETWORK_EMERGENCY = L"Emergency";
202 static const wchar_t* _USB_HOST = L"http://tizen.org/feature/usb.host";
203 static const wchar_t* _USB_ACCESSORY = L"http://tizen.org/feature/usb.accessory";
206 static const wchar_t* _WIFI = L"http://tizen.org/feature/network.wifi";
207 static const wchar_t* _WIFI_SUPPORTED = L"WiFiSupported";
208 static const wchar_t* _WIFI_DIRECT_SUPPORTED = L"WiFiDirectSupported";
209 static const wchar_t* _WIFI_DIRECT = L"http://tizen.org/feature/network.wifi.direct";
212 static const wchar_t* _PLATFORM_VERSION = L"http://tizen.org/feature/platform.version";
213 static const wchar_t* _PLATFORM_NATIVE_API_VERSION = L"http://tizen.org/feature/platform.native.api.version";
214 static const wchar_t* _PLATFORM_WEB_API_VERSION = L"http://tizen.org/feature/platform.web.api.version";
216 static const wchar_t* _WAC_VERSION = L"WACVersion";
217 static const wchar_t* _SUPPORTED = L"Supported";
218 static const wchar_t* _UNSUPPORTED = L"Unsupported";
221 _SystemInfoImpl::GetSysInfo(const String& key, String& value)
227 if (key == _NETWORK_TYPE)
229 sim_state_e simState;
230 ret = sim_get_state(&simState);
232 SysTryReturnResult(NID_SYS, ret == 0, E_SYSTEM, "Failed to get the SIM state");
234 if (simState == SIM_STATE_UNAVAILABLE)
236 value.Append(_NETWORK_EMERGENCY);
240 ret = system_info_get_value_string(SYSTEM_INFO_KEY_NETWORK_TYPE, &pValue);
241 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "[E_SYSTEM] system_info_get_value_string : \"SYSTEM_INFO_KEY_NETWORK_TYPE\"failed");
249 r = StringUtil::Utf8ToString(pValue, value);
250 SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_SYSTEM, r, "[%s] StringUtil::Utf8ToString failed", GetErrorMessage(r));
252 else if (key == _DEVICE_ID || key == _DUID)
254 r = _DeviceId::GetId(value);
255 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "Failed to get the key[%ls]", key.GetPointer());
258 else if (key == _MODEL_NAME || key == _MODELNAME)
260 ret = system_info_get_value_string(SYSTEM_INFO_KEY_MODEL, &pValue);
261 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE && pValue, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_MODEL");
263 r = StringUtil::Utf8ToString(pValue, value);
264 SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_SYSTEM, r, "[%s] StringUtil::Utf8ToString failed", GetErrorMessage(r));
266 else if (key == _OPENGL_ES_VERSION)
268 ret = system_info_get_value_string(SYSTEM_INFO_KEY_OPENGLES_VERSION, &pValue);
269 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE && pValue, E_SYSTEM, "[E_SYSTEM] system_info_get_value_string : \"SYSTEM_INFO_KEY_OPENGLES_TEXTURE_FORMAT\"failed");
271 r = StringUtil::Utf8ToString(pValue, value);
272 SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_SYSTEM, r, "[%s] StringUtil::Utf8ToString failed", GetErrorMessage(r));
274 else if (key == _KEYBOARD_TYPE || key == _INPUT_KEYBOARD_LAYOUT)
276 ret = system_info_get_value_string(SYSTEM_INFO_KEY_KEYBOARD_TYPE, &pValue);
277 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "[E_SYSTEM] system_info_get_value_string : \"SYSTEM_INFO_KEY_KEYBOARD_TYPE\"failed");
285 r = StringUtil::Utf8ToString(pValue, value);
286 SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_SYSTEM, r, "[%s] StringUtil::Utf8ToString failed", GetErrorMessage(r));
288 if(key == _INPUT_KEYBOARD_LAYOUT)
293 else if (key == _WAC_VERSION)
298 else if (key == _BLUETOOTH_SUPPORTED)
301 bool bluetoothSupported = false;
302 ret = system_info_get_value_bool(SYSTEM_INFO_KEY_BLUETOOTH_SUPPORTED, &bluetoothSupported);
303 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY__BLUETOOTH_SUPPORTED");
304 if(bluetoothSupported == true)
310 value = _UNSUPPORTED;
315 else if (key == _GPS_SUPPORTED)
318 bool gpsSupported = false;
319 ret = system_info_get_value_bool(SYSTEM_INFO_KEY_GPS_SUPPORTED, &gpsSupported);
320 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY__GPS_SUPPORTED");
321 if(gpsSupported == true)
327 value = _UNSUPPORTED;
331 else if (key == _WIFI_SUPPORTED)
334 bool wiFiSupported = false;
335 ret = system_info_get_value_bool(SYSTEM_INFO_KEY_WIFI_SUPPORTED, &wiFiSupported);
336 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY__WIFI_SUPPORTED");
337 if(wiFiSupported == true)
343 value = _UNSUPPORTED;
347 else if (key == _PLATFORM_VERSION)
349 char* pPlatformVersion = null;
350 ret = system_info_get_value_string(SYSTEM_INFO_KEY_TIZEN_VERSION, &pPlatformVersion);
351 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "[E_SYSTEM] system_info_get_value_string : \"SYSTEM_INFO_KEY_PLATFORM_NAME\"failed");
353 r = StringUtil::Utf8ToString(pPlatformVersion, value);
354 SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "[%s] StringUtil::Utf8ToString failed", GetErrorMessage(r));
355 free(pPlatformVersion);
359 else if (key == _PLATFORM_NAME)
361 ret = system_info_get_value_string(SYSTEM_INFO_KEY_PLATFORM_NAME, &pValue);
362 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "[E_SYSTEM] system_info_get_value_string : \"SYSTEM_INFO_KEY_PLATFORM_NAME\"failed");
364 r = StringUtil::Utf8ToString(pValue, value);
365 SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_SYSTEM, r, "[%s] StringUtil::Utf8ToString failed", GetErrorMessage(r));
367 else if (key == _PLATFORM_NATIVE_API_VERSION)
369 return E_OBJ_NOT_FOUND;
371 else if (key == _PLATFORM_WEB_API_VERSION)
373 return E_OBJ_NOT_FOUND;
377 r = GetFromRegistry(key, value);
378 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_OBJ_NOT_FOUND, "Failed to get the key[%ls]", key.GetPointer());
391 _SystemInfoImpl::GetSysInfo(const String& key, int& value)
394 result r = E_SUCCESS;
396 if (key == _CAMERA_COUNT)
399 ret = system_info_get_value_int(SYSTEM_INFO_KEY_CAMERA_COUNT, &cameraCount);
400 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY__CAMERA_COUNT");
403 else if (key == _SCREEN_BITS_PER_PIXEL ||key == _SCREEN_BPP)
405 int screenBitsPerPixel = 0;
406 ret = system_info_get_value_int(SYSTEM_INFO_KEY_SCREEN_BITS_PER_PIXEL, &screenBitsPerPixel);
407 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY__SCREEN_BITS_PER_PIXEL");
408 value = screenBitsPerPixel;
410 else if (key == _SCREENHEIGHT || key == _SCREEN_HEIGHT)
412 int screenHeight = 0;
413 ret = system_info_get_value_int(SYSTEM_INFO_KEY_SCREEN_HEIGHT, &screenHeight);
414 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY__SCREEN_HEIGHT");
415 value = screenHeight;
417 else if (key == _SCREENWIDTH || key == _SCREEN_WIDTH)
420 ret = system_info_get_value_int(SYSTEM_INFO_KEY_SCREEN_WIDTH, &screenWidth);
421 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY__SCREEN_WIDTH");
424 else if (key == _SCREENDPI || key == _SCREEN_DPI)
427 ret = system_info_get_value_int(SYSTEM_INFO_KEY_SCREEN_DPI, &screenDPI);
428 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY__SCREEN_DPI");
431 else if (key == _MAX_SYSTEM_SOUND_VOLUME || key == _SOUND_SYSTEM_VOLUME_MAX)
434 int ret = sound_manager_get_max_volume(SOUND_TYPE_SYSTEM, &maxVolume);
435 SysTryReturnResult(NID_SYS, ret == SOUND_MANAGER_ERROR_NONE, E_SYSTEM, "Failed to get the max volume");
438 else if (key == _MAX_MEDIA_SOUND_VOLUME || key == _SOUND_MEDIA_VOLUME_MAX)
441 int ret = sound_manager_get_max_volume(SOUND_TYPE_MEDIA, &maxVolume);
442 SysTryReturnResult(NID_SYS, ret == SOUND_MANAGER_ERROR_NONE, E_SYSTEM, "Failed to get the max volume");
446 else if (key == _MAX_RINGTONE_SOUND_VOLUME || key == _SOUND_RINGTONE_VOLUME_MAX)
449 int ret = sound_manager_get_max_volume(SOUND_TYPE_RINGTONE, &maxVolume);
450 SysTryReturnResult(NID_SYS, ret == SOUND_MANAGER_ERROR_NONE, E_SYSTEM, "Failed to get the max volume");
454 else if (key == _MAX_NOTIFICATION_SOUND_VOLUME || key == _SOUND_NOTIFICATION_VOLUME_MAX)
457 int ret = sound_manager_get_max_volume(SOUND_TYPE_NOTIFICATION, &maxVolume);
458 SysTryReturnResult(NID_SYS, ret == SOUND_MANAGER_ERROR_NONE, E_SYSTEM, "Failed to get the max volume");
461 else if (key == _MULTIPOINT_TOUCH_COUNT || key == _MULTIPOINTTOUCH_POINTCOUNT)
463 int multiPointTouchCount = 0;
464 ret = system_info_get_value_int(SYSTEM_INFO_KEY_MULTI_POINT_TOUCH_COUNT, &multiPointTouchCount);
465 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the ISYSTEM_INFO_KEY_MULTI_POINT_TOUCH_COUNT");
466 value = multiPointTouchCount;
470 r = GetFromRegistry(key, value);
471 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_OBJ_NOT_FOUND, "Failed to get the key[%ls]", key.GetPointer());
479 _SystemInfoImpl::GetSysInfo(const String& key, long long& value)
481 return E_OBJ_NOT_FOUND;
486 _SystemInfoImpl::GetSysInfo(const String& key, double& value)
488 return E_OBJ_NOT_FOUND;
493 _SystemInfoImpl::GetSysInfo(const String& key, bool& value)
496 result r = E_SUCCESS;
498 if (key == _BLUETOOTH_SUPPORTED || key == _BLUETOOTH)
500 bool bluetoothSupported = false;
501 ret = system_info_get_value_bool(SYSTEM_INFO_KEY_BLUETOOTH_SUPPORTED, &bluetoothSupported);
502 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_BLUETOOTH_SUPPORTED");
503 value = bluetoothSupported;
505 else if (key == _CAMERA)
508 ret = system_info_get_value_int(SYSTEM_INFO_KEY_CAMERA_COUNT, &cameraCount);
509 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY__CAMERA_COUNT");
520 else if (key == _CAMERA_FRONT)
522 bool frontCameraSupported = false;
523 ret = system_info_get_value_bool(SYSTEM_INFO_KEY_FRONT_CAMERA_SUPPORTED, &frontCameraSupported);
524 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_FRONT_CAMERA_SUPPORTED");
525 value = frontCameraSupported;
527 else if (key == _CAMERA_FRONT_FLASH)
529 bool frontCameraFlashSupported = false;
530 ret = system_info_get_value_bool(SYSTEM_INFO_KEY_FRONT_CAMERA_FLASH_SUPPORTED, &frontCameraFlashSupported);
531 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_FRONT_CAMERA_FLASH_SUPPORTED");
532 value = frontCameraFlashSupported;
534 else if (key == _CAMERA_BACK)
536 bool backCameraSupported = false;
537 ret = system_info_get_value_bool(SYSTEM_INFO_KEY_BACK_CAMERA_SUPPORTED, &backCameraSupported);
538 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_FRONT_CAMERA_SUPPORTED");
539 value = backCameraSupported;
541 else if ( key == _CAMERA_BACK_FLASH)
543 bool backCameraFlashSupported = false;
544 ret = system_info_get_value_bool(SYSTEM_INFO_KEY_BACK_CAMERA_FLASH_SUPPORTED, &backCameraFlashSupported);
545 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_FRONT_CAMERA_FLASH_SUPPORTED");
546 value = backCameraFlashSupported;
548 else if (key == _DATABASE_ENCRYPTION)
551 void* handle = dlopen(_DATABASE_LIBRARY_PATH, RTLD_NOW);
552 SysTryReturnResult(NID_SYS, handle != null, E_SYSTEM, "Failed to open database library file");
553 void* function = dlsym(handle, _DATABASE_ENCRYPTION_SYMBOL);
554 if (function != null)
567 else if (key == _LOCATION)
569 bool gpsSupported = false;
570 bool wpsSupported = false;
572 ret = system_info_get_value_bool(SYSTEM_INFO_KEY_GPS_SUPPORTED, &gpsSupported);
573 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_GPS_SUPPORTED");
574 wpsSupported = location_manager_is_supported_method(LOCATIONS_METHOD_WPS);
576 if(gpsSupported == true || wpsSupported == true)
585 else if (key == _GPS_SUPPORTED || key == _LOCATION_GPS)
587 bool gpsSupported = false;
588 ret = system_info_get_value_bool(SYSTEM_INFO_KEY_GPS_SUPPORTED, &gpsSupported);
589 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_GPS_SUPPORTED");
590 value = gpsSupported;
592 else if (key == _WPS_SUPPORTED || key == _LOCATION_WPS)
594 bool wpsSupported = false;
595 wpsSupported = location_manager_is_supported_method(LOCATIONS_METHOD_WPS);
596 value = wpsSupported;
598 else if (key == _MICROPHONE)
600 bool micSupported = false;
601 ret = system_info_get_value_bool(SYSTEM_INFO_KEY_MICROPHONE_SUPPORTED, &micSupported);
602 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_MICROPHONE_SUPPORTED");
603 value = micSupported;
605 else if (key == _PLATFORM_CORE_CPU_ARCH_ARMV6)
608 ret = system_info_get_value_string(SYSTEM_INFO_KEY_CORE_CPU_ARCH, &cpu);
609 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "[E_SYSTEM] system_info_get_value_string : \"SYSTEM_INFO_KEY_CORE_CPU_ARCH\"failed");
611 if(strcmp(cpu, "ARMv6") == 0)
621 else if (key == _PLATFORM_CORE_CPU_ARCH_ARMV7)
624 ret = system_info_get_value_string(SYSTEM_INFO_KEY_CORE_CPU_ARCH, &cpu);
625 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "[E_SYSTEM] system_info_get_value_string : \"SYSTEM_INFO_KEY_CORE_CPU_ARCH\"failed");
627 if(strcmp(cpu, "ARMv7") == 0)
637 else if (key == _PLATFORM_CORE_CPU_ARCH_X86)
640 ret = system_info_get_value_string(SYSTEM_INFO_KEY_CORE_CPU_ARCH, &cpu);
641 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "[E_SYSTEM] system_info_get_value_string : \"SYSTEM_INFO_KEY_CORE_CPU_ARCH\"failed");
643 if(strcmp(cpu, "x86") == 0)
653 else if (key == _PLATFORM_CORE_FPU_ARCH_VFPV2)
656 ret = system_info_get_value_string(SYSTEM_INFO_KEY_CORE_FPU_ARCH, &fpu);
657 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "[E_SYSTEM] system_info_get_value_string : \"SYSTEM_INFO_KEY_CORE_fPU_ARCH\"failed");
659 if(strcmp(fpu, "vfpv2") == 0)
669 else if (key == _PLATFORM_CORE_FPU_ARCH_VFPV3)
672 ret = system_info_get_value_string(SYSTEM_INFO_KEY_CORE_FPU_ARCH, &fpu);
673 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "[E_SYSTEM] system_info_get_value_string : \"SYSTEM_INFO_KEY_CORE_fPU_ARCH\"failed");
675 if(strcmp(fpu, "vfpv3") == 0)
685 else if (key == _PLATFORM_CORE_FPU_ARCH_SSE2)
688 ret = system_info_get_value_string(SYSTEM_INFO_KEY_CORE_FPU_ARCH, &fpu);
689 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "[E_SYSTEM] system_info_get_value_string : \"SYSTEM_INFO_KEY_CORE_fPU_ARCH\"failed");
691 if(strcmp(fpu, "sse2") == 0)
701 else if (key == _PLATFORM_CORE_FPU_ARCH_SSE3)
704 ret = system_info_get_value_string(SYSTEM_INFO_KEY_CORE_FPU_ARCH, &fpu);
705 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "[E_SYSTEM] system_info_get_value_string : \"SYSTEM_INFO_KEY_CORE_fPU_ARCH\"failed");
707 if(strcmp(fpu, "sse3") == 0)
717 else if (key == _PLATFORM_CORE_FPU_ARCH_SSSE3)
720 ret = system_info_get_value_string(SYSTEM_INFO_KEY_CORE_FPU_ARCH, &fpu);
721 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "[E_SYSTEM] system_info_get_value_string : \"SYSTEM_INFO_KEY_CORE_fPU_ARCH\"failed");
723 if(strcmp(fpu, "ssse3") == 0)
733 else if (key == _WIFI_SUPPORTED || key == _WIFI)
735 bool wifiSupported = false;
736 ret = system_info_get_value_bool(SYSTEM_INFO_KEY_WIFI_SUPPORTED, &wifiSupported);
737 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_WIFI_SUPPORTED");
738 value = wifiSupported;
740 else if (key == _WIFI_DIRECT || key == _WIFI_DIRECT_SUPPORTED)
742 bool wifiDirectSupported = false;
743 ret = system_info_get_value_bool(SYSTEM_INFO_KEY_WIFI_DIRECT_SUPPORTED, &wifiDirectSupported);
744 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_WIFI_DIRECT_SUPPORTED");
745 value = wifiDirectSupported;
747 else if (key == _FM_RADIO_SUPPORTED || key == _FMRADIO)
749 bool fmRadioSupported = false;
750 ret = system_info_get_value_bool(SYSTEM_INFO_KEY_FMRADIO_SUPPORTED, &fmRadioSupported);
751 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_FMRADIO_SUPPORTED");
752 value = fmRadioSupported;
754 else if (key == _TV_OUT_SUPPORTED)
756 bool tvOutSupported = false;
757 ret = system_info_get_value_bool(SYSTEM_INFO_KEY_TVOUT_SUPPORTED, &tvOutSupported);
758 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_TVOUT_SUPPORTED");
759 value = tvOutSupported;
761 else if (key == _SCREEN_OUTPUT_RCA)
763 bool rcaSupported = false;
764 ret = system_info_get_value_bool(SYSTEM_INFO_KEY_RCA_SUPPORTED, &rcaSupported);
765 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_RCA_SUPPORTED");
766 value = rcaSupported;
768 else if (key == _SCREEN_OUTPUT_HDMI)
770 bool hdmiSupported = false;
771 ret = system_info_get_value_bool(SYSTEM_INFO_KEY_HDMI_SUPPORTED, &hdmiSupported);
772 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_HDMI_SUPPORTED");
773 value = hdmiSupported;
775 else if (key == _NFC_SUPPORTED || key == _NFC || key == _NETWORK_NFC)
777 bool nfcSupported = false;
778 ret = system_info_get_value_bool(SYSTEM_INFO_KEY_NFC_SUPPORTED, &nfcSupported);
779 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_NFC_SUPPORTED");
780 value = nfcSupported;
782 else if (key == _TELEPHONY)
784 sim_state_e simState;
785 ret = sim_get_state(&simState);
796 else if (key == _TELEPHONY_SERVICE_GSM || key == _TELEPHONY_SERVICE_GPRS || key == _TELEPHONY_SERVICE_EDGE
797 || key == _TELEPHONY_SERVICE_UMTS || key == _TELEPHONY_SERVICE_HSDPA || key == _TELEPHONY_SERVICE_HSUPA
798 || key == _TELEPHONY_SERVICE_HSPA || key == _TELEPHONY_SERVICE_LTE || key == _TELEPHONY_SERVICE_CDMA)
800 String telephonyInfo;
802 ret = system_info_get_value_string(SYSTEM_INFO_KEY_NETWORK_TYPE, &pValue);
803 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "[E_SYSTEM] system_info_get_value_string : \"SYSTEM_INFO_KEY_NETWORK_TYPE\"failed");
811 r = StringUtil::Utf8ToString(pValue, telephonyInfo);
817 telephonyInfo.ToLowerCase();
818 if(key == _TELEPHONY_SERVICE_GSM && telephonyInfo.Contains("gsm"))
822 else if(key == _TELEPHONY_SERVICE_GPRS && telephonyInfo.Contains("gprs"))
826 else if(key == _TELEPHONY_SERVICE_EDGE && telephonyInfo.Contains("edge"))
830 else if(key == _TELEPHONY_SERVICE_UMTS && telephonyInfo.Contains("umts"))
834 else if(key == _TELEPHONY_SERVICE_HSDPA && telephonyInfo.Contains("hsdpa"))
838 else if(key == _TELEPHONY_SERVICE_HSUPA && telephonyInfo.Contains("hsupa"))
842 else if(key == _TELEPHONY_SERVICE_HSPA && telephonyInfo.Contains("hspa"))
846 else if(key == _TELEPHONY_SERVICE_LTE && telephonyInfo.Contains("lte"))
850 else if(key == _TELEPHONY_SERVICE_CDMA && telephonyInfo.Contains("cdma"))
860 else if (key == _SENSOR_BAROMETER)
862 bool barometerSupported = false;
863 ret = system_info_get_value_bool(SYSTEM_INFO_KEY_BAROMETER_SENSOR_SUPPORTED, &barometerSupported);
864 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_BAROMETER_SENSOR_SUPPORTED");
865 value = barometerSupported;
867 else if (key == _SENSOR_BAROMETER_WAKEUP)
869 bool barometerWakeupSupported = false;
870 ret = sf_is_wakeup_supported(BAROMETER_SENSOR);
873 barometerWakeupSupported = true;
875 value = barometerWakeupSupported;
877 else if (key == _SENSOR_ACCELEROMETER)
879 bool accelerometerSupported = false;
880 ret = sensor_is_supported(SENSOR_ACCELEROMETER, &accelerometerSupported);
881 SysTryReturnResult(NID_SYS, ret == SENSOR_ERROR_NONE, E_SYSTEM, "Failed to get the SENSOR_ACCELEROMETER");
882 value = accelerometerSupported;
884 else if (key == _SENSOR_ACCELEROMETER_WAKEUP)
886 bool accelerometerWakeupSupported = false;
887 ret = sf_is_wakeup_supported(ACCELEROMETER_SENSOR);
890 accelerometerWakeupSupported = true;
892 value = accelerometerWakeupSupported;
894 else if (key == _SENSOR_MAGNETOMETER)
896 bool magnetometerSupported = false;
897 ret = sensor_is_supported(SENSOR_MAGNETIC, &magnetometerSupported);
898 SysTryReturnResult(NID_SYS, ret == SENSOR_ERROR_NONE, E_SYSTEM, "Failed to get the SENSOR_MAGNETOMETER");
899 value = magnetometerSupported;
901 else if (key == _SENSOR_MAGNETOMETER_WAKEUP)
903 bool magnetometerWakeupSupported = false;
904 ret = sf_is_wakeup_supported(GEOMAGNETIC_SENSOR);
907 magnetometerWakeupSupported = true;
909 value = magnetometerWakeupSupported;
911 else if (key == _SENSOR_PHOTOMETER)
913 bool lightSupported = false;
914 ret = sensor_is_supported(SENSOR_LIGHT, &lightSupported);
915 SysTryReturnResult(NID_SYS, ret == SENSOR_ERROR_NONE, E_SYSTEM, "Failed to get the SENSOR_PHOTOMETER");
916 value = lightSupported;
918 else if (key == _SENSOR_PHOTOMETER_WAKEUP)
920 bool photometerWakeupSupported = false;
921 ret = sf_is_wakeup_supported(LIGHT_SENSOR);
924 photometerWakeupSupported = true;
926 value = photometerWakeupSupported;
928 else if (key == _SENSOR_GYROSCOPE)
930 bool gyroscopeSupported = false;
931 ret = sensor_is_supported(SENSOR_GYROSCOPE, &gyroscopeSupported);
932 SysTryReturnResult(NID_SYS, ret == SENSOR_ERROR_NONE, E_SYSTEM, "Failed to get the SENSOR_GYROSCOPE");
933 value = gyroscopeSupported;
935 else if (key == _SENSOR_GYROSCOPE_WAKEUP)
937 bool gyroscopeWakeupSupported = false;
938 ret = sf_is_wakeup_supported(GYROSCOPE_SENSOR);
941 gyroscopeWakeupSupported = true;
943 value = gyroscopeWakeupSupported;
945 else if (key == _SENSOR_PROXIMITY)
947 bool proximitySupported = false;
948 ret = sensor_is_supported(SENSOR_PROXIMITY, &proximitySupported);
949 SysTryReturnResult(NID_SYS, ret == SENSOR_ERROR_NONE, E_SYSTEM, "Failed to get the SENSOR_PROXIMITY");
950 value = proximitySupported;
952 else if (key == _SENSOR_PROXIMITY_WAKEUP)
954 bool proximityWakeupSupported = false;
955 ret = sf_is_wakeup_supported(PROXIMITY_SENSOR);
958 proximityWakeupSupported = true;
960 value = proximityWakeupSupported;
962 else if (key == _SENSOR_TILTMETER)
964 bool magnetometerSupported = false;
965 ret = sensor_is_supported(SENSOR_MAGNETIC, &magnetometerSupported);
966 SysTryReturnResult(NID_SYS, ret == SENSOR_ERROR_NONE, E_SYSTEM, "Failed to get the SENSOR_MAGNETOMETER");
968 bool accelerometerSupported = false;
969 ret = sensor_is_supported(SENSOR_ACCELEROMETER, &accelerometerSupported);
970 SysTryReturnResult(NID_SYS, ret == SENSOR_ERROR_NONE, E_SYSTEM, "Failed to get the SENSOR_ACCELEROMETER");
972 if(magnetometerSupported == true && accelerometerSupported == true)
981 else if (key == _SENSOR_TILTMETER_WAKEUP)
984 int accelerometer = 0;
985 magnetic = sf_is_wakeup_supported(GEOMAGNETIC_SENSOR);
986 accelerometer = sf_is_wakeup_supported(ACCELEROMETER_SENSOR);
987 if(magnetic == 0 && accelerometer == 0)
996 else if (key == _OPENGLES_VERSION_1_1)
998 char* pOpenglVersion = null;
999 ret = system_info_get_value_string(SYSTEM_INFO_KEY_OPENGLES_VERSION, &pOpenglVersion);
1000 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE && pOpenglVersion, E_SYSTEM, "[E_SYSTEM] system_info_get_value_string : \"SYSTEM_INFO_KEY_OPENGLES_VERSION\"failed");
1001 if(strcmp(pOpenglVersion, "1.1") != -1)
1009 free(pOpenglVersion);
1011 else if (key == _OPENGLES_VERSION_2_0)
1013 char* pOpenglVersion = null;
1014 ret = system_info_get_value_string(SYSTEM_INFO_KEY_OPENGLES_VERSION, &pOpenglVersion);
1015 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE && pOpenglVersion, E_SYSTEM, "[E_SYSTEM] system_info_get_value_string : \"SYSTEM_INFO_KEY_OPENGLES_VERSION\"failed");
1016 if(strcmp(pOpenglVersion + strlen(pOpenglVersion) - 3, "2.0") != -1)
1024 free(pOpenglVersion);
1026 else if(key == _OPENGLES_TEXTUREFORMAT_UTC || key == _OPENGLES_TEXTUREFORMAT_PTC || key == _OPENGLES_TEXTUREFORMAT_ETC
1027 || key == _OPENGLES_TEXTUREFORMAT_3DC || key == _OPENGLES_TEXTUREFORMAT_ATC || key == _OPENGLES_TEXTUREFORMAT_PVRTC)
1030 String openglesTexture;
1032 char* pTextureFormat = null;
1033 ret = system_info_get_value_string(SYSTEM_INFO_KEY_OPENGLES_TEXTURE_FORMAT, &pTextureFormat);
1035 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE && pTextureFormat, E_SYSTEM, "system_info_get_value_string : \"SYSTEM_INFO_KEY_OPENGLES_VERSION\"failed");
1037 r = StringUtil::Utf8ToString(pTextureFormat, openglesTexture);
1041 free(pTextureFormat);
1042 SysLog(NID_SYS, "Fail to convert string");
1045 openglesTexture.ToUpperCase();
1046 if (key == _OPENGLES_TEXTUREFORMAT_UTC && openglesTexture.Contains(L"UTC") == true)
1050 else if (key == _OPENGLES_TEXTUREFORMAT_PTC && openglesTexture.Contains(L"PTC") == true)
1054 else if (key == _OPENGLES_TEXTUREFORMAT_ETC && openglesTexture.Contains(L"ETC") == true)
1058 else if (key == _OPENGLES_TEXTUREFORMAT_3DC && openglesTexture.Contains(L"3DC") == true)
1062 else if (key == _OPENGLES_TEXTUREFORMAT_ATC && openglesTexture.Contains(L"ATC") == true)
1066 else if (key == _OPENGLES_TEXTUREFORMAT_PVRTC && openglesTexture.Contains(L"PVRTC") == true)
1075 else if (key == _SCREEN_DESKTOPMODE)
1079 else if (key == _SPEECH_RECOGNITION)
1081 bool speechRecognitionSupported = false;
1082 ret = system_info_get_value_bool(SYSTEM_INFO_KEY_SPEECH_RECOGNITION_SUPPORTED, &speechRecognitionSupported);
1083 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_SPEECH_RECOGNITION_SUPPORTED");
1084 value = speechRecognitionSupported;
1086 else if (key == _SIP_VOIP)
1088 bool sipVoipSupported = false;
1089 ret = system_info_get_value_bool(SYSTEM_INFO_KEY_SIP_VOIP_SUPPORTED, &sipVoipSupported);
1090 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_SIP_VOIP_SUPPORTED");
1091 value = sipVoipSupported;
1093 else if (key == _USB_HOST)
1095 bool usbHostSupported = false;
1096 ret = system_info_get_value_bool(SYSTEM_INFO_KEY_USB_HOST_SUPPORTED, &usbHostSupported);
1097 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_USB_HOST_SUPPORTED");
1098 value = usbHostSupported;
1100 else if (key == _USB_ACCESSORY)
1102 bool usbAccessorytSupported = false;
1103 ret = system_info_get_value_bool(SYSTEM_INFO_KEY_USB_ACCESSORY_SUPPORTED, &usbAccessorytSupported);
1104 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "Failed to get the SYSTEM_INFO_KEY_USB_HOST_SUPPORTED");
1105 value = usbAccessorytSupported;
1107 else if (key == _INPUT_KEYBOARD)
1109 char* pKeyboardType = null;
1110 ret = system_info_get_value_string(SYSTEM_INFO_KEY_KEYBOARD_TYPE, &pKeyboardType);
1111 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "[E_SYSTEM] system_info_get_value_string : \"SYSTEM_INFO_KEY_KEYBOARD_TYPE\"failed");
1114 if(pKeyboardType != null)
1116 if(strlen(pKeyboardType) > 0)
1121 free(pKeyboardType);
1126 r = GetFromRegistry(key, value);
1127 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_OBJ_NOT_FOUND, "Failed to get the key[%ls]", key.GetPointer());
1135 _SystemInfoImpl::GetSysInfo(const String& key, UuId& value)
1137 return E_OBJ_NOT_FOUND;
1142 _SystemInfoImpl::GetSysInfoValuesN(const String& key, SystemInfoValueType type)
1144 SetLastResult(E_OBJ_NOT_FOUND);
1149 _SystemInfoImpl::GetPlatformVersion(String& platformVersion)
1151 result r = E_SUCCESS;
1152 char* pPlatformVersion = null;
1153 int ret = system_info_get_value_string(SYSTEM_INFO_KEY_TIZEN_VERSION, &pPlatformVersion);
1154 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "[E_SYSTEM] system_info_get_value_string : \"SYSTEM_INFO_KEY_TIZEN_VERSION_NAME\"failed");
1156 r = StringUtil::Utf8ToString(pPlatformVersion, platformVersion);
1157 SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "[%s] StringUtil::Utf8ToString failed", GetErrorMessage(r));
1158 free(pPlatformVersion);
1163 _SystemInfoImpl::GetNativeApiVersion(String& nativeApiVersion)
1165 return GetFromRegistry(_PLATFORM_NATIVE_API_VERSION, nativeApiVersion);
1169 _SystemInfoImpl::GetWebApiVersion(String& webApiVersion)
1171 return GetFromRegistry(_PLATFORM_WEB_API_VERSION, webApiVersion);
1175 _SystemInfoImpl::GetImei(String& imei)
1177 result r = E_SUCCESS;
1181 error = system_info_get_value_string(SYSTEM_INFO_KEY_MOBILE_DEVICE_ID, &pImei);
1182 SysTryReturnResult(NID_SYS, error == SYSTEM_INFO_ERROR_NONE, E_SYSTEM, "[E_SYSTEM] system_info_get_value_string : \"SYSTEM_INFO_KEY_MOBILE_DEVICE_ID\"failed");
1184 r = StringUtil::Utf8ToString(pImei, imei);
1185 SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "[%s] StringUtil::Utf8ToString failed", GetErrorMessage(r));
1192 _SystemInfoImpl::GetFromRegistry(const String& key, String& value)
1194 result r = E_SUCCESS;
1198 r = _reg.Construct(_REGISTRY_PATH, REG_OPEN_READ_ONLY, null);
1199 SysTryReturnResult(NID_SYS, !IsFailed(r), r, " RegistryImpl construct Failed");
1201 r = _reg.GetValue(_SYSTEM_INFO_SESSION, key, valStr);
1202 SysTryReturnResult(NID_SYS, !IsFailed(r), r, " Registry GetValue Failed");
1204 if(valStr == L"true" || valStr == L"false")
1206 return E_OBJ_NOT_FOUND;
1217 _SystemInfoImpl::GetFromRegistry(const String& key, int& value)
1219 result r = E_SUCCESS;
1222 r = _reg.Construct(_REGISTRY_PATH, REG_OPEN_READ_ONLY, null);
1223 SysTryReturnResult(NID_SYS, !IsFailed(r), r, " RegistryImpl construct Failed");
1225 r = _reg.GetValue(_SYSTEM_INFO_SESSION, key, valStr);
1226 SysTryReturnResult(NID_SYS, !IsFailed(r), r, " Registry GetValue Failed");
1227 SysTryReturnResult(NID_SYS, !IsFailed(r), E_SYSTEM, " Registry GetValue Failed");
1228 r = Integer::Parse(valStr, value);
1229 SysTryReturnResult(NID_SYS, !IsFailed(r), E_OBJ_NOT_FOUND, " Integer::Parse() Failed");
1234 _SystemInfoImpl::GetFromRegistry(const String& key, bool& value)
1236 result r = E_SUCCESS;
1239 r = _reg.Construct(_REGISTRY_PATH, REG_OPEN_READ_ONLY, null);
1240 SysTryReturnResult(NID_SYS, !IsFailed(r), r, " RegistryImpl construct Failed");
1242 r = _reg.GetValue(_SYSTEM_INFO_SESSION, key, valStr);
1243 SysTryReturnResult(NID_SYS, !IsFailed(r), r, " Registry GetValue Failed");
1244 SysTryReturnResult(NID_SYS, !IsFailed(r), E_SYSTEM, " Registry GetValue Failed");
1245 if(valStr == L"true")
1249 else if(valStr == L"false")
1255 return E_OBJ_NOT_FOUND;
1260 _SystemInfoImpl::GetInstance(SystemInfo& systeminfo)
1262 return systeminfo.__pSystemInfoImpl;
1264 const _SystemInfoImpl*
1265 _SystemInfoImpl::GetInstance(const SystemInfo& systeminfo)
1267 return systeminfo.__pSystemInfoImpl;
1269 } } // Tizen::System