[ITC][capmgr][non-ACR][Fix app control reply] 28/211328/1
authorDaehyeon Jung <darrenh.jung@samsung.com>
Thu, 1 Aug 2019 10:59:54 +0000 (19:59 +0900)
committerDaehyeon Jung <darrenh.jung@samsung.com>
Thu, 1 Aug 2019 10:59:54 +0000 (19:59 +0900)
Change-Id: I97daab8be4e0ea1511aeb94e24986d8b3d4978ae

src/itc/capmgr/ITs-capmgr-app-control.c
src/itc/capmgr/ITs-capmgr-common.c
src/itc/capmgr/ITs-capmgr-common.h
src/itc/capmgr/res/mobile/org.example.capmgrsample-1.0.0-arm.tpk
src/itc/capmgr/res/mobile/org.example.capmgrsample-1.0.0-x86.tpk
src/itc/capmgr/res/tizeniot/org.example.capmgrsample-1.0.0-arm.tpk
src/itc/capmgr/res/tizeniot/org.example.capmgrsample-1.0.0-x86.tpk
src/itc/capmgr/res/tv/org.example.capmgrsample-1.0.0-arm.tpk
src/itc/capmgr/res/tv/org.example.capmgrsample-1.0.0-x86.tpk
src/itc/capmgr/res/wearable/org.example.capmgrsample-1.0.0-arm.tpk
src/itc/capmgr/res/wearable/org.example.capmgrsample-1.0.0-x86.tpk

index 01409cc4fab6954c4bde919bd998c3a506387ba6..947fc19fa65136e94b018837bca70c842e9fcd93 100644 (file)
@@ -86,6 +86,12 @@ int CapmgrAppControlReplyCallBack(const capmgr_app_control_h request, const capm
 #if DEBUG
        FPRINTF("[Line : %d][%s] %s Callback Invoked\\n", __LINE__, API_NAMESPACE, "CapmgrAppControlReplyCallBack");
 #endif
+       if (g_pApplicationMainLoop)
+       {
+               g_main_loop_quit(g_pApplicationMainLoop);
+               g_pApplicationMainLoop = NULL;
+       }
+
        g_CallBackHit = true;
        return 1;
 }
@@ -538,6 +544,7 @@ int ITc_capmgr_app_control_send_p(void)
        START_TEST;
 
        int nRet = -1;
+       int nTimeoutId = 0;
        capmgr_app_control_h hAppControl = NULL;
        void *pszData = NULL;
 
@@ -551,8 +558,11 @@ int ITc_capmgr_app_control_send_p(void)
        PRINT_RESULT_CLEANUP(true, g_CallBackHit, "CapmgrAppControlForeachAppCallBack", "CallBack Not Invoked", capmgr_app_control_destroy(hAppControl));
 
        g_CallBackHit = false;
+       nRet = capmgr_app_control_set_appid(hAppControl, TEST_APP_ID);
        nRet = capmgr_app_control_send(hAppControl, CapmgrAppControlReplyCallBack, pszData);
        PRINT_RESULT_CLEANUP(CAPMGR_ERROR_NONE, nRet, "capmgr_app_control_send", CapMgrGetError(nRet), capmgr_app_control_destroy(hAppControl));
+
+       RUN_POLLING_LOOP;
        PRINT_RESULT_CLEANUP(true, g_CallBackHit, "CapmgrAppControlReplyCallBack", "CallBack Not Invoked", capmgr_app_control_destroy(hAppControl));
 
        nRet = capmgr_app_control_destroy(hAppControl);
index 94f08f049a075ae2a761e0aec4873c7021bf117f..1a970f0b37cc9462c18f79e22290c0eb21a23256 100755 (executable)
@@ -62,4 +62,21 @@ char* CapMgrGetError(int nRet)
        return szErrorVal;
 }
 
+/**
+ * @function            Timeout
+ * @description         Called if some callback is not invoked for a particular timeout
+ * @parameter           gpointer data
+ * @return                      gboolean
+ */
+gboolean Timeout(gpointer data)
+{
+        GMainLoop *pMainLoop = NULL;
+        pMainLoop = (GMainLoop *)data;
+        if ( pMainLoop != NULL )
+        {
+                g_main_loop_quit(pMainLoop);
+        }
+        return false;
+}
+
 /** @} */
index 2eac2a6dba673deca6bfc529e252d9ce79f2c377..7fb33146f0c28ff5adb9761138aea0f408aea209 100755 (executable)
@@ -19,6 +19,7 @@
 #include "tct_common.h"
 #include "tct_app_common.h"
 #include <capability_manager.h>
