X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=service%2Feasy-setup%2Fmediator%2Frichsdk%2Fsrc%2FEasySetup.cpp;h=ef1a06abdae1d6c97a0fa818ae5b52ad28347e6e;hb=refs%2Ftags%2Fsubmit%2Ftizen_4.0%2F20171010.021147;hp=489b0e2f2ed2366dc11b1def746e2bbb40e810e4;hpb=c7080dd10db28cd74639df408635e9e0ff4c7cd2;p=platform%2Fupstream%2Fiotivity.git diff --git a/service/easy-setup/mediator/richsdk/src/EasySetup.cpp b/service/easy-setup/mediator/richsdk/src/EasySetup.cpp index 489b0e2..ef1a06a 100755 --- a/service/easy-setup/mediator/richsdk/src/EasySetup.cpp +++ b/service/easy-setup/mediator/richsdk/src/EasySetup.cpp @@ -18,7 +18,7 @@ // //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -#include "EasySetup.h" +#include "EasySetup.hpp" #include "OCPlatform.h" #include "logger.h" @@ -31,13 +31,12 @@ namespace OIC { namespace Service { - #define EASYSETUP_TAG "EASY_SETUP" + #define EASYSETUP_TAG "ES_EASY_SETUP" EasySetup * EasySetup::s_instance = nullptr; EasySetup::EasySetup() { - } EasySetup* EasySetup::getInstance () @@ -51,12 +50,34 @@ namespace OIC std::shared_ptr EasySetup::createRemoteEnrollee (std::shared_ptr< OC::OCResource > resource) { - if(resource->getResourceTypes().at(0) != OC_RSRVD_ES_RES_TYPE_PROV) + OIC_LOG(INFO, EASYSETUP_TAG, "createRemoteEnrollee IN"); + + if(resource) { - OIC_LOG_V (DEBUG, EASYSETUP_TAG, "createRemoteEnrollee : invalid reousrce"); - return nullptr; + if(resource->getResourceTypes().at(0) != OC_RSRVD_ES_RES_TYPE_EASYSETUP || + resource->connectivityType() & CT_ADAPTER_TCP) + { + OIC_LOG (ERROR, EASYSETUP_TAG, "Given resource is not valid due to wrong rt or conntype"); + return nullptr; + } + + auto interfaces = resource->getResourceInterfaces(); + for(auto interface : interfaces) + { + if(interface.compare(BATCH_INTERFACE) == 0) + { + OIC_LOG (INFO, EASYSETUP_TAG, "RemoteEnrollee object is succeessfully created"); + OIC_LOG_V (INFO_PRIVATE, EASYSETUP_TAG, "HOST: %s", resource->host().c_str()); + OIC_LOG_V (INFO_PRIVATE, EASYSETUP_TAG, "URI: %s", resource->uri().c_str()); + OIC_LOG_V (INFO_PRIVATE, EASYSETUP_TAG, "SID: %s", resource->sid().c_str()); + OIC_LOG_V (INFO_PRIVATE, EASYSETUP_TAG, "CONNECTIVITY: %d", resource->connectivityType()); + return std::shared_ptr< RemoteEnrollee > (new RemoteEnrollee(resource)); + } + } } - return std::shared_ptr< RemoteEnrollee > (new RemoteEnrollee(resource)); + + OIC_LOG (ERROR, EASYSETUP_TAG, "Given resource is NULL"); + return nullptr; } } }