[ITC][IoTCon][NonACR][Fix Failed TC]
authorsung.goo.kim <sung.goo.kim@samsung.com>
Thu, 9 Jun 2016 05:14:10 +0000 (14:14 +0900)
committersung.goo.kim <sung.goo.kim@samsung.com>
Thu, 9 Jun 2016 05:14:10 +0000 (14:14 +0900)
Change-Id: I5e4b669a0ba47b9190f8fed62c1afb58274071c5

src/itc/iotcon/ITs-iotcon-remote-resource.c

index 678a0ba..5a7492f 100755 (executable)
@@ -45,26 +45,26 @@ static bool g_found;
 static void Iotcon_update_lite_resource(void)
 {
        iotcon_attributes_h state = NULL;
-   
+
        int ret = iotcon_attributes_create(&state);
-       if (IOTCON_ERROR_NONE != ret) 
+       if (IOTCON_ERROR_NONE != ret)
        {
                FPRINTF("[Line : %d][%s] iotcon_attributes_create fail\\n", __LINE__, API_NAMESPACE);
                return;
        }
        ret = iotcon_attributes_add_int(state, "int", ++g_brightness);
-       if (IOTCON_ERROR_NONE != ret) 
+       if (IOTCON_ERROR_NONE != ret)
        {
                FPRINTF("[Line : %d][%s] iotcon_attributes_add_int fail\\n", __LINE__, API_NAMESPACE);
                iotcon_attributes_destroy(state);
                return;
        }
        ret = iotcon_lite_resource_update_attributes(g_hLiteLightResource, state);
-       if (IOTCON_ERROR_NONE != ret) 
+       if (IOTCON_ERROR_NONE != ret)
        {
                FPRINTF("[Line : %d][%s] iotcon_lite_resource_update_attributes fail\\n", __LINE__, API_NAMESPACE);
                iotcon_attributes_destroy(state);
-               return; 
+               return;
        }
        iotcon_attributes_destroy(state);
        return;
@@ -525,7 +525,19 @@ static void IotconRemoteResourceRepresentationCB(iotcon_remote_resource_h resour
        iotcon_remote_resource_get_uri_path(resource, &uri);
        dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] host_address[%s], uri[%s]", __FUNCTION__, __LINE__, host_address, uri);
 
-       g_hResourceHandle = resource;
+       nRet = iotcon_remote_resource_clone(resource, &g_hResourceHandle);
+       if (IOTCON_ERROR_NONE != nRet)
+       {
+               FPRINTF("[Line : %d][%s] iotcon_remote_resource_clone fail error returned : %s\\n", __LINE__, API_NAMESPACE, IotConGetError(nRet));
+               if ( g_pMainLoop )
+               {
+                       g_main_loop_quit(g_pMainLoop);
+                       g_main_loop_unref(g_pMainLoop);
+                       g_pMainLoop = NULL;
+               }
+               return;
+       }
+
        if ( g_pMainLoop )
        {
                g_main_loop_quit(g_pMainLoop);
@@ -1627,7 +1639,7 @@ int ITc_iotcon_remote_resource_get_policies_p(void)
        START_TEST;
 
        uint8_t properties;
-    
+
        int nRet = IotconCreateRemoteResource();
     if (IOTCON_ERROR_NONE != nRet)
        {