1 //******************************************************************
3 // Copyright 2015 Samsung Electronics All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
11 // http://www.apache.org/licenses/LICENSE-2.0
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
24 * This file contains the RCSDiscoveryManager class which provide APIs to discover the Resource in the network
28 #ifndef RCSDISCOVERYMANAGER_H
29 #define RCSDISCOVERYMANAGER_H
40 class RCSRemoteResourceObject;
47 DiscoveryTask(unsigned int id) : m_id{ id } {};
54 friend class RCSDiscoveryManager;
55 friend class RCSDiscoveryManagerImpl;
59 * This class contains the resource discovery methods.
61 * @see RCSRemoteResourceObject
63 class RCSDiscoveryManager
68 * Typedef for callback of discoverResource APIs
70 * @see discoverResource
72 typedef std::function< void(std::shared_ptr< RCSRemoteResourceObject >) >
73 ResourceDiscoveredCallback;
76 * @return Returns RCSDiscoveryManager instance.
79 static RCSDiscoveryManager* getInstance();
82 * API for discovering the resource of Interest, regardless of URI and resource type
84 * @param address A RCSAddress object
85 * @param cb A callback to obtain discovered resource
87 * @throws InvalidParameterException If cb is empty.
89 * @note The callback will be invoked in an internal thread.
94 std::unique_ptr<DiscoveryTask> discoverResource(const RCSAddress& address,
95 ResourceDiscoveredCallback cb);
98 * API for discovering the resource of Interest, regardless of resource type
100 * @param address A RCSAddress object
101 * @param relativeURI The relative uri of resource to be searched
102 * @param cb A callback to obtain discovered resource
104 * @throws InvalidParameterException If cb is empty.
106 * @note The callback will be invoked in an internal thread.
111 std::unique_ptr<DiscoveryTask> discoverResource(const RCSAddress& address,
112 const std::string& relativeURI, ResourceDiscoveredCallback cb);
115 * API for discovering the resource of Interest by Resource type.
117 * @param address A RCSAddress object
118 * @param resourceType Ressource Type
119 * @param cb A callback to obtain discovered resource
121 * @throws InvalidParameterException If cb is empty.
123 * @note The callback will be invoked in an internal thread.
128 std::unique_ptr<DiscoveryTask> discoverResourceByType(const RCSAddress& address,
129 const std::string& resourceType, ResourceDiscoveredCallback cb);
132 * API for discovering the resource of Interest by Resource type with provided relativeURI
134 * @param address A RCSAddress object
135 * @param relativeURI The relative uri of resource to be searched
136 * @param resourceType Ressource Type
137 * @param cb A callback to obtain discovered resource
139 * @throws InvalidParameterException If cb is empty.
141 * @note The callback will be invoked in an internal thread.
146 std::unique_ptr<DiscoveryTask> discoverResourceByType(const RCSAddress& address,
147 const std::string& relativeURI, const std::string& resourceType,
148 ResourceDiscoveredCallback cb);
152 RCSDiscoveryManager() = default;
153 ~RCSDiscoveryManager()= default;;
155 friend class DiscoveryTask;
159 #endif // RCSDISCOVERYMANAGER_H