CAResult_t CAAddNetworkType(CATransportAdapter_t transportType)
{
    OIC_LOG(DEBUG, TAG, "IN");
    if (NULL == g_selectedNetworkList)
    {
        OIC_LOG(DEBUG, TAG, "Create network list");

        g_selectedNetworkList = u_arraylist_create();

        if (NULL == g_selectedNetworkList)
        {
            return CA_MEMORY_ALLOC_FAILED;
        }
    }
    CAResult_t res = CA_STATUS_OK;
    switch (transportType)
    {
        case CA_ADAPTER_IP:
#ifndef IP_ADAPTER
            OIC_LOG(DEBUG, TAG, "Add network type(IP) - Not Supported");
            return CA_NOT_SUPPORTED;
#endif /* IP_ADAPTER */

            OIC_LOG(DEBUG, TAG, "Add network type(IP)");
            if (u_arraylist_contains(g_selectedNetworkList, &NETWORK_IP))
            {
                goto exit;
            }
            res = u_arraylist_add(g_selectedNetworkList, &NETWORK_IP);
            break;

        case CA_ADAPTER_RFCOMM_BTEDR:
#ifndef EDR_ADAPTER
            OIC_LOG(DEBUG, TAG, "Add network type(EDR) - Not Supported");
            return CA_NOT_SUPPORTED;
#endif /* EDR_ADAPTER */

            OIC_LOG(DEBUG, TAG, "Add network type(EDR)");
            if (u_arraylist_contains(g_selectedNetworkList, &NETWORK_RFCOMM))
            {
                goto exit;
            }
            res = u_arraylist_add(g_selectedNetworkList, &NETWORK_RFCOMM);
            break;

        case CA_ADAPTER_GATT_BTLE:
#ifndef LE_ADAPTER
            OIC_LOG(DEBUG, TAG, "Add network type(LE) - Not Supported");
            return CA_NOT_SUPPORTED;
#endif /* LE_ADAPTER */

            OIC_LOG(DEBUG, TAG, "Add network type(LE)");
            if (u_arraylist_contains(g_selectedNetworkList, &NETWORK_GATT))
            {
                goto exit;
            }
            res = u_arraylist_add(g_selectedNetworkList, &NETWORK_GATT);
            break;
        default:
            break;
    }

    if (CA_STATUS_OK != res)
    {
        OIC_LOG_V(ERROR, TAG, "Add arraylist failed[Err code: %d]", res);
        return res;
    }
    // start selected interface adapter
    res = CAStartAdapter(transportType);
    OIC_LOG(DEBUG, TAG, "OUT");
    return res;

exit:
    OIC_LOG(DEBUG, TAG, "This adapter is already enabled");
    return CA_STATUS_OK;
}
CAResult_t CAAddNetworkType(CAConnectivityType_t connectivityType)
{
    OIC_LOG(DEBUG, TAG, "IN");
    if (g_selectedNetworkList == NULL)
    {
        g_selectedNetworkList = u_arraylist_create();

        if (NULL == g_selectedNetworkList)
        {
            return CA_MEMORY_ALLOC_FAILED;
        }
    }
    CAResult_t res = CA_STATUS_OK;
    switch (connectivityType)
    {
        case CA_ETHERNET:
        {

#ifndef ETHERNET_ADAPTER
            OIC_LOG(DEBUG, TAG, "Add network type(ETHERNET) - Not Supported");
            return CA_NOT_SUPPORTED;
#endif /* ETHERNET_ADAPTER */

            OIC_LOG(DEBUG, TAG, "Add network type(ETHERNET)");
            if (!u_arraylist_contains(g_selectedNetworkList, &NETWORK_ETHERNET))
            {
                res = u_arraylist_add(g_selectedNetworkList, &NETWORK_ETHERNET);
                if (CA_STATUS_OK != res)
                {
                    OIC_LOG_V(ERROR, TAG, "Add arraylist failed[Err code: %d]", res);
                    return res;
                }
            }
        }
        break;

        case CA_WIFI:
        {

#ifndef WIFI_ADAPTER
            OIC_LOG(DEBUG, TAG, "Add network type(WIFI) - Not Supported");
            return CA_NOT_SUPPORTED;
#endif /* WIFI_ADAPTER */

            OIC_LOG(DEBUG, TAG, "Add network type(WIFI)");
            if (!u_arraylist_contains(g_selectedNetworkList, &NETWORK_WIFI))
            {
                res = u_arraylist_add(g_selectedNetworkList, &NETWORK_WIFI);
                if (CA_STATUS_OK != res)
                {
                    OIC_LOG_V(ERROR, TAG, "Add arraylist failed[Err code: %d]", res);
                    return res;
                }
            }
        }
        break;

        case CA_EDR:
        {

#ifndef EDR_ADAPTER
            OIC_LOG(DEBUG, TAG, "Add network type(EDR) - Not Supported");
            return CA_NOT_SUPPORTED;
#endif /* EDR_ADAPTER */

            OIC_LOG(DEBUG, TAG, "Add network type(EDR)");
            if (!u_arraylist_contains(g_selectedNetworkList, &NETWORK_EDR))
            {
                res = u_arraylist_add(g_selectedNetworkList, &NETWORK_EDR);
                if (CA_STATUS_OK != res)
                {
                    OIC_LOG_V(ERROR, TAG, "Add arraylist failed[Err code: %d]", res);
                    return res;
                }
            }
        }
        break;

        case CA_LE:
        {

#ifndef LE_ADAPTER
            OIC_LOG(DEBUG, TAG, "Add network type(LE) - Not Supported");
            return CA_NOT_SUPPORTED;
#endif /* LE_ADAPTER */

            OIC_LOG(DEBUG, TAG, "Add network type(LE)");
            if (!u_arraylist_contains(g_selectedNetworkList, &NETWORK_LE))
            {
                res = u_arraylist_add(g_selectedNetworkList, &NETWORK_LE);
                if (CA_STATUS_OK != res)
                {
                    OIC_LOG_V(ERROR, TAG, "Add arraylist failed[Err code: %d]", res);
                    return res;
                }
            }
        }
        break;

    }

    // start selected interface adapter
    res = CAStartAdapter((CAConnectivityType_t)connectivityType);
    OIC_LOG(DEBUG, TAG, "OUT");
    return res;
}