From b0748a1a3e5655fda6de84065142c5467cfc10a0 Mon Sep 17 00:00:00 2001 From: youngman Date: Mon, 9 Nov 2015 15:20:11 +0900 Subject: [PATCH] Allow various connectivity(IPv4, IPv6, BT_EDR) Change-Id: Ibc5d0b9864242ddbfcdab39ff329d61680956e01 Signed-off-by: youngman --- daemon/icd-ioty-ocprocess.c | 69 +++++++++++++++++----------- daemon/icd-ioty-type.c | 81 +++++++++++++++++++++++++++++++-- daemon/icd-ioty-type.h | 5 ++- daemon/icd-ioty.c | 84 ++++++++++------------------------- lib/icl-device.c | 20 ++++++--- lib/icl-presence.c | 13 ++++-- lib/icl-remote-resource.c | 16 +++++-- lib/include/iotcon-client.h | 9 ++-- lib/include/iotcon-constant.h | 2 +- packaging/iotcon-old.manifest | 2 + 10 files changed, 191 insertions(+), 110 deletions(-) diff --git a/daemon/icd-ioty-ocprocess.c b/daemon/icd-ioty-ocprocess.c index b167a8f..1215a9c 100644 --- a/daemon/icd-ioty-ocprocess.c +++ b/daemon/icd-ioty-ocprocess.c @@ -229,30 +229,47 @@ static int _ioty_oic_action_to_ioty_action(int oic_action) return action; } + +static void _icd_req_context_free(struct icd_req_context *ctx) +{ + free(ctx->bus_name); + if (ctx->payload) + g_variant_unref(ctx->payload); + g_variant_builder_unref(ctx->options); + g_variant_builder_unref(ctx->query); + free(ctx->dev_addr); + free(ctx); +} + + static int _worker_req_handler(void *context) { GVariant *value; + char *host_address; int ret, conn_type, action; - struct icd_req_context *ctx = context; GVariantBuilder payload_builder; - char addr[PATH_MAX] = {0}; + struct icd_req_context *ctx = context; RETV_IF(NULL == ctx, IOTCON_ERROR_INVALID_PARAMETER); g_variant_builder_init(&payload_builder, G_VARIANT_TYPE("av")); - if (ctx->payload) + if (ctx->payload) { g_variant_builder_add(&payload_builder, "v", ctx->payload); + ctx->payload = NULL; + } - if (ctx->dev_addr->addr && *ctx->dev_addr->addr) - snprintf(addr, sizeof(addr), "%s:%d", ctx->dev_addr->addr, ctx->dev_addr->port); - - conn_type = icd_ioty_transport_flag_to_conn_type(ctx->dev_addr->adapter, - ctx->dev_addr->flags); + ret = icd_ioty_get_host_address(ctx->dev_addr, &host_address, &conn_type); + if (IOTCON_ERROR_NONE != ret) { + ERR("icd_ioty_get_host_address() Fail(%d)", ret); + g_variant_builder_clear(&payload_builder); + _icd_req_context_free(ctx); + return ret; + } action = _ioty_oic_action_to_ioty_action(ctx->observe_action); value = g_variant_new("(siia(qs)a(ss)iiavxx)", - addr, + host_address, conn_type, ctx->types, ctx->options, @@ -263,16 +280,14 @@ static int _worker_req_handler(void *context) ICD_POINTER_TO_INT64(ctx->request_h), ICD_POINTER_TO_INT64(ctx->resource_h)); + free(host_address); + ret = _ocprocess_response_signal(ctx->bus_name, IC_DBUS_SIGNAL_REQUEST_HANDLER, ctx->signal_number, value); if (IOTCON_ERROR_NONE != ret) ERR("_ocprocess_response_signal() Fail(%d)", ret); - free(ctx->bus_name); - g_variant_builder_unref(ctx->options); - g_variant_builder_unref(ctx->query); - free(ctx->dev_addr); - free(ctx); + _icd_req_context_free(ctx); return ret; } @@ -378,13 +393,7 @@ OCEntityHandlerResult icd_ioty_ocprocess_req_handler(OCEntityHandlerFlag flag, ret = _ocprocess_worker_start(_worker_req_handler, req_ctx); if (IOTCON_ERROR_NONE != ret) { ERR("_ocprocess_worker_start() Fail(%d)", ret); - free(req_ctx->bus_name); - if (req_ctx->payload) - g_variant_unref(req_ctx->payload); - g_variant_builder_unref(req_ctx->options); - g_variant_builder_unref(req_ctx->query); - free(req_ctx->dev_addr); - free(req_ctx); + _icd_req_context_free(req_ctx); return OC_EH_ERROR; } @@ -826,18 +835,26 @@ static int _worker_presence_cb(void *context) { GVariant *value; int ret, conn_type; - char addr[PATH_MAX] = {0}; + char *host_address; struct icd_presence_context *ctx = context; RETV_IF(NULL == ctx, IOTCON_ERROR_INVALID_PARAMETER); - snprintf(addr, sizeof(addr), "%s:%d", ctx->dev_addr->addr, ctx->dev_addr->port); - conn_type = icd_ioty_transport_flag_to_conn_type(ctx->dev_addr->adapter, - ctx->dev_addr->flags); + ret = icd_ioty_get_host_address(ctx->dev_addr, &host_address, &conn_type); + if (IOTCON_ERROR_NONE != ret) { + ERR("icd_ioty_get_host_address() Fail(%d)", ret); + free(ctx->resource_type); + free(ctx->bus_name); + free(ctx->dev_addr); + free(ctx); + return ret; + } - value = g_variant_new("(iusiis)", ctx->result, ctx->nonce, addr, conn_type, + value = g_variant_new("(iusiis)", ctx->result, ctx->nonce, host_address, conn_type, ctx->trigger, ic_utils_dbus_encode_str(ctx->resource_type)); + free(host_address); + ret = _ocprocess_response_signal(ctx->bus_name, IC_DBUS_SIGNAL_PRESENCE, ctx->signal_number, value); if (IOTCON_ERROR_NONE != ret) diff --git a/daemon/icd-ioty-type.c b/daemon/icd-ioty-type.c index da78787..5def41a 100644 --- a/daemon/icd-ioty-type.c +++ b/daemon/icd-ioty-type.c @@ -13,9 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#include +#include +#include +#include + #include #include "iotcon-constant.h" +#include "ic-utils.h" #include "icd.h" #include "icd-ioty-type.h" @@ -53,9 +59,9 @@ int icd_ioty_transport_flag_to_conn_type(OCTransportAdapter adapter, /* Need to consider to allow various connectivity types */ switch (adapter) { case OC_ADAPTER_IP: - if (OC_IP_USE_V4 == flag) + if (OC_IP_USE_V4 & flag) conn_type = IOTCON_CONNECTIVITY_IPV4; - else if (OC_IP_USE_V6 == flag) + else if (OC_IP_USE_V6 & flag) conn_type = IOTCON_CONNECTIVITY_IPV6; break; case OC_ADAPTER_RFCOMM_BTEDR: @@ -72,8 +78,8 @@ int icd_ioty_transport_flag_to_conn_type(OCTransportAdapter adapter, } -int icd_ioty_conn_type_to_oic_transport_type(int conn_type, OCTransportAdapter *adapter, - OCTransportFlags *flag) +static void _icd_ioty_conn_type_to_oic_transport_type(int conn_type, + OCTransportAdapter *adapter, OCTransportFlags *flag) { switch (conn_type) { case IOTCON_CONNECTIVITY_IPV4: @@ -97,7 +103,74 @@ int icd_ioty_conn_type_to_oic_transport_type(int conn_type, OCTransportAdapter * *adapter = OC_DEFAULT_ADAPTER; *flag = OC_DEFAULT_FLAGS; } +} + + +int icd_ioty_get_dev_addr(const char *host_address, int conn_type, OCDevAddr *dev_addr) +{ + char host[PATH_MAX] = {0}; + char *dev_host, *ptr = NULL; + + snprintf(host, sizeof(host), "%s", host_address); + + 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; + case IOTCON_CONNECTIVITY_BT_EDR: + snprintf(dev_addr->addr, sizeof(dev_addr->addr), "%s", host); + break; + case IOTCON_CONNECTIVITY_BT_LE: + default: + ERR("Invalid Connectivity Type(%d)", conn_type); + return IOTCON_ERROR_INVALID_PARAMETER; + } + + _icd_ioty_conn_type_to_oic_transport_type(conn_type, &(dev_addr->adapter), + &(dev_addr->flags)); + + return IOTCON_ERROR_NONE; +} + + +int icd_ioty_get_host_address(OCDevAddr *dev_addr, char **host_address, int *conn_type) +{ + int connectivity_type; + char host_addr[PATH_MAX] = {0}; + + connectivity_type = icd_ioty_transport_flag_to_conn_type(dev_addr->adapter, + dev_addr->flags); + + switch (connectivity_type) { + case IOTCON_CONNECTIVITY_IPV6: + snprintf(host_addr, sizeof(host_addr), "[%s]:%d", dev_addr->addr, + dev_addr->port); + break; + case IOTCON_CONNECTIVITY_IPV4: + snprintf(host_addr, sizeof(host_addr), "%s:%d", dev_addr->addr, + dev_addr->port); + break; + case IOTCON_CONNECTIVITY_BT_EDR: + snprintf(host_addr, sizeof(host_addr), "%s", dev_addr->addr); + break; + case IOTCON_CONNECTIVITY_BT_LE: + default: + ERR("Invalid Connectivity Type(%d)", connectivity_type); + return IOTCON_ERROR_INVALID_PARAMETER; + } + + *host_address = strdup(host_addr); + + *conn_type = connectivity_type; return IOTCON_ERROR_NONE; } + diff --git a/daemon/icd-ioty-type.h b/daemon/icd-ioty-type.h index d124e39..fb3daf9 100644 --- a/daemon/icd-ioty-type.h +++ b/daemon/icd-ioty-type.h @@ -25,7 +25,8 @@ OCConnectivityType icd_ioty_conn_type_to_oic_conn_type(int conn_type); 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); +int icd_ioty_get_dev_addr(const char *host_address, int conn_type, OCDevAddr *dev_addr); + +int icd_ioty_get_host_address(OCDevAddr *dev_addr, char **host_address, int *conn_type); #endif /*__IOT_CONNECTIVITY_MANAGER_DAEMON_IOTIVITY_TYPE_H__*/ diff --git a/daemon/icd-ioty.c b/daemon/icd-ioty.c index 1627704..981a9fe 100644 --- a/daemon/icd-ioty.c +++ b/daemon/icd-ioty.c @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - #include #include #include /* for uint8_t etc */ @@ -36,6 +35,7 @@ #include "icd-ioty-type.h" #include "icd-ioty-ocprocess.h" +#define ICD_MULTICAST_ADDRESS "224.0.1.187:5683" #define ICD_UUID_LENGTH 37 static const char *ICD_SYSTEM_INFO_TIZEN_ID = "http://tizen.org/system/tizenid"; @@ -420,7 +420,7 @@ int icd_ioty_find_resource(const char *host_address, int conn_type, OCCallbackData cbdata = {0}; OCConnectivityType oic_conn_type; - if (IC_STR_EQUAL == strcmp(IOTCON_MULTICAST_ADDRESS, host_address)) { + if (IC_STR_EQUAL == strcmp(IC_STR_NULL, host_address)) { len = snprintf(uri, sizeof(uri), "%s", OC_RSRVD_WELL_KNOWN_URI); } else { len = snprintf(uri, sizeof(uri), ICD_IOTY_COAP"%s%s", host_address, @@ -581,8 +581,8 @@ static gboolean _icd_ioty_crud(int type, OCStackResult result; GVariantIter *options; OCCallbackData cbdata = {0}; - int conn_type, options_size; - char *uri_path, *host, *uri, *dev_host, *ptr = NULL; + int ret, conn_type, options_size; + char *uri_path, *uri, *host; OCHeaderOption oic_options[MAX_HEADER_OPTIONS]; OCHeaderOption *oic_options_ptr = NULL; OCPayload *payload = NULL; @@ -653,22 +653,9 @@ static gboolean _icd_ioty_crud(int type, 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"); + ret = icd_ioty_get_dev_addr(host, conn_type, &dev_addr); + if (IOTCON_ERROR_NONE != ret) { + ERR("icd_ioty_get_dev_addr() Fail(%d)", ret); icd_ioty_complete_error(type, invocation, IOTCON_ERROR_IOTIVITY); free(uri); return TRUE; @@ -729,8 +716,8 @@ OCDoHandle icd_ioty_observer_start(GVariant *resource, int observe_type, GVariantIter *options; icd_sig_ctx_s *context; OCCallbackData cbdata = {0}; - int conn_type, options_size; - char *uri_path, *host, *uri, *dev_host, *ptr = NULL; + int ret, conn_type, options_size; + char *uri_path, *host, *uri; OCHeaderOption oic_options[MAX_HEADER_OPTIONS]; OCHeaderOption *oic_options_ptr = NULL; OCConnectivityType oic_conn_type; @@ -783,22 +770,9 @@ OCDoHandle icd_ioty_observer_start(GVariant *resource, int observe_type, 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"); + ret = icd_ioty_get_dev_addr(host, conn_type, &dev_addr); + if (IOTCON_ERROR_NONE != ret) { + ERR("icd_ioty_get_dev_addr() Fail(%d)", ret); free(context->bus_name); free(context); free(uri); @@ -871,7 +845,7 @@ int icd_ioty_get_info(int type, const char *host_address, int conn_type, else return IOTCON_ERROR_INVALID_PARAMETER; - if (IC_STR_EQUAL == strcmp(IOTCON_MULTICAST_ADDRESS, host_address)) + if (IC_STR_EQUAL == strcmp(IC_STR_NULL, host_address)) snprintf(uri, sizeof(uri), "%s", uri_path); else snprintf(uri, sizeof(uri), "%s%s", host_address, uri_path); @@ -1101,35 +1075,20 @@ int icd_ioty_set_tizen_info() gboolean icd_ioty_get_tizen_info(icDbus *object, GDBusMethodInvocation *invocation, const gchar *host_address, int conn_type) { + int ret; OCStackResult result; OCDevAddr dev_addr = {0}; OCCallbackData cbdata = {0}; OCConnectivityType oic_conn_type; - char host[PATH_MAX] = {0}; - char *dev_host, *ptr = NULL; - - snprintf(host, sizeof(host), "%s", host_address); cbdata.cb = icd_ioty_ocprocess_get_tizen_info_cb; cbdata.context = invocation; 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"); + + ret = icd_ioty_get_dev_addr(host_address, conn_type, &dev_addr); + if (IOTCON_ERROR_NONE != ret) { + ERR("icd_ioty_get_dev_addr() Fail(%d)", ret); icd_ioty_complete_error(ICD_TIZEN_INFO, invocation, IOTCON_ERROR_IOTIVITY); return TRUE; } @@ -1172,7 +1131,12 @@ OCDoHandle icd_ioty_subscribe_presence(const char *host_address, int conn_type, OCCallbackData cbdata = {0}; OCConnectivityType oic_conn_type; - len = snprintf(uri, sizeof(uri), "%s%s", host_address, OC_RSRVD_PRESENCE_URI); + if (IC_STR_EQUAL == strcmp(IC_STR_NULL, host_address) || '\0' == host_address[0]) { + len = snprintf(uri, sizeof(uri), "%s%s", ICD_MULTICAST_ADDRESS, + OC_RSRVD_PRESENCE_URI); + } else { + len = snprintf(uri, sizeof(uri), "%s%s", host_address, OC_RSRVD_PRESENCE_URI); + } if (len <= 0 || sizeof(uri) <= len) { ERR("snprintf() Fail(%d)", len); return NULL; diff --git a/lib/icl-device.c b/lib/icl-device.c index 70c72d0..53dc13a 100644 --- a/lib/icl-device.c +++ b/lib/icl-device.c @@ -145,13 +145,17 @@ API int iotcon_get_device_info(const char *host_address, char signal_name[IC_DBUS_SIGNAL_LENGTH] = {0}; RETV_IF(NULL == icl_dbus_get_object(), IOTCON_ERROR_DBUS); - RETV_IF(NULL == host_address, IOTCON_ERROR_INVALID_PARAMETER); RETV_IF(NULL == cb, IOTCON_ERROR_INVALID_PARAMETER); signal_number = icl_dbus_generate_signal_number(); - ic_dbus_call_get_device_info_sync(icl_dbus_get_object(), host_address, - connectivity_type, signal_number, &ret, NULL, &error); + ic_dbus_call_get_device_info_sync(icl_dbus_get_object(), + ic_utils_dbus_encode_str(host_address), + connectivity_type, + signal_number, + &ret, + NULL, + &error); if (error) { ERR("ic_dbus_call_get_device_info_sync() Fail(%s)", error->message); ret = icl_dbus_convert_dbus_error(error->code); @@ -318,13 +322,17 @@ API int iotcon_get_platform_info(const char *host_address, char signal_name[IC_DBUS_SIGNAL_LENGTH] = {0}; RETV_IF(NULL == icl_dbus_get_object(), IOTCON_ERROR_DBUS); - RETV_IF(NULL == host_address, IOTCON_ERROR_INVALID_PARAMETER); RETV_IF(NULL == cb, IOTCON_ERROR_INVALID_PARAMETER); signal_number = icl_dbus_generate_signal_number(); - ic_dbus_call_get_platform_info_sync(icl_dbus_get_object(), host_address, - connectivity_type, signal_number, &ret, NULL, &error); + ic_dbus_call_get_platform_info_sync(icl_dbus_get_object(), + ic_utils_dbus_encode_str(host_address), + connectivity_type, + signal_number, + &ret, + NULL, + &error); if (error) { ERR("ic_dbus_call_get_platform_info_sync() Fail(%s)", error->message); ret = icl_dbus_convert_dbus_error(error->code); diff --git a/lib/icl-presence.c b/lib/icl-presence.c index 1e1c6a8..f4132fd 100644 --- a/lib/icl-presence.c +++ b/lib/icl-presence.c @@ -167,7 +167,6 @@ API int iotcon_add_presence_cb(const char *host_address, char signal_name[IC_DBUS_SIGNAL_LENGTH] = {0}; RETV_IF(NULL == icl_dbus_get_object(), IOTCON_ERROR_INVALID_PARAMETER); - RETV_IF(NULL == host_address, IOTCON_ERROR_INVALID_PARAMETER); RETV_IF(NULL == cb, IOTCON_ERROR_INVALID_PARAMETER); if (resource_type && (ICL_RESOURCE_TYPE_LENGTH_MAX < strlen(resource_type))) { @@ -175,6 +174,13 @@ API int iotcon_add_presence_cb(const char *host_address, return IOTCON_ERROR_INVALID_PARAMETER; } + if ((IOTCON_MULTICAST_ADDRESS == host_address || '\0' == host_address[0]) + && (IOTCON_CONNECTIVITY_IPV4 != connectivity_type + && IOTCON_CONNECTIVITY_ALL != connectivity_type)) { + ERR("Multicast is available only if IPV4"); + return IOTCON_ERROR_INVALID_PARAMETER; + } + signal_number = icl_dbus_generate_signal_number(); presence = calloc(1, sizeof(icl_presence_s)); @@ -186,7 +192,7 @@ API int iotcon_add_presence_cb(const char *host_address, resource_type = ic_utils_dbus_encode_str(resource_type); ic_dbus_call_subscribe_presence_sync(icl_dbus_get_object(), - host_address, + ic_utils_dbus_encode_str(host_address), connectivity_type, resource_type, signal_number, @@ -213,7 +219,8 @@ API int iotcon_add_presence_cb(const char *host_address, presence->cb = cb; presence->user_data = user_data; - presence->host_address = ic_utils_strdup(host_address); + if (host_address) + presence->host_address = strdup(host_address); presence->connectivity_type = connectivity_type; if (resource_type) presence->resource_type = strdup(resource_type); diff --git a/lib/icl-remote-resource.c b/lib/icl-remote-resource.c index f3960c5..e7cd598 100644 --- a/lib/icl-remote-resource.c +++ b/lib/icl-remote-resource.c @@ -106,7 +106,6 @@ API int iotcon_find_resource(const char *host_address, char signal_name[IC_DBUS_SIGNAL_LENGTH] = {0}; RETV_IF(NULL == icl_dbus_get_object(), IOTCON_ERROR_DBUS); - RETV_IF(NULL == host_address, IOTCON_ERROR_INVALID_PARAMETER); RETV_IF(NULL == cb, IOTCON_ERROR_INVALID_PARAMETER); if (resource_type && (ICL_RESOURCE_TYPE_LENGTH_MAX < strlen(resource_type))) { ERR("The length of resource_type(%s) is invalid", resource_type); @@ -115,8 +114,14 @@ API int iotcon_find_resource(const char *host_address, signal_number = icl_dbus_generate_signal_number(); - ic_dbus_call_find_resource_sync(icl_dbus_get_object(), host_address, connectivity_type, - ic_utils_dbus_encode_str(resource_type), signal_number, &ret, NULL, &error); + 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), + signal_number, + &ret, + NULL, + &error); if (error) { ERR("ic_dbus_call_find_resource_sync() Fail(%s)", error->message); ret = icl_dbus_convert_dbus_error(error->code); @@ -428,8 +433,11 @@ static iotcon_remote_resource_h _icl_remote_resource_from_gvariant(GVariant *pay snprintf(host_addr, sizeof(host_addr), "[%s]:%d", addr, port); break; case IOTCON_CONNECTIVITY_IPV4: - default: snprintf(host_addr, sizeof(host_addr), "%s:%d", addr, port); + break; + case IOTCON_CONNECTIVITY_BT_EDR: + default: + snprintf(host_addr, sizeof(host_addr), "%s", addr); } ret = iotcon_resource_types_create(&res_types); diff --git a/lib/include/iotcon-client.h b/lib/include/iotcon-client.h index ac3d709..0a169a8 100644 --- a/lib/include/iotcon-client.h +++ b/lib/include/iotcon-client.h @@ -67,7 +67,8 @@ typedef void (*iotcon_presence_cb)(iotcon_presence_h presence, iotcon_error_e er * @brief Adds callback to a server to receive presence events. * @details Request to receive presence to an interested server's resource with @a resource_type.\n * If succeed to subscribe, iotcon_presence_cb() will be invoked when the server sends presence.\n - * A server sends presence events when adds/removes/alters a resource or start/stop presence. + * A server sends presence events when adds/removes/alters a resource or start/stop presence.\n + * @a host_address could be #IOTCON_MULTICAST_ADDRESS for IPv4 multicast. * * @since_tizen 3.0 * @privlevel public @@ -319,7 +320,7 @@ typedef void (*iotcon_found_resource_cb)(iotcon_remote_resource_h resource, /** * @brief Finds resources, asynchronously. * @details Request to find a resource of @a host_address server with @a resource_type.\n - * @a host_address could be #IOTCON_MULTICAST_ADDRESS for IPv4 multicast.\n + * @a host_address could be #IOTCON_MULTICAST_ADDRESS for multicast.\n * If succeed to find the resource, iotcon_found_resource_cb() will be invoked with * information of the resource. * @@ -378,7 +379,7 @@ typedef void (*iotcon_device_info_cb)(iotcon_device_info_h device_info, * @brief Gets the device information of remote server, asynchronously. * @details Request device information to server and pass the information by calling * iotcon_device_info_cb().\n - * @a host_address could be #IOTCON_MULTICAST_ADDRESS for IPv4 multicast.\n + * @a host_address could be #IOTCON_MULTICAST_ADDRESS for multicast.\n * If succeed to getting device information, iotcon_device_info_cb() will be invoked with * information. * @@ -453,7 +454,7 @@ typedef void (*iotcon_platform_info_cb)(iotcon_platform_info_h platform_info, * @brief Gets the platform information of remote server, asynchronously. * @details Request platform information to server and pass the information by calling * iotcon_platform_info_cb().\n - * @a host_address could be #IOTCON_MULTICAST_ADDRESS for IPv4 multicast.\n + * @a host_address could be #IOTCON_MULTICAST_ADDRESS for multicast.\n * If succeed to getting platform information, iotcon_platform_info_cb() will be invoked * with information. * diff --git a/lib/include/iotcon-constant.h b/lib/include/iotcon-constant.h index 8485226..322c70c 100644 --- a/lib/include/iotcon-constant.h +++ b/lib/include/iotcon-constant.h @@ -219,7 +219,7 @@ typedef struct icl_state_s* iotcon_state_h; * * @since_tizen 3.0 */ -#define IOTCON_MULTICAST_ADDRESS "224.0.1.187" /**< Multicast IP Address */ +#define IOTCON_MULTICAST_ADDRESS NULL /**< Multicast Address */ /** * @brief Use this value as the return value to stop foreach function. diff --git a/packaging/iotcon-old.manifest b/packaging/iotcon-old.manifest index 6101ccc..b0453bc 100644 --- a/packaging/iotcon-old.manifest +++ b/packaging/iotcon-old.manifest @@ -13,6 +13,8 @@ + + -- 2.34.1