Fix a logic to handle collection resource payload construction for 45/16245/2
authorJihun Ha <jihun.ha@samsung.com>
Mon, 9 Jan 2017 07:00:01 +0000 (16:00 +0900)
committerUze Choi <uzchoi@samsung.com>
Mon, 9 Jan 2017 09:08:02 +0000 (09:08 +0000)
vendor-specific properties in easy setup.

For vendor-specific properties in provisioning resource,
they should be included in 'rep' property.

Change-Id: I6644cab3aab43b29ebf5ce48d639a4a8ca9b8016
Signed-off-by: Jihun Ha <jihun.ha@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/16245
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
service/easy-setup/enrollee/src/resourcehandler.c

index 82ac761..44b5c04 100755 (executable)
@@ -942,6 +942,11 @@ OCRepPayload* constructResponseOfProv(OCEntityHandlerRequest *ehRequest)
             OCRepPayloadSetPropInt(payload, OC_RSRVD_ES_PROVSTATUS, g_ESProvResource.status);
             OCRepPayloadSetPropInt(payload, OC_RSRVD_ES_LAST_ERRORCODE, g_ESProvResource.lastErrCode);
 
+            if(gWriteUserdataCb)
+            {
+                gWriteUserdataCb(payload, OC_RSRVD_ES_RES_TYPE_PROV);
+            }
+
             OCRepPayloadSetPropObjectArray(payload, OC_RSRVD_ES_LINKS, arrayPayload, dimensions);
         }
         else    // link list interface
@@ -994,12 +999,12 @@ OCRepPayload* constructResponseOfProv(OCEntityHandlerRequest *ehRequest)
         OCRepPayloadSetPropInt(repPayload, OC_RSRVD_ES_PROVSTATUS, g_ESProvResource.status);
         OCRepPayloadSetPropInt(repPayload, OC_RSRVD_ES_LAST_ERRORCODE, g_ESProvResource.lastErrCode);
 
-        OCRepPayloadSetPropObject(payload, OC_RSRVD_REPRESENTATION, repPayload);
-    }
+        if(gWriteUserdataCb)
+        {
+            gWriteUserdataCb(repPayload, OC_RSRVD_ES_RES_TYPE_PROV);
+        }
 
-    if(gWriteUserdataCb)
-    {
-        gWriteUserdataCb(payload, OC_RSRVD_ES_RES_TYPE_PROV);
+        OCRepPayloadSetPropObject(payload, OC_RSRVD_REPRESENTATION, repPayload);
     }
 
     if(ehRequest->query)