[Resource-Encapsulation] Splitted Resource Client to 2 files
[iotivity.git] / service / resource-encapsulation / include / RCSDiscoveryManager.h
1 //******************************************************************
2 //
3 // Copyright 2015 Samsung Electronics All Rights Reserved.
4 //
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 //
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
10 //
11 //      http://www.apache.org/licenses/LICENSE-2.0
12 //
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.
18 //
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20
21 /**
22  * @file
23  *
24  * This file contains the RCSDiscoveryManager class which provide API to discover the Resource in the network
25  *
26  */
27
28 #ifndef RCS_DISCOVERYMANAGER_H_
29 #define RCS_DISCOVERYMANAGER_H_
30
31 #include "RCSRemoteResourceObject.h"
32
33 namespace OIC
34 {
35     namespace Service
36     {
37
38         /*
39         * Forward Declaration of RCSAddress Class
40         */
41         class RCSAddress;
42
43         /**
44              * @class   RCSDiscoveryManager
45              * @brief   This class contains the resource discovery method.
46              *
47              */
48         class RCSDiscoveryManager
49         {
50             public:
51
52                 /**
53                  *  Typedef for callback of discoverResource API
54                  */
55                 typedef std::function< void( std::shared_ptr< RCSRemoteResourceObject>) >
56                 OnResourceDiscoveredCallback;
57
58                 /**
59                 * API for getting RCSDiscoveryManager instance.
60                 *
61                 * @return RCSDiscoveryManager - Instance of RCSDiscoveryManager class
62                 */
63                 static RCSDiscoveryManager *getInstance();
64
65                 /**
66                 * API for discovering the resource of Interest.
67                 *
68                 * @param address - RCSAddress object
69                 * @param resourceURI - uri of resource to be searched
70                 * @param cb - callback to obtain discovered resource
71                 *
72                 * @throw InvalidParameterException : This API throws the InvalidParameterException if any of
73                 *                                                         the parameter is invalid.
74                 * @RCSAddress
75                 */
76                 void discoverResource(const RCSAddress &address, const std::string &resourceURI,
77                                       OnResourceDiscoveredCallback cb);
78             private:
79
80                 /**
81                  * Constructor for RCSDiscoveryManager.
82                 */
83                 RCSDiscoveryManager() = default;
84
85                 /**
86                 * Destructor for RCSDiscoveryManager.
87                 */
88                 ~RCSDiscoveryManager() = default;
89
90         };
91     }
92 }
93 #endif //RCS_DISCOVERYMANAGER_H_