return IOTCON_FUNC_STOP;
}
- auto ret = IotconUtils::ConvertIotconError(result);
- if (!ret) {
- data->fun(ret, picojson::value{});
- return IOTCON_FUNC_STOP;
+ switch (result) {
+ case IOTCON_ERROR_NONE:
+ break;
+ case IOTCON_ERROR_TIMEOUT:
+ delete data;
+ return IOTCON_FUNC_STOP;
+ default:
+ auto ret = IotconUtils::ConvertIotconError(result);
+ data->fun(ret, picojson::value{});
+ return IOTCON_FUNC_STOP;
}
picojson::value json_result = picojson::value(picojson::object());
- ret = IotconUtils::RemoteResourceToJson(resource, &(json_result.get<picojson::object>()));
+ auto ret = IotconUtils::RemoteResourceToJson(resource, &(json_result.get<picojson::object>()));
if (!ret) {
data->fun(ret, picojson::value{});
return IOTCON_FUNC_STOP;
if (!result) {
delete data;
LogAndReturnTizenError(result);
- } else {
- int timeout = 60; //default value set much bigger than default value for iotcon = 30s
- auto result = IotconUtils::ConvertIotconError(iotcon_get_timeout(&timeout));
- if (!result) {
- LoggerE("iotcon_get_timeout - function call failed, using default value %d", timeout);
- } else {
- timeout = timeout + 1; //add one extra second to prevent too fast delete
- }
- // adding listener to delete data, when find would be finished
- std::thread([data, timeout]() {
- std::this_thread::sleep_for(std::chrono::seconds(timeout));
- LoggerD("Deleting resource find data: %p", data);
- delete data;
- }).detach();
}
return common::TizenSuccess();
picojson::value v{picojson::object{}};
common::TizenResult ret = common::TizenSuccess();
- if (IOTCON_ERROR_NONE != result) {
- ret = IotconUtils::ConvertIotconError(result);
- } else {
- ret = IotconUtils::DeviceInfoToJson(device_info,&v.get<picojson::object>());
+ switch (result) {
+ case IOTCON_ERROR_NONE:
+ ret = IotconUtils::DeviceInfoToJson(device_info,&v.get<picojson::object>());
+ break;
+ case IOTCON_ERROR_TIMEOUT:
+ delete data;
+ return IOTCON_FUNC_STOP;
+ default:
+ ret = IotconUtils::ConvertIotconError(result);
}
data->fun(ret, v);
- delete data;
return IOTCON_FUNC_CONTINUE;
}
picojson::value v{picojson::object{}};
common::TizenResult ret = common::TizenSuccess();
- if (IOTCON_ERROR_NONE != result) {
- ret = IotconUtils::ConvertIotconError(result);
- } else {
- ret = IotconUtils::PlatformInfoToJson(platform_info,&v.get<picojson::object>());
+ switch (result) {
+ case IOTCON_ERROR_NONE:
+ ret = IotconUtils::PlatformInfoToJson(platform_info,&v.get<picojson::object>());
+ break;
+ case IOTCON_ERROR_TIMEOUT:
+ delete data;
+ return IOTCON_FUNC_STOP;
+ default:
+ ret = IotconUtils::ConvertIotconError(result);
}
data->fun(ret, v);
- delete data;
return IOTCON_FUNC_CONTINUE;
}