OSDN Git Service

android: Add stubs for daemon-side HID support
authorJohan Hedberg <johan.hedberg@intel.com>
Wed, 23 Oct 2013 07:14:58 +0000 (10:14 +0300)
committerJohan Hedberg <johan.hedberg@intel.com>
Wed, 23 Oct 2013 07:14:58 +0000 (10:14 +0300)
Makefile.android
android/Android.mk
android/hid.c [new file with mode: 0644]
android/hid.h [new file with mode: 0644]
android/main.c

index 052d755..90d5973 100644 (file)
@@ -9,6 +9,7 @@ android_bluetoothd_SOURCES =    android/main.c \
                                src/shared/util.h src/shared/util.c \
                                src/shared/mgmt.h src/shared/mgmt.c \
                                android/adapter.h android/adapter.c \
+                               android/hid.h android/hid.c \
                                android/ipc.h android/ipc.c
 
 android_bluetoothd_LDADD = lib/libbluetooth-internal.la @GLIB_LIBS@
index c4b0621..bad5ebc 100644 (file)
@@ -16,6 +16,7 @@ LOCAL_SRC_FILES := \
        main.c \
        log.c \
        adapter.c \
+       hid.c \
        ipc.c ipc.h \
        ../src/shared/mgmt.c \
        ../src/shared/util.c \
diff --git a/android/hid.c b/android/hid.c
new file mode 100644 (file)
index 0000000..72eef0d
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ *
+ *  BlueZ - Bluetooth protocol stack for Linux
+ *
+ *  Copyright (C) 2013  Intel Corporation. All rights reserved.
+ *
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#include <stdint.h>
+
+#include <glib.h>
+
+#include "log.h"
+#include "hal-msg.h"
+#include "ipc.h"
+#include "hid.h"
+
+void bt_hid_handle_cmd(GIOChannel *io, uint8_t opcode, void *buf, uint16_t len)
+{
+       uint8_t status = HAL_ERROR_FAILED;
+
+       switch (opcode) {
+       case HAL_MSG_OP_BT_HID_CONNECT:
+               break;
+       case HAL_MSG_OP_BT_HID_DISCONNECT:
+               break;
+       default:
+               DBG("Unhandled command, opcode 0x%x", opcode);
+               break;
+       }
+
+       ipc_send_error(io, HAL_SERVICE_ID_BLUETOOTH, status);
+}
diff --git a/android/hid.h b/android/hid.h
new file mode 100644 (file)
index 0000000..1247488
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ *
+ *  BlueZ - Bluetooth protocol stack for Linux
+ *
+ *  Copyright (C) 2013  Intel Corporation. All rights reserved.
+ *
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+void bt_hid_handle_cmd(GIOChannel *io, uint8_t opcode, void *buf, uint16_t len);
index 988d08b..5e297f7 100644 (file)
@@ -49,6 +49,7 @@
 #include "src/shared/mgmt.h"
 
 #include "adapter.h"
+#include "hid.h"
 #include "hal-msg.h"
 #include "ipc.h"
 
@@ -162,6 +163,10 @@ static gboolean cmd_watch_cb(GIOChannel *io, GIOCondition cond,
                bt_adapter_handle_cmd(hal_cmd_io, msg->opcode, msg->payload,
                                                                msg->len);
                break;
+       case HAL_SERVICE_ID_HIDHOST:
+               bt_hid_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;