Imported Upstream version 1.0.0
[platform/upstream/iotivity.git] / service / simulator / src / client-controller / simulator_client.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 simulator_client.h
23  *
24  * @brief This file provides a class for realizing simulator client functionality.
25  *
26  */
27
28 #ifndef SIMULATOR_CLIENT_H_
29 #define SIMULATOR_CLIENT_H_
30
31 #include "simulator_client_types.h"
32 #include "simulator_remote_resource.h"
33 #include "simulator_exceptions.h"
34
35 /**
36  * @class   SimulatorClient
37  * @brief   This class provides a set of functions for discovering the resources over the network.
38  */
39 class SimulatorClient
40 {
41     public:
42
43         /**
44          * API for getting singleton instance of SimulatorClient class.
45          *
46          * @return Singleton instance of SimulatorClient class.
47          *
48          */
49         static SimulatorClient *getInstance(void);
50
51         /**
52          * API for discovering all type of resources.
53          * Discovered resources will be notified through the callback set using @callback parameter.
54          *
55          * @param callback - Method of type @ResourceFindCallback through which discoverd resources
56          *                                   will be notified.
57          *
58          * NOTE: API throws @InvalidArgsException and @SimulatorException.
59          */
60         void findResources(ResourceFindCallback callback);
61
62         /**
63          * API for discovering resources of a particular resource type.
64          * Discovered resources will be notified through the callback set using @callback parameter.
65          *
66          * @param resourceType - Type of resource to be searched for
67          * @param callback - Method of type @ResourceFindCallback through which discoverd resources
68          *                                   will be notified.
69          *
70          * NOTE: API throws @InvalidArgsException and @SimulatorException.
71          */
72         void findResources(const std::string &resourceType, ResourceFindCallback callback);
73
74     private:
75         SimulatorClient() = default;
76         ~SimulatorClient() = default;
77         SimulatorClient(const SimulatorClient &) = delete;
78         SimulatorClient &operator=(const SimulatorClient &) = delete;
79         SimulatorClient(const SimulatorClient &&) = delete;
80         SimulatorClient &operator=(const SimulatorClient && ) = delete;
81
82         void onResourceFound(std::shared_ptr<OC::OCResource> resource,
83                              ResourceFindCallback callback);
84 };
85
86 #endif
87