Fix modem ready issue on IMEI (P130506-0100)
authorJoohyun Kim <joohyune.kim@samsung.com>
Tue, 14 May 2013 02:58:12 +0000 (11:58 +0900)
committerGerrit Code Review <gerrit2@kim11>
Tue, 14 May 2013 04:33:14 +0000 (13:33 +0900)
Change-Id: I52bf86ba7a3ec6fe614b2761f02fb7e3447e19b3
Signed-off-by: Joohyun Kim <joohyune.kim@samsung.com>
packaging/osp-appfw.spec
src/CMakeLists.txt
src/system/CMakeLists.txt
src/system/FSys_SystemInfoImpl.cpp

index a3ce0ed..46f0d6e 100755 (executable)
@@ -19,6 +19,7 @@ BuildRequires:  pkgconfig(capi-system-info)
 BuildRequires:  pkgconfig(capi-system-power)
 BuildRequires:  pkgconfig(capi-system-runtime-info)
 BuildRequires:  pkgconfig(capi-system-system-settings)
+BuildRequires:  pkgconfig(tapi)
 BuildRequires:  pkgconfig(alarm-service)
 BuildRequires:  pkgconfig(appsvc)
 BuildRequires:  pkgconfig(aul)
index 19fac68..5470392 100755 (executable)
@@ -30,6 +30,7 @@ pkg_check_modules(pkgs REQUIRED
        uuid
        vconf
        zlib
+       tapi
        capi-appfw-app-manager
        capi-appfw-application
        capi-appfw-package-manager
index 3d87d91..73c1ecf 100755 (executable)
@@ -11,6 +11,8 @@ INCLUDE_DIRECTORIES(
        ${CMAKE_SOURCE_DIR}/src/locales/inc
        ${CMAKE_SOURCE_DIR}/src/app/inc
        ${CMAKE_SOURCE_DIR}/src/security/inc
+       /usr/include/telephony
+       /usr/include/telephony-client
        )
 
 INCLUDE(FindPkgConfig)
index 6974c1d..3ecd54a 100644 (file)
@@ -19,6 +19,9 @@
  * @brief              This is the implementation file for _SystemInfoImpl class.
  */
 #include <unique_ptr.h>
+#include <unistd.h>
+
+#include <ITapiModem.h>
 
 #include <FBaseBoolean.h>
 #include <FBaseInteger.h>
@@ -432,6 +435,40 @@ _SystemInfoImpl::GetSysInfo(const String& key, String& value)
        {
                r = E_OBJ_NOT_FOUND;
        }
+       else if (key == _DUID)
+       {
+               int ret = 0;
+               TapiHandle* handle = null;
+               int time_count = 0;
+               int status = 0;
+
+               handle = tel_init(null);
+               if(handle != null)
+               {
+                       while(time_count < 30) //Wait 30 second.
+                       {
+                               ret = tel_check_modem_power_status(handle, &status);
+                               SysLog(NID_SYS, "Modem check result is %d, status is %d.", handle, status);
+                               if(ret != TAPI_API_SUCCESS)
+                               {
+                                       SysLogException(NID_SYS, E_SYSTEM, "It is failed to get Modem status.");
+                                       tel_deinit(handle);
+                                       return E_SYSTEM;
+                               }
+
+                               if(status == 0)
+                               {
+                                       break;
+                               }
+
+                               usleep(1000000);
+                               time_count++;
+                       }
+                       tel_deinit(handle);
+               }
+               _SystemClient* pSystemClient = _SystemClient::GetInstance();
+               r = pSystemClient->GetValue(key, value);
+       }
        else
        {
                r = GetFromRegistry(tizenKey, value);
@@ -610,6 +647,34 @@ _SystemInfoImpl::GetImei(String& imei)
 {
        result r = E_SUCCESS;
 
+       int ret = 0;
+       TapiHandle* handle = null;
+       int time_count = 0;
+       int status = 0;
+
+       handle = tel_init(null);
+       SysTryReturnResult(NID_SYS, handle != null, E_SYSTEM, "It is failed to get handle of telephony.");
+       while(time_count < 30) //Wait 30 second.
+       {
+               ret = tel_check_modem_power_status(handle, &status);
+               SysLog(NID_SYS, "Modem check result is %d, status is %d.", handle, status);
+               if(ret != TAPI_API_SUCCESS)
+               {
+                       SysLogException(NID_SYS, E_SYSTEM, "It is failed to get Modem status.");
+                       tel_deinit(handle);
+                       return E_SYSTEM;
+               }
+
+               if(status == 0)
+               {
+                       break;
+               }
+
+               usleep(1000000);
+               time_count++;
+       }
+       tel_deinit(handle);
+
        ArrayList requestMessage;
        ArrayList responseMessage;