#include "ipc.h"
#include "adapter.h"
+static GIOChannel *notification_io = NULL;
+
struct bt_adapter {
uint16_t index;
struct mgmt *mgmt;
ipc_send_error(io, HAL_SERVICE_ID_BLUETOOTH, status);
}
+
+bool bt_adapter_register(GIOChannel *io)
+{
+ DBG("");
+
+ notification_io = g_io_channel_ref(io);
+
+ return true;
+}
+
+void bt_adapter_unregister(void)
+{
+ DBG("");
+
+ g_io_channel_unref(notification_io);
+ notification_io = NULL;
+}
void bt_adapter_handle_cmd(GIOChannel *io, uint8_t opcode, void *buf,
uint16_t len);
+
+bool bt_adapter_register(GIOChannel *io);
+void bt_adapter_unregister(void);
goto error;
switch (m->service_id) {
+ case HAL_SERVICE_ID_BLUETOOTH:
+ if (!bt_adapter_register(hal_notif_io))
+ goto error;
+
+ break;
default:
DBG("service %u not supported", m->service_id);
goto error;
goto error;
switch (m->service_id) {
+ case HAL_SERVICE_ID_BLUETOOTH:
+ bt_adapter_unregister();
+ break;
default:
/* This would indicate bug in HAL, as unregister should not be
* called in init failed */