Only adapter state callback is handled for now.
bt_callbacks_t *bt_hal_cbacks = NULL;
+static void handle_adapter_state_changed(void *buf)
+{
+ struct hal_msg_ev_bt_adapter_state_changed *ev = buf;
+
+ if (bt_hal_cbacks->adapter_state_changed_cb)
+ bt_hal_cbacks->adapter_state_changed_cb(ev->state);
+}
+
+/* will be called from notification thread context */
+void bt_notify_adapter(uint16_t opcode, void *buf, uint16_t len)
+{
+ if (!bt_hal_cbacks)
+ return;
+
+ switch (opcode) {
+ case HAL_MSG_EV_BT_ADAPTER_STATE_CHANGED:
+ handle_adapter_state_changed(buf);
+ break;
+ default:
+ DBG("Unhandled callback opcode=0x%x", opcode);
+ break;
+ }
+}
+
static bool interface_ready(void)
{
return bt_hal_cbacks != NULL;
#include <cutils/properties.h>
+#include "hal.h"
#include "hal-msg.h"
#include "hal-log.h"
#include "hal-ipc.h"
static void notification_dispatch(struct hal_msg_hdr *msg, int fd)
{
switch (msg->service_id) {
+ case HAL_SERVICE_ID_BLUETOOTH:
+ bt_notify_adapter(msg->opcode, msg->payload, msg->len);
+ break;
default:
DBG("Unhandled notification service=%d opcode=0x%x",
msg->service_id, msg->opcode);
bthh_interface_t *bt_get_hidhost_interface(void);
btpan_interface_t *bt_get_pan_interface(void);
btav_interface_t *bt_get_av_interface(void);
+
+void bt_notify_adapter(uint16_t opcode, void *buf, uint16_t len);