Commit a6bcace0 authored by sy01.youn's avatar sy01.youn Committed by Madan Lanka

[Enrollee] DeleteEasySetupResourcess() is fixed in resource handler.

   . Unbind logic is added
   . Check whether handle is NULL or not

Change-Id: I0b69d29735af06b75b4e775484cf835ca12007f0
Signed-off-by: default avatarsy01.youn <sy01.youn@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/10207Reviewed-by: default avatarJihun Ha <jihun.ha@samsung.com>
Tested-by: default avatarjenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: default avatarMadan Lanka <lanka.madan@samsung.com>
parent c5ac3b7d
......@@ -679,26 +679,66 @@ OCStackResult DeleteProvisioningResource()
OCStackResult DeleteEasySetupResources()
{
OCStackResult res = OCDeleteResource(gWiFiResource.handle);
if (res != OC_STACK_OK)
OCStackResult res = OC_STACK_ERROR;
if (gWiFiResource.handle != NULL)
{
OIC_LOG_V(ERROR, ES_RH_TAG, "Deleting WiFi resource error with result: %s", getResult(res));
res = OCUnBindResource(gProvResource.handle, gWiFiResource.handle);
if(res != OC_STACK_OK)
{
OIC_LOG_V(ERROR, ES_RH_TAG, "Unbind WiFi resource error with result: %s", getResult(res));
}
}
res = OCDeleteResource(gCloudResource.handle);
if (res != OC_STACK_OK)
if (gCloudResource.handle != NULL)
{
OIC_LOG_V(ERROR, ES_RH_TAG, "Deleting CloudServer resource error with result: %s", getResult(res));
res = OCUnBindResource(gProvResource.handle, gCloudResource.handle);
if(res != OC_STACK_OK)
{
OIC_LOG_V(ERROR, ES_RH_TAG, "Unbind CloudServer resource error with result: %s", getResult(res));
}
}
res = OCDeleteResource(gDevConfResource.handle);
if (res != OC_STACK_OK)
if (gDevConfResource.handle != NULL)
{
OIC_LOG_V(ERROR, ES_RH_TAG, "Deleting DevConf resource error with result: %s", getResult(res));
res = OCUnBindResource(gProvResource.handle, gDevConfResource.handle);
if(res != OC_STACK_OK)
{
OIC_LOG_V(ERROR, ES_RH_TAG, "Unbind DevConf resource error with result: %s", getResult(res));
}
}
res = OCDeleteResource(gProvResource.handle);
if (res != OC_STACK_OK)
if (gWiFiResource.handle != NULL)
{
OIC_LOG_V(ERROR, ES_RH_TAG, "Deleting Prov resource error with result: %s", getResult(res));
res = OCDeleteResource(gWiFiResource.handle);
if (res != OC_STACK_OK)
{
OIC_LOG_V(ERROR, ES_RH_TAG, "Deleting WiFi resource error with result: %s", getResult(res));
}
}
if(gCloudResource.handle != NULL)
{
res = OCDeleteResource(gCloudResource.handle);
if (res != OC_STACK_OK)
{
OIC_LOG_V(ERROR, ES_RH_TAG, "Deleting CloudServer resource error with result: %s", getResult(res));
}
}
if(gDevConfResource.handle != NULL)
{
res = OCDeleteResource(gDevConfResource.handle);
if (res != OC_STACK_OK)
{
OIC_LOG_V(ERROR, ES_RH_TAG, "Deleting DevConf resource error with result: %s", getResult(res));
}
}
if(gProvResource.handle != NULL)
{
res = OCDeleteResource(gProvResource.handle);
if (res != OC_STACK_OK)
{
OIC_LOG_V(ERROR, ES_RH_TAG, "Deleting Prov resource error with result: %s", getResult(res));
}
}
return res;
......
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