hdr.layer_specific = xx + 1;
bta_av_api_deregister((tBTA_AV_DATA *)&hdr);
}
+
+ alarm_free(p_cb->link_signalling_timer);
+ p_cb->link_signalling_timer = NULL;
+ alarm_free(p_cb->accept_signalling_timer);
+ p_cb->accept_signalling_timer = NULL;
}
/*******************************************************************************
*******************************************************************************/
static void bta_av_api_enable(tBTA_AV_DATA *p_data)
{
- int i;
- tBTA_AV_ENABLE enable;
-
- alarm_free(bta_av_cb.link_signalling_timer);
- alarm_free(bta_av_cb.accept_signalling_timer);
-
/* initialize control block */
memset(&bta_av_cb, 0, sizeof(tBTA_AV_CB));
- for(i=0; i<BTA_AV_NUM_RCB; i++)
+ for (int i = 0; i < BTA_AV_NUM_RCB; i++)
bta_av_cb.rcb[i].handle = BTA_AV_RC_HANDLE_NONE;
bta_av_cb.rc_acp_handle = BTA_AV_RC_HANDLE_NONE;
bta_av_cb.features = p_data->api_enable.features;
bta_av_cb.sec_mask = p_data->api_enable.sec_mask;
+ tBTA_AV_ENABLE enable;
enable.features = bta_av_cb.features;
/* Register for SCO change event */
assert(module != NULL);
assert(get_module_state(module) == MODULE_STATE_NONE);
- LOG_WARN(LOG_TAG, "%s initializing the module \"%s\"", __func__, module->name);
+ LOG_INFO(LOG_TAG, "%s Initializing module \"%s\"", __func__, module->name);
if (!call_lifecycle_function(module->init)) {
- LOG_ERROR(LOG_TAG, "%s failed to initialize \"%s\"", __func__, module->name);
+ LOG_ERROR(LOG_TAG, "%s Failed to initialize module \"%s\"",
+ __func__, module->name);
return false;
}
- LOG_WARN(LOG_TAG, "%s initialized the module \"%s\"", __func__, module->name);
+ LOG_INFO(LOG_TAG, "%s Initialized module \"%s\"", __func__, module->name);
set_module_state(module, MODULE_STATE_INITIALIZED);
return true;
// as we're converting the startup sequence.
assert(get_module_state(module) == MODULE_STATE_INITIALIZED || module->init == NULL);
- LOG_WARN(LOG_TAG, "%s Starting the module \"%s\"", __func__, module->name);
+ LOG_INFO(LOG_TAG, "%s Starting module \"%s\"", __func__, module->name);
if (!call_lifecycle_function(module->start_up)) {
- LOG_ERROR(LOG_TAG, "%s failed to start up \"%s\"", __func__, module->name);
+ LOG_ERROR(LOG_TAG, "%s Failed to start up module \"%s\"",
+ __func__, module->name);
return false;
}
- LOG_WARN(LOG_TAG, "%s Started the module \"%s\"", __func__, module->name);
+ LOG_INFO(LOG_TAG, "%s Started module \"%s\"", __func__, module->name);
set_module_state(module, MODULE_STATE_STARTED);
return true;
if (state < MODULE_STATE_STARTED)
return;
- LOG_WARN(LOG_TAG, "%s Shutting the module \"%s\"", __func__, module->name);
- if (!call_lifecycle_function(module->shut_down))
- LOG_ERROR(LOG_TAG, "%s found \"%s\" reported failure during shutdown. Continuing anyway.", __func__, module->name);
- else
- LOG_WARN(LOG_TAG, "%s Shutdown the module \"%s\"", __func__, module->name);
+ LOG_INFO(LOG_TAG, "%s Shutting down module \"%s\"", __func__, module->name);
+ if (!call_lifecycle_function(module->shut_down)) {
+ LOG_ERROR(LOG_TAG, "%s Failed to shutdown module \"%s\". Continuing anyway.",
+ __func__, module->name);
+ }
+ LOG_INFO(LOG_TAG, "%s Shutdown of module \"%s\" completed",
+ __func__, module->name);
set_module_state(module, MODULE_STATE_INITIALIZED);
}
if (state < MODULE_STATE_INITIALIZED)
return;
- if (!call_lifecycle_function(module->clean_up))
- LOG_ERROR(LOG_TAG, "%s found \"%s\" reported failure during cleanup. Continuing anyway.", __func__, module->name);
+ LOG_INFO(LOG_TAG, "%s Cleaning up module \"%s\"", __func__, module->name);
+ if (!call_lifecycle_function(module->clean_up)) {
+ LOG_ERROR(LOG_TAG, "%s Failed to cleanup module \"%s\". Continuing anyway.",
+ __func__, module->name);
+ }
+ LOG_INFO(LOG_TAG, "%s Cleanup of module \"%s\" completed",
+ __func__, module->name);
set_module_state(module, MODULE_STATE_NONE);
}
/*******************************************************************************
**
-** Function btif_shutdown_bluetooth
+** Function btif_cleanup_bluetooth
**
-** Description Finalizes BT scheduler shutdown and terminates BTIF
-** task.
+** Description Cleanup BTIF state.
**
**
** Returns void
**
*******************************************************************************/
-bt_status_t btif_shutdown_bluetooth(void);
+bt_status_t btif_cleanup_bluetooth(void);
/*******************************************************************************
**
uint32_t num_props, bt_property_t *p_props);
void btif_init_ok(UNUSED_ATTR uint16_t event, UNUSED_ATTR char *p_param);
-void btif_init_fail(UNUSED_ATTR uint16_t event, UNUSED_ATTR char *p_param);
#endif /* BTIF_COMMON_H */
** Static functions
************************************************************************************/
static void btif_jni_associate(UNUSED_ATTR uint16_t event, UNUSED_ATTR char *p_param);
-static void btif_jni_disassociate(UNUSED_ATTR uint16_t event, UNUSED_ATTR char *p_param);
+static void btif_jni_disassociate();
static bool btif_fetch_property(const char *key, bt_bdaddr_t *addr);
/* sends message to btif task */
/** TODO: Move these to _common.h */
void bte_main_boot_entry(void);
void bte_main_disable(void);
-void bte_main_shutdown(void);
+void bte_main_cleanup(void);
#if (defined(HCILP_INCLUDED) && HCILP_INCLUDED == TRUE)
void bte_main_enable_lpm(BOOLEAN enable);
#endif
BTA_EnableBluetooth(bte_dm_evt);
}
-void btif_init_fail(UNUSED_ATTR uint16_t event, UNUSED_ATTR char *p_param) {
- BTIF_TRACE_DEBUG("btif_task: hardware init failed");
- bte_main_disable();
- btif_queue_release();
- bte_main_shutdown();
- btif_dut_mode = 0;
-
- future_ready(stack_manager_get_hack_future(), FUTURE_FAIL);
-}
-
/*******************************************************************************
**
** Function btif_task
/*******************************************************************************
**
-** Function btif_shutdown_bluetooth
+** Function btif_cleanup_bluetooth
**
-** Description Finalizes BT scheduler shutdown and terminates BTIF
-** task.
+** Description Cleanup BTIF state.
**
** Returns void
**
*******************************************************************************/
-bt_status_t btif_shutdown_bluetooth(void)
+bt_status_t btif_cleanup_bluetooth(void)
{
BTIF_TRACE_DEBUG("%s", __FUNCTION__);
btif_dm_cleanup();
-
- btif_transfer_context(btif_jni_disassociate, 0, NULL, 0, NULL);
-
+ btif_jni_disassociate();
btif_queue_release();
thread_free(bt_jni_workqueue_thread);
bt_jni_workqueue_thread = NULL;
- bte_main_shutdown();
+ bte_main_cleanup();
btif_dut_mode = 0;
HAL_CBACK(bt_hal_cbacks, thread_evt_cb, ASSOCIATE_JVM);
}
-static void btif_jni_disassociate(UNUSED_ATTR uint16_t event, UNUSED_ATTR char *p_param) {
+static void btif_jni_disassociate() {
BTIF_TRACE_DEBUG("%s Disassociating thread from JVM", __func__);
HAL_CBACK(bt_hal_cbacks, thread_evt_cb, DISASSOCIATE_JVM);
bt_hal_cbacks = NULL;
- future_ready(stack_manager_get_hack_future(), FUTURE_SUCCESS);
}
-
btif_sdp_execute_service(b_enable);
}break;
default:
- BTIF_TRACE_ERROR("%s: Unknown service being enabled", __FUNCTION__);
+ BTIF_TRACE_ERROR("%s: Unknown service %d being %s",
+ __func__, service_id,
+ (b_enable) ? "enabled" : "disabled");
return BT_STATUS_FAIL;
}
return BT_STATUS_SUCCESS;
hack_future = local_hack_future;
stack_is_initialized = false;
- btif_shutdown_bluetooth();
+ btif_cleanup_bluetooth();
module_clean_up(get_module(BTIF_CONFIG_MODULE));
module_clean_up(get_module(BT_UTILS_MODULE));
-
- future_await(local_hack_future);
module_clean_up(get_module(OSI_MODULE));
module_management_stop();
LOG_INFO(LOG_TAG, "%s finished", __func__);
/******************************************************************************
**
-** Function bte_main_shutdown
+** Function bte_main_cleanup
**
-** Description BTE MAIN API - Shutdown code for BTE chip/stack
+** Description BTE MAIN API - Cleanup code for BTE chip/stack
**
** Returns None
**
******************************************************************************/
-void bte_main_shutdown()
+void bte_main_cleanup()
{
data_dispatcher_register_default(hci_layer_get_interface()->event_dispatcher, NULL);
hci->set_data_queue(NULL);