CAResult_t CAStartLEGattServer() { OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN"); CAResult_t ret = CAInitGattServerMutexVariables(); if (CA_STATUS_OK != ret ) { OIC_LOG(ERROR, TZ_BLE_SERVER_TAG, "CAInitGattServerMutexVariables failed!"); CATerminateGattServerMutexVariables(); return CA_SERVER_NOT_STARTED; } ca_mutex_lock(g_bleServerThreadPoolMutex); if (NULL == g_bleServerThreadPool) { OIC_LOG(ERROR, TZ_BLE_SERVER_TAG, "g_bleServerThreadPool is NULL"); ca_mutex_unlock(g_bleServerThreadPoolMutex); return CA_STATUS_FAILED; } ret = ca_thread_pool_add_task(g_bleServerThreadPool, CAStartBleGattServerThread, NULL); if (CA_STATUS_OK != ret) { OIC_LOG_V(ERROR, TZ_BLE_SERVER_TAG, "ca_thread_pool_add_task failed with ret [%d]", ret); ca_mutex_unlock(g_bleServerThreadPoolMutex); return CA_STATUS_FAILED; } ca_mutex_unlock(g_bleServerThreadPoolMutex); OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT"); return CA_STATUS_OK; }
CAResult_t CAInitializeLEGattServer() { OIC_LOG(DEBUG, TAG, "IN"); CAResult_t ret = CAInitGattServerMutexVariables(); if (CA_STATUS_OK != ret ) { OIC_LOG(ERROR, TAG, "CAInitGattServerMutexVariables failed!"); CATerminateGattServerMutexVariables(); return CA_SERVER_NOT_STARTED; } OIC_LOG(DEBUG, TAG, "OUT"); return ret; }