[CTC][Platform-Permission][ACR-682][Modified iotcon_initialize function and fixed...
authorNibha Sharma <nibha.sharma@samsung.com>
Fri, 24 Jun 2016 06:00:39 +0000 (15:00 +0900)
committerNibha Sharma <nibha.sharma@samsung.com>
Fri, 24 Jun 2016 06:00:39 +0000 (15:00 +0900)
Change-Id: I4adda67ddbea871959829a7c4c277a9368a551ab
Signed-off-by: Nibha Sharma <nibha.sharma@samsung.com>
src/ctc/platform-permission/CTs-platform-permission-common.c
src/ctc/platform-permission/CTs-platform-permission-common.h
src/ctc/platform-permission/CTs-platform-permission-iotcon.c

index 271c2dc..103c38c 100755 (executable)
@@ -1807,4 +1807,32 @@ bool EflUtilCreateNotificationWindow(Evas_Object **pstWindow)
        }
 }
 
+/**
+* @function            IotconGetSvrDBPath
+* @description         Gets path to initialize iotcon
+* @parameter[OUT]      path 
+* @return              NA
+*/
+int IotconGetSvrDBPath(char **path)
+{
+        char file_path[PATH_MAX] = {0};
+        char pszValue[CONFIG_VALUE_LEN_MAX] = {0,};
+        const char *svr_db_file = "svr_db.dat";
+
+        if (false == GetValueForTCTSetting("DEVICE_USER_30", pszValue, API_NAMESPACE)) {
+                PRINT_UTC_LOG("[Line : %d][%s] GetValueForTCTSetting returned error for 'DEVICE_SUITE_TARGET_30'\\n", __LINE__, API_NAMESPACE);
+                return -1;
+        }
+
+        PRINT_UTC_LOG("[Line : %d][%s] 'DEVICE_USER_30' Values Received = %s\\n",
+                        __LINE__, API_NAMESPACE,  pszValue);
+
+        snprintf(file_path, sizeof(file_path), "%s/apps_rw/native-iotcon-itc/data/%s", pszValue,
+                        svr_db_file);
+
+        *path = strdup(file_path);
+
+        return 0;
+}
+
 /** @} */ //end of ctc-platform-permission
index 293e026..7791660 100755 (executable)
@@ -295,6 +295,7 @@ char* InputmethodManagerGetError(int nRet);
 char* InputmethodGetError(int nRet);
 void EflUtilDeleteWindow(void *pData, Evas_Object *pstWindow, void *pEvent);
 bool EflUtilCreateNotificationWindow(Evas_Object **pstWindow);
+int IotconGetSvrDBPath(char **path);
 #ifdef MOBILE  //Starts MOBILE
 char* ContextHistoryGetError(int nRet);
 #endif  //MOBILE       //End MOBILE
index 0ba283b..d8fc760 100755 (executable)
@@ -299,16 +299,19 @@ int CTc_Iotcon_PrivilegeNetworkGet_initialize_deinitialize_p(void)
 {
        START_TEST;
        int nRet = 0;
-               
+       char *pSvrDBPath;
+
        if ( !TCTCheckSystemInfoFeatureSupported(IOTCON_FEATURE, API_NAMESPACE) )
        {
                return 0;
        }
        
-       nRet = iotcon_initialize();
-       PRINT_RESULT_ERROR_NONE(TIZEN_ERROR_PERMISSION_DENIED, nRet, "iotcon_initialize", IotConGetError(nRet),iotcon_deinitialize(),IOTCON_ERROR_NONE);        
+        IotconGetSvrDBPath(&pSvrDBPath);
+         nRet = iotcon_initialize(pSvrDBPath);
+        free(pSvrDBPath);
+        PRINT_RESULT(TIZEN_ERROR_PERMISSION_DENIED, nRet, "iotcon_initialize", IotConGetError(nRet));
        
-       iotcon_deinitialize();
+        iotcon_deinitialize();
                
        return 0;
 }