[ENROLLEE] Tizen enrollee sample application build using scons command
[platform/upstream/iotivity.git] / service / easy-setup / mediator / richsdk / inc / EasySetup.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 #ifndef EASYSETUP_H_
22 #define EASYSETUP_H_
23
24 #include <memory>
25 #include <vector>
26
27 #include "escommon.h"
28 #include "Utility.h"
29 #include "RemoteEnrollee.h"
30
31 namespace OIC
32 {
33     namespace Service
34     {
35         class RemoteEnrollee;
36
37         /**
38          * This provides methods for Mediator devices to perform EasySetup of Enrollee devices.
39          * EasySetup involves
40          * 1) Ownership transfer for enabling secured communication between Mediator and Enrollee
41          * devices.
42          * 2) Provisioning of Enrollee devices using the credentails of target Enroller devices.
43          */
44         class EasySetup
45         {
46         public:
47             /**
48              * API for getting the instance of EasySetup singleton class.
49              * @return EasySetup instance.
50              */
51             static EasySetup* getInstance();
52
53             /**
54              * This API is used for creating a remote Enrollee device instance.
55              * @param enrolleeNWProvIndo Provisioning information for configuring the Enrollee.
56              *
57              * @throws ESBadRequestException If createEnrolleeDevice is invoked with the same
58              *         provisioning information.
59              *
60              * @return Pointer to RemoteEnrollee instance.
61              */
62             std::shared_ptr<RemoteEnrollee> createEnrolleeDevice (
63                                             const EnrolleeNWProvInfo& enrolleeNWProvInfo);
64         private:
65             EasySetup();
66             ~EasySetup();
67
68             RemoteEnrollee::shared_ptr findDeviceInProvisioningList(
69                                 const EnrolleeNWProvInfo& enrolleeNWProvInfo);
70             bool addDeviceToProvisioningList(const RemoteEnrollee::shared_ptr remoteEnrollee);
71             bool deleteDeviceFromProvisioningList (const EnrolleeNWProvInfo& enrolleeNWProvInfo);
72
73             std::vector< RemoteEnrollee::shared_ptr > m_activeEnrolleeList;
74             static EasySetup *s_instance;
75         };
76     }
77 }
78
79 #endif /* EASYSETUP_H_ */