From: Jihun Ha Date: Mon, 17 Oct 2016 05:31:09 +0000 (+0900) Subject: Update a logic to check an availability of cloud server resource X-Git-Tag: 1.2.0~27 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=eda5dfa0fa00c0d25fafa9439db9b4a9b84686f5;p=platform%2Fupstream%2Fiotivity.git Update a logic to check an availability of cloud server resource Rather than URI, resource type of the cloud server resource is more confirmable to check the availability. Change-Id: I61f3b63412b39fc56e993a3041ac007d0886368b Signed-off-by: Jihun Ha Reviewed-on: https://gerrit.iotivity.org/gerrit/13333 Tested-by: jenkins-iotivity Reviewed-by: Uze Choi --- diff --git a/service/easy-setup/enrollee/src/resourcehandler.c b/service/easy-setup/enrollee/src/resourcehandler.c index be8232b6d..c2ffa4a6a 100755 --- a/service/easy-setup/enrollee/src/resourcehandler.c +++ b/service/easy-setup/enrollee/src/resourcehandler.c @@ -502,6 +502,12 @@ OCRepPayload* constructResponseOfWiFi() return NULL; } + if(gWiFiResource.handle == NULL) + { + OIC_LOG(ERROR, ES_RH_TAG, "WiFi resource is not created"); + return NULL; + } + OIC_LOG(INFO, ES_RH_TAG, "constructResponse wifi res"); OCRepPayloadSetUri(payload, OC_RSRVD_ES_URI_WIFI); OCRepPayloadAddInterface(payload, OC_RSRVD_INTERFACE_DEFAULT); @@ -538,6 +544,12 @@ OCRepPayload* constructResponseOfCloud() return NULL; } + if(gCloudResource.handle == NULL) + { + OIC_LOG(ERROR, ES_RH_TAG, "CloudServer resource is not created"); + return NULL; + } + OIC_LOG(INFO, ES_RH_TAG, "constructResponse cloudserver res"); OCRepPayloadSetUri(payload, OC_RSRVD_ES_URI_CLOUDSERVER); OCRepPayloadAddInterface(payload, OC_RSRVD_INTERFACE_DEFAULT); @@ -564,6 +576,12 @@ OCRepPayload* constructResponseOfDevConf() return NULL; } + if(gDevConfResource.handle == NULL) + { + OIC_LOG(ERROR, ES_RH_TAG, "DevConf resource is not created"); + return NULL; + } + OIC_LOG(INFO, ES_RH_TAG, "constructResponse devconf res"); OCRepPayloadSetUri(payload, OC_RSRVD_ES_URI_DEVCONF); OCRepPayloadAddInterface(payload, OC_RSRVD_INTERFACE_DEFAULT); diff --git a/service/easy-setup/mediator/richsdk/inc/ESRichCommon.h b/service/easy-setup/mediator/richsdk/inc/ESRichCommon.h index 0eb7f36fd..9bafeae49 100755 --- a/service/easy-setup/mediator/richsdk/inc/ESRichCommon.h +++ b/service/easy-setup/mediator/richsdk/inc/ESRichCommon.h @@ -616,9 +616,12 @@ namespace OIC std::vector children = m_ProvRep.getChildren(); for(auto child = children.begin(); child != children.end(); ++child) { - if(child->getUri().find(OC_RSRVD_ES_URI_CLOUDSERVER) != std::string::npos) + for(auto rt : child->getResourceTypes()) { - return true; + if(0 == rt.compare(OC_RSRVD_ES_RES_TYPE_CLOUDSERVER)) + { + return true; + } } } return false;