From b759c572755472043c4efed9522954d6124fbd7a Mon Sep 17 00:00:00 2001 From: Harish Kumara Marappa Date: Fri, 4 Sep 2015 11:13:17 +0530 Subject: [PATCH] Including observer endpoint information in ObservationInfo structure. 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 Reviewed-on: https://gerrit.iotivity.org/gerrit/2323 Reviewed-by: Madan Lanka Tested-by: jenkins-iotivity Reviewed-by: Patrick Lankswert --- resource/include/OCApi.h | 6 ++++++ resource/include/OCResourceRequest.h | 2 +- resource/src/InProcServerWrapper.cpp | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/resource/include/OCApi.h b/resource/include/OCApi.h index 5c5024d..dfe91fe 100644 --- a/resource/include/OCApi.h +++ b/resource/include/OCApi.h @@ -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 diff --git a/resource/include/OCResourceRequest.h b/resource/include/OCResourceRequest.h index 004adf1..962ddb2 100644 --- a/resource/include/OCResourceRequest.h +++ b/resource/include/OCResourceRequest.h @@ -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} diff --git a/resource/src/InProcServerWrapper.cpp b/resource/src/InProcServerWrapper.cpp index 8a267b0..0ae7c89 100644 --- a/resource/src/InProcServerWrapper.cpp +++ b/resource/src/InProcServerWrapper.cpp @@ -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( + (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); } } -- 2.7.4