const auto& types = IotconUtils::GetArg(args, kTypes).get<picojson::array>();
for (const auto& type : types) {
- result = IotconUtils::ConvertIotconError(iotcon_resource_bind_type(resource->handle, type.get<std::string>().c_str()));
- if (!result) {
- LogAndReturnTizenError(result, ("iotcon_resource_bind_type() failed"));
+ int ret = iotcon_resource_bind_type(resource->handle, type.get<std::string>().c_str());
+ if (IOTCON_ERROR_NONE != ret && IOTCON_ERROR_ALREADY != ret) {
+ LogAndReturnTizenError(
+ IotconUtils::ConvertIotconError(ret), ("iotcon_resource_bind_type() failed"));
}
}
LogAndReturnTizenError(result, ("GetResourceById() failed"));
}
- result = IotconUtils::ConvertIotconError(iotcon_resource_bind_interface(resource->handle, IotconUtils::GetArg(args, kInterface).get<std::string>().c_str()));
- if (!result) {
- LogAndReturnTizenError(result, ("iotcon_resource_bind_interface() failed"));
+ int ret = iotcon_resource_bind_interface(
+ resource->handle, IotconUtils::GetArg(args, kInterface).get<std::string>().c_str());
+ if (IOTCON_ERROR_NONE != ret && IOTCON_ERROR_ALREADY != ret) {
+ LogAndReturnTizenError(
+ IotconUtils::ConvertIotconError(ret), ("iotcon_resource_bind_interface() failed"));
}
return common::TizenSuccess();
LogAndReturnTizenError(result, ("GetResourceById() failed"));
}
- result = IotconUtils::ConvertIotconError(iotcon_resource_bind_child_resource(parent->handle, child->handle));
- if (!result) {
- LogAndReturnTizenError(result, ("iotcon_resource_bind_child_resource() failed"));
+ int ret = iotcon_resource_bind_child_resource(parent->handle, child->handle);
+ if (IOTCON_ERROR_NONE != ret && IOTCON_ERROR_ALREADY != ret) {
+ LogAndReturnTizenError(
+ IotconUtils::ConvertIotconError(ret), ("iotcon_resource_bind_child_resource() failed"));
}
parent->children.insert(child);
case IOTCON_ERROR_NOT_SUPPORTED:
return common::NotSupportedError(error);
+ case IOTCON_ERROR_NO_DATA:
case IOTCON_ERROR_INVALID_PARAMETER:
return common::InvalidValuesError(error);
- case IOTCON_ERROR_NO_DATA:
- return common::NotFoundError(error);
-
case IOTCON_ERROR_TIMEOUT:
return common::TimeoutError(error);