add duid ipc mode
authordavid_kim31 <david_kim31@samsung.com>
Tue, 6 Aug 2013 12:36:55 +0000 (21:36 +0900)
committerdavid_kim31 <david_kim31@samsung.com>
Tue, 6 Aug 2013 12:57:22 +0000 (21:57 +0900)
Change-Id: Ie05d0707254ec6eb8272a2772b938dc7f5e50246
Signed-off-by: david_kim31 <david_kim31@samsung.com>
src/FSys_SystemService.cpp

index 17833e9..141c72f 100644 (file)
@@ -32,6 +32,7 @@
 #include <FBaseSysLog.h>
 #include <FSysSystemTime.h>
 #include <FSysSystemInfo.h>
+#include <FSys_DeviceId.h>
 
 #include <FApp_AppManagerImpl.h>
 #include <FBase_StringConverter.h>
@@ -58,6 +59,7 @@ namespace {
 
        static const wchar_t* _SYSTEM_COMMAND_GET_IMEI = L"osp.system.command.get.imei";
        static const wchar_t* _SYSTEM_COMMAND_GET_IMEI_INTERNAL = L"osp.system.command.get.imei.internal";
+       static const wchar_t* _SYSTEM_COMMAND_GET_DUID_INTERNAL = L"osp.system.command.get.duid.internal";
 
        static const wchar_t* _SYSTEM_COMMAND_POWER = L"osp.system.command.power";
        static const wchar_t* _SYSTEM_COMMAND_SYSTEM = L"osp.system.command.system";
@@ -67,6 +69,9 @@ namespace {
        static const wchar_t* _SYSTEM_RESULT_ERROR = L"osp.system.result.error";
        static const wchar_t* _SYSTEM_RESULT_INVALID = L"osp.system.result.invalid";
        static const wchar_t* _SYSTEM_RESULT_PRIVILEGED = L"osp.system.result.privilege";
+       static const wchar_t* _NETWORK_BLUETOOTH = L"http://tizen.org/feature/network.bluetooth";
+       static const wchar_t* _NETWORK_TELEPHONY = L"http://tizen.org/feature/network.telephony";
+       static const wchar_t* _NETWORK_WIFI = L"http://tizen.org/feature/network.wifi";
        static const int _SYSTEM_COMMAND_ID = 1;
        static const int _SYSTEM_COMMAND_ARG = 2;
 }
@@ -277,6 +282,51 @@ _SystemService::OnRequestOccured(AppId appId, int pid, ArrayList* request, Array
                        }
                }
        }
+       else if(*command ==  _SYSTEM_COMMAND_GET_DUID_INTERNAL)
+       {
+               bool supported = false;
+               String duid;
+               SysLog(NID_SYS, "It trys to get DUID from telephony.");
+               system_info_get_platform_bool("tizen.org/feature/network.telephony", &supported);
+               if(supported == true)
+               {
+                       r = _DeviceId::GetId(duid, 0);
+               }
+               else
+               {
+                       SysLog(NID_SYS, "It trys to get DUID from wifi.");
+                       system_info_get_platform_bool("tizen.org/feature/network.wifi", &supported);
+                       if(supported == true)
+                       {
+                               r = _DeviceId::GetId(duid, 1);
+                       }
+                       else
+                       {
+                               SysLog(NID_SYS, "It trys to get DUID from bluetooth.");
+                               system_info_get_platform_bool("tizen.org/feature/network.bluetooth", &supported);
+                               if(supported == true)
+                               {
+                                       r = _DeviceId::GetId(duid, 2);
+                               }
+                               else
+                               {
+                                       SysLogException(NID_SYS, E_SYSTEM, "It is failed to get telephony, wifi, bluetooth information.");
+                                       resultId = new (std::nothrow) String(_SYSTEM_RESULT_ERROR);
+                               }
+                       }
+               }
+
+               if(r != E_SUCCESS)
+               {
+                       SysLogException(NID_SYS, E_SYSTEM, "It is failed to get IMEI.");
+                       resultId = new (std::nothrow) String(_SYSTEM_RESULT_ERROR);
+               }
+               else
+               {
+                       resultId = new (std::nothrow) String(_SYSTEM_RESULT_OK);
+                       returnValue = new (std::nothrow) String(duid);
+               }
+       }
        else if(command->Contains(_SYSTEM_COMMAND_POWER) == true)
        {
                if(__pPowerManager != null)