Add send Response with DOResponse for subscription request. 41/10641/3
authorjaesick.shin <jaesick.shin@samsung.com>
Fri, 19 Aug 2016 02:29:57 +0000 (11:29 +0900)
committerUze Choi <uzchoi@samsung.com>
Fri, 19 Aug 2016 07:00:41 +0000 (07:00 +0000)
observe request alwyas needs response with DoResponse.

Change-Id: Icc9d25def0aed28a48f0f34278e3bc87e6e67d9c
Signed-off-by: jaesick.shin <jaesick.shin@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/10641
Reviewed-by: Uze Choi <uzchoi@samsung.com>
Reviewed-by: Chihyun Cho <ch79.cho@samsung.com>
Tested-by: Uze Choi <uzchoi@samsung.com>
service/notification/src/provider/NSProviderListener.c

index c295645..e186e7d 100644 (file)
@@ -72,6 +72,12 @@ OCEntityHandlerResult NSEntityHandlerMessageCb(OCEntityHandlerFlag flag,
         return OC_EH_ERROR;\r
     }\r
 \r
+    OCEntityHandlerResponse response;\r
+    response.numSendVendorSpecificHeaderOptions = 0;\r
+    memset(response.sendVendorSpecificHeaderOptions, 0,\r
+            sizeof response.sendVendorSpecificHeaderOptions);\r
+    memset(response.resourceUri, 0, sizeof response.resourceUri);\r
+\r
     if (flag & OC_REQUEST_FLAG)\r
     {\r
         NS_LOG(DEBUG, "Flag includes OC_REQUEST_FLAG");\r
@@ -102,6 +108,18 @@ OCEntityHandlerResult NSEntityHandlerMessageCb(OCEntityHandlerFlag flag,
         }\r
     }\r
 \r
+    response.requestHandle = entityHandlerRequest->requestHandle;\r
+    response.resourceHandle = entityHandlerRequest->resource;\r
+    response.persistentBufferFlag = 0;\r
+    response.ehResult = OC_EH_OK;\r
+    response.payload = (OCPayload *) NULL;\r
+\r
+    if (OCDoResponse(&response) != OC_STACK_OK)\r
+    {\r
+        NS_LOG(ERROR, "Fail to AccessPolicy send response");\r
+        return NS_ERROR;\r
+    }\r
+\r
     NS_LOG(DEBUG, "NSEntityHandlerMessageCb - OUT");\r
     return ehResult;\r
 }\r
@@ -120,6 +138,12 @@ OCEntityHandlerResult NSEntityHandlerSyncCb(OCEntityHandlerFlag flag,
         return OC_EH_ERROR;\r
     }\r
 \r
+    OCEntityHandlerResponse response;\r
+    response.numSendVendorSpecificHeaderOptions = 0;\r
+    memset(response.sendVendorSpecificHeaderOptions, 0,\r
+            sizeof response.sendVendorSpecificHeaderOptions);\r
+    memset(response.resourceUri, 0, sizeof response.resourceUri);\r
+\r
     if (flag & OC_REQUEST_FLAG)\r
     {\r
         NS_LOG(DEBUG, "Flag includes OC_REQUEST_FLAG");\r
@@ -167,6 +191,18 @@ OCEntityHandlerResult NSEntityHandlerSyncCb(OCEntityHandlerFlag flag,
         }\r
     }\r
 \r
+    response.requestHandle = entityHandlerRequest->requestHandle;\r
+    response.resourceHandle = entityHandlerRequest->resource;\r
+    response.persistentBufferFlag = 0;\r
+    response.ehResult = OC_EH_OK;\r
+    response.payload = (OCPayload *) NULL;\r
+\r
+    if (OCDoResponse(&response) != OC_STACK_OK)\r
+    {\r
+        NS_LOG(ERROR, "Fail to AccessPolicy send response");\r
+        return NS_ERROR;\r
+    }\r
+\r
     NS_LOG(DEBUG, "NSEntityHandlerSyncCb - OUT");\r
     return ehResult;\r
 }\r