1 //******************************************************************
3 // Copyright 2015 Samsung Electronics All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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
11 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21 #ifndef REMOTE_ENROLLEE_H_
22 #define REMOTE_ENROLLEE_H_
26 #include "ESRichCommon.h"
36 class EnrolleeResource;
38 class EnrolleeSecurity;
41 * This class represents Remote Enrollee device instance.
42 * It will provide APIs for Mediator to perform operations to enable the Enrollee device
43 * to connect to the Enroller.
48 ~RemoteEnrollee() = default;
52 * Register Security status and other information callback handlers.
54 * @param secProvisioningDbCb Callback to be invoked when the stack expects a
55 * path for the provisioning db.
56 * @param securityPinCb Callback to get security pin during pin based ownership transfer.
58 * @throws InvalidParameterException If callback is an empty function or null.
59 * @throws ESBadRequestException If registration is already completed.
61 * @see SecProvisioningResult
63 ESResult registerSecurityCallbackHandler(SecurityPinCb securityPinCb,
64 SecProvisioningDbPathCb secProvisioningDbPathCb);
65 #endif //__WITH_DTLS__
68 * Start provisioning of target Enrollers information to the Enrollee.
70 * @throws ESBadRequestException If RemoteEnrollee device not created prior to this call.
74 void initRemoteEnrollee();
77 * Start provisioning of target Enrollers information to the Enrollee.
79 * @throws ESBadRequestException If RemoteEnrollee device not created prior to this call.
83 void requestPropertyData(RequestPropertyDataStatusCb callback);
86 * Start provisioning of target Enrollers information to the Enrollee.
88 * @throws ESBadRequestException If RemoteEnrollee device not created prior to this call.
92 void startSecurityProvisioning(EnrolleeSecStatusCb callback);
95 * Start provisioning of target Enrollers information to the Enrollee.
97 * @throws ESBadRequestException If RemoteEnrollee device not created prior to this call.
101 void startDataProvisioning(DataProvStatusCb callback);
104 * Start provisioning of target Enrollers information to the Enrollee.
106 * @throws ESBadRequestException If RemoteEnrollee device not created prior to this call.
108 * @see RemoteEnrollee
110 void startCloudProvisioning(CloudProvStatusCb callback);
113 * Get the Provisioning information provided for the current Enrollee.
115 * @return DataProvInfo Provisioning information provided for the current Enrollee.
117 DataProvInfo getDataProvInfo();
119 void setDataProvInfo(const DataProvInfo& );
120 void setCloudProvInfo(const CloudProvInfo& );
125 ESResult discoverResource();
126 ESResult ESDiscoveryTimeout(unsigned short waittime);
127 void onDeviceDiscovered(std::shared_ptr<OC::OCResource> resource);
128 void initCloudResource();
130 void RequestPropertyDataStatusHandler (std::shared_ptr< RequestPropertyDataStatus > status);
131 void dataProvisioningStatusHandler (std::shared_ptr< DataProvisioningStatus > status);
132 void cloudProvisioningStatusHandler (std::shared_ptr< CloudProvisioningStatus > status);
133 void easySetupSecurityStatusCallback(std::shared_ptr< SecProvisioningStatus > status);
136 std::shared_ptr< OC::OCResource > m_ocResource;
137 std::shared_ptr< EnrolleeResource > m_enrolleeResource;
138 std::shared_ptr< EnrolleeSecurity > m_enrolleeSecurity;
139 std::shared_ptr< CloudResource > m_cloudResource;
141 std::string m_deviceId;
142 bool m_discoveryResponse;
144 EnrolleeSecStatusCb m_enrolleeSecStatusCb;
145 RequestPropertyDataStatusCb m_RequestPropertyDataStatusCb;
146 SecurityPinCb m_securityPinCb;
147 SecProvisioningDbPathCb m_secProvisioningDbPathCb;
148 DataProvStatusCb m_dataProvStatusCb;
149 CloudProvStatusCb m_cloudProvStatusCb;
151 DataProvInfo m_dataProvInfo;
152 CloudProvInfo m_cloudProvInfo;
153 PropertyData m_propertyData;
155 friend class EasySetup;
160 #endif //REMOTE_ENROLLEE_H_