OSDN Git Service

android: Add initial code for handling adapter commands
authorSzymon Janc <szymon.janc@tieto.com>
Tue, 22 Oct 2013 16:47:52 +0000 (18:47 +0200)
committerJohan Hedberg <johan.hedberg@intel.com>
Tue, 22 Oct 2013 20:17:46 +0000 (23:17 +0300)
No commands are handled yet.

android/adapter.c
android/adapter.h
android/main.c

index cae3187..5621e67 100644 (file)
 
 #include <errno.h>
 
+#include <glib.h>
+
 #include "lib/bluetooth.h"
 #include "src/shared/mgmt.h"
 #include "lib/mgmt.h"
 #include "log.h"
+#include "hal-msg.h"
+#include "ipc.h"
 #include "adapter.h"
 
 struct bt_adapter {
@@ -285,3 +289,13 @@ bool bt_adapter_init(uint16_t index, struct mgmt *mgmt_if,
 
        return adapter;
 }
+
+void bt_adapter_handle_cmd(GIOChannel *io, uint8_t opcode, void *buf,
+                                                               uint16_t len)
+{
+       switch (opcode) {
+       default:
+               ipc_send_error(io, HAL_SERVICE_ID_BLUETOOTH, HAL_ERROR_FAILED);
+               break;
+       }
+}
index d8ad191..bfd4932 100644 (file)
@@ -34,3 +34,6 @@ typedef void (*bt_adapter_ready)(struct bt_adapter *adapter, int err);
 
 bool bt_adapter_init(uint16_t index, struct mgmt *mgmt_if,
                                                bt_adapter_ready func);
+
+void bt_adapter_handle_cmd(GIOChannel *io, uint8_t opcode, void *buf,
+                                                               uint16_t len);
index d4916ca..f3e2baa 100644 (file)
@@ -155,6 +155,10 @@ static gboolean cmd_watch_cb(GIOChannel *io, GIOCondition cond,
        case HAL_SERVICE_ID_CORE:
                handle_service_core(msg->opcode, buf + sizeof(*msg), msg->len);
                break;
+       case HAL_SERVICE_ID_BLUETOOTH:
+               bt_adapter_handle_cmd(hal_cmd_io, msg->opcode, msg->payload,
+                                                               msg->len);
+               break;
        default:
                ipc_send_error(hal_cmd_io, msg->service_id, HAL_ERROR_FAILED);
                break;