Application developers have to pass devices id instead of the list of queries.
It will make them more convenient.
As-Is
const QueryParamsList& queryParams
To-Be
const std::vector<std::string>& di
Change-Id: I2c8231a58425227333c2a9c672c086409e2e51be
Signed-off-by: Jaehong Jo <jaehong.jo@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/9917
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: jihwan seo <jihwan.seo@samsung.com>
Reviewed-by: Eunok Shin <eunok.shin@samsung.com>
Reviewed-by: Hyuna Jo <hyuna0213.jo@samsung.com>
Reviewed-by: Jon A. Cruz <jon@joncruz.org>
#ifdef WITH_CLOUD
virtual OCStackResult SubscribeDevicePresence(OCDoHandle* handle,
const std::string& host,
- const QueryParamsList& queryParams,
+ const std::vector<std::string>& di,
OCConnectivityType connectivityType,
ObserveCallback& callback) = 0;
#endif
#ifdef WITH_CLOUD
virtual OCStackResult SubscribeDevicePresence(OCDoHandle* handle,
const std::string& host,
- const QueryParamsList& queryParams,
+ const std::vector<std::string>& di,
OCConnectivityType connectivityType,
ObserveCallback& callback);
#endif
* It will be set upon successful return of this method.
* @param host The IP address/addressable name of the server to subscribe to.
* This should be in the format coap://address:port
- * @param queryParams map which can have the query parameter name and list of value.
+ * @param di Vector which can have the devices id.
+ * @param connectivityType ::OCConnectivityType type of connectivity indicating the
+ * interface. Example: CT_DEFAULT, CT_ADAPTER_IP, CT_ADAPTER_TCP.
* @param observeHandler handles callback
* The callback function will be invoked with a map of attribute name and values.
* The callback function will also have the result from this observe operation
*/
OCStackResult subscribeDevicePresence(OCPresenceHandle& presenceHandle,
const std::string& host,
- const QueryParamsList& queryParams,
+ const std::vector<std::string>& di,
OCConnectivityType connectivityType,
ObserveCallback callback);
#endif
#ifdef WITH_CLOUD
OCStackResult subscribeDevicePresence(OCPresenceHandle& presenceHandle,
const std::string& host,
- const QueryParamsList& queryParams,
+ const std::vector<std::string>& di,
OCConnectivityType connectivityType,
ObserveCallback callback);
#endif
virtual OCStackResult SubscribeDevicePresence(
OCDoHandle* /*handle*/,
const std::string& /*host*/,
- const QueryParamsList& /*queryParams*/,
+ const std::vector<std::string>& /*di*/,
OCConnectivityType /*connectivityType*/,
ObserveCallback& /*callback*/)
{return OC_STACK_NOTIMPL;}
#ifdef WITH_CLOUD
OCStackResult InProcClientWrapper::SubscribeDevicePresence(OCDoHandle* handle,
const std::string& host,
- const QueryParamsList& queryParams,
+ const std::vector<std::string>& di,
OCConnectivityType connectivityType,
ObserveCallback& callback)
{
std::ostringstream os;
os << host << OCF_RSRVD_DEVICE_PRESENCE_URI;
+ QueryParamsList queryParams({{OC_RSRVD_DEVICE_ID, di}});
std::string url = assembleSetResourceUri(os.str(), queryParams);
result = OCDoResource(handle, OC_REST_OBSERVE,
#ifdef WITH_CLOUD
OCStackResult subscribeDevicePresence(OCPresenceHandle& presenceHandle,
const std::string& host,
- const QueryParamsList& queryParams,
+ const std::vector<std::string>& di,
OCConnectivityType connectivityType,
ObserveCallback callback)
{
return OCPlatform_impl::Instance().subscribeDevicePresence(presenceHandle,
host,
- queryParams,
+ di,
connectivityType,
callback);
}
#ifdef WITH_CLOUD
OCStackResult OCPlatform_impl::subscribeDevicePresence(OCPresenceHandle& presenceHandle,
const std::string& host,
- const QueryParamsList& queryParams,
+ const std::vector<std::string>& di,
OCConnectivityType connectivityType,
ObserveCallback callback)
{
return checked_guard(m_client, &IClientWrapper::SubscribeDevicePresence,
- &presenceHandle, host, queryParams, connectivityType, callback);
+ &presenceHandle, host, di, connectivityType, callback);
}
#endif
}
#ifdef WITH_CLOUD
- //SubscribeDevicePresence Test
+ // SubscribeDevicePresence Test
TEST(SubscribeDevicePresenceTest, DISABLED_SubscribeDevicePresenceWithValidParameters)
{
std::string hostAddress = "192.168.1.2:5000";
OCPlatform::OCPresenceHandle presenceHandle = nullptr;
- QueryParamsList queryParams = {};
+ std::vector<std::string> di;
EXPECT_EQ(OC_STACK_OK, OCPlatform::subscribeDevicePresence(presenceHandle,
- hostAddress, queryParams, CT_DEFAULT, &onObserve));
+ hostAddress, di, CT_DEFAULT, &onObserve));
}
TEST(SubscribeDevicePresenceTest, SubscribeDevicePresenceWithNullHost)
{
OCPlatform::OCPresenceHandle presenceHandle = nullptr;
- QueryParamsList queryParams = {};
+ std::vector<std::string> di;
EXPECT_ANY_THROW(OCPlatform::subscribeDevicePresence(presenceHandle,
- nullptr, queryParams, CT_DEFAULT, &onObserve));
+ nullptr, di, CT_DEFAULT, &onObserve));
}
TEST(SubscribeDevicePresenceTest, SubscribeDevicePresenceWithNullOnObserve)
{
std::string hostAddress = "192.168.1.2:5000";
OCPlatform::OCPresenceHandle presenceHandle = nullptr;
- QueryParamsList queryParams = {};
+ std::vector<std::string> di;
EXPECT_ANY_THROW(OCPlatform::subscribeDevicePresence(presenceHandle,
- hostAddress, queryParams, CT_DEFAULT, NULL));
+ hostAddress, di, CT_DEFAULT, NULL));
}
TEST(SubscribeDevicePresenceTest, DISABLED_UnsubscribePresenceWithValidHandle)
{
std::string hostAddress = "192.168.1.2:5000";
OCPlatform::OCPresenceHandle presenceHandle = nullptr;
- QueryParamsList queryParams = {};
+ std::vector<std::string> di;
EXPECT_EQ(OC_STACK_OK, OCPlatform::subscribeDevicePresence(presenceHandle,
- hostAddress, queryParams, CT_DEFAULT, &onObserve));
+ hostAddress, di, CT_DEFAULT, &onObserve));
EXPECT_EQ(OC_STACK_OK, OCPlatform::unsubscribePresence(presenceHandle));
}
#endif