Exemplo n.º 1
0
/*******************************************************************************
**
** Function 		btif_shutdown_bluetooth
**
** Description		destroy BTIF task and prepares BT scheduler for startup
**
** Returns			bt_status_t
**
*******************************************************************************/
bt_status_t btif_shutdown_bluetooth(void)
{
	ALOGI("+++[btif_shutdown_bluetooth]+++!\n");

	if (btif_is_enabled())
    {
        ALOGI("[btif_shutdown_bluetooth]:disable bt before shutdown!\n");

        /* shutdown called prior to disabling, initiate disable */
        btif_disable_bluetooth();
		//bt_hal_cbacks = NULL;
        btif_shutdown_pending = 1;
	    btmtk_gap_cleanup(0);
        goto exit;
    }

	ALOGI("[btif_shutdown_bluetooth]:btmtk_gap_cleanup entry!\n");
	if(btif_shutdown_pending == 0)
    {
    	btmtk_gap_cleanup(1);
	}
	else
	{
	 	btif_shutdown_pending = 0;
		btmtk_gap_exit();
	}
	
exit:
	btif_dut_mode = 0;
    ALOGI("---[GAP] btif_shutdown_bluetooth---!\n");
    return BT_STATUS_SUCCESS;
}
Exemplo n.º 2
0
bt_status_t btif_shutdown_bluetooth(void)
{
    BTIF_TRACE_DEBUG1("%s", __FUNCTION__);

    if (btif_is_enabled())
    {
        BTIF_TRACE_WARNING0("shutdown while still enabled, initiate disable");

        /* shutdown called prior to disabling, initiate disable */
        btif_disable_bluetooth();
        btif_shutdown_pending = 1;
        return BT_STATUS_NOT_READY;
    }

    btif_shutdown_pending = 0;

    GKI_destroy_task(BTIF_TASK);

    bte_main_shutdown();

    btif_dut_mode = 0;

    BTIF_TRACE_DEBUG1("%s done", __FUNCTION__);

    return BT_STATUS_SUCCESS;
}
static int disable(void)
{
    /* sanity check */
    if (interface_ready() == FALSE)
        return BT_STATUS_NOT_READY;

    return btif_disable_bluetooth();
}