// extern const btav_interface_t *btif_av_get_sink_interface(void);
static void bt_stack_evt(tBT_APP_EVT event, tBT_APP_EVT_DATA *p_data);
-static void bt_stack_state_changed(bt_state_t state);
-
// static bt_bdaddr_t peer_bd_addr = {{0x00, 0x1b, 0xdc, 0x08, 0x0f, 0xe7}};
-static bt_callbacks_t bt_callbacks = {
- bt_stack_state_changed
-};
osi_alarm_t *app_alarm = NULL;
(void *)p_data, sizeof(tBT_APP_EVT_DATA), NULL);
}
-static void bt_stack_state_changed(bt_state_t state)
+void app_main_entry(void)
{
- if (state == BT_STATE_ON) {
- bt_stack_evt(BT_APP_EVT_STACK_ON, NULL);
+ bt_status_t init, enable;
+ init = BTIF_InitStack();
+ if (init != BT_STATUS_SUCCESS) {
+ return;
}
-}
-void app_main_entry(void)
-{
- bt_status_t stat;
- stat = BTIF_InitStack(&bt_callbacks);
- if (stat == BT_STATUS_SUCCESS) {
- BTIF_EnableStack();
+ enable = BTIF_EnableStack();
+ if (enable != BT_STATUS_SUCCESS) {
+ return;
}
+
+ bt_stack_evt(BT_APP_EVT_STACK_ON, NULL);
}
************************************************************************************/
static bool stack_is_initialized = false;
static bool stack_is_running = false;
-static bt_callbacks_t *bt_hal_cbacks = NULL;
static future_t *hack_future = NULL;
-static bt_status_t event_init_stack(bt_callbacks_t *cb);
+static bt_status_t event_init_stack(void);
static bt_status_t event_start_up_stack(void);
static bt_status_t event_shut_down_stack(void);
static bt_status_t event_clean_up_stack(void);
-static void event_signal_stack_up(UNUSED_ATTR uint16_t event, UNUSED_ATTR char *p_param);
-static void event_signal_stack_down(UNUSED_ATTR uint16_t event, UNUSED_ATTR char *p_param);
-static bt_status_t event_init_stack(bt_callbacks_t *cb)
+static bt_status_t event_init_stack(void)
{
bt_status_t ret;
if (!stack_is_initialized) {
return BT_STATUS_FAIL;
}
if (ret == BT_STATUS_SUCCESS) {
- bt_hal_cbacks = cb;
stack_is_initialized = true;
}
return ret;
stack_is_running = true;
LOG_DEBUG("%s finished\n", __func__);
- btif_transfer_context(event_signal_stack_up, 0, NULL, 0, NULL);
return BT_STATUS_SUCCESS;
}
future_await(hack_future);
LOG_DEBUG("%s finished.\n", __func__);
- btif_transfer_context(event_signal_stack_down, 0, NULL, 0, NULL);
return BT_STATUS_SUCCESS;
}
return BT_STATUS_SUCCESS;
}
-static void event_signal_stack_up(UNUSED_ATTR uint16_t event, UNUSED_ATTR char *p_param)
+bt_status_t BTIF_InitStack(void)
{
- HAL_CBACK(bt_hal_cbacks, adapter_state_changed_cb, BT_STATE_ON);
-}
-
-static void event_signal_stack_down(UNUSED_ATTR uint16_t event, UNUSED_ATTR char *p_param)
-{
- HAL_CBACK(bt_hal_cbacks, adapter_state_changed_cb, BT_STATE_OFF);
-}
-
-bt_status_t BTIF_InitStack(bt_callbacks_t *cb)
-{
- return event_init_stack(cb);
+ return event_init_stack();
}
bt_status_t BTIF_EnableStack(void)