Update publish request payload for RD
authorhyuna0213.jo <hyuna0213.jo@samsung.com>
Tue, 8 Nov 2016 05:35:34 +0000 (14:35 +0900)
committerAshok Babu Channa <ashok.channa@samsung.com>
Wed, 7 Dec 2016 04:35:20 +0000 (04:35 +0000)
1. add device name (mandatory)
2. add platform model number

Change-Id: If26e6a2b75a68a1e67b20b19e10524c31fb918f8
Signed-off-by: hyuna0213.jo <hyuna0213.jo@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/13321
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Habib Virji <habib.virji@samsung.com>
Reviewed-by: Dan Mihai <Daniel.Mihai@microsoft.com>
Reviewed-by: Ashok Babu Channa <ashok.channa@samsung.com>
resource/csdk/resource-directory/include/rd_client.h
resource/csdk/resource-directory/src/rd_client.c

index 2b4a582..b8e90c4 100644 (file)
@@ -36,6 +36,9 @@ extern "C" {
 
 #define DEFAULT_MESSAGE_TYPE "application/json"
 
+/** Platform Model Number.*/
+#define OC_DATA_MODEL_NUMBER            "x.model"
+
 /**
  * Discover Local RD across the network.
  *
index 57ce40c..a2d6815 100644 (file)
@@ -122,6 +122,23 @@ OCStackResult OCRDPublishWithDeviceId(const char *host, const unsigned char *id,
     }
 
     OCRepPayloadSetPropString(rdPayload, OC_RSRVD_DEVICE_ID, (const char *) id);
+
+    char *deviceName = NULL;
+    OCGetPropertyValue(PAYLOAD_TYPE_DEVICE, OC_RSRVD_DEVICE_NAME, (void **) &deviceName);
+    if (deviceName)
+    {
+        OCRepPayloadSetPropString(rdPayload, OC_RSRVD_DEVICE_NAME, deviceName);
+        OICFree(deviceName);
+    }
+
+    char *platformModelName = NULL;
+    OCGetPropertyValue(PAYLOAD_TYPE_PLATFORM, OC_RSRVD_MODEL_NUM, (void **) &platformModelName);
+    if (platformModelName)
+    {
+        OCRepPayloadSetPropString(rdPayload, OC_DATA_MODEL_NUMBER, platformModelName);
+        OICFree(platformModelName);
+    }
+
     OCRepPayloadSetPropInt(rdPayload, OC_RSRVD_DEVICE_TTL, OIC_RD_PUBLISH_TTL);
 
     OCRepPayload **linkArr = OICCalloc(nPubResHandles, sizeof(OCRepPayload *));