Update observe-request processing logic. 35/13235/2
authorParkhi <h_w.park@samsung.com>
Thu, 13 Oct 2016 13:06:37 +0000 (22:06 +0900)
committerUze Choi <uzchoi@samsung.com>
Fri, 14 Oct 2016 01:26:39 +0000 (01:26 +0000)
Change-Id: Icb5ae1a3f8c8e985570b30b0420cc6e7fe98ffdc
Signed-off-by: Parkhi <h_w.park@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/13235
Reviewed-by: Jihun Ha <jihun.ha@samsung.com>
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
service/easy-setup/enrollee/src/resourcehandler.c

index 707f55e..21592c9 100755 (executable)
@@ -353,6 +353,11 @@ void updateWiFiResource(OCRepPayload* input)
         }
     }
 
+    if(OC_STACK_NO_OBSERVERS == OCNotifyAllObservers(gWiFiResource.handle, OC_HIGH_QOS))
+    {
+        OIC_LOG(INFO, ES_RH_TAG, "Enrollee doesn't have any observers.");
+    }
+
     OICFree(wiFiData);
 }
 
@@ -415,6 +420,11 @@ void updateCloudResource(OCRepPayload* input)
         }
     }
 
+    if(OC_STACK_NO_OBSERVERS == OCNotifyAllObservers(gCloudResource.handle, OC_HIGH_QOS))
+    {
+        OIC_LOG(INFO, ES_RH_TAG, "cloudResource doesn't have any observers.");
+    }
+
     OICFree(cloudData);
 }
 
@@ -475,6 +485,11 @@ void updateDevConfResource(OCRepPayload* input)
         }
     }
 
+    if(OC_STACK_NO_OBSERVERS == OCNotifyAllObservers(gDevConfResource.handle, OC_HIGH_QOS))
+    {
+        OIC_LOG(INFO, ES_RH_TAG, "devConfResource doesn't have any observers.");
+    }
+
     OICFree(devConfData);
 }
 
@@ -1208,7 +1223,19 @@ OCEntityHandlerResult OCEntityHandlerCb(OCEntityHandlerFlag flag,
             ehRet = OC_EH_ERROR;
         }
     }
+    if (flag & OC_OBSERVE_FLAG)
+    {
+        OIC_LOG(INFO, ES_RH_TAG, "Flag includes OC_OBSERVE_FLAG");
 
+        if (OC_OBSERVE_REGISTER == entityHandlerRequest->obsInfo.action)
+        {
+            OIC_LOG (INFO, ES_RH_TAG, "Received OC_OBSERVE_REGISTER from Mediator");
+        }
+        else if (OC_OBSERVE_DEREGISTER == entityHandlerRequest->obsInfo.action)
+        {
+            OIC_LOG (INFO, ES_RH_TAG, "Received OC_OBSERVE_DEREGISTER from Mediator");
+        }
+    }
     return ehRet;
 }
 
@@ -1235,6 +1262,16 @@ OCStackResult SetDeviceProperty(ESDeviceProperty *deviceProperty)
                                                             (deviceProperty->DevConf).modelNumber);
     OIC_LOG_V(INFO, ES_RH_TAG, "Model Number : %s", gDevConfResource.modelNumber);
 
+    if(OC_STACK_NO_OBSERVERS == OCNotifyAllObservers(gWiFiResource.handle, OC_HIGH_QOS))
+    {
+        OIC_LOG(INFO, ES_RH_TAG, "wifiResource doesn't have any observers.");
+    }
+
+    if(OC_STACK_NO_OBSERVERS == OCNotifyAllObservers(gDevConfResource.handle, OC_HIGH_QOS))
+    {
+        OIC_LOG(INFO, ES_RH_TAG, "devConfResource doesn't have any observers.");
+    }
+
     OIC_LOG(INFO, ES_RH_TAG, "SetDeviceProperty OUT");
     return OC_STACK_OK;
 }
@@ -1246,6 +1283,11 @@ OCStackResult SetEnrolleeState(ESEnrolleeState esState)
     gProvResource.status = esState;
     OIC_LOG_V(INFO, ES_RH_TAG, "Enrollee Status : %d", gProvResource.status);
 
+    if(OC_STACK_NO_OBSERVERS == OCNotifyAllObservers(gProvResource.handle, OC_HIGH_QOS))
+    {
+        OIC_LOG(INFO, ES_RH_TAG, "provResource doesn't have any observers.");
+    }
+
     OIC_LOG(INFO, ES_RH_TAG, "SetEnrolleeState OUT");
     return OC_STACK_OK;
 }
@@ -1257,6 +1299,11 @@ OCStackResult SetEnrolleeErrCode(ESErrorCode esErrCode)
     gProvResource.lastErrCode = esErrCode;
     OIC_LOG_V(INFO, ES_RH_TAG, "Enrollee ErrorCode : %d", gProvResource.lastErrCode);
 
+    if(OC_STACK_NO_OBSERVERS == OCNotifyAllObservers(gProvResource.handle, OC_HIGH_QOS))
+    {
+        OIC_LOG(INFO, ES_RH_TAG, "provResource doesn't have any observers.");
+    }
+
     OIC_LOG(INFO, ES_RH_TAG, "SetEnrolleeErrCode OUT");
     return OC_STACK_OK;
 }