Merge branch 'master' into notification-service
[platform/upstream/iotivity.git] / service / easy-setup / mediator / richsdk / src / EnrolleeResource.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 ENROLLEE_RESOURCE_H_
22 #define ENROLLEE_RESOURCE_H_
23
24 #include <mutex>
25 #include <memory>
26
27 #include "ESRichCommon.h"
28
29 #include "OCApi.h"
30
31 using namespace OC;
32
33 namespace OIC
34 {
35     namespace Service
36     {
37         class OCResource;
38         class EnrolleeSecurity;
39
40         /**
41          * This class contains the resource discovery methods.
42          *
43          * @see EnrolleeResource
44          */
45         class EnrolleeResource
46         {
47             friend class EnrolleeSecurity;
48
49         public:
50             EnrolleeResource(std::shared_ptr< OC::OCResource > resource);
51
52             ~EnrolleeResource() = default;
53
54             void registerGetStatusCallback(const GetStatusCb callback);
55             void registerGetConfigurationStatusCallback(
56                 const GetConfigurationStatusCb callback);
57             void registerDevicePropProvStatusCallback(
58                 const DevicePropProvStatusCb callback);
59
60             void getConfiguration();
61             void getStatus();
62
63             void provisionProperties(const DeviceProp& deviceProp);
64
65         private:
66             std::shared_ptr< OC::OCResource > m_ocResource;
67
68             GetStatusCb m_getStatusCb;
69             GetConfigurationStatusCb m_getConfigurationStatusCb;
70             DevicePropProvStatusCb m_devicePropProvStatusCb;
71
72         private:
73             void onGetStatusResponse(const HeaderOptions& headerOptions,
74                                                 const OCRepresentation& rep,
75                                                 const int eCode);
76             void onGetConfigurationResponse(const HeaderOptions& headerOptions,
77                                                            const OCRepresentation& rep,
78                                                            const int eCode);
79             void onProvisioningResponse(const HeaderOptions& headerOptions,
80                                                     const OCRepresentation& rep,
81                                                     const int eCode);
82         };
83     }
84 }
85 #endif