600c15825ced53215cce4c6c000c3c9a5e63ebf4
[platform/upstream/iotivity.git] / service / easy-setup / sdk / mediator / include / EasySetup.h
1 //******************************************************************\r
2 //\r
3 // Copyright 2015 Samsung Electronics All Rights Reserved.\r
4 //\r
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
6 //\r
7 // Licensed under the Apache License, Version 2.0 (the "License");\r
8 // you may not use this file except in compliance with the License.\r
9 // You may obtain a copy of the License at\r
10 //\r
11 //      http://www.apache.org/licenses/LICENSE-2.0\r
12 //\r
13 // Unless required by applicable law or agreed to in writing, software\r
14 // distributed under the License is distributed on an "AS IS" BASIS,\r
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16 // See the License for the specific language governing permissions and\r
17 // limitations under the License.\r
18 //\r
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
20 \r
21 #ifndef EASYSETUP_H_\r
22 #define EASYSETUP_H_\r
23 \r
24 #include <memory>\r
25 #include <vector>\r
26 \r
27 #include "escommon.h"\r
28 #include "RemoteEnrollee.h"\r
29 \r
30 namespace OIC\r
31 {\r
32     namespace Service\r
33     {\r
34         class RemoteEnrollee;\r
35 \r
36         /**\r
37          * This provides methods for Mediator devices to perform EasySetup of Enrollee devices.\r
38          * EasySetup involves\r
39          * 1) Ownership transfer for enabling secured communication between Mediator and Enrollee\r
40          * devices.\r
41          * 2) Provisioning of Enrollee devices using the credentails of target Enroller devices.\r
42          */\r
43         class EasySetup\r
44         {\r
45         public:\r
46             /**\r
47              * API for getting the instance of EasySetup singleton class.\r
48              * @return EasySetup instance.\r
49              */\r
50             static EasySetup* getInstance();\r
51 \r
52             /**\r
53              * This API is used for creating a remote Enrollee device instance.\r
54              * @param enrolleeNWProvIndo Provisioning information for configuring the Enrollee.\r
55              *\r
56              * @throws ESBadRequestException If createEnrolleeDevice is invoked with the same\r
57              *         provisioning information.\r
58              *\r
59              * @return Pointer to RemoteEnrollee instance.\r
60              */\r
61             std::shared_ptr<RemoteEnrollee> createEnrolleeDevice (\r
62                                             const EnrolleeNWProvInfo& enrolleeNWProvInfo);\r
63         private:\r
64             EasySetup();\r
65             ~EasySetup();\r
66 \r
67             RemoteEnrollee::shared_ptr findDeviceInProvisioningList(\r
68                                 const EnrolleeNWProvInfo& enrolleeNWProvInfo);\r
69             bool addDeviceToProvisioningList(const RemoteEnrollee::shared_ptr remoteEnrollee);\r
70             bool deleteDeviceFromProvisioningList (const EnrolleeNWProvInfo& enrolleeNWProvInfo);\r
71 \r
72             std::vector< RemoteEnrollee::shared_ptr > m_activeEnrolleeList;\r
73             static EasySetup *s_instance;\r
74         };\r
75     }\r
76 }\r
77 \r
78 #endif /* EASYSETUP_H_ */\r