From fb1a9ab3bfa193414f1d2acfa4eec2ec517d2534 Mon Sep 17 00:00:00 2001 From: Jaehong Jo Date: Fri, 22 Jul 2016 11:41:39 +0900 Subject: [PATCH] Added preprocessor WITH_CLOUD for Subscribe device presence. It is only used with RD in cloud. Change-Id: Iabebe4b8b6cf33443e6114281d1ab8ceb3a1b646 Signed-off-by: Jaehong Jo Reviewed-on: https://gerrit.iotivity.org/gerrit/9585 Reviewed-by: Eunok Shin Tested-by: jenkins-iotivity Reviewed-by: jihwan seo Reviewed-by: Hyuna Jo Reviewed-by: Ashok Babu Channa --- resource/csdk/stack/include/octypes.h | 2 ++ resource/include/IClientWrapper.h | 2 ++ resource/include/InProcClientWrapper.h | 2 ++ resource/include/OCPlatform.h | 2 ++ resource/include/OCPlatform_impl.h | 2 ++ resource/include/OutOfProcClientWrapper.h | 3 ++- resource/src/InProcClientWrapper.cpp | 2 ++ resource/src/OCPlatform.cpp | 2 ++ resource/src/OCPlatform_impl.cpp | 2 ++ resource/unittests/OCPlatformTest.cpp | 4 ++++ 10 files changed, 22 insertions(+), 1 deletion(-) diff --git a/resource/csdk/stack/include/octypes.h b/resource/csdk/stack/include/octypes.h index b132d6e..c45d3c6 100644 --- a/resource/csdk/stack/include/octypes.h +++ b/resource/csdk/stack/include/octypes.h @@ -79,8 +79,10 @@ extern "C" { /** Presence URI through which the OIC devices advertise their presence.*/ #define OC_RSRVD_PRESENCE_URI "/oic/ad" +#ifdef WITH_CLOUD /** Presence URI through which the OCF devices advertise their device presence.*/ #define OCF_RSRVD_DEVICE_PRESENCE_URI "/.well-known/ocf/prs" +#endif /** Sets the default time to live (TTL) for presence.*/ #define OC_DEFAULT_PRESENCE_TTL_SECONDS (60) diff --git a/resource/include/IClientWrapper.h b/resource/include/IClientWrapper.h index 43e52c1..e560219 100644 --- a/resource/include/IClientWrapper.h +++ b/resource/include/IClientWrapper.h @@ -109,11 +109,13 @@ namespace OC virtual OCStackResult UnsubscribePresence(OCDoHandle handle) =0; +#ifdef WITH_CLOUD virtual OCStackResult SubscribeDevicePresence(OCDoHandle* handle, const std::string& host, const QueryParamsList& queryParams, OCConnectivityType connectivityType, ObserveCallback& callback) = 0; +#endif virtual OCStackResult GetDefaultQos(QualityOfService& qos) = 0; diff --git a/resource/include/InProcClientWrapper.h b/resource/include/InProcClientWrapper.h index e97c990..0cd2df4 100644 --- a/resource/include/InProcClientWrapper.h +++ b/resource/include/InProcClientWrapper.h @@ -179,11 +179,13 @@ namespace OC virtual OCStackResult UnsubscribePresence(OCDoHandle handle); +#ifdef WITH_CLOUD virtual OCStackResult SubscribeDevicePresence(OCDoHandle* handle, const std::string& host, const QueryParamsList& queryParams, OCConnectivityType connectivityType, ObserveCallback& callback); +#endif OCStackResult GetDefaultQos(QualityOfService& QoS); diff --git a/resource/include/OCPlatform.h b/resource/include/OCPlatform.h index c3d540f..f5e9692 100644 --- a/resource/include/OCPlatform.h +++ b/resource/include/OCPlatform.h @@ -534,6 +534,7 @@ namespace OC */ OCStackResult unsubscribePresence(OCPresenceHandle presenceHandle); +#ifdef WITH_CLOUD /** * Subscribes to a server's device presence change events. * @@ -555,6 +556,7 @@ namespace OC const QueryParamsList& queryParams, OCConnectivityType connectivityType, ObserveCallback callback); +#endif /** * Creates a resource proxy object so that get/put/observe functionality diff --git a/resource/include/OCPlatform_impl.h b/resource/include/OCPlatform_impl.h index 2beb4a3..7897c46 100644 --- a/resource/include/OCPlatform_impl.h +++ b/resource/include/OCPlatform_impl.h @@ -225,11 +225,13 @@ namespace OC SubscribeCallback presenceHandler); OCStackResult unsubscribePresence(OCPresenceHandle presenceHandle); +#ifdef WITH_CLOUD OCStackResult subscribeDevicePresence(OCPresenceHandle& presenceHandle, const std::string& host, const QueryParamsList& queryParams, OCConnectivityType connectivityType, ObserveCallback callback); +#endif OCResource::Ptr constructResourceObject(const std::string& host, const std::string& uri, OCConnectivityType connectivityType, bool isObservable, diff --git a/resource/include/OutOfProcClientWrapper.h b/resource/include/OutOfProcClientWrapper.h index 513156d..982fbb3 100644 --- a/resource/include/OutOfProcClientWrapper.h +++ b/resource/include/OutOfProcClientWrapper.h @@ -121,7 +121,7 @@ namespace OC virtual OCStackResult UnsubscribePresence(OCDoHandle /*handle*/) {return OC_STACK_NOTIMPL;} - +#ifdef WITH_CLOUD virtual OCStackResult SubscribeDevicePresence( OCDoHandle* /*handle*/, const std::string& /*host*/, @@ -129,6 +129,7 @@ namespace OC OCConnectivityType /*connectivityType*/, ObserveCallback& /*callback*/) {return OC_STACK_NOTIMPL;} +#endif virtual OCStackResult GetDefaultQos(QualityOfService& /*QoS*/) {return OC_STACK_NOTIMPL;} diff --git a/resource/src/InProcClientWrapper.cpp b/resource/src/InProcClientWrapper.cpp index 8a892c6..76cce93 100644 --- a/resource/src/InProcClientWrapper.cpp +++ b/resource/src/InProcClientWrapper.cpp @@ -1197,6 +1197,7 @@ namespace OC return result; } +#ifdef WITH_CLOUD OCStackResult InProcClientWrapper::SubscribeDevicePresence(OCDoHandle* handle, const std::string& host, const QueryParamsList& queryParams, @@ -1240,6 +1241,7 @@ namespace OC return result; } +#endif OCStackResult InProcClientWrapper::GetDefaultQos(QualityOfService& qos) { diff --git a/resource/src/OCPlatform.cpp b/resource/src/OCPlatform.cpp index dd161e4..913f658 100644 --- a/resource/src/OCPlatform.cpp +++ b/resource/src/OCPlatform.cpp @@ -266,6 +266,7 @@ namespace OC return OCPlatform_impl::Instance().unsubscribePresence(presenceHandle); } +#ifdef WITH_CLOUD OCStackResult subscribeDevicePresence(OCPresenceHandle& presenceHandle, const std::string& host, const QueryParamsList& queryParams, @@ -278,6 +279,7 @@ namespace OC connectivityType, callback); } +#endif OCStackResult sendResponse(const std::shared_ptr pResponse) { diff --git a/resource/src/OCPlatform_impl.cpp b/resource/src/OCPlatform_impl.cpp index f40c14c..f5817c6 100644 --- a/resource/src/OCPlatform_impl.cpp +++ b/resource/src/OCPlatform_impl.cpp @@ -382,6 +382,7 @@ namespace OC std::ref(presenceHandle)); } +#ifdef WITH_CLOUD OCStackResult OCPlatform_impl::subscribeDevicePresence(OCPresenceHandle& presenceHandle, const std::string& host, const QueryParamsList& queryParams, @@ -391,6 +392,7 @@ namespace OC return checked_guard(m_client, &IClientWrapper::SubscribeDevicePresence, &presenceHandle, host, queryParams, connectivityType, callback); } +#endif OCStackResult OCPlatform_impl::sendResponse(const std::shared_ptr pResponse) { diff --git a/resource/unittests/OCPlatformTest.cpp b/resource/unittests/OCPlatformTest.cpp index 2a18ad7..d7e2cf2 100644 --- a/resource/unittests/OCPlatformTest.cpp +++ b/resource/unittests/OCPlatformTest.cpp @@ -62,9 +62,11 @@ namespace OCPlatformTest { } +#ifdef WITH_CLOUD void onObserve(const HeaderOptions, const OCRepresentation&, const int&, const int&) { } +#endif void directPairHandler(std::shared_ptr /*dev*/, OCStackResult /*res*/) { @@ -837,6 +839,7 @@ namespace OCPlatformTest EXPECT_EQ(OC_STACK_OK, OCPlatform::unsubscribePresence(presenceHandle)); } +#ifdef WITH_CLOUD //SubscribeDevicePresence Test TEST(SubscribeDevicePresenceTest, DISABLED_SubscribeDevicePresenceWithValidParameters) { @@ -877,6 +880,7 @@ namespace OCPlatformTest hostAddress, queryParams, CT_DEFAULT, &onObserve)); EXPECT_EQ(OC_STACK_OK, OCPlatform::unsubscribePresence(presenceHandle)); } +#endif TEST(FindDirectPairingTest, FindDirectPairingNullCallback) { -- 2.7.4