summaryrefslogtreecommitdiff
path: root/resource/csdk/connectivity
diff options
context:
space:
mode:
authorsamanway <samanway@samanway.sa.corp.samsungelectronics.net>2019-10-30 15:57:15 +0530
committerPyun DoHyun <dh79.pyun@samsung.com>2020-01-12 23:05:13 +0000
commit1cd1a6cd15480a9d42ae0c69e553ec72202b3dcb (patch)
tree02bb4a521552fc8d181544ccd4672d21047d1406 /resource/csdk/connectivity
parent332d686c019e1c6cfda8c5f21f0a50b0f81ea1ca (diff)
downloadiotivity-1cd1a6cd15480a9d42ae0c69e553ec72202b3dcb.tar.gz
iotivity-1cd1a6cd15480a9d42ae0c69e553ec72202b3dcb.tar.bz2
iotivity-1cd1a6cd15480a9d42ae0c69e553ec72202b3dcb.zip
Adding retry logic for gatt connection for VD client
- There was an issue initially reported for LUX, that Gatt Client disconnects just after it connects - Connection retry logic was added as a fix in the commit 25ef240cc9978fa5945a26e72a8e763c436960db - Again the same issue was reported for TV - So adding the same fix in VD client https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/commit/6faf5ba264411d383ec5c3225f9fdcd90690088d (cherry-picked from 6faf5ba264411d383ec5c3225f9fdcd90690088d) Change-Id: I0c7ad06e65b1c1774b9d7269be64a2f569d55664 Signed-off-by: samanway-dey <samanway.dey@samsung.com> Signed-off-by: Sudipto <sudipto.bal@samsung.com>
Diffstat (limited to 'resource/csdk/connectivity')
-rw-r--r--resource/csdk/connectivity/src/bt_le_adapter/tizen/caleclient.c22
1 files changed, 1 insertions, 21 deletions
diff --git a/resource/csdk/connectivity/src/bt_le_adapter/tizen/caleclient.c b/resource/csdk/connectivity/src/bt_le_adapter/tizen/caleclient.c
index 561e2bf62..f6cb5b8ea 100644
--- a/resource/csdk/connectivity/src/bt_le_adapter/tizen/caleclient.c
+++ b/resource/csdk/connectivity/src/bt_le_adapter/tizen/caleclient.c
@@ -58,7 +58,6 @@ static int g_retrycount = 0;
static int retry_flag = 0;
uint64_t const TIMEOUT = 30 * MICROSECS_PER_SEC;
-#ifndef TIZEN_VD
/**
* Mutex to call connect only after disconnect during retry
*/
@@ -68,7 +67,6 @@ static oc_mutex g_isDisconnectedMutex = NULL;
* Condition for calling connect during connection retry
*/
static oc_cond g_LEDisconnectedCond = NULL;
-#endif
/**
* Flag to check if scanning is in progress
@@ -290,10 +288,8 @@ CAResult_t CALEGattInitiateConnection(const char *remoteAddress)
return CA_STATUS_FAILED;
}
g_isConnectionInProgress = true;
-#ifndef TIZEN_VD
// Set gatt connect retry count
g_retrycount = RETRY_COUNT;
-#endif
oc_mutex_unlock(g_isConnectionInProgressMutex);
// Pause the scanning
@@ -340,11 +336,6 @@ void CALEGattConnectionStateChanged(bool connected, const char *remoteAddress)
if (!connected)
{
OIC_LOG_V(DEBUG, TAG, "DisConnected from [%s] ", remoteAddress);
-#ifdef TIZEN_VD
- oc_mutex_lock(g_LEServerListMutex);
- CARemoveLEServerInfoFromList(&g_LEServerList, remoteAddress);
- oc_mutex_unlock(g_LEServerListMutex);
-#else
if(!retry_flag)
{
oc_mutex_lock(g_LEServerListMutex);
@@ -358,7 +349,6 @@ void CALEGattConnectionStateChanged(bool connected, const char *remoteAddress)
oc_mutex_unlock(g_isDisconnectedMutex);
}
retry_flag = 0;
-#endif
}
else
{
@@ -577,7 +567,6 @@ void CALEAdapterScanResultCb(int result, bt_adapter_le_device_scan_result_info_s
oc_mutex_unlock(g_LEServerListMutex);
}
-
OIC_LOG(DEBUG, TAG, "OUT");
}
@@ -941,7 +930,6 @@ CAResult_t CAInitGattClientMutexVariables()
}
}
-#ifndef TIZEN_VD
if (NULL == g_isDisconnectedMutex)
{
g_isDisconnectedMutex = oc_mutex_new();
@@ -961,7 +949,6 @@ CAResult_t CAInitGattClientMutexVariables()
return CA_STATUS_FAILED;
}
}
-#endif
if (NULL == g_startTimerCond)
{
@@ -1045,13 +1032,11 @@ void CATerminateGattClientMutexVariables()
oc_mutex_free(g_threadMTUChangedMutex);
g_threadMTUChangedMutex = NULL;
-#ifndef TIZEN_VD
oc_mutex_free(g_isDisconnectedMutex);
g_isDisconnectedMutex = NULL;
oc_cond_free(g_LEDisconnectedCond);
g_LEDisconnectedCond = NULL;
-#endif
oc_cond_free(g_startTimerCond);
g_startTimerCond = NULL;
@@ -1321,7 +1306,6 @@ void CADiscoverLEServicesThread(void *remoteAddress)
OIC_LOG(DEBUG, TAG, "OUT");
}
-#ifndef TIZEN_VD
static int CALEWaittillDisconnect(oc_mutex mutex, oc_cond cv, int wait_seconds)
{
OIC_LOG(DEBUG, TAG, "Waiting for server to be disconnected...");
@@ -1344,7 +1328,6 @@ static CAResult_t CALEGattConnectionRetry(const char *remoteAddress)
OIC_LOG(DEBUG, TAG, "OUT");
return result;
}
-#endif
CAResult_t CALEGattDiscoverServices(const char *remoteAddress)
{
@@ -1370,9 +1353,7 @@ CAResult_t CALEGattDiscoverServices(const char *remoteAddress)
{
OIC_LOG_V(ERROR, TAG,
"bt_gatt_client_get_service Failed with ret value [%s] ", CALEGetErrorMsg(ret));
-#ifdef TIZEN_VD
- goto error_exit;
-#else
+
if(g_retrycount)
{
OIC_LOG(DEBUG, TAG, "Retry will be attempted to connect Gatt Server");
@@ -1392,7 +1373,6 @@ CAResult_t CALEGattDiscoverServices(const char *remoteAddress)
return CA_STATUS_FAILED;
}
}
-#endif
}
retry_flag = 0;