コード例 #1
0
ファイル: cableserver.c プロジェクト: darcyg/iotivity-1
void CATerminateLEGattServer()
{
    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");

    ca_mutex_lock(g_bleServerStateMutex);

    // free service Path(unique identifier for ble service)
    ca_mutex_lock(g_bleServiceMutex);
    OICFree(g_gattSvcPath);
    g_gattSvcPath = NULL;
    ca_mutex_unlock(g_bleServiceMutex);

    // freeing characteristics
    ca_mutex_lock(g_bleCharacteristicMutex);
    OICFree(g_gattReadCharPath);
    g_gattReadCharPath = NULL;
    OICFree(g_gattWriteCharPath);
    g_gattWriteCharPath = NULL;
    ca_mutex_unlock(g_bleCharacteristicMutex);

    ca_mutex_unlock(g_bleServerStateMutex);

    // Terminating all mutex variables.
    CATerminateGattServerMutexVariables();
    OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
}
コード例 #2
0
ファイル: cableserver.c プロジェクト: darcyg/iotivity-1
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;
}
コード例 #3
0
ファイル: caleserver.c プロジェクト: aaronkim/iotivity
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;
}
コード例 #4
0
ファイル: caleserver.c プロジェクト: aaronkim/iotivity
void CATerminateLEGattServer()
{
    OIC_LOG(DEBUG, TAG, "IN");

    // Service and characteristics path will be freed by the platform.
    ca_mutex_lock(g_leServiceMutex);
    g_gattSvcPath = NULL;
    ca_mutex_unlock(g_leServiceMutex);

    ca_mutex_lock(g_leCharacteristicMutex);
    g_gattReadCharPath = NULL;
    g_gattWriteCharPath = NULL;
    ca_mutex_unlock(g_leCharacteristicMutex);

    ca_mutex_lock(g_leServerThreadPoolMutex);
    g_leServerThreadPool = NULL;
    ca_mutex_unlock(g_leServerThreadPoolMutex);

    // Terminating all mutex variables.
    CATerminateGattServerMutexVariables();
    OIC_LOG(DEBUG, TAG, "OUT");
}