#define LOG_TAG "bt_main"
#include <assert.h>
-#include <cutils/properties.h>
#include <fcntl.h>
-#include <hardware/bluetooth.h>
#include <pthread.h>
#include <signal.h>
#include <stdlib.h>
#include <time.h>
-#include "osi/include/alarm.h"
-#include "bta_api.h"
+#include <hardware/bluetooth.h>
+
#include "bt_hci_bdroid.h"
+#include "bt_utils.h"
+#include "bta_api.h"
+#include "btcore/include/counter.h"
+#include "btcore/include/module.h"
#include "bte.h"
#include "btif_common.h"
-#include "btu.h"
#include "btsnoop.h"
-#include "bt_utils.h"
-#include "btcore/include/counter.h"
+#include "btu.h"
+#include "gki.h"
+#include "hci_layer.h"
+#include "osi/include/alarm.h"
#include "osi/include/fixed_queue.h"
#include "osi/include/future.h"
-#include "gki.h"
#include "osi/include/hash_functions.h"
#include "osi/include/hash_map.h"
-#include "hci_layer.h"
-#include "btcore/include/module.h"
-#include "osi/include/osi.h"
#include "osi/include/log.h"
-#include "stack_config.h"
+#include "osi/include/osi.h"
#include "osi/include/thread.h"
-#include "vendor.h"
+#include "stack_config.h"
/*******************************************************************************
** Constants & Macros
/* Run-time configuration file for BLE*/
#ifndef BTE_BLE_STACK_CONF_FILE
+// TODO(armansito): Find a better way than searching by a hardcoded path.
+#if defined(OS_GENERIC)
+#define BTE_BLE_STACK_CONF_FILE "ble_stack.conf"
+#else // !defined(OS_GENERIC)
#define BTE_BLE_STACK_CONF_FILE "/etc/bluetooth/ble_stack.conf"
-#endif
+#endif // defined(OS_GENERIC)
+#endif // BT_BLE_STACK_CONF_FILE
/******************************************************************************
** Variables
hci = hci_layer_get_interface();
if (!hci)
- LOG_ERROR("%s could not get hci layer interface.", __func__);
+ LOG_ERROR(LOG_TAG, "%s could not get hci layer interface.", __func__);
btu_hci_msg_queue = fixed_queue_new(SIZE_MAX);
if (btu_hci_msg_queue == NULL) {
- LOG_ERROR("%s unable to allocate hci message queue.", __func__);
+ LOG_ERROR(LOG_TAG, "%s unable to allocate hci message queue.", __func__);
return;
}
**
** Function bte_main_lpm_allow_bt_device_sleep
**
-** Description BTE MAIN API - Allow BT controller goest to sleep
+** Description BTE MAIN API - Allow the BT controller to go to sleep
**
** Returns None
**
}
#endif // HCILP_INCLUDED
-
-/* NOTICE:
- * Definitions for audio state structure, this type needs to match to
- * the bt_vendor_op_audio_state_t type defined in bt_vendor_lib.h
- */
-typedef struct {
- UINT16 handle;
- UINT16 peer_codec;
- UINT16 state;
-} bt_hc_audio_state_t;
-
-struct bt_audio_state_tag {
- BT_HDR hdr;
- bt_hc_audio_state_t audio;
-};
-
-/******************************************************************************
-**
-** Function set_audio_state
-**
-** Description Sets audio state on controller state for SCO (PCM, WBS, FM)
-**
-** Parameters handle: codec related handle for SCO: sco cb idx, unused for
-** codec: BTA_AG_CODEC_MSBC, BTA_AG_CODEC_CSVD or FM codec
-** state: codec state, eg. BTA_AG_CO_AUD_STATE_SETUP
-** param: future extensions, e.g. call-in structure/event.
-**
-** Returns None
-**
-******************************************************************************/
-int set_audio_state(UINT16 handle, UINT16 codec, UINT8 state, void *param)
-{
- struct bt_audio_state_tag *p_msg;
- int result = -1;
-
- APPL_TRACE_API("set_audio_state(handle: %d, codec: 0x%x, state: %d)", handle,
- codec, state);
- if (NULL != param)
- APPL_TRACE_WARNING("set_audio_state() non-null param not supported");
- p_msg = (struct bt_audio_state_tag *)GKI_getbuf(sizeof(*p_msg));
- if (!p_msg)
- return result;
- p_msg->audio.handle = handle;
- p_msg->audio.peer_codec = codec;
- p_msg->audio.state = state;
-
- p_msg->hdr.event = MSG_CTRL_TO_HC_CMD | (MSG_SUB_EVT_MASK & BT_HC_AUDIO_STATE);
- p_msg->hdr.len = sizeof(p_msg->audio);
- p_msg->hdr.offset = 0;
- /* layer_specific shall contain return path event! for BTA events!
- * 0 means no return message is expected. */
- p_msg->hdr.layer_specific = 0;
- vendor_get_interface()->send_command(VENDOR_SET_AUDIO_STATE, &(p_msg->audio));
- return result;
-}
-
-
/******************************************************************************
**
** Function bte_main_hci_send