From 9602861f1c70ea9ff88361b4327404b670daae12 Mon Sep 17 00:00:00 2001 From: "vimala.v" Date: Thu, 3 Mar 2016 14:02:29 +0530 Subject: [PATCH] Fix to notify connected state to Tizen LE client from network monitor Change-Id: I6d0c0cbf1c6c48f07c39b1d01c48ac0f29396eaa Signed-off-by: Jaehong Jo Signed-off-by: vimala.v Reviewed-on: https://gerrit.iotivity.org/gerrit/5339 Tested-by: jenkins-iotivity Reviewed-by: Jon A. Cruz --- .../src/bt_le_adapter/tizen/calenwmonitor.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/resource/csdk/connectivity/src/bt_le_adapter/tizen/calenwmonitor.c b/resource/csdk/connectivity/src/bt_le_adapter/tizen/calenwmonitor.c index 18cd152..ed03e02 100644 --- a/resource/csdk/connectivity/src/bt_le_adapter/tizen/calenwmonitor.c +++ b/resource/csdk/connectivity/src/bt_le_adapter/tizen/calenwmonitor.c @@ -342,22 +342,21 @@ void CALEAdapterStateChangedCb(int result, bt_adapter_state_e adapter_state, void CALENWConnectionStateChangedCb(int result, bool connected, const char *remoteAddress, void *userData) { - OIC_LOG(DEBUG, TAG, "IN "); + OIC_LOG(DEBUG, TAG, "IN"); VERIFY_NON_NULL_VOID(remoteAddress, TAG, "remote address is NULL"); - if (!connected) + ca_mutex_lock(g_bleConnectionStateChangedCbMutex); + const char *addr = OICStrdup(remoteAddress); + if (NULL == addr) { - OIC_LOG_V(DEBUG, TAG, "disconnected [%s] ", remoteAddress); - ca_mutex_lock(g_bleConnectionStateChangedCbMutex); - const char *addr = OICStrdup(remoteAddress); - g_bleConnectionStateChangedCallback(CA_ADAPTER_GATT_BTLE, addr, connected); + OIC_LOG(ERROR, TAG, "addr is NULL"); ca_mutex_unlock(g_bleConnectionStateChangedCbMutex); + return; } - else - { - OIC_LOG_V(DEBUG, TAG, "connected [%s] ", remoteAddress); - } + g_bleConnectionStateChangedCallback(CA_ADAPTER_GATT_BTLE, addr, connected); + OICFree(addr); + ca_mutex_unlock(g_bleConnectionStateChangedCbMutex); OIC_LOG(DEBUG, TAG, "OUT"); } -- 2.7.4