<arg type="i" name="connectivity" direction="in"/>
<arg type="s" name="type" direction="in"/>
<arg type="b" name="is_secure" direction="in"/>
+ <arg type="i" name="timeout" direction="in"/>
<arg type="x" name="signal_number" direction="out"/>
<arg type="i" name="ret" direction="out"/>
</method>
<method name="getDeviceInfo">
<arg type="s" name="host_address" direction="in"/>
<arg type="i" name="connectivity" direction="in"/>
+ <arg type="i" name="timeout" direction="in"/>
<arg type="x" name="signal_number" direction="out"/>
<arg type="i" name="ret" direction="out"/>
</method>
<method name="getPlatformInfo">
<arg type="s" name="host_address" direction="in"/>
<arg type="i" name="connectivity" direction="in"/>
+ <arg type="i" name="timeout" direction="in"/>
<arg type="x" name="signal_number" direction="out"/>
<arg type="i" name="ret" direction="out"/>
</method>
const gchar *host_address,
gint connectivity,
const gchar *type,
- bool is_secure)
+ bool is_secure,
+ gint timeout)
{
int ret;
const gchar *sender;
sender = g_dbus_method_invocation_get_sender(invocation);
signal_number = icd_dbus_generate_signal_number();
- ret = icd_ioty_find_resource(host_address, connectivity, type, is_secure,
+ ret = icd_ioty_find_resource(host_address, connectivity, type, is_secure, timeout,
signal_number, sender);
if (IOTCON_ERROR_NONE != ret)
ERR("icd_ioty_find_resource() Fail(%d)", ret);
static gboolean _dbus_handle_get_device_info(icDbus *object,
GDBusMethodInvocation *invocation,
const gchar *host_address,
- gint connectivity)
+ gint connectivity,
+ gint timeout)
{
int ret;
const gchar *sender;
signal_number = icd_dbus_generate_signal_number();
sender = g_dbus_method_invocation_get_sender(invocation);
- ret = icd_ioty_get_info(ICD_DEVICE_INFO, host_address, connectivity, signal_number,
- sender);
+ ret = icd_ioty_get_info(ICD_DEVICE_INFO, host_address, connectivity, timeout,
+ signal_number, sender);
if (IOTCON_ERROR_NONE != ret)
ERR("icd_ioty_get_info(device info) Fail(%d)", ret);
static gboolean _dbus_handle_get_platform_info(icDbus *object,
GDBusMethodInvocation *invocation,
const gchar *host_address,
- gint connectivity)
+ gint connectivity,
+ gint timeout)
{
int ret;
const gchar *sender;
signal_number = icd_dbus_generate_signal_number();
sender = g_dbus_method_invocation_get_sender(invocation);
- ret = icd_ioty_get_info(ICD_PLATFORM_INFO, host_address, connectivity, signal_number,
- sender);
+ ret = icd_ioty_get_info(ICD_PLATFORM_INFO, host_address, connectivity, timeout,
+ signal_number, sender);
if (IOTCON_ERROR_NONE != ret)
ERR("icd_ioty_get_info(platform info) Fail(%d)", ret);
}
+static gboolean _icd_ioty_discovery_timeout(gpointer user_data)
+{
+ int ret;
+ OCDoHandle handle = user_data;
+
+ icd_ioty_csdk_lock();
+ ret = OCCancel(handle, OC_LOW_QOS, NULL, 0);
+ icd_ioty_csdk_unlock();
+ if (OC_STACK_OK != ret) {
+ ERR("OCCancel() Fail(%d)", ret);
+ return G_SOURCE_REMOVE;
+ }
+
+ return G_SOURCE_REMOVE;
+}
+
+
int icd_ioty_find_resource(const char *host_address,
int conn_type,
const char *resource_type,
bool is_secure,
+ int timeout,
int64_t signal_number,
const char *bus_name)
{
int len;
char *coap_str;
+ OCDoHandle handle;
OCStackResult result;
icd_sig_ctx_s *context;
char uri[PATH_MAX] = {0};
icd_ioty_csdk_lock();
/* TODO : QoS is come from lib. */
- result = OCDoResource(NULL, OC_REST_DISCOVER, uri, NULL, NULL, oic_conn_type,
+ result = OCDoResource(&handle, OC_REST_DISCOVER, uri, NULL, NULL, oic_conn_type,
OC_LOW_QOS, &cbdata, NULL, 0);
icd_ioty_csdk_unlock();
return icd_ioty_convert_error(result);
}
+ g_timeout_add_seconds(timeout, _icd_ioty_discovery_timeout, handle);
+
return IOTCON_ERROR_NONE;
}
return IOTCON_ERROR_NONE;
}
-int icd_ioty_get_info(int type, const char *host_address, int conn_type,
+int icd_ioty_get_info(int type, const char *host_address, int conn_type, int timeout,
int64_t signal_number, const char *bus_name)
{
+ OCDoHandle handle;
OCStackResult result;
icd_sig_ctx_s *context;
OCCallbackData cbdata = {0};
icd_ioty_csdk_lock();
/* TODO : QoS is come from lib. And user can set QoS to client structure. */
- result = OCDoResource(NULL, OC_REST_DISCOVER, uri, NULL, NULL, oic_conn_type,
+ result = OCDoResource(&handle, OC_REST_DISCOVER, uri, NULL, NULL, oic_conn_type,
OC_LOW_QOS, &cbdata, NULL, 0);
icd_ioty_csdk_unlock();
return icd_ioty_convert_error(result);
}
+ g_timeout_add_seconds(timeout, _icd_ioty_discovery_timeout, handle);
+
return IOTCON_ERROR_NONE;
}
int conn_type,
const char *resource_type,
bool is_secure,
+ int timeout,
int64_t signal_number,
const char *bus_name);
int icd_ioty_observer_stop(OCDoHandle handle, GVariant *options);
-int icd_ioty_get_info(int type, const char *host_address, int conn_type,
+int icd_ioty_get_info(int type, const char *host_address, int conn_type, int timeout,
int64_t signal_number, const char *bus_name);
int icd_ioty_set_device_info();
iotcon_device_info_cb cb,
void *user_data)
{
- int ret;
+ int ret, timeout;
unsigned int sub_id;
GError *error = NULL;
icl_device_info_s *cb_container;
RETV_IF(NULL == icl_dbus_get_object(), IOTCON_ERROR_DBUS);
RETV_IF(NULL == cb, IOTCON_ERROR_INVALID_PARAMETER);
+ timeout = icl_dbus_get_timeout();
+
ic_dbus_call_get_device_info_sync(icl_dbus_get_object(),
ic_utils_dbus_encode_str(host_address),
connectivity_type,
+ timeout,
&signal_number,
&ret,
NULL,
cb_container->id = sub_id;
- cb_container->timeout_id = g_timeout_add_seconds(icl_dbus_get_timeout(),
+ cb_container->timeout_id = g_timeout_add_seconds(timeout,
_icl_timeout_get_device_info, cb_container);
return ret;
iotcon_platform_info_cb cb,
void *user_data)
{
- int ret;
+ int ret, timeout;
unsigned int sub_id;
GError *error = NULL;
icl_platform_info_s *cb_container;
RETV_IF(NULL == icl_dbus_get_object(), IOTCON_ERROR_DBUS);
RETV_IF(NULL == cb, IOTCON_ERROR_INVALID_PARAMETER);
+ timeout = icl_dbus_get_timeout();
+
ic_dbus_call_get_platform_info_sync(icl_dbus_get_object(),
ic_utils_dbus_encode_str(host_address),
connectivity_type,
+ timeout,
&signal_number,
&ret,
NULL,
}
cb_container->id = sub_id;
- cb_container->timeout_id = g_timeout_add_seconds(icl_dbus_get_timeout(),
+ cb_container->timeout_id = g_timeout_add_seconds(timeout,
_icl_timeout_get_platform_info, cb_container);
return ret;
iotcon_found_resource_cb cb,
void *user_data)
{
- int ret;
+ int ret, timeout;
unsigned int sub_id;
GError *error = NULL;
int64_t signal_number;
return IOTCON_ERROR_INVALID_PARAMETER;
}
+ timeout = icl_dbus_get_timeout();
+
ic_dbus_call_find_resource_sync(icl_dbus_get_object(),
ic_utils_dbus_encode_str(host_address),
connectivity_type,
ic_utils_dbus_encode_str(resource_type),
is_secure,
+ timeout,
&signal_number,
&ret,
NULL,
cb_container->id = sub_id;
- cb_container->timeout_id = g_timeout_add_seconds(icl_dbus_get_timeout(),
- _icl_timeout_find_resource, cb_container);
+ cb_container->timeout_id = g_timeout_add_seconds(timeout, _icl_timeout_find_resource,
+ cb_container);
return ret;
}