Resolved tizen build issue regarding ip network
[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 "ESRichCommon.h"
28 #include "RemoteEnrollee.h"
29
30 namespace OIC
31 {
32     namespace Service
33     {
34         class RemoteEnrollee;
35
36         /**
37          * This provides methods for Mediator devices to perform EasySetup of Enrollee devices.
38          * EasySetup involves
39          * 1) Ownership transfer for enabling secured communication between Mediator and Enrollee
40          * devices.
41          * 2) Provisioning of Enrollee devices using the credentails of target Enroller devices.
42          */
43         class EasySetup
44         {
45         public:
46             /**
47              * API for getting the instance of EasySetup singleton class.
48              * @return EasySetup instance.
49              */
50             static EasySetup* getInstance();
51
52             /**
53              * This API is used for creating a remote Enrollee device instance.
54              * @param ProvConfig Provisioning information for configuring the Enrollee.
55              * @param WiFiOnboadingConnection Onboarding connection 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 ProvConfig& enrolleeNWProvInfo,
64                          const WiFiOnboadingConnection& wifiOnboardingconn);
65         private:
66             EasySetup();
67             ~EasySetup();
68
69             RemoteEnrollee::shared_ptr findDeviceInProvisioningList(
70                                 const ProvConfig& enrolleeNWProvInfo,
71                                 const WiFiOnboadingConnection& wifiOnboardingconn);
72             bool addDeviceToProvisioningList(const RemoteEnrollee::shared_ptr remoteEnrollee);
73             bool deleteDeviceFromProvisioningList (const ProvConfig& enrolleeNWProvInfo);
74
75             std::vector< RemoteEnrollee::shared_ptr > m_activeEnrolleeList;
76             static EasySetup *s_instance;
77         };
78     }
79 }
80
81 #endif /* EASYSETUP_H_ */