Commit 9a025e55 authored by Jihun Ha's avatar Jihun Ha Committed by Madan Lanka

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: default avatarJihun Ha <jihun.ha@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/13331Tested-by: default avatarjenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: default avatarHeewon Park <h_w.park@samsung.com>
Reviewed-by: default avatarMadan Lanka <lanka.madan@samsung.com>
parent 79bf0872
......@@ -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);
......
......@@ -616,9 +616,12 @@ namespace OIC
std::vector<OCRepresentation> 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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment