If just check only OC_STACK_OK, it can cause problems.
Below value is success like OC_STACK_OK.
OC_STACK_RESOURCE_CREATED,
OC_STACK_RESOURCE_DELETED,
OC_STACK_CONTINUE.
BUG : https://jira.iotivity.org/browse/IOT-1185
Change-Id: I60b369138df00b98c4dbeb952ffba140aa902b27
Signed-off-by: Jaehong Jo <jaehong.jo@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/9217
Reviewed-by: Hyuna Jo <hyuna0213.jo@samsung.com>
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Randeep Singh <randeep.s@samsung.com>
OCStackResult CAResultToOCResult(CAResult_t caResult);
/**
+ * Converts a OCStackResult type to a bool type.
+ *
+ * @param ocResult OCStackResult value to convert.
+ * @return true on success, false upon failure.
+ */
+bool OCResultToSuccess(OCStackResult ocResult);
+
+/**
* Map OCQualityOfService to CAMessageType.
*
* @param qos Input qos.
CA_MSG_ACKNOWLEDGE,0, NULL, NULL, 0, NULL);
}
}
- else if(requestResult != OC_STACK_OK)
+ else if(!OCResultToSuccess(requestResult))
{
OIC_LOG_V(ERROR, TAG, "HandleStackRequests failed. error: %d", requestResult);
return OC_STACK_ERROR;
}
}
+
+bool OCResultToSuccess(OCStackResult ocResult)
+{
+ switch (ocResult)
+ {
+ case OC_STACK_OK:
+ case OC_STACK_RESOURCE_CREATED:
+ case OC_STACK_RESOURCE_DELETED:
+ case OC_STACK_CONTINUE:
+ return true;
+ default:
+ return false;
+ }
+}