1 //******************************************************************
\r
3 // Copyright 2015 Samsung Electronics All Rights Reserved.
\r
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
\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
11 // http://www.apache.org/licenses/LICENSE-2.0
\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
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
\r
21 #ifndef REMOTE_ENROLLEE_H_
\r
22 #define REMOTE_ENROLLEE_H_
\r
24 #include "escommon.h"
\r
30 class RemoteEnrolleeResource;
\r
31 class EnrolleeSecurity;
\r
34 * This class represents Remote Enrollee device instance.
\r
35 * It will provide APIs for Mediator to perform operations to enable the Enrollee device
\r
36 * to connect to the Enroller.
\r
38 class RemoteEnrollee
\r
42 * RemoteEnrollee constructor
\r
44 * @param enrolleeNWProvInfo Provisioning information for the Enrollee
\r
46 * @throw ESBadRequestException is thrown if the parameters are invalid
\r
48 RemoteEnrollee(const EnrolleeNWProvInfo& enrolleeNWProvInfo) ;
\r
50 ~RemoteEnrollee() = default;
\r
52 typedef std::shared_ptr< RemoteEnrollee > shared_ptr;
\r
55 * Callback definition to be invoked when EasySetup status is changed.
\r
56 * The same callback will be invoked when there is an error in the
\r
57 * EasySetup process.
\r
59 * @see registerResourceHandler
\r
60 * @see ResourceState
\r
62 typedef std::function< void(std::shared_ptr< EasySetupStatus >) >
\r
65 #ifdef __WITH_DTLS__
\r
67 * Register Security status and other information callback handlers.
\r
69 * @param secProvisioningDbCb Callback to be invoked when the stack expects a
\r
70 * path for the provisioning db.
\r
71 * @param securityPinCb Callback to get security pin during pin based ownership transfer.
\r
73 * @throws InvalidParameterException If callback is an empty function or null.
\r
74 * @throws ESBadRequestException If registration is already completed.
\r
76 * @see SecProvisioningResult
\r
78 ESResult registerSecurityCallbackHandler(SecurityPinCb securityPinCb,
\r
79 SecProvisioningDbPathCb secProvisioningDbPathCb);
\r
80 #endif //__WITH_DTLS__
\r
83 * Register EasySetup status handler.
\r
85 * @param callback Callback to get EasySetup status.
\r
86 * @param secProvisioningDbCB Callback to be invoked when the stack expects a
\r
87 * path for the provisioning db.
\r
89 * @throws InvalidParameterException If callback is an empty function or null.
\r
90 * @throws ESBadRequestException If registration is already completed.
\r
92 * @see EasySetupStatus
\r
94 void registerEasySetupStatusHandler(EasySetupStatusCB callback);
\r
97 * Start provisioning of target Enrollers information to the Enrollee.
\r
99 * @throws ESBadRequestException If RemoteEnrollee device not created prior to this call.
\r
101 * @see RemoteEnrollee
\r
103 void startProvisioning();
\r
106 * Stop provisioning process that is currently in progress.
\r
108 * @throws BadRequestException If provisioning is not in progress.
\r
110 void stopProvisioning();
\r
113 * Check if the Enrollee device provisioned.
\r
115 bool isEnrolleeProvisioned();
\r
118 * Get the Provisioning information provided for the current Enrollee.
\r
120 * @return EnrolleeNWProvInfo Provisioning information provided for the current Enrollee.
\r
122 EnrolleeNWProvInfo& getEnrolleeProvisioningInfo ();
\r
125 std::shared_ptr< RemoteEnrolleeResource > m_remoteResource;
\r
126 EasySetupStatusCB m_easySetupStatusCb;
\r
127 EnrolleeSecStatusCb m_enrolleeSecStatusCb;
\r
128 SecurityPinCb m_securityPinCb;
\r
129 SecProvisioningDbPathCb m_secProvisioningDbPathCb;
\r
130 EnrolleeNWProvInfo m_enrolleeNWProvInfo;
\r
131 std::shared_ptr< EnrolleeSecurity > m_enrolleeSecurity;
\r
132 CurrentESState m_currentESState;
\r
133 bool m_needSecuredEasysetup;
\r
135 void provisioningStatusHandler (std::shared_ptr< ProvisioningStatus > provStatus);
\r
136 void easySetupSecurityStatusCallback(
\r
137 std::shared_ptr< SecProvisioningResult > secProvisioningResult);
\r
142 #endif //REMOTE_ENROLLEE_H_
\r