2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file FSys_SystemInfoImpl.cpp
19 * @brief This is the implementation file for _SystemInfoImpl class.
21 #include <unique_ptr.h>
24 #include <system_info.h>
25 #include <ITapiModem.h>
27 #include <FBaseBoolean.h>
28 #include <FBaseInteger.h>
29 #include <FBaseColHashMap.h>
30 #include <FBaseUtilStringUtil.h>
32 #include <FBase_NativeError.h>
33 #include <FBase_StringConverter.h>
34 #include <FIo_RegistryImpl.h>
35 #include <FSys_SystemInfoImpl.h>
36 #include <FIo_AppServiceIpcMessages.h>
37 #include <FIo_IpcClient.h>
39 #include "FSys_Types.h"
40 #include "FSys_SystemClient.h"
41 #include "FSys_CommunicationDispatcherClient.h"
45 using namespace Tizen::Base;
46 using namespace Tizen::Base::Collection;
47 using namespace Tizen::Io;
48 using namespace Tizen::Base::Utility;
50 namespace Tizen { namespace System
53 static const wchar_t* _REGISTRY_PATH = L"/opt/usr/etc/system_info_cache.ini";
54 static const wchar_t* _SYSTEM_INFO_SESSION = L"SystemInformation";
57 static const wchar_t* _BLUETOOTH = L"http://tizen.org/feature/network.bluetooth";
58 static const wchar_t* _BLUETOOTH_SUPPORTED = L"BluetoothSupported";
62 static const wchar_t* _CAMERA_FRONT = L"http://tizen.org/feature/camera.front";
64 static const wchar_t* _CAMERA_BACK = L"http://tizen.org/feature/camera.back";
66 static const wchar_t* _CAMERA_COUNT = L"CameraCount";
69 static const wchar_t* _DUID = L"http://tizen.org/system/duid";
70 static const wchar_t* _DEVICE_ID = L"DUID";
73 static const wchar_t* _FMRADIO = L"http://tizen.org/feature/fmradio";
74 static const wchar_t* _FM_RADIO_SUPPORTED = L"FmRadioSupported";
77 static const wchar_t* _KEYBOARD_TYPE = L"KeyboardType";
78 static const wchar_t* _INPUT_KEYBOARD_LAYOUT = L"http://tizen.org/feature/input.keyboard.layout";
81 static const wchar_t* _GPS_SUPPORTED = L"GPSSupported";
82 static const wchar_t* _LOCATION_GPS = L"http://tizen.org/feature/location.gps";
83 static const wchar_t* _WPS_SUPPORTED = L"WPSSupported";
84 static const wchar_t* _LOCATION_WPS = L"http://tizen.org/feature/location.wps";
87 static const wchar_t* _MODELNAME = L"http://tizen.org/system/model_name";
88 static const wchar_t* _MODEL_NAME = L"ModelName";
91 static const wchar_t* _MULTIPOINTTOUCH_POINTCOUNT = L"http://tizen.org/feature/multi_point_touch.point_count";
92 static const wchar_t* _MULTIPOINT_TOUCH_COUNT = L"MultiPointTouchCount";
95 static const wchar_t* _NETWORK_NFC = L"http://tizen.org/feature/network.nfc";
96 static const wchar_t* _NFC_SUPPORTED = L"NFCSupported";
99 static const wchar_t* _OPENGLES_VERSION_1_1 = L"http://tizen.org/feature/opengles.version.1_1";
100 static const wchar_t* _OPENGLES_VERSION_2_0 = L"http://tizen.org/feature/opengles.version.2_0";
101 static const wchar_t* _OPENGL_ES_VERSION = L"OpenGLESVersion";
104 static const wchar_t* _SCREEN_BPP = L"http://tizen.org/feature/screen.bpp";
105 static const wchar_t* _SCREEN_BITS_PER_PIXEL = L"ScreenBitsPerPixel";
106 static const wchar_t* _SCREEN_DPI = L"http://tizen.org/feature/screen.dpi";
107 static const wchar_t* _SCREEN_HEIGHT = L"http://tizen.org/feature/screen.height";
108 static const wchar_t* _SCREENHEIGHT = L"ScreenHeight";
109 static const wchar_t* _SCREEN_WIDTH = L"http://tizen.org/feature/screen.width";
110 static const wchar_t* _SCREENWIDTH = L"ScreenWidth";
111 static const wchar_t* _SCREENDPI = L"ScreenDPI";
114 static const wchar_t* _SCREEN_OUTPUT_RCA = L"http://tizen.org/feature/screen.output.rca";
115 static const wchar_t* _TV_OUT_SUPPORTED = L"TvOutSupported";
118 static const wchar_t* _SOUND_MEDIA_VOLUME_MAX = L"http://tizen.org/system/sound.media.volume.resolution.max";
119 static const wchar_t* _MAX_MEDIA_SOUND_VOLUME = L"MaxMediaSoundVolume";
120 static const wchar_t* _SOUND_NOTIFICATION_VOLUME_MAX = L"http://tizen.org/system/sound.notification.volume.resolution.max";
121 static const wchar_t* _MAX_NOTIFICATION_SOUND_VOLUME = L"MaxNotificationSoundVolume";
122 static const wchar_t* _SOUND_RINGTONE_VOLUME_MAX = L"http://tizen.org/system/sound.ringtone.volume.resolution.max";
123 static const wchar_t* _MAX_RINGTONE_SOUND_VOLUME = L"MaxRingtoneSoundVolume";
124 static const wchar_t* _SOUND_SYSTEM_VOLUME_MAX = L"http://tizen.org/system/sound.system.volume.resolution.max";
125 static const wchar_t* _MAX_SYSTEM_SOUND_VOLUME = L"MaxSystemSoundVolume";
128 static const wchar_t* _TELEPHONY = L"http://tizen.org/feature/network.telephony";
129 static const wchar_t* _TELEPHONY_SERVICE_GSM = L"http://tizen.org/feature/network.telephony.service.gsm";
130 static const wchar_t* _TELEPHONY_SERVICE_GPRS = L"http://tizen.org/feature/network.telephony.service.gprs";
131 static const wchar_t* _TELEPHONY_SERVICE_EDGE = L"http://tizen.org/feature/network.telephony.service.edge";
132 static const wchar_t* _TELEPHONY_SERVICE_UMTS = L"http://tizen.org/feature/network.telephony.service.umts";
133 static const wchar_t* _TELEPHONY_SERVICE_HSDPA = L"http://tizen.org/feature/network.telephony.service.hsdpa";
134 static const wchar_t* _TELEPHONY_SERVICE_HSUPA = L"http://tizen.org/feature/network.telephony.service.hsupa";
135 static const wchar_t* _TELEPHONY_SERVICE_HSPA = L"http://tizen.org/feature/network.telephony.service.hspa";
136 static const wchar_t* _TELEPHONY_SERVICE_LTE = L"http://tizen.org/feature/network.telephony.service.lte";
137 static const wchar_t* _TELEPHONY_SERVICE_CDMA = L"http://tizen.org/feature/network.telephony.service.cdma";
138 static const wchar_t* _NETWORK_TYPE = L"NetworkType";
139 static const wchar_t* _NETWORK_EMERGENCY = L"Emergency";
140 static const wchar_t* _NETWORK_NO_SERVICE = L"NoService";
143 static const wchar_t* _WIFI = L"http://tizen.org/feature/network.wifi";
144 static const wchar_t* _WIFI_SUPPORTED = L"WiFiSupported";
145 static const wchar_t* _WIFI_DIRECT = L"http://tizen.org/feature/network.wifi.direct";
146 static const wchar_t* _WIFI_DIRECT_SUPPORTED = L"WiFiDirectSupported";
149 static const wchar_t* _PLATFORM_VERSION = L"http://tizen.org/feature/platform.version";
150 static const wchar_t* _PLATFORM_NATIVE_API_VERSION = L"http://tizen.org/feature/platform.native.api.version";
151 static const wchar_t* _PLATFORM_WEB_API_VERSION = L"http://tizen.org/feature/platform.web.api.version";
152 static const wchar_t* _BUILD_STRING = L"http://tizen.org/system/build.string";
154 static const wchar_t* _WAC_VERSION = L"WACVersion";
155 static const wchar_t* _SUPPORTED = L"Supported";
156 static const wchar_t* _UNSUPPORTED = L"Unsupported";
158 static bool firstRequest = false;
159 static HashMap integerList(SingleObjectDeleter);
160 static HashMap boolList(SingleObjectDeleter);
161 static HashMap stringList(SingleObjectDeleter);
166 if(firstRequest == false)
168 integerList.Construct();
169 boolList.Construct();
170 stringList.Construct();
176 _SystemInfoImpl::ConvertToTizen(const String& key)
180 if(code == _DEVICE_ID)
184 else if(code == _MODEL_NAME)
188 else if(code == _KEYBOARD_TYPE)
190 code = _INPUT_KEYBOARD_LAYOUT;
192 else if(code == _SCREEN_BITS_PER_PIXEL)
196 else if(code == _SCREENHEIGHT)
198 code = _SCREEN_HEIGHT;
200 else if(code == _SCREENWIDTH)
202 code = _SCREEN_WIDTH;
204 else if(code == _SCREENDPI)
208 else if(code == _MAX_SYSTEM_SOUND_VOLUME)
210 code = _SOUND_SYSTEM_VOLUME_MAX;
212 else if(code == _MAX_MEDIA_SOUND_VOLUME)
214 code = _SOUND_MEDIA_VOLUME_MAX;
216 else if(code == _MAX_RINGTONE_SOUND_VOLUME)
218 code = _SOUND_RINGTONE_VOLUME_MAX;
220 else if(code == _MAX_NOTIFICATION_SOUND_VOLUME)
222 code = _SOUND_NOTIFICATION_VOLUME_MAX;
224 else if(code == _MULTIPOINT_TOUCH_COUNT)
226 code = _MULTIPOINTTOUCH_POINTCOUNT;
228 else if(code == _BLUETOOTH_SUPPORTED)
232 else if(code == _GPS_SUPPORTED)
234 code = _LOCATION_GPS;
236 else if(code == _WPS_SUPPORTED)
238 code = _LOCATION_WPS;
240 else if(code == _WIFI_SUPPORTED)
244 else if(code == _WIFI_DIRECT_SUPPORTED)
248 else if(code == _FM_RADIO_SUPPORTED)
252 else if(code == _TV_OUT_SUPPORTED)
254 code = _SCREEN_OUTPUT_RCA;
256 else if(code == _NFC_SUPPORTED)
264 _SystemInfoImpl::GetSysInfo(const String& key, String& value)
266 result r = E_OBJ_NOT_FOUND;
267 String tizenKey = ConvertToTizen(key);
269 SysLog(NID_SYS, "Request Key is %ls.", key.GetPointer());
271 if (firstRequest == false)
276 String* pValue = (String*)stringList.GetValue(tizenKey);
284 if (key == _NETWORK_TYPE) //Compatibility
286 bool supported = false;
287 GetSysInfo(_TELEPHONY, supported);
288 if(supported == false)
290 value = _NETWORK_EMERGENCY;
293 bool supportedGsm = false;
294 bool supportedGprs = false;
295 bool supportedEdge = false;
296 bool supportedUmts = false;
297 bool supportedHsdpa = false;
298 bool supportedHsupa = false;
299 bool supportedHspa = false;
300 bool supportedLte = false;
301 bool supportedCdma = false;
303 GetSysInfo(_TELEPHONY_SERVICE_GSM, supportedGsm);
304 GetSysInfo(_TELEPHONY_SERVICE_GPRS, supportedGprs);
305 GetSysInfo(_TELEPHONY_SERVICE_EDGE, supportedEdge);
306 GetSysInfo(_TELEPHONY_SERVICE_UMTS, supportedUmts);
307 GetSysInfo(_TELEPHONY_SERVICE_HSDPA, supportedHsdpa);
308 GetSysInfo(_TELEPHONY_SERVICE_HSUPA, supportedHsupa);
309 GetSysInfo(_TELEPHONY_SERVICE_HSPA, supportedHspa);
310 GetSysInfo(_TELEPHONY_SERVICE_LTE, supportedLte);
311 GetSysInfo(_TELEPHONY_SERVICE_CDMA, supportedCdma);
314 if(supportedGsm == false && supportedGprs == false
315 && supportedEdge == false && supportedUmts == false
316 && supportedHsdpa == false && supportedHsupa == false
317 && supportedHspa == false && supportedLte == false
318 && supportedCdma == false)
320 value = _NETWORK_NO_SERVICE;
322 else if(supportedGsm == true)
324 value.Append(L"GSM");
326 else if(supportedGprs == true)
328 if(value.GetLength() > 0)
329 value.Append(L" | ");
331 value.Append(L"GPRS");
333 else if(supportedEdge == true)
335 if(value.GetLength() > 0)
336 value.Append(L" | ");
338 value.Append(L"EDGE");
340 else if(supportedUmts == true)
342 if(value.GetLength() > 0)
343 value.Append(L" | ");
345 value.Append(L"UMTS");
347 else if(supportedHsdpa == true)
349 if(value.GetLength() > 0)
350 value.Append(L" | ");
352 value.Append(L"HSDPA");
354 else if(supportedHsupa == true)
356 if(value.GetLength() > 0)
357 value.Append(L" | ");
359 value.Append(L"HSUPA");
361 else if(supportedHspa == true)
363 if(value.GetLength() > 0)
364 value.Append(L" | ");
366 value.Append(L"HSPA");
368 else if(supportedLte == true)
370 if(value.GetLength() > 0)
371 value.Append(L" | ");
373 value.Append(L"LTE");
375 else if(supportedCdma == true)
377 if(value.GetLength() > 0)
378 value.Append(L" | ");
380 value.Append(L"CDMA");
384 else if (key == _OPENGL_ES_VERSION)
386 bool opengles_11 = false;
387 bool opengles_20 = false;
389 GetSysInfo(_OPENGLES_VERSION_1_1, opengles_11);
390 GetSysInfo(_OPENGLES_VERSION_2_0, opengles_20);
392 if(opengles_11 == true)
394 value.Append(L"1.1");
396 else if(opengles_20 == true)
398 if(value.GetLength() > 0)
399 value.Append(L" | ");
401 value.Append(L"2.0");
405 else if(key == _BLUETOOTH_SUPPORTED)
407 bool supported = false;
408 GetSysInfo(_BLUETOOTH, supported);
409 if(supported == false)
412 value = _UNSUPPORTED;
415 else if (key == _GPS_SUPPORTED)
417 bool supported = false;
418 GetSysInfo(_LOCATION_GPS, supported);
419 if(supported == false)
422 value = _UNSUPPORTED;
425 else if (key == _WIFI_SUPPORTED)
427 bool supported = false;
428 GetSysInfo(_WIFI, supported);
429 if(supported == false)
432 value = _UNSUPPORTED;
435 else if (key == _WAC_VERSION)
440 else if (key == _PLATFORM_NATIVE_API_VERSION || key == _PLATFORM_WEB_API_VERSION || key == _PLATFORM_VERSION || key == _BUILD_STRING)
444 else if (tizenKey == _DUID)
446 r = GetFromRegistry(tizenKey, value);
451 TapiHandle* handle = null;
455 handle = tel_init(null);
458 while(time_count < 30) //Wait 30 second.
460 ret = tel_check_modem_power_status(handle, &status);
461 SysLog(NID_SYS, "Modem check result is %d, status is %d.", handle, status);
462 if(ret != TAPI_API_SUCCESS)
464 SysLogException(NID_SYS, E_SYSTEM, "It is failed to get Modem status.");
479 _SystemClient* pSystemClient = _SystemClient::GetInstance();
480 r = pSystemClient->GetValue(tizenKey, value);
485 r = GetFromRegistry(tizenKey, value);
489 char* pStringValue = null;
491 tizenKey.SubString(7, tKey);
494 unique_ptr< char[] > systemKey(_StringConverter::CopyToCharArrayN(tKey));
496 SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "[%s] StringUtil::StringToUtf8N It is failed", GetErrorMessage(r));
497 int ret = system_info_get_platform_string(systemKey.get(), &pStringValue);
499 SysTryReturnResult(NID_SYS, ret == 0, E_OBJ_NOT_FOUND, "It is failed to get system information %ls from configration file.", tizenKey.GetPointer());
501 r = StringUtil::Utf8ToString(pStringValue, value);
508 stringList.Add(new String(tizenKey), new String(value));
514 _SystemInfoImpl::GetSysInfo(const String& key, int& value)
516 result r = E_SUCCESS;
517 String tizenKey = ConvertToTizen(key);
519 SysLog(NID_SYS, "Request Key is %ls.", key.GetPointer());
521 if (firstRequest == false)
526 Integer* pValue = (Integer*)integerList.GetValue(tizenKey);
530 value = pValue->value;
534 if (key == _CAMERA_COUNT)
536 bool supported = false;
539 GetSysInfo(_CAMERA_FRONT, supported);
540 if(supported == true)
543 GetSysInfo(_CAMERA_BACK, supported);
544 if(supported == true)
551 r = GetFromRegistry(tizenKey, value);
557 tizenKey.SubString(7, tKey);
560 unique_ptr< char[] > systemKey(_StringConverter::CopyToCharArrayN(tKey));
562 SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "[%s] StringUtil::StringToUtf8N It is failed", GetErrorMessage(r));
563 ret = system_info_get_platform_int(systemKey.get(), &value);
565 SysTryReturnResult(NID_SYS, ret == 0, E_OBJ_NOT_FOUND, "It is failed to get system information %ls from configration file.", tizenKey.GetPointer());
572 integerList.Add(new String(tizenKey), new Integer(value));
579 _SystemInfoImpl::GetSysInfo(const String& key, long long& value)
581 return E_OBJ_NOT_FOUND;
585 _SystemInfoImpl::GetSysInfo(const String& key, double& value)
587 return E_OBJ_NOT_FOUND;
591 _SystemInfoImpl::GetSysInfo(const String& key, bool& value)
593 result r = E_SUCCESS;
594 String tizenKey = ConvertToTizen(key);
596 SysLog(NID_SYS, "Request Key is %ls.", key.GetPointer());
598 if (firstRequest == false)
603 Boolean* pValue = (Boolean*)boolList.GetValue(tizenKey);
607 value = pValue->value;
611 r = GetFromRegistry(tizenKey, value);
615 tizenKey.SubString(7, tKey);
618 unique_ptr< char[] > systemKey(_StringConverter::CopyToCharArrayN(tKey));
620 SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "[%s] StringUtil::StringToUtf8N It is failed", GetErrorMessage(r));
622 bool supported = false;
623 int ret = system_info_get_platform_bool(systemKey.get(), &supported);
624 SysTryReturnResult(NID_SYS, ret == 0, E_OBJ_NOT_FOUND, "It is failed to get system information %ls from configration file.", tizenKey.GetPointer());
631 boolList.Add(new String(tizenKey), new Boolean(value));
638 _SystemInfoImpl::GetSysInfo(const String& key, UuId& value)
640 return E_OBJ_NOT_FOUND;
644 _SystemInfoImpl::GetSysInfoValuesN(const String& key, SystemInfoValueType type)
646 SetLastResult(E_OBJ_NOT_FOUND);
651 _SystemInfoImpl::GetPlatformVersion(String& platformVersion)
653 result r = E_SUCCESS;
654 String tizenKey(_PLATFORM_VERSION);
656 r = GetFromRegistry(tizenKey, platformVersion);
660 char* pStringValue = null;
662 tizenKey.SubString(7, tKey);
665 unique_ptr< char[] > systemKey(_StringConverter::CopyToCharArrayN(tKey));
667 SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "[%s] StringUtil::StringToUtf8N It is failed", GetErrorMessage(r));
668 int ret = system_info_get_platform_string(systemKey.get(), &pStringValue);
670 SysTryReturnResult(NID_SYS, ret == 0, E_OBJ_NOT_FOUND, "It is failed to get system information %ls from configration file.", tizenKey.GetPointer());
672 r = StringUtil::Utf8ToString(pStringValue, platformVersion);
680 _SystemInfoImpl::GetBuildInfo(String& buildInfo)
682 result r = E_SUCCESS;
683 String tizenKey(_BUILD_STRING);
685 r = GetFromRegistry(tizenKey, buildInfo);
689 char* pStringValue = null;
691 tizenKey.SubString(7, tKey);
694 unique_ptr< char[] > systemKey(_StringConverter::CopyToCharArrayN(tKey));
696 SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "[%s] StringUtil::StringToUtf8N It is failed", GetErrorMessage(r));
697 int ret = system_info_get_platform_string(systemKey.get(), &pStringValue);
699 SysTryReturnResult(NID_SYS, ret == 0, E_OBJ_NOT_FOUND, "It is failed to get system information %ls from configration file.", tizenKey.GetPointer());
701 r = StringUtil::Utf8ToString(pStringValue, buildInfo);
709 _SystemInfoImpl::GetNativeApiVersion(String& nativeApiVersion)
711 result r = E_SUCCESS;
712 String tizenKey(_PLATFORM_NATIVE_API_VERSION);
714 r = GetFromRegistry(tizenKey, nativeApiVersion);
718 char* pStringValue = null;
720 tizenKey.SubString(7, tKey);
723 unique_ptr< char[] > systemKey(_StringConverter::CopyToCharArrayN(tKey));
725 SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "[%s] StringUtil::StringToUtf8N It is failed", GetErrorMessage(r));
726 int ret = system_info_get_platform_string(systemKey.get(), &pStringValue);
728 SysTryReturnResult(NID_SYS, ret == 0, E_OBJ_NOT_FOUND, "It is failed to get system information %ls from configration file.", tizenKey.GetPointer());
730 r = StringUtil::Utf8ToString(pStringValue, nativeApiVersion);
738 _SystemInfoImpl::GetWebApiVersion(String& webApiVersion)
740 result r = E_SUCCESS;
741 String tizenKey(_PLATFORM_WEB_API_VERSION);
743 r = GetFromRegistry(tizenKey, webApiVersion);
747 char* pStringValue = null;
749 tizenKey.SubString(7, tKey);
752 unique_ptr< char[] > systemKey(_StringConverter::CopyToCharArrayN(tKey));
754 SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "[%s] StringUtil::StringToUtf8N It is failed", GetErrorMessage(r));
755 int ret = system_info_get_platform_string(systemKey.get(), &pStringValue);
757 SysTryReturnResult(NID_SYS, ret == 0, E_OBJ_NOT_FOUND, "It is failed to get system information %ls from configration file.", tizenKey.GetPointer());
759 r = StringUtil::Utf8ToString(pStringValue, webApiVersion);
767 _SystemInfoImpl::GetImei(String& imei)
769 result r = E_SUCCESS;
772 TapiHandle* handle = null;
776 handle = tel_init(null);
777 SysTryReturnResult(NID_SYS, handle != null, E_SYSTEM, "It is failed to get handle of telephony.");
778 while(time_count < 30) //Wait 30 second.
780 ret = tel_check_modem_power_status(handle, &status);
781 SysLog(NID_SYS, "Modem check result is %d, status is %d.", handle, status);
782 if(ret != TAPI_API_SUCCESS)
784 SysLogException(NID_SYS, E_SYSTEM, "It is failed to get Modem status.");
799 ArrayList requestMessage;
800 ArrayList responseMessage;
802 _CommunicationDispatcherClient* pCommunicationDispatcherClient = _CommunicationDispatcherClient::GetInstance();
804 _IpcClient* pIpcClient = pCommunicationDispatcherClient->GetIpcClient();
805 SysTryReturn(NID_SYS, pIpcClient != null, E_OUT_OF_MEMORY, r, "It is failed to create IPC instance.");
807 requestMessage.Construct();
808 responseMessage.Construct();
810 String serviceId(_SYSTEM_SERVICE_ID);
811 String commandId(L"osp.system.command.get.imei.internal");
813 requestMessage.Add(serviceId);
814 requestMessage.Add(commandId);
816 unique_ptr<IoService_Request> pMsg(new (std::nothrow) IoService_Request(requestMessage, &responseMessage));
817 SysTryReturnResult(NID_SYS, pMsg != null, E_OUT_OF_MEMORY, "It is failed to create Ipc message");
819 r = pIpcClient->SendRequest(pMsg.get());
820 SysTryReturn(NID_SYS, r == E_SUCCESS, E_SYSTEM, r, "It is failed to send ipc message. [%s]", GetErrorMessage(r));
822 unique_ptr<String> pResult((String*)responseMessage.GetAt(_SYSTEM_RESPONSE_DATA));
823 unique_ptr<String> pImei((String*)responseMessage.GetAt(_SYSTEM_RESPONSE_DATA+1));
825 SysTryReturnResult(NID_SYS, pResult != null, E_SYSTEM, "It is failed to receive result on IPC response message.");
826 SysTryReturnResult(NID_SYS, pImei != null, E_SYSTEM, "It is failed to receive IMEI value on IPC response message.");
828 SysTryReturnResult(NID_SYS, *pResult != _SYSTEM_RESULT_PRIVILEGED, E_PRIVILEGE_DENIED, "It is failed to get privilege.");
829 SysTryReturnResult(NID_SYS, *pResult == _SYSTEM_RESULT_OK, E_SYSTEM, "It is failed to get IMEI value.");
836 _SystemInfoImpl::GetFromRegistry(const String& key, String& value)
838 result r = E_SUCCESS;
842 r = _reg.Construct(_REGISTRY_PATH, REG_OPEN_READ_ONLY, null);
843 SysTryReturnResult(NID_SYS, r == E_SUCCESS , r, " RegistryImpl construct is failed");
845 r = _reg.GetValue(_SYSTEM_INFO_SESSION, key, valStr);
846 SysTryReturnResult(NID_SYS, r == E_SUCCESS , r, " Registry GetValue is failed");
848 if(valStr == L"true" || valStr == L"false")
850 return E_OBJ_NOT_FOUND;
861 _SystemInfoImpl::GetFromRegistry(const String& key, int& value)
863 result r = E_SUCCESS;
867 r = _reg.Construct(_REGISTRY_PATH, REG_OPEN_READ_ONLY, null);
868 SysTryReturnResult(NID_SYS, r == E_SUCCESS, r, " RegistryImpl construct is failed");
870 r = _reg.GetValue(_SYSTEM_INFO_SESSION, key, valStr);
871 SysTryReturnResult(NID_SYS, r == E_SUCCESS, r, " Registry GetValue is failed");
872 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, " Registry GetValue is failed");
873 r = Integer::Parse(valStr, value);
874 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_OBJ_NOT_FOUND, " Integer::Parse() is failed");
879 _SystemInfoImpl::GetFromRegistry(const String& key, bool& value)
881 result r = E_SUCCESS;
885 r = _reg.Construct(_REGISTRY_PATH, REG_OPEN_READ_ONLY, null);
886 SysTryReturnResult(NID_SYS, r == E_SUCCESS, r, " RegistryImpl construct is failed");
888 r = _reg.GetValue(_SYSTEM_INFO_SESSION, key, valStr);
889 SysTryReturnResult(NID_SYS, r == E_SUCCESS, r, " Registry GetValue is failed");
890 SysTryReturnResult(NID_SYS, r == E_SUCCESS, E_SYSTEM, " Registry GetValue is failed");
891 if(valStr == L"true")
895 else if(valStr == L"false")
901 return E_OBJ_NOT_FOUND;
907 _SystemInfoImpl::GetInstance(SystemInfo& systeminfo)
909 return systeminfo.__pSystemInfoImpl;
911 const _SystemInfoImpl*
912 _SystemInfoImpl::GetInstance(const SystemInfo& systeminfo)
914 return systeminfo.__pSystemInfoImpl;