sync with master
[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 <unique_ptr.h>
23
24 #include <FBaseInteger.h>
25
26 #include <FBase_NativeError.h>
27 #include <FIo_RegistryImpl.h>
28 #include <FSys_SystemInfoImpl.h>
29 #include <FIo_AppServiceIpcMessages.h>
30 #include <FIo_IpcClient.h>
31 #include <FSys_Types.h>
32
33 using namespace std;
34
35 using namespace Tizen::Base;
36 using namespace Tizen::Base::Collection;
37 using namespace Tizen::Io;
38
39 namespace Tizen { namespace System
40 {
41
42 static const wchar_t* _REGISTRY_PATH = L"/tmp/osp/system_info_cache.ini";
43 static const wchar_t* _SYSTEM_INFO_SESSION = L"SystemInformation";
44
45 //Bluetooth
46 static const wchar_t* _BLUETOOTH = L"http://tizen.org/feature/network.bluetooth";
47 static const wchar_t* _BLUETOOTH_SUPPORTED = L"BluetoothSupported";
48
49 //Camera
50
51 static const wchar_t* _CAMERA_FRONT = L"http://tizen.org/feature/camera.front";
52
53 static const wchar_t* _CAMERA_BACK = L"http://tizen.org/feature/camera.back";
54
55 static const wchar_t* _CAMERA_COUNT = L"CameraCount";
56
57 //DUID
58 static const wchar_t* _DUID = L"http://tizen.org/system/duid";
59 static const wchar_t* _DEVICE_ID = L"DUID";
60
61 //FM Radio
62 static const wchar_t* _FMRADIO = L"http://tizen.org/feature/fmradio";
63 static const wchar_t* _FM_RADIO_SUPPORTED = L"FmRadioSupported";
64
65 //Keyboard
66 static const wchar_t* _KEYBOARD_TYPE = L"KeyboardType";
67 static const wchar_t* _INPUT_KEYBOARD_LAYOUT = L"http://tizen.org/feature/input.keyboard.layout";
68
69 //Location
70 static const wchar_t* _GPS_SUPPORTED = L"GPSSupported";
71 static const wchar_t* _LOCATION_GPS = L"http://tizen.org/feature/location.gps";
72 static const wchar_t* _WPS_SUPPORTED = L"WPSSupported";
73 static const wchar_t* _LOCATION_WPS = L"http://tizen.org/feature/location.wps";
74
75 //Model name
76 static const wchar_t* _MODELNAME = L"http://tizen.org/system/model_name";
77 static const wchar_t* _MODEL_NAME = L"ModelName";
78
79 //Multi point
80 static const wchar_t* _MULTIPOINTTOUCH_POINTCOUNT = L"http://tizen.org/feature/multi_point_touch.point_count";
81 static const wchar_t* _MULTIPOINT_TOUCH_COUNT = L"MultiPointTouchCount";
82
83 //NFC
84 static const wchar_t* _NETWORK_NFC = L"http://tizen.org/feature/network.nfc";
85 static const wchar_t* _NFC_SUPPORTED = L"NFCSupported";
86
87 //Opengles
88 static const wchar_t* _OPENGLES_VERSION_1_1 = L"http://tizen.org/feature/opengles.version.1_1";
89 static const wchar_t* _OPENGLES_VERSION_2_0 = L"http://tizen.org/feature/opengles.version.2_0";
90 static const wchar_t* _OPENGL_ES_VERSION = L"OpenGLESVersion";
91
92 // Screen
93 static const wchar_t* _SCREEN_BPP = L"http://tizen.org/feature/screen.bpp";
94 static const wchar_t* _SCREEN_BITS_PER_PIXEL = L"ScreenBitsPerPixel";
95 static const wchar_t* _SCREEN_DPI = L"http://tizen.org/feature/screen.dpi";
96 static const wchar_t* _SCREEN_HEIGHT = L"http://tizen.org/feature/screen.height";
97 static const wchar_t* _SCREENHEIGHT = L"ScreenHeight";
98 static const wchar_t* _SCREEN_WIDTH = L"http://tizen.org/feature/screen.width";
99 static const wchar_t* _SCREENWIDTH = L"ScreenWidth";
100 static const wchar_t* _SCREENDPI = L"ScreenDPI";
101
102 //HDMI RCA
103 static const wchar_t* _SCREEN_OUTPUT_RCA = L"http://tizen.org/feature/screen.output.rca";
104 static const wchar_t* _TV_OUT_SUPPORTED = L"TvOutSupported";
105
106 //Sound
107 static const wchar_t* _SOUND_MEDIA_VOLUME_MAX = L"http://tizen.org/system/sound.media.volume.resolution.max";
108 static const wchar_t* _MAX_MEDIA_SOUND_VOLUME = L"MaxMediaSoundVolume";
109 static const wchar_t* _SOUND_NOTIFICATION_VOLUME_MAX = L"http://tizen.org/system/sound.notification.volume.resolution.max";
110 static const wchar_t* _MAX_NOTIFICATION_SOUND_VOLUME = L"MaxNotificationSoundVolume";
111 static const wchar_t* _SOUND_RINGTONE_VOLUME_MAX = L"http://tizen.org/system/sound.ringtone.volume.resolution.max";
112 static const wchar_t* _MAX_RINGTONE_SOUND_VOLUME = L"MaxRingtoneSoundVolume";
113 static const wchar_t* _SOUND_SYSTEM_VOLUME_MAX = L"http://tizen.org/system/sound.system.volume.resolution.max";
114 static const wchar_t* _MAX_SYSTEM_SOUND_VOLUME = L"MaxSystemSoundVolume";
115
116 //Telephony
117 static const wchar_t* _TELEPHONY = L"http://tizen.org/feature/network.telephony";
118 static const wchar_t* _TELEPHONY_SERVICE_GSM = L"http://tizen.org/feature/network.telephony.service.gsm";
119 static const wchar_t* _TELEPHONY_SERVICE_GPRS = L"http://tizen.org/feature/network.telephony.service.gprs";
120 static const wchar_t* _TELEPHONY_SERVICE_EDGE = L"http://tizen.org/feature/network.telephony.service.edge";
121 static const wchar_t* _TELEPHONY_SERVICE_UMTS = L"http://tizen.org/feature/network.telephony.service.umts";
122 static const wchar_t* _TELEPHONY_SERVICE_HSDPA = L"http://tizen.org/feature/network.telephony.service.hsdpa";
123 static const wchar_t* _TELEPHONY_SERVICE_HSUPA = L"http://tizen.org/feature/network.telephony.service.hsupa";
124 static const wchar_t* _TELEPHONY_SERVICE_HSPA = L"http://tizen.org/feature/network.telephony.service.hspa";
125 static const wchar_t* _TELEPHONY_SERVICE_LTE = L"http://tizen.org/feature/network.telephony.service.lte";
126 static const wchar_t* _TELEPHONY_SERVICE_CDMA = L"http://tizen.org/feature/network.telephony.service.cdma";
127 static const wchar_t* _NETWORK_TYPE = L"NetworkType";
128 static const wchar_t* _NETWORK_EMERGENCY = L"Emergency";
129 static const wchar_t* _NETWORK_NO_SERVICE = L"NoService";
130
131
132 //WIFI
133 static const wchar_t* _WIFI = L"http://tizen.org/feature/network.wifi";
134 static const wchar_t* _WIFI_SUPPORTED = L"WiFiSupported";
135 static const wchar_t* _WIFI_DIRECT = L"http://tizen.org/feature/network.wifi.direct";
136 static const wchar_t* _WIFI_DIRECT_SUPPORTED = L"WiFiDirectSupported";
137
138 //Version
139 static const wchar_t* _PLATFORM_VERSION = L"http://tizen.org/feature/platform.version";
140 static const wchar_t* _PLATFORM_NATIVE_API_VERSION = L"http://tizen.org/feature/platform.native.api.version";
141 static const wchar_t* _PLATFORM_WEB_API_VERSION = L"http://tizen.org/feature/platform.web.api.version";
142 static const wchar_t* _BUID_STRING = L"http://tizen.org/system/build.string";
143
144 static const wchar_t* _WAC_VERSION = L"WACVersion";
145 static const wchar_t* _SUPPORTED = L"Supported";
146 static const wchar_t* _UNSUPPORTED = L"Unsupported";
147
148 String
149 _SystemInfoImpl::ConvertToTizen(const String& key)
150 {
151         String code(key);
152
153         if(code == _DEVICE_ID)
154         {
155                 code = _DUID;
156         }
157         else if(code == _MODEL_NAME)
158         {
159                 code = _MODELNAME;
160         }
161         else if(code == _KEYBOARD_TYPE)
162         {
163                 code == _INPUT_KEYBOARD_LAYOUT;
164         }
165         else if(code == _SCREEN_BITS_PER_PIXEL)
166         {
167                 code = _SCREEN_BPP;
168         }
169         else if(code == _SCREENHEIGHT)
170         {
171                 code = _SCREEN_HEIGHT;
172         }
173         else if(code == _SCREENWIDTH)
174         {
175                 code = _SCREEN_WIDTH;
176         }
177         else if(code == _SCREENDPI)
178         {
179                 code = _SCREEN_DPI;
180         }
181         else if(code == _MAX_SYSTEM_SOUND_VOLUME)
182         {
183                 code = _SOUND_SYSTEM_VOLUME_MAX;
184         }
185         else if(code == _MAX_MEDIA_SOUND_VOLUME)
186         {
187                 code = _SOUND_MEDIA_VOLUME_MAX;
188         }
189         else if(code == _MAX_RINGTONE_SOUND_VOLUME)
190         {
191                 code = _SOUND_RINGTONE_VOLUME_MAX;
192         }
193         else if(code == _MAX_NOTIFICATION_SOUND_VOLUME)
194         {
195                 code = _SOUND_NOTIFICATION_VOLUME_MAX;
196         }
197         else if(code == _MULTIPOINT_TOUCH_COUNT)
198         {
199                 code = _MULTIPOINTTOUCH_POINTCOUNT;
200         }
201         else if(code == _BLUETOOTH_SUPPORTED)
202         {
203                 code = _BLUETOOTH;
204         }
205         else if(code == _GPS_SUPPORTED)
206         {
207                 code = _LOCATION_GPS;
208         }
209         else if(code == _WPS_SUPPORTED)
210         {
211                 code = _LOCATION_WPS;
212         }
213         else if(code == _WIFI_SUPPORTED)
214         {
215                 code = _WIFI;
216         }
217         else if(code == _WIFI_DIRECT_SUPPORTED)
218         {
219                 code = _WIFI_DIRECT;
220         }
221         else if(code == _FM_RADIO_SUPPORTED)
222         {
223                 code = _FMRADIO;
224         }
225         else if(code == _TV_OUT_SUPPORTED)
226         {
227                 code = _SCREEN_OUTPUT_RCA;
228         }
229         else if(code == _NFC_SUPPORTED)
230         {
231                 code = _NETWORK_NFC;
232         }
233         return code;
234 }
235
236 result
237 _SystemInfoImpl::GetSysInfo(const String& key, String& value)
238 {
239         result r = E_OBJ_NOT_FOUND;
240         String tizenKey = ConvertToTizen(key);
241
242         if (key == _NETWORK_TYPE) //Compatibility
243         {
244                 bool supported = false;
245                 GetSysInfo(_TELEPHONY, supported);
246                 if(supported == false)
247                 {
248                         value = _NETWORK_EMERGENCY;
249                 }
250
251                 bool supportedGsm = false;
252                 bool supportedGprs = false;
253                 bool supportedEdge = false;
254                 bool supportedUmts = false;
255                 bool supportedHsdpa = false;
256                 bool supportedHsupa = false;
257                 bool supportedHspa = false;
258                 bool supportedLte = false;
259                 bool supportedCdma = false;
260
261                 GetSysInfo(_TELEPHONY_SERVICE_GSM, supportedGsm);
262                 GetSysInfo(_TELEPHONY_SERVICE_GPRS, supportedGprs);
263                 GetSysInfo(_TELEPHONY_SERVICE_EDGE, supportedEdge);
264                 GetSysInfo(_TELEPHONY_SERVICE_UMTS, supportedUmts);
265                 GetSysInfo(_TELEPHONY_SERVICE_HSDPA, supportedHsdpa);
266                 GetSysInfo(_TELEPHONY_SERVICE_HSUPA, supportedHsupa);
267                 GetSysInfo(_TELEPHONY_SERVICE_HSPA, supportedHspa);
268                 GetSysInfo(_TELEPHONY_SERVICE_LTE, supportedLte);
269                 GetSysInfo(_TELEPHONY_SERVICE_CDMA, supportedCdma);
270
271                 value.Clear();
272                 if(supportedGsm == false && supportedGprs == false
273                         && supportedEdge == false && supportedUmts == false
274                         && supportedHsdpa == false && supportedHsupa == false
275                         && supportedHspa == false && supportedLte == false
276                         && supportedCdma == false)
277                 {
278                         value = _NETWORK_NO_SERVICE;
279                 }
280                 else if(supportedGsm == true)
281                 {
282                         value.Append(L"GSM");
283                 }
284                 else if(supportedGprs == true)
285                 {
286                         if(value.GetLength() > 0)
287                                 value.Append(L" | ");
288
289                         value.Append(L"GPRS");
290                 }
291                 else if(supportedEdge == true)
292                 {
293                         if(value.GetLength() > 0)
294                                 value.Append(L" | ");
295
296                         value.Append(L"EDGE");
297                 }
298                 else if(supportedUmts == true)
299                 {
300                         if(value.GetLength() > 0)
301                                 value.Append(L" | ");
302
303                         value.Append(L"UMTS");
304                 }
305                 else if(supportedHsdpa == true)
306                 {
307                         if(value.GetLength() > 0)
308                                 value.Append(L" | ");
309
310                         value.Append(L"HSDPA");
311                 }
312                 else if(supportedHsupa == true)
313                 {
314                         if(value.GetLength() > 0)
315                                 value.Append(L" | ");
316
317                         value.Append(L"HSUPA");
318                 }
319                 else if(supportedHspa == true)
320                 {
321                         if(value.GetLength() > 0)
322                                 value.Append(L" | ");
323
324                         value.Append(L"HSPA");
325                 }
326                 else if(supportedLte == true)
327                 {
328                         if(value.GetLength() > 0)
329                                 value.Append(L" | ");
330
331                         value.Append(L"LTE");
332                 }
333                 else if(supportedCdma == true)
334                 {
335                         if(value.GetLength() > 0)
336                                 value.Append(L" | ");
337
338                         value.Append(L"CDMA");
339                 }
340
341         }
342         else if (key == _OPENGL_ES_VERSION)
343         {
344                 bool opengles_11 = false;
345                 bool opengles_20 = false;
346
347                 GetSysInfo(_OPENGLES_VERSION_1_1, opengles_11);
348                 GetSysInfo(_OPENGLES_VERSION_2_0, opengles_20);
349
350                 if(opengles_11 == true)
351                 {
352                         value.Append(L"1.1");
353                 }
354                 else if(opengles_20 == true)
355                 {
356                         if(value.GetLength() > 0)
357                                 value.Append(L" | ");
358
359                         value.Append(L"2.0");
360                 }
361         }
362         else if(key == _BLUETOOTH_SUPPORTED)
363         {
364                 bool supported = false;
365                 GetSysInfo(_BLUETOOTH, supported);
366                 if(supported == false)
367                         value = _SUPPORTED;
368                 else
369                         value = _UNSUPPORTED;
370         }
371         else if (key == _GPS_SUPPORTED)
372         {
373                 bool supported = false;
374                 GetSysInfo(_LOCATION_GPS, supported);
375                 if(supported == false)
376                         value = _SUPPORTED;
377                 else
378                         value = _UNSUPPORTED;
379         }
380         else if (key == _WIFI_SUPPORTED)
381         {
382                 bool supported = false;
383                 GetSysInfo(_WIFI, supported);
384                 if(supported == false)
385                         value = _SUPPORTED;
386                 else
387                         value = _UNSUPPORTED;
388         }
389         else if (key == _WAC_VERSION)
390         {
391                 value.Clear();
392                 r = E_SUCCESS;
393         }
394         else if (key == _PLATFORM_NATIVE_API_VERSION || key == _PLATFORM_WEB_API_VERSION || key == _PLATFORM_VERSION)
395         {
396                 r = E_OBJ_NOT_FOUND;
397         }
398         else
399         {
400                 r = GetFromRegistry(tizenKey, value);
401                 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_OBJ_NOT_FOUND, "It is failed to get the key[%ls]", tizenKey.GetPointer());
402                 r = E_SUCCESS;
403         }
404         return r;
405 }
406
407
408 result
409 _SystemInfoImpl::GetSysInfo(const String& key, int& value)
410 {
411         result r = E_SUCCESS;
412         String tizenKey = ConvertToTizen(key);
413
414         if (key == _CAMERA_COUNT)
415         {
416                 bool supported = false;
417                 int cameraCount = 0;
418
419                 GetSysInfo(_CAMERA_FRONT, supported);
420                 if(supported == true)
421                         cameraCount++;
422
423                 GetSysInfo(_CAMERA_BACK, supported);
424                 if(supported == true)
425                         cameraCount++;
426
427                 value = cameraCount;
428         }       
429         else
430         {
431                 r = GetFromRegistry(tizenKey, value);
432                 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_OBJ_NOT_FOUND, "It is failed to get the key[%ls]", tizenKey.GetPointer());
433         }
434         
435         return r;
436 }
437
438
439 result
440 _SystemInfoImpl::GetSysInfo(const String& key, long long& value)
441 {
442         return E_OBJ_NOT_FOUND;
443 }
444
445
446 result
447 _SystemInfoImpl::GetSysInfo(const String& key, double& value)
448 {
449         return E_OBJ_NOT_FOUND;
450 }
451
452
453 result
454 _SystemInfoImpl::GetSysInfo(const String& key, bool& value)
455 {
456         result r = E_SUCCESS;
457         String tizenKey = ConvertToTizen(key);
458
459         r = GetFromRegistry(tizenKey, value);
460         SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_OBJ_NOT_FOUND, "It is failed to get the key[%ls]", tizenKey.GetPointer());
461
462         return E_SUCCESS;
463 }
464
465
466 result
467 _SystemInfoImpl::GetSysInfo(const String& key, UuId& value)
468 {
469         return E_OBJ_NOT_FOUND;
470 }
471
472
473 Collection::IList*
474 _SystemInfoImpl::GetSysInfoValuesN(const String& key, SystemInfoValueType type)
475 {       
476         SetLastResult(E_OBJ_NOT_FOUND);
477         return null;
478 }
479
480 result
481 _SystemInfoImpl::GetPlatformVersion(String& platformVersion)
482 {
483         result r = E_SUCCESS;
484         String tizenKey(_PLATFORM_VERSION);
485
486         r = GetFromRegistry(tizenKey, platformVersion);
487         SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to get the key[%ls]", tizenKey.GetPointer());
488         return r;
489 }
490
491 result
492 _SystemInfoImpl::GetBuildInfo(String& buildInfo)
493 {
494         result r = E_SUCCESS;
495         String tizenKey(_BUID_STRING);
496
497         r = GetFromRegistry(tizenKey, buildInfo);
498         SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to get the key[%ls]", tizenKey.GetPointer());
499         return r;
500 }
501
502 result
503 _SystemInfoImpl::GetNativeApiVersion(String& nativeApiVersion)
504 {
505         result r = E_SUCCESS;
506         String tizenKey(_PLATFORM_NATIVE_API_VERSION);
507
508         r = GetFromRegistry(tizenKey, nativeApiVersion);
509         SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to get the key[%ls]", tizenKey.GetPointer());
510         return r;
511 }
512
513 result
514 _SystemInfoImpl::GetWebApiVersion(String& webApiVersion)
515 {
516         result r = E_SUCCESS;
517         String tizenKey(_PLATFORM_WEB_API_VERSION);
518
519         r = GetFromRegistry(tizenKey, webApiVersion);
520         SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, "It is failed to get the key[%ls]", tizenKey.GetPointer());
521         return r;
522 }
523
524 result
525 _SystemInfoImpl::GetImei(String& imei)
526 {
527         result r = E_SUCCESS;
528
529         ArrayList requestMessage;
530         ArrayList responseMessage;
531
532         unique_ptr<_IpcClient> pIpcClient (new (std::nothrow) _IpcClient());
533         SysTryReturn(NID_SYS, pIpcClient != null, E_OUT_OF_MEMORY, r, "It is failed to create IPC instance.");
534
535         r = pIpcClient->Construct(_COMMUNICATION_DISPATCHER_IPC_ID);
536         SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "It is failed to create IpcClient. [%s]", GetErrorMessage(r));
537
538         requestMessage.Construct();
539         responseMessage.Construct();
540
541         String serviceId(_SYSTEM_SERVICE_ID);
542         String commandId(L"osp.system.command.get.imei.internal");
543
544         requestMessage.Add(serviceId);
545         requestMessage.Add(commandId);
546
547         unique_ptr<IoService_Request> pMsg(new (std::nothrow) IoService_Request(requestMessage, &responseMessage));
548         SysTryReturnResult(NID_SYS, pMsg != null, E_OUT_OF_MEMORY, "It is failed to create Ipc message");
549
550         r = pIpcClient->SendRequest(pMsg.get());
551         SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "It is failed to send ipc message. [%s]", GetErrorMessage(r));
552
553         unique_ptr<String> pResult((String*)responseMessage.GetAt(_SYSTEM_RESPONSE_DATA));
554         unique_ptr<String> pImei((String*)responseMessage.GetAt(_SYSTEM_RESPONSE_DATA+1));
555
556         SysTryReturnResult(NID_SYS, pResult != null, E_SYSTEM, "It is failed to receive result on IPC response message.");
557         SysTryReturnResult(NID_SYS, pImei != null, E_SYSTEM, "It is failed to receive IMEI value on IPC response message.");
558
559         SysTryReturnResult(NID_SYS, *pResult != _SYSTEM_RESULT_PRIVILEGED, E_PRIVILEGE_DENIED, "It is failed to get privilege.");
560         SysTryReturnResult(NID_SYS, *pResult == _SYSTEM_RESULT_OK, E_SYSTEM, "It is failed to get IMEI value.");
561
562         imei = *pImei;
563         return r;
564 }
565
566 result
567 _SystemInfoImpl::GetFromRegistry(const String& key, String& value)
568 {
569         result r = E_SUCCESS;
570         _RegistryImpl _reg;
571         String valStr;
572
573         r = _reg.Construct(_REGISTRY_PATH, REG_OPEN_READ_ONLY, null);
574         SysTryReturnResult(NID_SYS, r == E_SUCCESS , r, " RegistryImpl construct It is failed");
575
576         r = _reg.GetValue(_SYSTEM_INFO_SESSION, key, valStr);
577         SysTryReturnResult(NID_SYS, r == E_SUCCESS , r, " Registry GetValue  It is failed");
578
579         if(valStr == L"true" || valStr == L"false")
580         {
581                 return E_OBJ_NOT_FOUND;
582         }
583         else
584         {
585                 value = valStr;
586         }
587
588         return E_SUCCESS;
589 }
590
591 result
592 _SystemInfoImpl::GetFromRegistry(const String& key, int& value)
593 {
594         result r = E_SUCCESS;
595         _RegistryImpl _reg;
596         String valStr;
597         r = _reg.Construct(_REGISTRY_PATH, REG_OPEN_READ_ONLY, null);
598         SysTryReturnResult(NID_SYS, r == E_SUCCESS, r, " RegistryImpl construct It is failed");
599
600         r = _reg.GetValue(_SYSTEM_INFO_SESSION, key, valStr);
601         SysTryReturnResult(NID_SYS, r == E_SUCCESS, r, " Registry GetValue  It is failed");
602         SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, " Registry GetValue  It is failed");
603         r = Integer::Parse(valStr, value);
604         SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_OBJ_NOT_FOUND, " Integer::Parse()  It is failed");
605         return E_SUCCESS;
606 }
607
608 result
609 _SystemInfoImpl::GetFromRegistry(const String& key, bool& value)
610 {
611         result r = E_SUCCESS;
612         _RegistryImpl _reg;
613         String valStr;
614         r = _reg.Construct(_REGISTRY_PATH, REG_OPEN_READ_ONLY, null);
615         SysTryReturnResult(NID_SYS, r == E_SUCCESS, r, " RegistryImpl construct It is failed");
616
617         r = _reg.GetValue(_SYSTEM_INFO_SESSION, key, valStr);
618         SysTryReturnResult(NID_SYS, r == E_SUCCESS, r, " Registry GetValue It is failed");
619         SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, " Registry GetValue  It is failed");
620         if(valStr == L"true")
621         {
622                 value = true;
623         }
624         else if(valStr == L"false")
625         {
626                 value = false;
627         }
628         else
629         {
630                 return E_OBJ_NOT_FOUND;
631         }
632         return E_SUCCESS;
633 }
634 _SystemInfoImpl*
635 _SystemInfoImpl::GetInstance(SystemInfo& systeminfo)
636 {
637         return systeminfo.__pSystemInfoImpl;
638 }
639 const _SystemInfoImpl*
640 _SystemInfoImpl::GetInstance(const SystemInfo& systeminfo)
641 {
642         return systeminfo.__pSystemInfoImpl;
643 }
644 } } // Tizen::System