diff options
author | Jooseok Park <jooseok.park@samsung.com> | 2016-12-12 20:57:38 +0900 |
---|---|---|
committer | Jooseok Park <jooseok.park@samsung.com> | 2016-12-12 20:57:38 +0900 |
commit | 41e94254edeca4344310fcc9d3ccfcf4519e1fa3 (patch) | |
tree | 7ae37a28e1b5d927b42ba1aa3dadb5f6207abed2 | |
parent | 6d7a57d7b76a0e8964ec2aaa8e5a2d1672fdaa70 (diff) | |
download | iotcon-41e94254edeca4344310fcc9d3ccfcf4519e1fa3.tar.gz iotcon-41e94254edeca4344310fcc9d3ccfcf4519e1fa3.tar.bz2 iotcon-41e94254edeca4344310fcc9d3ccfcf4519e1fa3.zip |
fix presence unicast callbacksubmit/tizen_3.0/20161212.121610accepted/tizen/3.0/wearable/20161213.025100accepted/tizen/3.0/tv/20161213.025051accepted/tizen/3.0/mobile/20161213.025037accepted/tizen/3.0/ivi/20161213.025117accepted/tizen/3.0/common/20161213.163909
Change-Id: I60de01959f3a3f69d7a1714a89746cd87113843d
-rw-r--r-- | packaging/iotcon.spec | 2 | ||||
-rw-r--r-- | src/ic-ioty.c | 43 |
2 files changed, 23 insertions, 22 deletions
diff --git a/packaging/iotcon.spec b/packaging/iotcon.spec index 0cf7c68..f083411 100644 --- a/packaging/iotcon.spec +++ b/packaging/iotcon.spec @@ -1,6 +1,6 @@ Name: iotcon Summary: Tizen IoT Connectivity -Version: 0.3.7 +Version: 0.3.8 Release: 0 Group: Network & Connectivity/Service License: Apache-2.0 diff --git a/src/ic-ioty.c b/src/ic-ioty.c index 897dda8..10bafe3 100644 --- a/src/ic-ioty.c +++ b/src/ic-ioty.c @@ -726,12 +726,10 @@ int icl_ioty_add_presence_cb(const char *host_address, iotcon_presence_h *presence_handle) { int ret; - int conn_extra; - int conn_options; OCDoHandle handle; char uri[PATH_MAX] = {0}; OCCallbackData cbdata = {0}; - OCConnectivityType oic_conn_type; + OCConnectivityType oic_conn_type = CT_ADAPTER_IP; iotcon_presence_h presence = NULL; OCDevAddr dev_addr = {0}; @@ -749,31 +747,32 @@ int icl_ioty_add_presence_cb(const char *host_address, presence->user_data = user_data; if (host_address) presence->host_address = strdup(host_address); - presence->connectivity_type - = connectivity_type % IC_CONNECTIVITY_REMOVE_EXTRA_OPTIONS; if (resource_type) presence->resource_type = strdup(resource_type); + if (!(IOTCON_CONNECTIVITY_IP & connectivity_type)) { + DBG("default IP type is addeded"); + connectivity_type |= IOTCON_CONNECTIVITY_IP; + } + presence->connectivity_type = connectivity_type; + + if (IOTCON_CONNECTIVITY_PREFER_TCP & connectivity_type) + oic_conn_type |= CT_ADAPTER_TCP; + if (IOTCON_CONNECTIVITY_IPV4_ONLY & connectivity_type) + oic_conn_type |= CT_IP_USE_V4; + if (IOTCON_CONNECTIVITY_IPV6_ONLY & connectivity_type) + oic_conn_type |= CT_IP_USE_V6; cbdata.context = presence; cbdata.cd = NULL; cbdata.cb = icl_ioty_ocprocess_presence_cb; - conn_extra = connectivity_type - presence->connectivity_type; - - conn_options = ic_utils_host_address_get_connectivity(host_address, - presence->connectivity_type); - if (NULL == host_address && IOTCON_CONNECTIVITY_IP == presence->connectivity_type) { - if (IOTCON_CONNECTIVITY_IPV4_ONLY & conn_extra) - conn_options |= IC_UTILS_CONNECTIVITY_IPV4; - else if (IOTCON_CONNECTIVITY_IPV6_ONLY & conn_extra) - conn_options |= IC_UTILS_CONNECTIVITY_IPV6; - } - oic_conn_type = ic_ioty_convert_connectivity_type(presence->connectivity_type, - conn_options); - if (NULL != host_address) { + int temp_conn_type; + int conn_options; + temp_conn_type = connectivity_type % IC_CONNECTIVITY_REMOVE_EXTRA_OPTIONS; + conn_options = ic_utils_host_address_get_connectivity(host_address, temp_conn_type); ret = ic_ioty_convert_host_address(host_address, - connectivity_type, conn_options, &dev_addr); + temp_conn_type, conn_options, &dev_addr); if (IOTCON_ERROR_NONE != ret) { ERR("ic_ioty_convert_host_address() Fail(%d)", ret); icl_destroy_presence(presence); @@ -787,7 +786,9 @@ int icl_ioty_add_presence_cb(const char *host_address, icl_destroy_presence(presence); return ret; } - DBG("uri:[%s], oic_conn_type:[%d(0x%x)]", uri, oic_conn_type, oic_conn_type); + + DBG("uri:[%s], connectivity_type:[%d(0x%x)], oic_conn_type:[%d(0x%x)]", + uri, connectivity_type, connectivity_type, oic_conn_type, oic_conn_type); if (NULL != host_address) { DBG("dev_addr.addr:[%s], dev_addr.port:[%d]", dev_addr.addr, dev_addr.port); ret = OCDoResource(&handle, OC_REST_PRESENCE, uri, &dev_addr, NULL, oic_conn_type, @@ -796,7 +797,7 @@ int icl_ioty_add_presence_cb(const char *host_address, ret = OCDoResource(&handle, OC_REST_PRESENCE, uri, NULL, NULL, oic_conn_type, OC_LOW_QOS, &cbdata, NULL, 0); } - DBG("handle:[%p]", handle); + DBG("oic handle:[%p]", handle); icl_ioty_mutex_unlock(); presence->handle = handle; |