<arg type="i" name="ifaces" direction="in"/>
<arg type="y" name="properties" direction="in"/>
<arg type="u" name="signal_number" direction="in"/>
- <arg type="i" name="resource" direction="out"/>
+ <arg type="x" name="resource" direction="out"/>
</method>
<method name="unregisterResource">
- <arg type="i" name="resource" direction="in"/>
+ <arg type="x" name="resource" direction="in"/>
<arg type="i" name="ret" direction="out"/>
</method>
<method name="bindInterface">
- <arg type="i" name="resource" direction="in"/>
+ <arg type="x" name="resource" direction="in"/>
<arg type="i" name="iface" direction="in"/>
<arg type="i" name="ret" direction="out"/>
</method>
<method name="bindType">
- <arg type="i" name="resource" direction="in"/>
+ <arg type="x" name="resource" direction="in"/>
<arg type="s" name="type" direction="in"/>
<arg type="i" name="ret" direction="out"/>
</method>
<method name="bindResource">
- <arg type="i" name="parent" direction="in"/>
- <arg type="i" name="child" direction="in"/>
+ <arg type="x" name="parent" direction="in"/>
+ <arg type="x" name="child" direction="in"/>
<arg type="i" name="ret" direction="out"/>
</method>
<method name="unbindResource">
- <arg type="i" name="parent" direction="in"/>
- <arg type="i" name="child" direction="in"/>
+ <arg type="x" name="parent" direction="in"/>
+ <arg type="x" name="child" direction="in"/>
<arg type="i" name="ret" direction="out"/>
</method>
<method name="notifyListOfObservers">
- <arg type="i" name="resource" direction="in"/>
+ <arg type="x" name="resource" direction="in"/>
<arg type="a(iv)" name="notify_msg" direction="in"/>
<arg type="ai" name="observers" direction="in"/>
<arg type="i" name="ret" direction="out"/>
</method>
<method name="notifyAll">
- <arg type="i" name="resource" direction="in"/>
+ <arg type="x" name="resource" direction="in"/>
<arg type="i" name="ret" direction="out"/>
</method>
<method name="sendResponse">
- <arg type="(sia(qs)ivii)" name="response" direction="in"/>
+ <arg type="(sia(qs)ivxx)" name="response" direction="in"/>
<arg type="i" name="ret" direction="out"/>
</method>
<method name="findResource">
<arg type="i" name="observe_type" direction="in"/>
<arg type="a(ss)" name="query" direction="in"/>
<arg type="u" name="signal_number" direction="in"/>
- <arg type="i" name="observe_h" direction="out"/>
+ <arg type="x" name="observe_h" direction="out"/>
</method>
<method name="observerStop">
- <arg type="i" name="observe_h" direction="in"/>
+ <arg type="x" name="observe_h" direction="in"/>
<arg type="a(qs)" name="options" direction="in"/>
<arg type="i" name="ret" direction="out"/>
</method>
<arg type="s" name="host_address" direction="in"/>
<arg type="s" name="type" direction="in"/>
<arg type="u" name="signal_number" direction="in"/>
- <arg type="i" name="presence_h" direction="out"/>
+ <arg type="x" name="presence_h" direction="out"/>
</method>
<method name="unsubscribePresence">
- <arg type="i" name="presence_h" direction="in"/>
+ <arg type="x" name="presence_h" direction="in"/>
<arg type="i" name="ret" direction="out"/>
</method>
<method name="startPresence">
#include <stdlib.h>
#include <gio/gio.h>
+#include <octypes.h>
+
#include "iotcon.h"
#include "ic-common.h"
#include "ic-utils.h"
} icd_dbus_client_s;
typedef struct _icd_resource_handle {
- void *handle;
+ OCResourceHandle handle;
unsigned int number;
} icd_resource_handle_s;
}
-static void _icd_dbus_resource_handle_free(void *handle)
+static void _icd_dbus_resource_handle_free(OCResourceHandle handle)
{
icd_dbus_client_s *client;
GList *cur_client, *cur_hd;
return;
}
-int icd_dbus_client_list_get_info(void *handle, unsigned int *sig_num, gchar **bus_name)
+int icd_dbus_client_list_get_info(OCResourceHandle handle, unsigned int *sig_num,
+ gchar **bus_name)
{
FN_CALL;
icd_dbus_client_s *client;
return IOTCON_ERROR_NONE;
}
-static void _icd_dbus_cleanup_handle(void *data)
+static void _icd_dbus_cleanup_handle(OCResourceHandle data)
{
int ret;
icd_resource_handle_s *rsrc_handle = data;
return IOTCON_ERROR_NONE;
}
-static int _icd_dbus_resource_list_append_handle(const gchar *bus_name, void *handle,
- unsigned int signal_number)
+static int _icd_dbus_resource_list_append_handle(const gchar *bus_name,
+ OCResourceHandle handle, unsigned int signal_number)
{
FN_CALL;
GList *cur_client, *cur_hd;
FN_CALL;
int ret;
const gchar *sender;
- void *handle = NULL;
+ OCResourceHandle handle = NULL;
handle = icd_ioty_register_resource(uri_path, resource_types, ifaces, properties);
if (handle) {
}
}
- ic_dbus_complete_register_resource(object, invocation, GPOINTER_TO_INT(handle));
+ ic_dbus_complete_register_resource(object, invocation, ICD_POINTER_TO_INT64(handle));
return TRUE;
}
static gboolean _dbus_handle_unregister_resource(icDbus *object,
- GDBusMethodInvocation *invocation, gint resource)
+ GDBusMethodInvocation *invocation, gint64 resource)
{
int ret;
- ret = icd_ioty_unregister_resource(GINT_TO_POINTER(resource));
+ ret = icd_ioty_unregister_resource(ICD_INT64_TO_POINTER(resource));
if (IOTCON_ERROR_NONE != ret)
ERR("icd_ioty_unregister_resource(%u) Fail(%d)", resource, ret);
else
DBG("handle(%u) deregistered", resource);
- _icd_dbus_resource_handle_free(GINT_TO_POINTER(resource));
+ _icd_dbus_resource_handle_free(ICD_INT64_TO_POINTER(resource));
ic_dbus_complete_unregister_resource(object, invocation, ret);
static gboolean _dbus_handle_bind_interface(icDbus *object,
- GDBusMethodInvocation *invocation, gint resource, gint iface)
+ GDBusMethodInvocation *invocation, gint64 resource, gint iface)
{
int ret;
- ret = icd_ioty_bind_interface(GINT_TO_POINTER(resource), iface);
+ ret = icd_ioty_bind_interface(ICD_INT64_TO_POINTER(resource), iface);
if (IOTCON_ERROR_NONE != ret)
ERR("icd_ioty_bind_interface() Fail(%d)", ret);
static gboolean _dbus_handle_bind_type(icDbus *object,
- GDBusMethodInvocation *invocation, gint resource, const gchar *type)
+ GDBusMethodInvocation *invocation, gint64 resource, const gchar *type)
{
int ret;
- ret = icd_ioty_bind_type(GINT_TO_POINTER(resource), type);
+ ret = icd_ioty_bind_type(ICD_INT64_TO_POINTER(resource), type);
if (IOTCON_ERROR_NONE != ret)
ERR("icd_ioty_bind_type() Fail(%d)", ret);
static gboolean _dbus_handle_bind_resource(icDbus *object,
- GDBusMethodInvocation *invocation, gint parent, gint child)
+ GDBusMethodInvocation *invocation, gint64 parent, gint64 child)
{
int ret;
- ret = icd_ioty_bind_resource(GINT_TO_POINTER(parent), GINT_TO_POINTER(child));
+ ret = icd_ioty_bind_resource(ICD_INT64_TO_POINTER(parent), ICD_INT64_TO_POINTER(child));
if (IOTCON_ERROR_NONE != ret)
ERR("icd_ioty_bind_resource() Fail(%d)", ret);
static gboolean _dbus_handle_unbind_resource(icDbus *object,
- GDBusMethodInvocation *invocation, gint parent, gint child)
+ GDBusMethodInvocation *invocation, gint64 parent, gint64 child)
{
int ret;
- ret = icd_ioty_unbind_resource(GINT_TO_POINTER(parent), GINT_TO_POINTER(child));
+ ret = icd_ioty_unbind_resource(ICD_INT64_TO_POINTER(parent),
+ ICD_INT64_TO_POINTER(child));
if (IOTCON_ERROR_NONE != ret)
ERR("icd_ioty_unbind_resource() Fail(%d)", ret);
GVariant *query,
guint signal_number)
{
- void *observe_h;
+ OCDoHandle observe_h;
const gchar *sender;
sender = g_dbus_method_invocation_get_sender(invocation);
if (NULL == observe_h)
ERR("icd_ioty_observer_start() Fail");
- ic_dbus_complete_observer_start(object, invocation, GPOINTER_TO_INT(observe_h));
+ ic_dbus_complete_observer_start(object, invocation, ICD_POINTER_TO_INT64(observe_h));
/* observe_h will be freed in _dbus_handle_observer_stop() */
return TRUE;
static gboolean _dbus_handle_observer_stop(icDbus *object,
GDBusMethodInvocation *invocation,
- gint observe_h,
+ gint64 observe_h,
GVariant *options)
{
int ret;
- ret = icd_ioty_observer_stop(GINT_TO_POINTER(observe_h), options);
+ ret = icd_ioty_observer_stop(ICD_INT64_TO_POINTER(observe_h), options);
if (IOTCON_ERROR_NONE != ret)
ERR("icd_ioty_observer_stop() Fail(%d)", ret);
static gboolean _dbus_handle_notify_list_of_observers(icDbus *object,
GDBusMethodInvocation *invocation,
- gint resource,
+ gint64 resource,
GVariant *notify_msg,
GVariant *observers)
{
int ret;
- ret = icd_ioty_notify_list_of_observers(GINT_TO_POINTER(resource), notify_msg,
+ ret = icd_ioty_notify_list_of_observers(ICD_INT64_TO_POINTER(resource), notify_msg,
observers);
if (IOTCON_ERROR_NONE != ret)
ERR("icd_ioty_notify_list_of_observers() Fail(%d)", ret);
static gboolean _dbus_handle_notify_all(icDbus *object, GDBusMethodInvocation *invocation,
- gint resource)
+ gint64 resource)
{
int ret;
- ret = icd_ioty_notify_all(GINT_TO_POINTER(resource));
+ ret = icd_ioty_notify_all(ICD_INT64_TO_POINTER(resource));
if (IOTCON_ERROR_NONE != ret)
ERR("icd_ioty_notify_all() Fail(%d)", ret);
const gchar *type,
guint signal_number)
{
- void *presence_h;
+ OCDoHandle presence_h;
const gchar *sender;
sender = g_dbus_method_invocation_get_sender(invocation);
if (NULL == presence_h)
ERR("icd_ioty_subscribe_presence() Fail");
- ic_dbus_complete_subscribe_presence(object, invocation, GPOINTER_TO_INT(presence_h));
+ ic_dbus_complete_subscribe_presence(object, invocation,
+ ICD_POINTER_TO_INT64(presence_h));
return TRUE;
}
static gboolean _dbus_handle_unsubscribe_presence(icDbus *object,
GDBusMethodInvocation *invocation,
- gint presence_h)
+ gint64 presence_h)
{
int ret;
- ret = icd_ioty_unsubscribe_presence(GINT_TO_POINTER(presence_h));
+ ret = icd_ioty_unsubscribe_presence(ICD_INT64_TO_POINTER(presence_h));
if (IOTCON_ERROR_NONE != ret)
ERR("icd_ioty_unsubscribe_presence() Fail(%d)", ret);
#ifndef __IOT_CONNECTIVITY_MANAGER_DAEMON_DBUS_H__
#define __IOT_CONNECTIVITY_MANAGER_DAEMON_DBUS_H__
+#include <stdint.h>
#include <glib.h>
#include "ic-dbus.h"
+#define ICD_INT64_TO_POINTER(i) ((void*)(intptr_t)(i))
+#define ICD_POINTER_TO_INT64(p) ((int64_t)(intptr_t)(p))
+
icDbus* icd_dbus_get_object();
int icd_dbus_client_list_get_info(void *handle, unsigned int *sig_num, gchar **bus_name);
int icd_dbus_emit_signal(const char *dest, const char *sig_name, GVariant *value);
if (ctx->payload)
g_variant_builder_add(&payload_builder, "v", ctx->payload);
- value = g_variant_new("(ia(qs)a(ss)iiavii)",
+ value = g_variant_new("(ia(qs)a(ss)iiavxx)",
ctx->types,
ctx->options,
ctx->query,
ctx->observe_action,
ctx->observer_id,
&payload_builder,
- GPOINTER_TO_INT(ctx->request_h),
- GPOINTER_TO_INT(ctx->resource_h));
+ ICD_POINTER_TO_INT64(ctx->request_h),
+ ICD_POINTER_TO_INT64(ctx->resource_h));
ret = _ocprocess_response_signal(ctx->bus_name, IC_DBUS_SIGNAL_REQUEST_HANDLER,
ctx->signum, value);
}
+int icd_ioty_conn_type_to_oic_transport_type(int conn_type, OCTransportAdapter *adapter,
+ OCTransportFlags *flag)
+{
+ switch (conn_type) {
+ case IOTCON_CONNECTIVITY_IPV4:
+ *adapter = OC_ADAPTER_IP;
+ *flag = OC_IP_USE_V4;
+ break;
+ case IOTCON_CONNECTIVITY_IPV6:
+ *adapter = OC_ADAPTER_IP;
+ *flag = OC_IP_USE_V6;
+ break;
+ case IOTCON_CONNECTIVITY_EDR:
+ *adapter = OC_ADAPTER_RFCOMM_BTEDR;
+ *flag = OC_DEFAULT_FLAGS;
+ break;
+ case IOTCON_CONNECTIVITY_LE:
+ *adapter = OC_ADAPTER_GATT_BTLE;
+ *flag = OC_DEFAULT_FLAGS;
+ break;
+ case IOTCON_CONNECTIVITY_ALL:
+ default:
+ *adapter = OC_DEFAULT_ADAPTER;
+ *flag = OC_DEFAULT_FLAGS;
+ }
+
+ return IOTCON_ERROR_NONE;
+}
int icd_ioty_transport_flag_to_conn_type(OCTransportAdapter adapter,
OCTransportFlags flag);
+int icd_ioty_conn_type_to_oic_transport_type(int conn_type, OCTransportAdapter *adapter,
+ OCTransportFlags *flag);
+
#endif /*__IOT_CONNECTIVITY_MANAGER_DAEMON_IOTIVITY_TYPE_H__*/
int icd_ioty_send_response(GVariant *resp)
{
- int result, error_code, options_size;
- int request_handle, resource_handle;
char *new_uri_path;
GVariant *repr_gvar;
GVariantIter *options;
OCStackResult ret;
OCEntityHandlerResponse response = {0};
+ int result, error_code, options_size;
+ int64_t request_handle, resource_handle;
- g_variant_get(resp, "(&sia(qs)ivii)",
+ g_variant_get(resp, "(&sia(qs)ivxx)",
&new_uri_path,
&error_code,
&options,
&request_handle,
&resource_handle);
- response.requestHandle = GINT_TO_POINTER(request_handle);
- response.resourceHandle = GINT_TO_POINTER(resource_handle);
+ response.requestHandle = ICD_INT64_TO_POINTER(request_handle);
+ response.resourceHandle = ICD_INT64_TO_POINTER(resource_handle);
response.ehResult = (OCEntityHandlerResult)result;
if (OC_EH_RESOURCE_CREATED == response.ehResult)
/*
* returned string SHOULD be released by you
*/
-static char* _icd_ioty_resource_generate_uri(char *host, bool is_secure, char *uri_path,
- GVariant *query)
+static char* _icd_ioty_resource_generate_uri(char *uri_path, GVariant *query)
{
int len;
bool loop_first = true;
GVariantIter query_iter;
char uri_buf[PATH_MAX] = {0};
- if (is_secure)
- len = snprintf(uri_buf, sizeof(uri_buf), ICD_IOTY_COAPS"%s%s", host, uri_path);
- else
- len = snprintf(uri_buf, sizeof(uri_buf), ICD_IOTY_COAP"%s%s", host, uri_path);
+ len = snprintf(uri_buf, sizeof(uri_buf), "%s", uri_path);
/* remove suffix '/' */
if ('/' == uri_buf[strlen(uri_buf) - 1]) {
GVariantIter *options;
OCCallbackData cbdata = {0};
int conn_type, options_size;
- char *uri_path, *host, *uri;
- char uri_buf[PATH_MAX] = {0};
+ char *uri_path, *host, *uri, *dev_host, *ptr;
OCHeaderOption oic_options[MAX_HEADER_OPTIONS];
OCHeaderOption *oic_options_ptr = NULL;
OCPayload *payload = NULL;
OCConnectivityType oic_conn_type;
+ OCDevAddr dev_addr = {0};
switch (type) {
case ICD_CRUD_GET:
return FALSE;
}
- g_variant_get(resource, "(&s&sba(qs)i)", &uri_path, &host, &is_secure, &options,
+ g_variant_get(resource, "(&s&sba(qs)i)", &uri_path, &host, &is_secure, &options,
&conn_type);
switch (type) {
case ICD_CRUD_GET:
case ICD_CRUD_PUT:
case ICD_CRUD_POST:
- uri = _icd_ioty_resource_generate_uri(host, is_secure, uri_path, query);
+ uri = _icd_ioty_resource_generate_uri(uri_path, query);
if (NULL == uri) {
ERR("_icd_ioty_resource_generate_uri() Fail");
g_variant_iter_free(options);
}
break;
case ICD_CRUD_DELETE:
- snprintf(uri_buf, sizeof(uri_buf), "%s%s", host, uri_path);
- uri = strdup(uri_buf);
+ uri = strdup(uri_path);
break;
}
oic_conn_type = icd_ioty_conn_type_to_oic_conn_type(conn_type);
+ icd_ioty_conn_type_to_oic_transport_type(conn_type, &dev_addr.adapter,
+ &dev_addr.flags);
+
+ switch (conn_type) {
+ case IOTCON_CONNECTIVITY_IPV4:
+ dev_host = strtok_r(host, ":", &ptr);
+ snprintf(dev_addr.addr, sizeof(dev_addr.addr), "%s", dev_host);
+ dev_addr.port = atoi(strtok_r(NULL, ":", &ptr));
+ break;
+ case IOTCON_CONNECTIVITY_IPV6:
+ dev_host = strtok_r(host, "]", &ptr);
+ snprintf(dev_addr.addr, sizeof(dev_addr.addr), "%s", dev_host);
+ dev_addr.port = atoi(strtok_r(NULL, "]", &ptr));
+ break;
+ default:
+ ERR("Invalid Connectivitiy Type");
+ icd_ioty_complete_error(type, invocation, IOTCON_ERROR_IOTIVITY);
+ return TRUE;
+ }
+
icd_ioty_csdk_lock();
/* TODO : QoS is come from lib. And user can set QoS to client structure. */
- result = OCDoResource(NULL, rest_type, uri, NULL, payload, oic_conn_type, OC_LOW_QOS,
- &cbdata, oic_options_ptr, options_size);
+ result = OCDoResource(NULL, rest_type, uri, &dev_addr, payload, oic_conn_type,
+ OC_LOW_QOS, &cbdata, oic_options_ptr, options_size);
icd_ioty_csdk_unlock();
free(uri);
icd_sig_ctx_s *context;
OCCallbackData cbdata = {0};
int conn_type, options_size;
- char *uri_path, *host, *uri;
+ char *uri_path, *host, *uri, *dev_host, *ptr;
OCHeaderOption oic_options[MAX_HEADER_OPTIONS];
OCHeaderOption *oic_options_ptr = NULL;
OCConnectivityType oic_conn_type;
+ OCDevAddr dev_addr = {0};
g_variant_get(resource, "(&s&sba(qs)i)", &uri_path, &host, &is_secure, &options,
&conn_type);
- uri = _icd_ioty_resource_generate_uri(host, is_secure, uri_path, query);
+ uri = _icd_ioty_resource_generate_uri(uri_path, query);
if (NULL == uri) {
ERR("_icd_ioty_resource_generate_uri() Fail");
g_variant_iter_free(options);
oic_conn_type = icd_ioty_conn_type_to_oic_conn_type(conn_type);
+ icd_ioty_conn_type_to_oic_transport_type(conn_type, &dev_addr.adapter,
+ &dev_addr.flags);
+
+ switch (conn_type) {
+ case IOTCON_CONNECTIVITY_IPV4:
+ dev_host = strtok_r(host, ":", &ptr);
+ snprintf(dev_addr.addr, sizeof(dev_addr.addr), "%s", dev_host);
+ dev_addr.port = atoi(strtok_r(NULL, ":", &ptr));
+ break;
+ case IOTCON_CONNECTIVITY_IPV6:
+ dev_host = strtok_r(host, "]", &ptr);
+ snprintf(dev_addr.addr, sizeof(dev_addr.addr), "%s", dev_host);
+ dev_addr.port = atoi(strtok_r(NULL, "]", &ptr));
+ break;
+ default:
+ ERR("Invalid Connectivitiy Type");
+ return NULL;
+ }
+
icd_ioty_csdk_lock();
/* TODO : QoS is come from lib. And user can set QoS to client structure. */
- result = OCDoResource(&handle, method, uri, NULL, NULL, oic_conn_type, OC_LOW_QOS,
- &cbdata, oic_options_ptr, options_size);
+ result = OCDoResource(&handle, method, uri, &dev_addr, NULL, oic_conn_type,
+ OC_LOW_QOS, &cbdata, oic_options_ptr, options_size);
icd_ioty_csdk_unlock();
free(uri);
if (OC_STACK_OK != result) {
char uri[PATH_MAX] = {0};
OCCallbackData cbdata = {0};
icd_sig_ctx_s *context;
- iotcon_connectivity_type_e conn_type = IOTCON_CONNECTIVITY_IPV4;
- OCConnectivityType oic_conn_type;
len = snprintf(uri, sizeof(uri), "%s%s", host_address, OC_RSRVD_PRESENCE_URI);
if (len <= 0 || sizeof(uri) <= len) {
cbdata.cb = icd_ioty_ocprocess_presence_cb;
cbdata.cd = _ioty_free_signal_context;
- oic_conn_type = icd_ioty_conn_type_to_oic_conn_type(conn_type);
-
+ /* In case of IPV4 or IPV6, connectivity type is CT_ADAPTER_IP in iotivity 0.9.2 */
icd_ioty_csdk_lock();
- result = OCDoResource(&handle, OC_REST_PRESENCE, uri, NULL, NULL, oic_conn_type,
+ result = OCDoResource(&handle, OC_REST_PRESENCE, uri, NULL, NULL, CT_ADAPTER_IP,
OC_LOW_QOS, &cbdata, NULL, 0);
icd_ioty_csdk_unlock();
GThread* icd_ioty_init(const char *addr, unsigned short port);
-void icd_ioty_deinit();
+void icd_ioty_deinit(GThread *thread);
OCResourceHandle icd_ioty_register_resource(const char *uri_path,
const char* const* res_types, int ifaces, uint8_t properties);
SET(PREFIX ${CMAKE_INSTALL_PREFIX})
CONFIGURE_FILE(${CLIENT}.pc.in ${CLIENT}.pc @ONLY)
-INSTALL(FILES ${CLIENT}.pc DESTINATION lib/pkgconfig)
+INSTALL(FILES ${CLIENT}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
FILE(GLOB CLIENT_HEADER include/*.h)
INSTALL(FILES ${CLIENT_HEADER} DESTINATION ${INCLUDE_INSTALL_DIR}/${CLIENT})
* limitations under the License.
*/
#include <stdio.h>
+#include <stdint.h>
#include <stdlib.h>
#include <errno.h>
#include <glib.h>
iotcon_on_observe_cb cb,
void *user_data)
{
- int observe_handle;
+ int64_t observe_handle;
GError *error = NULL;
unsigned int sub_id;
int signal_number;
return NULL;
}
client->conn_type = conn_type;
- client->is_secure = true;
+ client->is_secure = is_secure;
return client;
}
#ifndef __IOT_CONNECTIVITY_MANAGER_LIBRARY_CLIENT_H__
#define __IOT_CONNECTIVITY_MANAGER_LIBRARY_CLIENT_H__
+#include <stdint.h>
#include "iotcon-struct.h"
#include "icl-options.h"
iotcon_resource_types_h types;
int ifaces;
iotcon_connectivity_type_e conn_type;
- int observe_handle;
+ int64_t observe_handle;
unsigned int observe_sub_id;
};
return NULL;
}
- value = g_variant_new("(sia(qs)ivii)",
+ value = g_variant_new("(sia(qs)ivxx)",
ic_utils_dbus_encode_str(response->new_uri_path),
response->error_code,
&options,
response->result,
repr_gvar,
- GPOINTER_TO_INT(response->request_handle),
- GPOINTER_TO_INT(response->resource_handle));
+ response->oic_request_h,
+ response->oic_resource_h);
DBG("response : %s", g_variant_print(value, FALSE));
* limitations under the License.
*/
#include <stdio.h>
+#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
iotcon_presence_cb cb;
void *user_data;
unsigned int id;
- int handle;
+ int64_t handle;
} icl_presence_s;
API int iotcon_start_presence(unsigned int time_to_live)
static void _icl_presence_conn_cleanup(icl_presence_s *presence)
{
presence->id = 0;
- presence->handle = 0;
+
+ if (presence->handle) {
+ presence->handle = 0;
+ return;
+ }
+
+ free(presence);
}
ERR("iotcon-daemon Fail(%d)", ret);
return icl_dbus_convert_daemon_error(ret);
}
+ presence->handle = 0;
icl_dbus_unsubscribe_signal(presence->id);
- free(presence);
-
return IOTCON_ERROR_NONE;
}
#ifndef __IOT_CONNECTIVITY_MANAGER_LIBRARY_REQUEST_H__
#define __IOT_CONNECTIVITY_MANAGER_LIBRARY_REQUEST_H__
+#include <stdint.h>
#include "iotcon-struct.h"
#include "iotcon-constant.h"
-typedef void* oc_request_h;
-typedef void* oc_resource_h;
-
struct icl_observe_info {
iotcon_observe_action_e action;
int observer_id;
iotcon_query_h query;
struct icl_observe_info observation_info;
iotcon_repr_h repr;
- oc_request_h request_handle;
- oc_resource_h resource_handle;
+ int64_t oic_request_h;
+ int64_t oic_resource_h;
};
#endif /* __IOT_CONNECTIVITY_MANAGER_LIBRARY_REQUEST_H__ */
GVariantIter *repr_iter;
char *key = NULL;
char *value = NULL;
- int request_handle;
- int resource_handle;
struct icl_resource_request request = {0};
iotcon_resource_h resource = user_data;
iotcon_request_handler_cb cb = resource->cb;
GVariant *repr_gvar;
- g_variant_get(parameters, "(ia(qs)a(ss)iiavii)",
+ g_variant_get(parameters, "(ia(qs)a(ss)iiavxx)",
&request.types,
&options,
&query,
&request.observation_info.action,
&request.observation_info.observer_id,
&repr_iter,
- &request_handle,
- &resource_handle);
+ &request.oic_request_h,
+ &request.oic_resource_h);
if (g_variant_iter_n_children(options)) {
request.header_options = iotcon_options_new();
}
g_variant_iter_free(query);
- request.request_handle = GINT_TO_POINTER(request_handle);
- request.resource_handle = GINT_TO_POINTER(resource_handle);
-
if (g_variant_iter_loop(repr_iter, "v", &repr_gvar)) {
request.repr = icl_repr_from_gvariant(repr_gvar);
if (NULL == request.repr) {
static void _icl_resource_conn_cleanup(iotcon_resource_h resource)
{
resource->sub_id = 0;
- resource->handle = 0;
+
+ if (resource->handle) {
+ resource->handle = 0;
+ return;
+ }
+
+ iotcon_resource_types_free(resource->types);
+ free(resource->uri_path);
+ free(resource);
}
ERR("iotcon-daemon Fail(%d)", ret);
return icl_dbus_convert_daemon_error(ret);
}
+ resource->handle = 0;
icl_dbus_unsubscribe_signal(resource->sub_id);
- iotcon_resource_types_free(resource->types);
- free(resource->uri_path);
- free(resource);
-
return IOTCON_ERROR_NONE;
}
#ifndef __IOT_CONNECTIVITY_MANAGER_LIBRARY_RESOURCE_H__
#define __IOT_CONNECTIVITY_MANAGER_LIBRARY_RESOURCE_H__
+#include <stdint.h>
#include "iotcon.h"
#include "icl-dbus.h"
iotcon_request_handler_cb cb;
void *user_data;
unsigned int sub_id;
- int handle;
+ int64_t handle;
iotcon_resource_h children[IOTCON_CONTAINED_RESOURCES_MAX];
};
return NULL;
}
- resp->request_handle = request_h->request_handle;
- resp->resource_handle = request_h->resource_handle;
+ resp->oic_request_h = request_h->oic_request_h;
+ resp->oic_resource_h = request_h->oic_resource_h;
resp->error_code = 200;
return resp;
#ifndef __IOT_CONNECTIVITY_MANAGER_LIBRARY_RESPONSE_H__
#define __IOT_CONNECTIVITY_MANAGER_LIBRARY_RESPONSE_H__
+#include <stdint.h>
#include "iotcon-struct.h"
#include "iotcon-constant.h"
-#include "icl-request.h"
-
typedef enum {
ICL_VISIBILITY_NONE = 0,
iotcon_interface_e iface;
iotcon_response_result_e result;
iotcon_repr_h repr;
- oc_request_h request_handle;
- oc_resource_h resource_handle;
+ int64_t oic_request_h;
+ int64_t oic_resource_h;
};
#endif /* __IOT_CONNECTIVITY_MANAGER_LIBRARY_RESPONSE_H__ */