Including observer endpoint information in ObservationInfo structure. 23/2323/5
authorHarish Kumara Marappa <h.marappa@samsung.com>
Fri, 4 Sep 2015 05:43:17 +0000 (11:13 +0530)
committerPatrick Lankswert <patrick.lankswert@intel.com>
Mon, 14 Sep 2015 13:56:37 +0000 (13:56 +0000)
Observation ID is not enough to differentiate between multiple
observers from application point of view in the cases of application
needs to notify specific observers. This patch has changes making
ObservationInfo structure to hold connectivity type, address and port information too.

Change-Id: I4f2aa81bf60366d208f0c06a1694ac2bc70665f3
Signed-off-by: Harish Kumara Marappa <h.marappa@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/2323
Reviewed-by: Madan Lanka <lanka.madan@samsung.com>
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Patrick Lankswert <patrick.lankswert@intel.com>
resource/include/OCApi.h
resource/include/OCResourceRequest.h
resource/src/InProcServerWrapper.cpp

index 5c5024d..dfe91fe 100644 (file)
@@ -228,6 +228,12 @@ namespace OC
         ObserveAction action;
         // Identifier for observation being registered/unregistered
         OCObservationId obsId;
+        // Connectivity type
+        OCConnectivityType connectivityType;
+        // Addresss
+        std::string address;
+        // Port
+        uint16_t port;
     } ObservationInfo;
 
     // const strings for different interfaces
index 004adf1..962ddb2 100644 (file)
@@ -52,7 +52,7 @@ namespace OC
             m_queryParameters{},
             m_requestHandlerFlag{},
             m_representation{},
-            m_observationInfo{ObserveAction::ObserveRegister, 0},
+            m_observationInfo{},
             m_headerOptions{},
             m_requestHandle{nullptr},
             m_resourceHandle{nullptr}
index 8a267b0..0ae7c89 100644 (file)
@@ -128,6 +128,12 @@ void formResourceRequest(OCEntityHandlerFlag flag,
             OC::ObservationInfo observationInfo;
             observationInfo.action = (OC::ObserveAction) entityHandlerRequest->obsInfo.action;
             observationInfo.obsId = entityHandlerRequest->obsInfo.obsId;
+
+            observationInfo.connectivityType = static_cast<OCConnectivityType>(
+                    (entityHandlerRequest->devAddr.adapter << CT_ADAPTER_SHIFT) |
+                    (entityHandlerRequest->devAddr.flags & CT_MASK_FLAGS));
+            observationInfo.address = entityHandlerRequest->devAddr.addr;
+            observationInfo.port = entityHandlerRequest->devAddr.port;
             pRequest->setObservationInfo(observationInfo);
         }
     }