+#include <glib.h>
 
 /** @addtogroup itc-capmgr
 *  @ingroup itc
@@ -27,6 +28,7 @@
 
 #define API_NAMESPACE  "CAPMGR_ITC"
 
+GMainLoop *g_pApplicationMainLoop;
 bool g_CallBackHit;
 
 //Add helper function declarations here
@@ -40,7 +42,10 @@ int CapmgrDeviceForeachDeviceCallBack(const capmgr_device_h hDevice, void *user_
 int CapmgrDeviceForeachAppCallBack(const capmgr_device_h hDevice, void *user_data);
 int CapmgrAppControlForeachAppCallBack(const capmgr_device_h hDevice, void *user_data);
 int CapmgrAppControlReplyCallBack(const capmgr_app_control_h request, const capmgr_app_control_h reply, capmgr_app_control_result_e result, void* user_data);
+gboolean Timeout(gpointer data);
 
+#define TEST_APP_ID "org.example.capmgrsample"
+#define TIMEOUT_CB 10000
 
 #define START_TEST {\
        FPRINTF("[Line : %d][%s] Starting test : %s\\n", __LINE__, API_NAMESPACE, __FUNCTION__);\
@@ -70,5 +75,13 @@ int CapmgrAppControlReplyCallBack(const capmgr_app_control_h request, const capm
        StringVariable = NULL;\
 }
 
+#define RUN_POLLING_LOOP {\
+        g_pApplicationMainLoop = g_main_loop_new(NULL, false);\
+        nTimeoutId = g_timeout_add(TIMEOUT_CB, Timeout, g_pApplicationMainLoop);\
+        g_main_loop_run(g_pApplicationMainLoop);\
+        g_source_remove(nTimeoutId);\
+        g_pApplicationMainLoop = NULL;\
+}
+
 /** @} */
 #endif  //_ITS_CAPMGR_COMMON_H_
index 72c3d1f477df5cc9b26cb8e573822be08ddc0aa2..64939b90ce165fd13961501d6a5bec993f87fe39 100644 (file)
Binary files a/src/itc/capmgr/res/mobile/org.example.capmgrsample-1.0.0-arm.tpk and b/src/itc/capmgr/res/mobile/org.example.capmgrsample-1.0.0-arm.tpk differ
index edeb18e141c7073b6303e830091e5a9bffbc8c97..31101fce5342394c9c7875682768349800b189bf 100644 (file)
Binary files a/src/itc/capmgr/res/mobile/org.example.capmgrsample-1.0.0-x86.tpk and b/src/itc/capmgr/res/mobile/org.example.capmgrsample-1.0.0-x86.tpk differ
index 72c3d1f477df5cc9b26cb8e573822be08ddc0aa2..64939b90ce165fd13961501d6a5bec993f87fe39 100644 (file)
Binary files a/src/itc/capmgr/res/tizeniot/org.example.capmgrsample-1.0.0-arm.tpk and b/src/itc/capmgr/res/tizeniot/org.example.capmgrsample-1.0.0-arm.tpk differ
index edeb18e141c7073b6303e830091e5a9bffbc8c97..31101fce5342394c9c7875682768349800b189bf 100644 (file)
Binary files a/src/itc/capmgr/res/tizeniot/org.example.capmgrsample-1.0.0-x86.tpk and b/src/itc/capmgr/res/tizeniot/org.example.capmgrsample-1.0.0-x86.tpk differ
index 72c3d1f477df5cc9b26cb8e573822be08ddc0aa2..64939b90ce165fd13961501d6a5bec993f87fe39 100644 (file)
Binary files a/src/itc/capmgr/res/tv/org.example.capmgrsample-1.0.0-arm.tpk and b/src/itc/capmgr/res/tv/org.example.capmgrsample-1.0.0-arm.tpk differ
index edeb18e141c7073b6303e830091e5a9bffbc8c97..31101fce5342394c9c7875682768349800b189bf 100644 (file)
Binary files a/src/itc/capmgr/res/tv/org.example.capmgrsample-1.0.0-x86.tpk and b/src/itc/capmgr/res/tv/org.example.capmgrsample-1.0.0-x86.tpk differ
index 72c3d1f477df5cc9b26cb8e573822be08ddc0aa2..64939b90ce165fd13961501d6a5bec993f87fe39 100644 (file)
Binary files a/src/itc/capmgr/res/wearable/org.example.capmgrsample-1.0.0-arm.tpk and b/src/itc/capmgr/res/wearable/org.example.capmgrsample-1.0.0-arm.tpk differ
index edeb18e141c7073b6303e830091e5a9bffbc8c97..31101fce5342394c9c7875682768349800b189bf 100644 (file)
Binary files a/src/itc/capmgr/res/wearable/org.example.capmgrsample-1.0.0-x86.tpk and b/src/itc/capmgr/res/wearable/org.example.capmgrsample-1.0.0-x86.tpk differ