X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=service%2Feasy-setup%2Fmediator%2Frichsdk%2Finc%2FRemoteEnrollee.h;h=76ce15525c92d832c8b43cc593a5222b089980aa;hb=7f00f942c39b7bc27c7eeecf213a239c3fe4173c;hp=30ef55cc1a0e1f058a27a15f1ca2ca1dd0de447f;hpb=edcfc3d2329da7b914771c0dcff5f42c9b74fd93;p=platform%2Fupstream%2Fiotivity.git diff --git a/service/easy-setup/mediator/richsdk/inc/RemoteEnrollee.h b/service/easy-setup/mediator/richsdk/inc/RemoteEnrollee.h index 30ef55c..76ce155 100755 --- a/service/easy-setup/mediator/richsdk/inc/RemoteEnrollee.h +++ b/service/easy-setup/mediator/richsdk/inc/RemoteEnrollee.h @@ -59,6 +59,7 @@ namespace OIC * * @param callback will give the requested status * + * @throws ESInvalidParameterException If callback is null. * @throws ESBadRequestException If RemoteEnrollee device not created prior to this call. * * @see GetStatusCb @@ -70,17 +71,19 @@ namespace OIC * * @param callback will give the requested configuration * + * @throws ESInvalidParameterException If callback is null. * @throws ESBadRequestException If RemoteEnrollee device not created prior to this call. * * @see GetConfigurationStatusCb */ void getConfiguration(const GetConfigurationStatusCb callback); - /** + /** * Do security provisioning such as ownership tranfer to Enrollee. * * @param callback will give the result if the security provisioning succeeds or fails for some reasons * + * @throws ESInvalidParameterException If callback is null. * @throws ESBadRequestException If RemoteEnrollee device not created prior to this call. * * @see SecurityProvStatusCb @@ -88,6 +91,20 @@ namespace OIC void provisionSecurity(const SecurityProvStatusCb callback); /** + * Do security provisioning such as ownership tranfer to Enrollee which may require more + * specific user selections like a type of ownership transfer method or pre-configured + * pin number used to Pre-configured pin-based MOT. + * + * @param callback will give the result if the security provisioning succeeds or fails for some reasons. + * + * @throws ESInvalidParameterException If callback is null. + * @throws ESBadRequestException If RemoteEnrollee device not created prior to this call. + * + * @see SecurityProvStatusCb + */ + void provisionSecurity(const SecurityProvStatusCbWithOption callback); + + /** * Provision WiFi AP information and device configuration to Enrollee * 1. WiFi AP information includes a SSID, password, auth type, and encryption type. * 2. Device configuration includes a language (IETF language tags) and country (ISO 3166-1 Alpha-2) @@ -95,6 +112,7 @@ namespace OIC * @param devProp a data structure storing the above information to be delivered * @param callback will give the result if the provisioning succeeds or fails * + * @throws ESInvalidParameterException If callback is null. * @throws ESBadRequestException If RemoteEnrollee device not created prior to this call. * * @see DeviceProp @@ -114,6 +132,7 @@ namespace OIC * @param cloudProp a data structure storing the above information to be delivered * @param callback will give the result if the provisioning succeeds or fails * + * @throws ESInvalidParameterException If callback is null. * @throws ESBadRequestException If RemoteEnrollee device not created prior to this call. * * @see CloudProp @@ -122,13 +141,72 @@ namespace OIC void provisionCloudProperties(const CloudProp& cloudProp, const CloudPropProvStatusCb callback); + /** + * Provision Cloud information to Enrollee, which includes Auth code, auth provider, + * Cloud interface server URL, and etc. + * Note that, this API is skipping finding Enrollee in a given network. Instead, an OCResource + * given as a first parameter will be considered to the Enrollee for cloud provisioning. + * + * @param resource an OCResource corresponding to a target Enrollee for cloud provisioning + * @param cloudProp a data structure storing the above information to be delivered + * @param callback will give the result if the provisioning succeeds or fails + * + * @throws ESInvalidParameterException If callback is null. + * @throws ESBadRequestException If RemoteEnrollee device not created prior to this call. + * + * @see CloudProp + * @see CloudPropProvStatusCb + */ + void provisionCloudProperties(const std::shared_ptr< OC::OCResource > resource, + const CloudProp& cloudProp, + const CloudPropProvStatusCb callback); + + /** + * Notify an Enrollee to Connect WiFi/Cloud + * + * @param connectTypes Target configurations to be connected. E.g. WiFi and coap cloud server + * @param callback will give the result if the connect request succeeds or fails + * + * @see ES_CONNECT_TYPE + * @see ConnectRequestStatusCb + */ + void requestToConnect(const std::vector &connectTypes, const ConnectRequestStatusCb callback); + private: RemoteEnrollee(const std::shared_ptr< OC::OCResource > resource); ESResult discoverResource(); static void onDiscoveredCallback(const std::shared_ptr resource, - std::weak_ptr this_ptr); + std::weak_ptr this_ptr); + + static void onGetStatusHandlerCallback( + const std::shared_ptr< GetEnrolleeStatus > status, + std::weak_ptr this_ptr); + + static void onGetConfigurationStatusHandlerCallback( + const std::shared_ptr< GetConfigurationStatus > status, + std::weak_ptr this_ptr); + + static void onDevicePropProvisioningStatusHandlerCallback( + const std::shared_ptr< DevicePropProvisioningStatus > status, + std::weak_ptr this_ptr); + + static void onCloudPropProvisioningStatusHandlerCallback( + const std::shared_ptr< CloudPropProvisioningStatus > status, + std::weak_ptr this_ptr); + + static void onConnectRequestStatusHandlerCallback( + const std::shared_ptr< ConnectRequestStatus > status, + std::weak_ptr this_ptr); + + static void onSecurityStatusHandlerCallback( + const std::shared_ptr< SecProvisioningStatus > status, + std::weak_ptr this_ptr); + + static ESOwnershipTransferData onSecurityStatusWithOptionHandlerCallback( + const std::shared_ptr< SecProvisioningStatus > status, + std::weak_ptr this_ptr); void onDeviceDiscovered(const std::shared_ptr resource); void initCloudResource(); @@ -141,13 +219,18 @@ namespace OIC (const std::shared_ptr< DevicePropProvisioningStatus > status) const; void cloudPropProvisioningStatusHandler (const std::shared_ptr< CloudPropProvisioningStatus > status) const; + void connectRequestStatusHandler( + const std::shared_ptr< ConnectRequestStatus > status) const; void securityStatusHandler (const std::shared_ptr< SecProvisioningStatus > status) const; + ESOwnershipTransferData securityStatusWithOptionHandler + (const std::shared_ptr< SecProvisioningStatus > status) const; private: std::shared_ptr< OC::OCResource > m_ocResource; std::shared_ptr< EnrolleeResource > m_enrolleeResource; - std::shared_ptr< EnrolleeSecurity > m_enrolleeSecurity; + std::shared_ptr< EnrolleeSecurity > m_localEnrolleeSecurity; + std::shared_ptr< EnrolleeSecurity > m_cloudEnrolleeSecurity; std::shared_ptr< CloudResource > m_cloudResource; std::string m_deviceId; @@ -157,12 +240,14 @@ namespace OIC std::condition_variable m_cond; SecurityProvStatusCb m_securityProvStatusCb; + SecurityProvStatusCbWithOption m_securityProvStatusCbWithOption; GetStatusCb m_getStatusCb; GetConfigurationStatusCb m_getConfigurationStatusCb; SecurityPinCb m_securityPinCb; SecProvisioningDbPathCb m_secProvisioningDbPathCb; DevicePropProvStatusCb m_devicePropProvStatusCb; CloudPropProvStatusCb m_cloudPropProvStatusCb; + ConnectRequestStatusCb m_connectRequestStatusCb; friend class EasySetup; };