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
38 class RCSRemoteResourceObject;
42 * This class contains the resource discovery methods.
44 * @see RCSRemoteResourceObject
46 class RCSDiscoveryManager
51 * Typedef for callback of discoverResource APIs
53 * @see discoverResource
55 typedef std::function< void(std::shared_ptr< RCSRemoteResourceObject >) >
56 ResourceDiscoveredCallback;
59 * Returns RCSDiscoveryManager instance.
62 static RCSDiscoveryManager* getInstance();
65 * API for discovering the resource of Interest, regardless of URI and resource type
67 * @param address A RCSAddress object
68 * @param cb A callback to obtain discovered resource
70 * @throws InvalidParameterException If cb is empty.
72 * @note The callback will be invoked in an internal thread.
77 void discoverResource(const RCSAddress& address, ResourceDiscoveredCallback cb);
80 * API for discovering the resource of Interest, regardless of resource type
82 * @param address A RCSAddress object
83 * @param relativeURI The relative uri of resource to be searched
84 * @param cb A callback to obtain discovered resource
86 * @throws InvalidParameterException If cb is empty.
88 * @note The callback will be invoked in an internal thread.
93 void discoverResource(const RCSAddress& address, const std::string& relativeURI,
94 ResourceDiscoveredCallback cb);
97 * API for discovering the resource of Interest by Resource type.
99 * @param address A RCSAddress object
100 * @param resourceType Ressource Type
101 * @param cb A callback to obtain discovered resource
103 * @throws InvalidParameterException If cb is empty.
105 * @note The callback will be invoked in an internal thread.
110 void discoverResourceByType(const RCSAddress& address, const std::string& resourceType,
111 ResourceDiscoveredCallback cb);
114 * API for discovering the resource of Interest by Resource type with provided relativeURI
116 * @param address A RCSAddress object
117 * @param relativeURI The relative uri of resource to be searched
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 void discoverResourceByType(const RCSAddress& address, const std::string& relativeURI,
129 const std::string& resourceType,
130 ResourceDiscoveredCallback cb);
134 RCSDiscoveryManager() = default;
135 ~RCSDiscoveryManager() = default;
139 #endif // RCSDISCOVERYMANAGER_H