Fix prevent issue
authorJoohyun Kim <joohyune.kim@samsung.com>
Tue, 25 Jun 2013 08:03:02 +0000 (17:03 +0900)
committerJoohyun Kim <joohyune.kim@samsung.com>
Tue, 25 Jun 2013 08:16:03 +0000 (17:16 +0900)
Change-Id: Ia19c052e1a917827831e9fb40f74320076285250
Signed-off-by: Joohyun Kim <joohyune.kim@samsung.com>
src/system/FSys_DeviceId.cpp

index 2fc2f5e..4790ff5 100644 (file)
@@ -150,16 +150,24 @@ _DeviceId::GetId(Tizen::Base::String& deviceId, int type)
                int time_count = 0;
                int status = 0;
                TapiHandle* handle = null;
-               
+
                while(time_count < 30) //Wait 30 second.
                {
-                       handle = tel_init(null);
+                       if(handle == null)
+                       {
+                               handle = tel_init(null);
+                       }
 
                        if(handle != null)
                        {
                                ret = tel_check_modem_power_status(handle, &status);
                                SysLog(NID_SYS, "Modem check result is %d, status is %d.", handle, status);
-                               SysTryReturnResult(NID_SYS, ret == TAPI_API_SUCCESS, E_SYSTEM,  "It is failed to get Modem status.");
+                               if(ret != TAPI_API_SUCCESS)
+                               {
+                                       tel_deinit(handle);
+                                       SysLogException(NID_SYS, E_SYSTEM, "It is failed to get IMEI.");
+                                       return E_SYSTEM;
+                               }
 
                                if(status == 0)
                                {
@@ -170,17 +178,25 @@ _DeviceId::GetId(Tizen::Base::String& deviceId, int type)
                        time_count++;
                }
 
-               if(ret != TAPI_API_SUCCESS)
+               if(handle != null)
                {
-                       tel_deinit(handle);
-                       SysLogException(NID_SYS, E_SYSTEM, "It is failed to get IMEI.");
-                       return E_SYSTEM;
+                       if(status == 0)
+                       {
+                               pDeviceString = tel_get_misc_me_imei_sync(handle);
+                               tel_deinit(handle);
+                               SysTryReturnResult(NID_SYS, pDeviceString != null, E_SYSTEM, "It is failed to get IMEI");
+                       }
+                       else
+                       {
+                               tel_deinit(handle);
+                               SysLogException(NID_SYS, E_SYSTEM, "Modem is not ready to get IMEI.");
+                               return E_SYSTEM;
+                       }
                }
                else
                {
-                       pDeviceString = tel_get_misc_me_imei_sync(handle);
-                       tel_deinit(handle);
-                       SysTryReturnResult(NID_SYS, pDeviceString != null, E_SYSTEM, "It is failed to get IMEI");
+                       SysLogException(NID_SYS, E_SYSTEM, "Modem handle is not ready.");
+                       return E_SYSTEM;
                }
        }
        else if(type == 1)