6a30f6e85af0aa32a869c483b9f8e6348c425c20
[platform/framework/native/appfw.git] / src / system / FSys_SystemInfoImpl.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
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.
16 //
17
18 /**
19  * @file                FSys_SystemInfoImpl.cpp
20  * @brief               This is the implementation file for _SystemInfoImpl class.
21  */
22 #include <stdlib.h>
23 #include <dlfcn.h>
24 #include <media/sound_manager.h>
25 #include <sim.h>
26 #include <sensor.h>
27 #include <sensors.h>
28 #include <system_info.h>
29 #include <telephony_network.h>
30 #include <locations.h>
31
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>
42
43 #include <FBase_NativeError.h>
44 #include <FIo_RegistryImpl.h>
45 #include <FSys_DeviceId.h>
46 #include <FSys_SystemInfoImpl.h>
47
48 using namespace Tizen::Base;
49 using namespace Tizen::Base::Collection;
50 using namespace Tizen::Base::Utility;
51 using namespace Tizen::Io;
52
53 namespace Tizen { namespace System
54 {
55
56 static const wchar_t* _REGISTRY_PATH = L"/usr/etc/system-info.ini";
57 static const wchar_t* _SYSTEM_INFO_SESSION = L"SystemInfo";
58
59 //Bluetooth
60 static const wchar_t* _BLUETOOTH = L"http://tizen.org/feature/network.bluetooth";
61 static const wchar_t* _BLUETOOTH_SUPPORTED = L"BluetoothSupported";
62
63 //Camera
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";
70
71 //Database
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";
75
76 //DUID
77 static const wchar_t* _DUID = L"http://tizen.org/system/duid";
78 static const wchar_t* _DEVICE_ID = L"DUID";
79
80 //FM Radio
81 static const wchar_t* _FMRADIO = L"http://tizen.org/feature/fmradio";
82 static const wchar_t* _FM_RADIO_SUPPORTED = L"FmRadioSupported";
83
84 //Keyboard
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";
88
89 //Location
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";
95
96 //Microphone
97 static const wchar_t* _MICROPHONE = L"http://tizen.org/feature/microphone";
98
99 //Model name
100 static const wchar_t* _MODELNAME = L"http://tizen.org/system/model_name";
101 static const wchar_t* _MODEL_NAME = L"ModelName";
102
103 //Multi point
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";
106
107 //NFC
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";
111
112 //Opengles
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";
119
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";
123
124 //Platform name
125 static const wchar_t* _PLATFORM_NAME = L"http://tizen.org/system/platform.name";
126
127 //CPU
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";
131
132 //FPU
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";
138
139 // Screen
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";
149
150 //HDMI RCA
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";
154
155 //Sensors
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";
170
171 //VOIP
172 static const wchar_t* _SIP_VOIP = L"http://tizen.org/feature/sip.voip";
173
174 //Sound
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";
183
184 //Speech Recognition
185 static const wchar_t* _SPEECH_RECOGNITION = L"http://tizen.org/feature/speech.recognition";
186
187 //Telephony
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";
200
201 //USB
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";
204
205 //WIFI
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";
210
211 //Version
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";
215
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";
219
220 result
221 _SystemInfoImpl::GetSysInfo(const String& key, String& value)
222 {
223         int ret = 0;
224         result r = E_SYSTEM;
225         char* pValue = null;
226
227         if (key == _NETWORK_TYPE)
228         {
229                 sim_state_e simState;
230                 ret = sim_get_state(&simState);
231
232                 SysTryReturnResult(NID_SYS, ret == 0, E_SYSTEM, "Failed to get the SIM state");
233
234                 if (simState == SIM_STATE_UNAVAILABLE)
235                 {
236                         value.Append(_NETWORK_EMERGENCY);
237                         return E_SUCCESS;
238                 }
239
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");
242
243                 if(pValue == null)
244                 {
245                         value.Clear();
246                         return E_SUCCESS;
247                 }
248
249                 r = StringUtil::Utf8ToString(pValue, value);
250                 SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_SYSTEM, r, "[%s] StringUtil::Utf8ToString failed", GetErrorMessage(r));
251         }
252         else if (key == _DEVICE_ID || key == _DUID)
253         {
254                 r = _DeviceId::GetId(value);
255                 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "Failed to get the key[%ls]", key.GetPointer());
256                 return E_SUCCESS;
257         }
258         else if (key == _MODEL_NAME || key == _MODELNAME)
259         {
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");
262
263                 r = StringUtil::Utf8ToString(pValue, value);
264                 SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_SYSTEM, r, "[%s] StringUtil::Utf8ToString failed", GetErrorMessage(r));
265         }
266         else if (key == _OPENGL_ES_VERSION)
267         {
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");
270
271                 r = StringUtil::Utf8ToString(pValue, value);
272                 SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_SYSTEM, r, "[%s] StringUtil::Utf8ToString failed", GetErrorMessage(r));
273         }       
274         else if (key == _KEYBOARD_TYPE || key == _INPUT_KEYBOARD_LAYOUT)
275         {
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");
278
279                 if(pValue == null)
280                 {
281                         value.Clear();
282                         return E_SUCCESS;
283                 }
284
285                 r = StringUtil::Utf8ToString(pValue, value);
286                 SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_SYSTEM, r, "[%s] StringUtil::Utf8ToString failed", GetErrorMessage(r));
287
288                 if(key == _INPUT_KEYBOARD_LAYOUT)
289                 {
290                         value.ToLowerCase();
291                 }
292         }
293         else if (key == _WAC_VERSION)
294         {
295                 value = "";
296                 return E_SUCCESS;
297         }
298         else if (key == _BLUETOOTH_SUPPORTED)
299         {
300                 value.Clear();
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)
305                 {
306                         value = _SUPPORTED;
307                 }
308                 else
309                 {
310                         value = _UNSUPPORTED;
311                 }
312
313                 r = E_SUCCESS;
314         }
315         else if (key == _GPS_SUPPORTED)
316         {
317                 value.Clear();
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)
322                 {
323                         value = _SUPPORTED;
324                 }
325                 else
326                 {
327                         value = _UNSUPPORTED;
328                 }
329                 r = E_SUCCESS;
330         }
331         else if (key == _WIFI_SUPPORTED)
332         {
333                 value.Clear();
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)
338                 {
339                         value = _SUPPORTED;
340                 }
341                 else
342                 {
343                         value = _UNSUPPORTED;
344                 }
345                 r = E_SUCCESS;
346         }
347         else if (key == _PLATFORM_VERSION)
348         {
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");
352
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);
356                 return r;
357
358         }
359         else if (key == _PLATFORM_NAME)
360         {
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");
363
364                 r = StringUtil::Utf8ToString(pValue, value);
365                 SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_SYSTEM, r, "[%s] StringUtil::Utf8ToString failed", GetErrorMessage(r));
366         }
367         else if (key == _PLATFORM_NATIVE_API_VERSION)
368         {
369                 return E_OBJ_NOT_FOUND;
370         }
371         else if (key == _PLATFORM_WEB_API_VERSION)
372         {
373                 return E_OBJ_NOT_FOUND;
374         }
375         else
376         {
377                 r = GetFromRegistry(key, value);
378                 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_OBJ_NOT_FOUND, "Failed to get the key[%ls]", key.GetPointer());
379                 return E_SUCCESS;
380         }
381 CATCH:
382         if(pValue != null)
383         {
384                 free(pValue);
385         }
386         return r;
387 }
388
389
390 result
391 _SystemInfoImpl::GetSysInfo(const String& key, int& value)
392 {
393         int ret = -1;
394         result r = E_SUCCESS;
395
396         if (key == _CAMERA_COUNT)
397         {
398                 int cameraCount = 0;
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");
401                 value = cameraCount;
402         }
403         else if (key == _SCREEN_BITS_PER_PIXEL ||key == _SCREEN_BPP)
404         {
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;
409         }
410         else if (key == _SCREENHEIGHT || key == _SCREEN_HEIGHT)
411         {
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;
416         }
417         else if (key == _SCREENWIDTH || key == _SCREEN_WIDTH)
418         {
419                 int screenWidth = 0;
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");
422                 value = screenWidth;
423         }
424         else if (key == _SCREENDPI || key == _SCREEN_DPI)
425         {
426                 int screenDPI = 0;
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");
429                 value = screenDPI;
430         }
431         else if (key == _MAX_SYSTEM_SOUND_VOLUME || key == _SOUND_SYSTEM_VOLUME_MAX)
432         {
433                 int maxVolume = 0;
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");
436                 value = maxVolume;
437         }
438         else if (key == _MAX_MEDIA_SOUND_VOLUME || key == _SOUND_MEDIA_VOLUME_MAX)
439         {
440                 int maxVolume = 0;
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");
443
444                 value = maxVolume;
445         }
446         else if (key == _MAX_RINGTONE_SOUND_VOLUME || key == _SOUND_RINGTONE_VOLUME_MAX)
447         {
448                 int maxVolume = 0;
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");
451
452                 value = maxVolume;
453         }
454         else if (key == _MAX_NOTIFICATION_SOUND_VOLUME || key == _SOUND_NOTIFICATION_VOLUME_MAX)
455         {
456                 int maxVolume = 0;
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");
459                 value = maxVolume;
460         }
461         else if (key == _MULTIPOINT_TOUCH_COUNT || key == _MULTIPOINTTOUCH_POINTCOUNT)
462         {
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;
467         }
468         else
469         {
470                 r = GetFromRegistry(key, value);
471                 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_OBJ_NOT_FOUND, "Failed to get the key[%ls]", key.GetPointer());
472         }
473         
474         return E_SUCCESS;
475 }
476
477
478 result
479 _SystemInfoImpl::GetSysInfo(const String& key, long long& value)
480 {
481         return E_OBJ_NOT_FOUND;
482 }
483
484
485 result
486 _SystemInfoImpl::GetSysInfo(const String& key, double& value)
487 {
488         return E_OBJ_NOT_FOUND;
489 }
490
491
492 result
493 _SystemInfoImpl::GetSysInfo(const String& key, bool& value)
494 {
495         int ret = 0;
496         result r = E_SUCCESS;
497
498         if (key == _BLUETOOTH_SUPPORTED || key == _BLUETOOTH)
499         {
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;
504         }
505         else if (key == _CAMERA)
506         {
507                 int cameraCount = 0;
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");
510
511                 if (cameraCount > 0)
512                 {
513                         value = true;
514                 }
515                 else
516                 {
517                         value = false;
518                 }
519         }
520         else if (key == _CAMERA_FRONT)
521         {
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;
526         }
527         else if (key == _CAMERA_FRONT_FLASH)
528         {
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;
533         }
534         else if (key == _CAMERA_BACK)
535         {
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;
540         }
541         else if ( key == _CAMERA_BACK_FLASH)
542         {
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;
547         }
548         else if (key == _DATABASE_ENCRYPTION)
549         {
550 #ifndef _OSP_EMUL_
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)
555                 {
556                         value = true;
557                 }
558                 else
559                 {
560                         value = false;
561                 }
562                 dlclose(handle);
563 #else
564                 value = true;
565 #endif
566         }
567         else if (key == _LOCATION)
568         {
569                 bool gpsSupported = false;
570                 bool wpsSupported = false;
571
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);
575
576                 if(gpsSupported == true || wpsSupported == true)
577                 {
578                         value = true;
579                 }
580                 else
581                 {
582                         value = false;
583                 }
584         }
585         else if (key == _GPS_SUPPORTED || key == _LOCATION_GPS)
586         {
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;
591         }
592         else if (key == _WPS_SUPPORTED || key == _LOCATION_WPS)
593         {
594                 bool wpsSupported = false;
595                 wpsSupported = location_manager_is_supported_method(LOCATIONS_METHOD_WPS);
596                 value = wpsSupported;
597         }       
598         else if (key == _MICROPHONE)
599         {
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;
604         }
605         else if (key == _PLATFORM_CORE_CPU_ARCH_ARMV6)
606         {
607                 char* cpu = null;
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");
610
611                 if(strcmp(cpu, "ARMv6") == 0)
612                 {
613                         value = true;
614                 }
615                 else
616                 {
617                         value = false;
618                 }
619                 free(cpu);
620         }
621         else if (key == _PLATFORM_CORE_CPU_ARCH_ARMV7)
622         {
623                 char* cpu = null;
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");
626
627                 if(strcmp(cpu, "ARMv7") == 0)
628                 {
629                         value = true;
630                 }
631                 else
632                 {
633                         value = false;
634                 }
635                 free(cpu);
636         }
637         else if (key == _PLATFORM_CORE_CPU_ARCH_X86)
638         {
639                 char* cpu = null;
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");
642
643                 if(strcmp(cpu, "x86") == 0)
644                 {
645                         value = true;
646                 }
647                 else
648                 {
649                         value = false;
650                 }
651                 free(cpu);
652         }
653         else if (key == _PLATFORM_CORE_FPU_ARCH_VFPV2)
654         {
655                 char* fpu = null;
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");
658
659                 if(strcmp(fpu, "vfpv2") == 0)
660                 {
661                         value = true;
662                 }
663                 else
664                 {
665                         value = false;
666                 }
667                 free(fpu);
668         }
669         else if (key == _PLATFORM_CORE_FPU_ARCH_VFPV3)
670         {
671                 char* fpu = null;
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");
674
675                 if(strcmp(fpu, "vfpv3") == 0)
676                 {
677                         value = true;
678                 }
679                 else
680                 {
681                         value = false;
682                 }
683                 free(fpu);
684         }
685         else if (key == _PLATFORM_CORE_FPU_ARCH_SSE2)
686         {
687                 char* fpu = null;
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");
690
691                 if(strcmp(fpu, "sse2") == 0)
692                 {
693                         value = true;
694                 }
695                 else
696                 {
697                         value = false;
698                 }
699                 free(fpu);
700         }
701         else if (key == _PLATFORM_CORE_FPU_ARCH_SSE3)
702         {
703                 char* fpu = null;
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");
706
707                 if(strcmp(fpu, "sse3") == 0)
708                 {
709                         value = true;
710                 }
711                 else
712                 {
713                         value = false;
714                 }
715                 free(fpu);
716         }
717         else if (key == _PLATFORM_CORE_FPU_ARCH_SSSE3)
718         {
719                 char* fpu = null;
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");
722
723                 if(strcmp(fpu, "ssse3") == 0)
724                 {
725                         value = true;
726                 }
727                 else
728                 {
729                         value = false;
730                 }
731                 free(fpu);
732         }
733         else if (key == _WIFI_SUPPORTED || key == _WIFI)
734         {
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;
739         }
740         else if (key == _WIFI_DIRECT || key == _WIFI_DIRECT_SUPPORTED)
741         {
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;
746         }
747         else if (key == _FM_RADIO_SUPPORTED || key == _FMRADIO)
748         {
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;
753         }
754         else if (key == _TV_OUT_SUPPORTED)
755         {
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;
760         }
761         else if (key == _SCREEN_OUTPUT_RCA)
762         {
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;
767         }
768         else if (key == _SCREEN_OUTPUT_HDMI)
769         {
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;
774         }
775         else if (key == _NFC_SUPPORTED || key == _NFC || key == _NETWORK_NFC)
776         {
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;
781         }
782         else if (key == _TELEPHONY)
783         {
784                 sim_state_e simState;
785                 ret = sim_get_state(&simState);
786
787                 if(ret == 0)
788                 {
789                         value = true;
790                 }
791                 else
792                 {
793                         value = false;
794                 }
795         }
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)
799         {
800                 String telephonyInfo;
801                 char* pValue = null;
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");
804
805                 if(pValue == null)
806                 {
807                         value = false;
808                         return E_SUCCESS;
809                 }
810
811                 r = StringUtil::Utf8ToString(pValue, telephonyInfo);
812                 if(r != E_SUCCESS)
813                 {
814                         free(pValue);
815                         return E_SYSTEM;
816                 }
817                 telephonyInfo.ToLowerCase();
818                 if(key == _TELEPHONY_SERVICE_GSM && telephonyInfo.Contains("gsm"))
819                 {
820                         value = true;
821                 }
822                 else if(key == _TELEPHONY_SERVICE_GPRS && telephonyInfo.Contains("gprs"))
823                 {
824                         value = true;
825                 }
826                 else if(key == _TELEPHONY_SERVICE_EDGE && telephonyInfo.Contains("edge"))
827                 {
828                         value = true;
829                 }
830                 else if(key == _TELEPHONY_SERVICE_UMTS && telephonyInfo.Contains("umts"))
831                 {
832                         value = true;
833                 }
834                 else if(key == _TELEPHONY_SERVICE_HSDPA && telephonyInfo.Contains("hsdpa"))
835                 {
836                         value = true;
837                 }
838                 else if(key == _TELEPHONY_SERVICE_HSUPA && telephonyInfo.Contains("hsupa"))
839                 {
840                         value = true;
841                 }
842                 else if(key == _TELEPHONY_SERVICE_HSPA && telephonyInfo.Contains("hspa"))
843                 {
844                         value = true;
845                 }
846                 else if(key == _TELEPHONY_SERVICE_LTE && telephonyInfo.Contains("lte"))
847                 {
848                         value = true;
849                 }
850                 else if(key == _TELEPHONY_SERVICE_CDMA && telephonyInfo.Contains("cdma"))
851                 {
852                         value = true;
853                 }
854                 else
855                 {
856                         value = false;
857                 }
858                 free(pValue);
859         }
860         else if (key == _SENSOR_BAROMETER)
861         {
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;
866         }
867         else if (key == _SENSOR_BAROMETER_WAKEUP)
868         {
869                 bool barometerWakeupSupported = false;
870                 ret = sf_is_wakeup_supported(BAROMETER_SENSOR);
871                 if(ret == 0)
872                 {
873                         barometerWakeupSupported = true;
874                 }
875                 value = barometerWakeupSupported;
876         }
877         else if (key == _SENSOR_ACCELEROMETER)
878         {
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;
883         }
884         else if (key == _SENSOR_ACCELEROMETER_WAKEUP)
885         {
886                 bool accelerometerWakeupSupported = false;
887                 ret = sf_is_wakeup_supported(ACCELEROMETER_SENSOR);
888                 if(ret == 0)
889                 {
890                         accelerometerWakeupSupported = true;
891                 }
892                 value = accelerometerWakeupSupported;
893         }
894         else if (key == _SENSOR_MAGNETOMETER)
895         {
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;
900         }
901         else if (key == _SENSOR_MAGNETOMETER_WAKEUP)
902         {
903                 bool magnetometerWakeupSupported = false;
904                 ret = sf_is_wakeup_supported(GEOMAGNETIC_SENSOR);
905                 if(ret == 0)
906                 {
907                         magnetometerWakeupSupported = true;
908                 }
909                 value = magnetometerWakeupSupported;
910         }
911         else if (key == _SENSOR_PHOTOMETER)
912         {
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;
917         }
918         else if (key == _SENSOR_PHOTOMETER_WAKEUP)
919         {
920                 bool photometerWakeupSupported = false;
921                 ret = sf_is_wakeup_supported(LIGHT_SENSOR);
922                 if(ret == 0)
923                 {
924                         photometerWakeupSupported = true;
925                 }
926                 value = photometerWakeupSupported;
927         }
928         else if (key == _SENSOR_GYROSCOPE)
929         {
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;
934         }
935         else if (key == _SENSOR_GYROSCOPE_WAKEUP)
936         {
937                 bool gyroscopeWakeupSupported = false;
938                 ret = sf_is_wakeup_supported(GYROSCOPE_SENSOR);
939                 if(ret == 0)
940                 {
941                         gyroscopeWakeupSupported = true;
942                 }
943                 value = gyroscopeWakeupSupported;
944         }
945         else if (key == _SENSOR_PROXIMITY)
946         {
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;
951         }
952         else if (key == _SENSOR_PROXIMITY_WAKEUP)
953         {
954                 bool proximityWakeupSupported = false;
955                 ret = sf_is_wakeup_supported(PROXIMITY_SENSOR);
956                 if(ret == 0)
957                 {
958                         proximityWakeupSupported = true;
959                 }
960                 value = proximityWakeupSupported;
961         }
962         else if (key == _SENSOR_TILTMETER)
963         {
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");
967
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");
971
972                 if(magnetometerSupported == true && accelerometerSupported == true)
973                 {
974                         value = true;
975                 }
976                 else
977                 {
978                         value = false;
979                 }
980         }
981         else if (key == _SENSOR_TILTMETER_WAKEUP)
982         {
983                 int magnetic = 0;
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)
988                 {
989                         value = true;
990                 }
991                 else
992                 {
993                         value = false;
994                 }
995         }
996         else if (key == _OPENGLES_VERSION_1_1)
997         {
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)
1002                 {
1003                         value = true;
1004                 }
1005                 else
1006                 {
1007                         value = false;
1008                 }
1009                 free(pOpenglVersion);
1010         }
1011         else if (key == _OPENGLES_VERSION_2_0)
1012         {
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)
1017                 {
1018                         value = true;
1019                 }
1020                 else
1021                 {
1022                         value = false;
1023                 }
1024                 free(pOpenglVersion);
1025         }
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)
1028         {
1029                 int ret = 0;
1030                 String openglesTexture;
1031                 
1032                 char* pTextureFormat = null;
1033                 ret = system_info_get_value_string(SYSTEM_INFO_KEY_OPENGLES_TEXTURE_FORMAT, &pTextureFormat);
1034
1035                 SysTryReturnResult(NID_SYS, ret == SYSTEM_INFO_ERROR_NONE && pTextureFormat, E_SYSTEM, "system_info_get_value_string : \"SYSTEM_INFO_KEY_OPENGLES_VERSION\"failed");
1036
1037                 r = StringUtil::Utf8ToString(pTextureFormat, openglesTexture);
1038
1039                 if (r != E_SUCCESS)
1040                 {
1041                         free(pTextureFormat);
1042                         SysLog(NID_SYS, "Fail to convert string");
1043                 }
1044
1045                 openglesTexture.ToUpperCase();
1046                 if (key == _OPENGLES_TEXTUREFORMAT_UTC && openglesTexture.Contains(L"UTC") == true)
1047                 {
1048                         value = true;
1049                 }
1050                 else if (key == _OPENGLES_TEXTUREFORMAT_PTC && openglesTexture.Contains(L"PTC") == true)
1051                 {
1052                         value = true;
1053                 }
1054                 else if (key == _OPENGLES_TEXTUREFORMAT_ETC && openglesTexture.Contains(L"ETC") == true)
1055                 {
1056                         value = true;
1057                 }
1058                 else if (key == _OPENGLES_TEXTUREFORMAT_3DC && openglesTexture.Contains(L"3DC") == true)
1059                 {
1060                         value = true;
1061                 }
1062                 else if (key == _OPENGLES_TEXTUREFORMAT_ATC && openglesTexture.Contains(L"ATC") == true)
1063                 {
1064                         value = true;
1065                 }
1066                 else if (key == _OPENGLES_TEXTUREFORMAT_PVRTC && openglesTexture.Contains(L"PVRTC") == true)
1067                 {
1068                         value = true;
1069                 }
1070                 else
1071                 {
1072                         value = false;
1073                 }
1074         }
1075         else if (key == _SCREEN_DESKTOPMODE)
1076         {               
1077                 value = false;
1078         }
1079         else if (key == _SPEECH_RECOGNITION)
1080         {
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;
1085         }
1086         else if (key == _SIP_VOIP)
1087         {
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;
1092         }
1093         else if (key == _USB_HOST)
1094         {
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;
1099         }
1100         else if (key == _USB_ACCESSORY)
1101         {
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;
1106         }
1107         else if (key == _INPUT_KEYBOARD)
1108         {
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");
1112
1113                 value = false;
1114                 if(pKeyboardType != null)
1115                 {
1116                         if(strlen(pKeyboardType) > 0)
1117                         {
1118                                 value = true;
1119                         }
1120                 }
1121                 free(pKeyboardType);
1122                 return r;
1123         }
1124         else
1125         {
1126                 r = GetFromRegistry(key, value);
1127                 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_OBJ_NOT_FOUND, "Failed to get the key[%ls]", key.GetPointer());
1128         }
1129
1130         return E_SUCCESS;
1131 }
1132
1133
1134 result
1135 _SystemInfoImpl::GetSysInfo(const String& key, UuId& value)
1136 {
1137         return E_OBJ_NOT_FOUND;
1138 }
1139
1140
1141 Collection::IList*
1142 _SystemInfoImpl::GetSysInfoValuesN(const String& key, SystemInfoValueType type)
1143 {       
1144         SetLastResult(E_OBJ_NOT_FOUND);
1145         return null;
1146 }
1147
1148 result
1149 _SystemInfoImpl::GetPlatformVersion(String& platformVersion)
1150 {
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");
1155
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);
1159         return r;
1160 }
1161
1162 result
1163 _SystemInfoImpl::GetNativeApiVersion(String& nativeApiVersion)
1164 {
1165         return GetFromRegistry(_PLATFORM_NATIVE_API_VERSION, nativeApiVersion);
1166 }
1167
1168 result
1169 _SystemInfoImpl::GetWebApiVersion(String& webApiVersion)
1170 {
1171         return GetFromRegistry(_PLATFORM_WEB_API_VERSION, webApiVersion);
1172 }
1173
1174 result
1175 _SystemInfoImpl::GetImei(String& imei)
1176 {
1177         result r = E_SUCCESS;
1178         int error = -1;
1179         char* pImei = null;
1180
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");
1183
1184         r = StringUtil::Utf8ToString(pImei, imei);
1185         SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "[%s] StringUtil::Utf8ToString failed", GetErrorMessage(r));
1186         free(pImei);
1187
1188         return r;
1189 }
1190
1191 result
1192 _SystemInfoImpl::GetFromRegistry(const String& key, String& value)
1193 {
1194         result r = E_SUCCESS;
1195         _RegistryImpl _reg;
1196         String valStr;
1197
1198         r = _reg.Construct(_REGISTRY_PATH, REG_OPEN_READ_ONLY, null);
1199         SysTryReturnResult(NID_SYS, !IsFailed(r), r, " RegistryImpl construct Failed");
1200
1201         r = _reg.GetValue(_SYSTEM_INFO_SESSION, key, valStr);
1202         SysTryReturnResult(NID_SYS, !IsFailed(r), r, " Registry GetValue  Failed");
1203
1204         if(valStr == L"true" || valStr == L"false")
1205         {
1206                 return E_OBJ_NOT_FOUND;
1207         }
1208         else
1209         {
1210                 value = valStr;
1211         }
1212
1213         return E_SUCCESS;
1214 }
1215
1216 result
1217 _SystemInfoImpl::GetFromRegistry(const String& key, int& value)
1218 {
1219         result r = E_SUCCESS;
1220         _RegistryImpl _reg;
1221         String valStr;
1222         r = _reg.Construct(_REGISTRY_PATH, REG_OPEN_READ_ONLY, null);
1223         SysTryReturnResult(NID_SYS, !IsFailed(r), r, " RegistryImpl construct Failed");
1224
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");
1230         return E_SUCCESS;
1231 }
1232
1233 result
1234 _SystemInfoImpl::GetFromRegistry(const String& key, bool& value)
1235 {
1236         result r = E_SUCCESS;
1237         _RegistryImpl _reg;
1238         String valStr;
1239         r = _reg.Construct(_REGISTRY_PATH, REG_OPEN_READ_ONLY, null);
1240         SysTryReturnResult(NID_SYS, !IsFailed(r), r, " RegistryImpl construct Failed");
1241
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")
1246         {
1247                 value = true;
1248         }
1249         else if(valStr == L"false")
1250         {
1251                 value = false;
1252         }
1253         else
1254         {
1255                 return E_OBJ_NOT_FOUND;
1256         }
1257         return E_SUCCESS;
1258 }
1259 _SystemInfoImpl*
1260 _SystemInfoImpl::GetInstance(SystemInfo& systeminfo)
1261 {
1262         return systeminfo.__pSystemInfoImpl;
1263 }
1264 const _SystemInfoImpl*
1265 _SystemInfoImpl::GetInstance(const SystemInfo& systeminfo)
1266 {
1267         return systeminfo.__pSystemInfoImpl;
1268 }
1269 } } // Tizen::System