Removed href from device and platform payload
authorHabib Virji <habib.virji@samsung.com>
Wed, 30 Nov 2016 22:09:30 +0000 (22:09 +0000)
committerZiran Sun <ziran.sun@samsung.com>
Mon, 12 Dec 2016 10:50:12 +0000 (10:50 +0000)
- Created a separate function to handle Device and Platform payload.
- rt, if and attribute information are the only included in the payload.
- BuildResponseRepresentation updated to avoid information about device and platform payload.
- Updated dmv value from res.1.1.0,sh.1.2.0 to res.1.1.0,sh.1.1.0.

Change-Id: I59059997f170d177663e87eddea9df32275ca882
Signed-off-by: Habib Virji <habib.virji@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/14979
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
Tested-by: Uze Choi <uzchoi@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/15265
Reviewed-by: Ziran Sun <ziran.sun@samsung.com>
resource/csdk/stack/samples/linux/SimpleClientServer/ocserver.cpp
resource/csdk/stack/samples/tizen/SimpleClientServer/ocserver.cpp
resource/csdk/stack/src/ocresource.c
resource/examples/devicediscoveryserver.cpp
resource/examples/simpleserver.cpp

index 53d191a..224c1aa 100644 (file)
@@ -88,7 +88,7 @@ const char *supportLink = "https://www.iotivity.org";
 const char *version = "myVersion";
 const char *systemTime = "2015-05-15T11.04";
 const char *specVersion = "core.1.1.0";
-const char *dataModelVersions = "res.1.1.0";
+const char *dataModelVersions = "res.1.1.0,sh.1.1.0";
 
 // Entity handler should check for resourceTypeName and ResourceInterface in order to GET
 // the existence of a known resource
index 945d4c3..4305399 100644 (file)
@@ -78,7 +78,7 @@ const char *supportLink = "https://www.iotivity.org";
 const char *version = "myVersion";
 const char *systemTime = "2015-05-15T11.04";
 const char *specVersion = "core.1.1.0";
-const char *dataModelVersions = "res.1.1.0";
+const char *dataModelVersions = "res.1.1.0,sh.1.1.0";
 
 // Entity handler should check for resourceTypeName and ResourceInterface in order to GET
 // the existence of a known resource
index 606dddc..117a1ad 100755 (executable)
@@ -349,12 +349,14 @@ exit:
 
 static OCStackResult BuildDevicePlatformPayload(const OCResource *resourcePtr, OCRepPayload** payload, bool addDeviceId)
 {
+    OCRepPayload *tempPayload = OCRepPayloadCreate();
+
     if (!resourcePtr)
     {
+        OCRepPayloadDestroy(tempPayload);
         return OC_STACK_INVALID_PARAM;
     }
 
-    OCRepPayload *tempPayload = OCRepPayloadCreate();
     if (!tempPayload)
     {
         return OC_STACK_NO_MEMORY;
@@ -1097,13 +1099,13 @@ static OCStackResult HandleVirtualResource (OCServerRequest *request, OCResource
     {
         OCResource *resourcePtr = FindResourceByUri(OC_RSRVD_DEVICE_URI);
         VERIFY_PARAM_NON_NULL(TAG, resourcePtr, "Device URI not found.");
-        discoveryResult = BuildResponseRepresentation(resourcePtr, (OCRepPayload **)&payload, &request->devAddr);
+        discoveryResult = BuildDevicePlatformPayload(resourcePtr, (OCRepPayload **)&payload, true);
     }
     else if (virtualUriInRequest == OC_PLATFORM_URI)
     {
         OCResource *resourcePtr = FindResourceByUri(OC_RSRVD_PLATFORM_URI);
         VERIFY_PARAM_NON_NULL(TAG, resourcePtr, "Platform URI not found.");
-        discoveryResult = BuildResponseRepresentation(resourcePtr, (OCRepPayload **)&payload, &request->devAddr);
+        discoveryResult = BuildDevicePlatformPayload(resourcePtr, (OCRepPayload **)&payload, false);
     }
 #ifdef ROUTING_GATEWAY
     else if (OC_GATEWAY_URI == virtualUriInRequest)
index d92fd5b..1c3404a 100644 (file)
@@ -49,7 +49,7 @@ std::string  systemTime = "2016-01-15T11.01";
 // Set of strings for each of device info fields
 std::string  deviceName = "Bill's Battlestar";
 std::string  specVersion = "core.1.1.0";
-std::string  dataModelVersions = "res.1.1.0";
+std::string  dataModelVersions = "res.1.1.0,sh.1.1.0";
 
 // OCPlatformInfo Contains all the platform info to be stored
 OCPlatformInfo platformInfo;
index 0ca461d..ae3897a 100644 (file)
@@ -67,7 +67,7 @@ std::string  systemTime = "2016-01-15T11.01";
 // Set of strings for each of device info fields
 std::string  deviceName = "IoTivity Simple Server";
 std::string  specVersion = "core.1.1.0";
-std::string  dataModelVersions = "res.1.1.0";
+std::string  dataModelVersions = "res.1.1.0,sh.1.1.0";
 
 // OCPlatformInfo Contains all the platform info to be stored
 OCPlatformInfo platformInfo;