linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] android/gatt: Add initial files
@ 2014-03-03  9:29 Grzegorz Kolodziejczyk
  2014-03-03  9:29 ` [PATCH 2/2] android/gatt: Add stubs for GATT commands handlers Grzegorz Kolodziejczyk
  2014-03-03 14:39 ` [PATCH 1/2] android/gatt: Add initial files Szymon Janc
  0 siblings, 2 replies; 4+ messages in thread
From: Grzegorz Kolodziejczyk @ 2014-03-03  9:29 UTC (permalink / raw)
  To: linux-bluetooth

This adds initial daemon code for GATT profile.
---
 android/Android.mk  |  1 +
 android/Makefile.am |  1 +
 android/gatt.c      | 44 ++++++++++++++++++++++++++++++++++++++++++++
 android/gatt.h      | 25 +++++++++++++++++++++++++
 android/main.c      | 13 +++++++++++++
 5 files changed, 84 insertions(+)
 create mode 100644 android/gatt.c
 create mode 100644 android/gatt.h

diff --git a/android/Android.mk b/android/Android.mk
index 56b86ba..429a4b8 100644
--- a/android/Android.mk
+++ b/android/Android.mk
@@ -42,6 +42,7 @@ LOCAL_SRC_FILES := \
 	bluez/android/avrcp-lib.c \
 	bluez/android/pan.c \
 	bluez/android/handsfree.c \
+	bluez/android/gatt.c
 	bluez/src/log.c \
 	bluez/src/shared/mgmt.c \
 	bluez/src/shared/util.c \
diff --git a/android/Makefile.am b/android/Makefile.am
index 31f905c..6be6cda 100644
--- a/android/Makefile.am
+++ b/android/Makefile.am
@@ -40,6 +40,7 @@ android_bluetoothd_SOURCES = android/main.c \
 				android/socket.h android/socket.c \
 				android/pan.h android/pan.c \
 				android/handsfree.h android/handsfree.c \
+				android/gatt.h android/gatt.c \
 				btio/btio.h btio/btio.c \
 				src/sdp-client.h src/sdp-client.c \
 				profiles/network/bnep.h profiles/network/bnep.c
diff --git a/android/gatt.c b/android/gatt.c
new file mode 100644
index 0000000..f577446
--- /dev/null
+++ b/android/gatt.c
@@ -0,0 +1,44 @@
+/*
+ *
+ *  BlueZ - Bluetooth protocol stack for Linux
+ *
+ *  Copyright (C) 2014  Intel Corporation. All rights reserved.
+ *
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This library 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
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdbool.h>
+#include <stdlib.h>
+#include <stdint.h>
+
+#include "ipc.h"
+#include "lib/bluetooth.h"
+#include "gatt.h"
+
+bool bt_gatt_register(struct ipc *ipc, const bdaddr_t *addr)
+{
+	return false;
+}
+
+void bt_gatt_unregister(void)
+{
+
+}
diff --git a/android/gatt.h b/android/gatt.h
new file mode 100644
index 0000000..d4392d9
--- /dev/null
+++ b/android/gatt.h
@@ -0,0 +1,25 @@
+/*
+ *
+ *  BlueZ - Bluetooth protocol stack for Linux
+ *
+ *  Copyright (C) 2014  Intel Corporation. All rights reserved.
+ *
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This library 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
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+bool bt_gatt_register(struct ipc *ipc, const bdaddr_t *addr);
+void bt_gatt_unregister(void);
diff --git a/android/main.c b/android/main.c
index a6742ef..7b5ca9c 100644
--- a/android/main.c
+++ b/android/main.c
@@ -58,6 +58,7 @@
 #include "pan.h"
 #include "avrcp.h"
 #include "handsfree.h"
+#include "gatt.h"
 
 #define STARTUP_GRACE_SECONDS 5
 #define SHUTDOWN_GRACE_SECONDS 10
@@ -125,6 +126,12 @@ static void service_register(const void *buf, uint16_t len)
 			goto failed;
 		}
 
+	case HAL_SERVICE_ID_GATT:
+		if (!bt_gatt_register(hal_ipc, &adapter_bdaddr)) {
+			status = HAL_STATUS_FAILED;
+			goto failed;
+		}
+
 		break;
 	default:
 		DBG("service %u not supported", m->service_id);
@@ -175,6 +182,9 @@ static void service_unregister(const void *buf, uint16_t len)
 	case HAL_SERVICE_ID_HANDSFREE:
 		bt_handsfree_unregister();
 		break;
+	case HAL_SERVICE_ID_GATT:
+		bt_gatt_unregister();
+		break;
 	default:
 		/* This would indicate bug in HAL, as unregister should not be
 		 * called in init failed */
@@ -371,6 +381,9 @@ static void cleanup_services(void)
 		case HAL_SERVICE_ID_HANDSFREE:
 			bt_handsfree_unregister();
 			break;
+		case HAL_SERVICE_ID_GATT:
+			bt_gatt_unregister();
+			break;
 		}
 
 		services[i] = false;
-- 
1.8.5.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] android/gatt: Add stubs for GATT commands handlers
  2014-03-03  9:29 [PATCH 1/2] android/gatt: Add initial files Grzegorz Kolodziejczyk
@ 2014-03-03  9:29 ` Grzegorz Kolodziejczyk
  2014-03-03 14:41   ` Szymon Janc
  2014-03-03 14:39 ` [PATCH 1/2] android/gatt: Add initial files Szymon Janc
  1 sibling, 1 reply; 4+ messages in thread
From: Grzegorz Kolodziejczyk @ 2014-03-03  9:29 UTC (permalink / raw)
  To: linux-bluetooth

Add empty handlers for GATT IPC commands.
---
 android/gatt.c | 414 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 413 insertions(+), 1 deletion(-)

diff --git a/android/gatt.c b/android/gatt.c
index f577446..7a01d15 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -28,17 +28,429 @@
 #include <stdbool.h>
 #include <stdlib.h>
 #include <stdint.h>
+#include <glib.h>
 
 #include "ipc.h"
 #include "lib/bluetooth.h"
 #include "gatt.h"
+#include "src/log.h"
+#include "hal-msg.h"
+
+static struct ipc *hal_ipc = NULL;
+static bdaddr_t adapter_addr;
+
+static void handle_client_register(const void *buf, uint16_t len)
+{
+	DBG("");
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT, HAL_OP_GATT_CLIENT_REGISTER,
+							HAL_STATUS_FAILED);
+}
+
+static void handle_client_unregister(const void *buf, uint16_t len)
+{
+	DBG("");
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+			HAL_OP_GATT_CLIENT_UNREGISTER, HAL_STATUS_FAILED);
+}
+
+static void handle_client_scan(const void *buf, uint16_t len)
+{
+	DBG("");
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT, HAL_OP_GATT_CLIENT_SCAN,
+							HAL_STATUS_FAILED);
+}
+
+static void handle_client_connect(const void *buf, uint16_t len)
+{
+	DBG("");
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT, HAL_OP_GATT_CLIENT_CONNECT,
+							HAL_STATUS_FAILED);
+}
+
+static void handle_client_disconnect(const void *buf, uint16_t len)
+{
+	DBG("");
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+			HAL_OP_GATT_CLIENT_DISCONNECT, HAL_STATUS_FAILED);
+}
+
+static void handle_client_listen(const void *buf, uint16_t len)
+{
+	DBG("");
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT, HAL_OP_GATT_CLIENT_LISTEN,
+							HAL_STATUS_FAILED);
+}
+
+static void handle_client_refresh(const void *buf, uint16_t len)
+{
+	DBG("");
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT, HAL_OP_GATT_CLIENT_REFRESH,
+							HAL_STATUS_FAILED);
+}
+
+static void handle_client_search_service(const void *buf, uint16_t len)
+{
+	DBG("");
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+			HAL_OP_GATT_CLIENT_SEARCH_SERVICE, HAL_STATUS_FAILED);
+}
+
+static void handle_client_get_included_service(const void *buf, uint16_t len)
+{
+	DBG("");
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+					HAL_OP_GATT_CLIENT_GET_INCLUDED_SERVICE,
+					HAL_STATUS_FAILED);
+}
+
+static void handle_client_get_characteristic(const void *buf, uint16_t len)
+{
+	DBG("");
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+					HAL_OP_GATT_CLIENT_GET_CHARACTERISTIC,
+					HAL_STATUS_FAILED);
+}
+
+static void handle_client_get_descriptor(const void *buf, uint16_t len)
+{
+	DBG("");
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+			HAL_OP_GATT_CLIENT_GET_DESCRIPTOR, HAL_STATUS_FAILED);
+}
+
+static void handle_client_read_characteristic(const void *buf, uint16_t len)
+{
+	DBG("");
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+					HAL_OP_GATT_CLIENT_READ_CHARACTERISTIC,
+					HAL_STATUS_FAILED);
+}
+
+static void handle_client_write_characteristic(const void *buf, uint16_t len)
+{
+	DBG("");
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+					HAL_OP_GATT_CLIENT_WRITE_CHARACTERISTIC,
+					HAL_STATUS_FAILED);
+}
+
+static void handle_client_read_descriptor(const void *buf, uint16_t len)
+{
+	DBG("");
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+			HAL_OP_GATT_CLIENT_READ_DESCRIPTOR, HAL_STATUS_FAILED);
+}
+
+static void handle_client_write_descriptor(const void *buf, uint16_t len)
+{
+	DBG("");
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+			HAL_OP_GATT_CLIENT_WRITE_DESCRIPTOR, HAL_STATUS_FAILED);
+}
+
+static void handle_client_execute_write(const void *buf, uint16_t len)
+{
+	DBG("");
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+			HAL_OP_GATT_CLIENT_EXECUTE_WRITE, HAL_STATUS_FAILED);
+}
+
+static void handle_client_register_for_notification(const void *buf,
+								uint16_t len)
+{
+	DBG("");
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+				HAL_OP_GATT_CLIENT_REGISTER_FOR_NOTIFICATION,
+				HAL_STATUS_FAILED);
+}
+
+static void handle_client_deregister_for_notification(const void *buf,
+								uint16_t len)
+{
+	DBG("");
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+				HAL_OP_GATT_CLIENT_DEREGISTER_FOR_NOTIFICATION,
+				HAL_STATUS_FAILED);
+}
+
+static void handle_client_read_remote_rssi(const void *buf, uint16_t len)
+{
+	DBG("");
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+			HAL_OP_GATT_CLIENT_READ_REMOTE_RSSI, HAL_STATUS_FAILED);
+}
+
+static void handle_client_get_device_type(const void *buf, uint16_t len)
+{
+	DBG("");
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+			HAL_OP_GATT_CLIENT_GET_DEVICE_TYPE, HAL_STATUS_FAILED);
+}
+
+static void handle_client_set_adv_data(const void *buf, uint16_t len)
+{
+	DBG("");
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+			HAL_OP_GATT_CLIENT_SET_ADV_DATA, HAL_STATUS_FAILED);
+}
+
+static void handle_client_test_command(const void *buf, uint16_t len)
+{
+	DBG("");
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+			HAL_OP_GATT_CLIENT_TEST_COMMAND, HAL_STATUS_FAILED);
+}
+
+static void handle_server_register(const void *buf, uint16_t len)
+{
+	DBG("");
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT, HAL_OP_GATT_SERVER_REGISTER,
+							HAL_STATUS_FAILED);
+}
+
+static void handle_server_unregister(const void *buf, uint16_t len)
+{
+	DBG("");
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+			HAL_OP_GATT_SERVER_UNREGISTER, HAL_STATUS_FAILED);
+}
+
+static void handle_server_connect(const void *buf, uint16_t len)
+{
+	DBG("");
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT, HAL_OP_GATT_SERVER_CONNECT,
+							HAL_STATUS_FAILED);
+}
+
+static void handle_server_disconnect(const void *buf, uint16_t len)
+{
+	DBG("");
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+			HAL_OP_GATT_SERVER_DISCONNECT, HAL_STATUS_FAILED);
+}
+
+static void handle_server_add_service(const void *buf, uint16_t len)
+{
+	DBG("");
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+			HAL_OP_GATT_SERVER_ADD_SERVICE, HAL_STATUS_FAILED);
+}
+
+static void handle_server_add_included_service(const void *buf, uint16_t len)
+{
+	DBG("");
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+			HAL_OP_GATT_SERVER_ADD_INC_SERVICE, HAL_STATUS_FAILED);
+}
+
+static void handle_server_add_characteristic(const void *buf, uint16_t len)
+{
+	DBG("");
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+					HAL_OP_GATT_SERVER_ADD_CHARACTERISTIC,
+					HAL_STATUS_FAILED);
+}
+
+static void handle_server_add_descriptor(const void *buf, uint16_t len)
+{
+	DBG("");
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+			HAL_OP_GATT_SERVER_ADD_DESCRIPTOR, HAL_STATUS_FAILED);
+}
+
+static void handle_server_start_service(const void *buf, uint16_t len)
+{
+	DBG("");
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+			HAL_OP_GATT_SERVER_START_SERVICE, HAL_STATUS_FAILED);
+}
+
+static void handle_server_stop_service(const void *buf, uint16_t len)
+{
+	DBG("");
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+			HAL_OP_GATT_SERVER_STOP_SERVICE, HAL_STATUS_FAILED);
+}
+
+static void handle_server_delete_service(const void *buf, uint16_t len)
+{
+	DBG("");
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+			HAL_OP_GATT_SERVER_DELETE_SERVICE, HAL_STATUS_FAILED);
+}
+
+static void handle_server_send_indication(const void *buf, uint16_t len)
+{
+	DBG("");
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+			HAL_OP_GATT_SERVER_SEND_INDICATION, HAL_STATUS_FAILED);
+}
+
+static void handle_server_send_response(const void *buf, uint16_t len)
+{
+	DBG("");
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
+			HAL_OP_GATT_SERVER_SEND_RESPONSE, HAL_STATUS_FAILED);
+}
+
+static const struct ipc_handler cmd_handlers[] = {
+	/* HAL_OP_GATT_CLIENT_REGISTER */
+	{handle_client_register, false,
+				sizeof(struct hal_cmd_gatt_client_register)},
+	/* HAL_OP_GATT_CLIENT_UNREGISTER */
+	{handle_client_unregister, false,
+				sizeof(struct hal_cmd_gatt_client_unregister)},
+	/* HAL_OP_GATT_CLIENT_SCAN */
+	{handle_client_scan, false,
+				sizeof(struct hal_cmd_gatt_client_scan)},
+	/* HAL_OP_GATT_CLIENT_CONNECT */
+	{handle_client_connect, false,
+				sizeof(struct hal_cmd_gatt_client_connect)},
+	/* HAL_OP_GATT_CLIENT_DISCONNECT */
+	{handle_client_disconnect, false,
+				sizeof(struct hal_cmd_gatt_client_disconnect)},
+	/* HAL_OP_GATT_CLIENT_LISTEN */
+	{handle_client_listen, false,
+				sizeof(struct hal_cmd_gatt_client_listen)},
+	/* HAL_OP_GATT_CLIENT_REFRESH */
+	{handle_client_refresh, false,
+				sizeof(struct hal_cmd_gatt_client_refresh)},
+	/* HAL_OP_GATT_CLIENT_SEARCH_SERVICE */
+	{handle_client_search_service, true,
+			sizeof(struct hal_cmd_gatt_client_search_service)},
+	/* HAL_OP_GATT_CLIENT_GET_INCLUDED_SERVICE */
+	{handle_client_get_included_service, true,
+		sizeof(struct hal_cmd_gatt_client_get_included_service)},
+	/* HAL_OP_GATT_CLIENT_GET_CHARACTERISTIC */
+	{handle_client_get_characteristic, true,
+			sizeof(struct hal_cmd_gatt_client_get_characteristic)},
+	/* HAL_OP_GATT_CLIENT_GET_DESCRIPTOR */
+	{handle_client_get_descriptor, true,
+			sizeof(struct hal_cmd_gatt_client_get_descriptor)},
+	/* HAL_OP_GATT_CLIENT_READ_CHARACTERISTIC */
+	{handle_client_read_characteristic, false,
+			sizeof(struct hal_cmd_gatt_client_read_characteristic)},
+	/* HAL_OP_GATT_CLIENT_WRITE_CHARACTERISTIC */
+	{handle_client_write_characteristic, true,
+		sizeof(struct hal_cmd_gatt_client_write_characteristic)},
+	/* HAL_OP_GATT_CLIENT_READ_DESCRIPTOR */
+	{handle_client_read_descriptor, false,
+			sizeof(struct hal_cmd_gatt_client_read_descriptor)},
+	/* HAL_OP_GATT_CLIENT_WRITE_DESCRIPTOR */
+	{handle_client_write_descriptor, true,
+			sizeof(struct hal_cmd_gatt_client_write_descriptor)},
+	/* HAL_OP_GATT_CLIENT_EXECUTE_WRITE */
+	{handle_client_execute_write, false,
+			sizeof(struct hal_cmd_gatt_client_execute_write)},
+	/* HAL_OP_GATT_CLIENT_REGISTER_FOR_NOTIFICATION */
+	{handle_client_register_for_notification, false,
+		sizeof(struct hal_cmd_gatt_client_register_for_notification)},
+	/* HAL_OP_GATT_CLIENT_DEREGISTER_FOR_NOTIFICATION */
+	{handle_client_deregister_for_notification, false,
+		sizeof(struct hal_cmd_gatt_client_deregister_for_notification)},
+	/* HAL_OP_GATT_CLIENT_READ_REMOTE_RSSI */
+	{handle_client_read_remote_rssi, false,
+			sizeof(struct hal_cmd_gatt_client_read_remote_rssi)},
+	/* HAL_OP_GATT_CLIENT_GET_DEVICE_TYPE */
+	{handle_client_get_device_type, false,
+			sizeof(struct hal_cmd_gatt_client_get_device_type)},
+	/* HAL_OP_GATT_CLIENT_SET_ADV_DATA */
+	{handle_client_set_adv_data, true,
+			sizeof(struct hal_cmd_gatt_client_set_adv_data)},
+	/* HAL_OP_GATT_CLIENT_TEST_COMMAND */
+	{handle_client_test_command, false,
+			sizeof(struct hal_cmd_gatt_client_test_command)},
+	/* HAL_OP_GATT_SERVER_REGISTER */
+	{handle_server_register, false,
+				sizeof(struct hal_cmd_gatt_server_register)},
+	/* HAL_OP_GATT_SERVER_UNREGISTER */
+	{handle_server_unregister, false,
+				sizeof(struct hal_cmd_gatt_server_unregister)},
+	/* HAL_OP_GATT_SERVER_CONNECT */
+	{handle_server_connect, false,
+				sizeof(struct hal_cmd_gatt_server_connect)},
+	/* HAL_OP_GATT_SERVER_DISCONNECT */
+	{handle_server_disconnect, false,
+				sizeof(struct hal_cmd_gatt_server_disconnect)},
+	/* HAL_OP_GATT_SERVER_ADD_SERVICE */
+	{handle_server_add_service, false,
+				sizeof(struct hal_cmd_gatt_server_add_service)},
+	/* HAL_OP_GATT_SERVER_ADD_INC_SERVICE */
+	{handle_server_add_included_service, false,
+			sizeof(struct hal_cmd_gatt_server_add_inc_service)},
+	/* HAL_OP_GATT_SERVER_ADD_CHARACTERISTIC */
+	{handle_server_add_characteristic, false,
+			sizeof(struct hal_cmd_gatt_server_add_characteristic)},
+	/* HAL_OP_GATT_SERVER_ADD_DESCRIPTOR */
+	{handle_server_add_descriptor, false,
+			sizeof(struct hal_cmd_gatt_server_add_descriptor)},
+	/* HAL_OP_GATT_SERVER_START_SERVICE */
+	{handle_server_start_service, false,
+			sizeof(struct hal_cmd_gatt_server_start_service)},
+	/* HAL_OP_GATT_SERVER_STOP_SERVICE */
+	{handle_server_stop_service, false,
+			sizeof(struct hal_cmd_gatt_server_stop_service)},
+	/* HAL_OP_GATT_SERVER_DELETE_SERVICE */
+	{handle_server_delete_service, false,
+			sizeof(struct hal_cmd_gatt_server_delete_service)},
+	/* HAL_OP_GATT_SERVER_SEND_INDICATION */
+	{handle_server_send_indication, true,
+			sizeof(struct hal_cmd_gatt_server_send_indication)},
+	/* HAL_OP_GATT_SERVER_SEND_RESPONSE */
+	{handle_server_send_response, true,
+			sizeof(struct hal_cmd_gatt_server_send_response)},
+};
 
 bool bt_gatt_register(struct ipc *ipc, const bdaddr_t *addr)
 {
-	return false;
+	DBG("");
+
+	bacpy(&adapter_addr, addr);
+
+	ipc_register(hal_ipc, HAL_SERVICE_ID_GATT, cmd_handlers,
+						G_N_ELEMENTS(cmd_handlers));
+
+	return true;
 }
 
 void bt_gatt_unregister(void)
 {
+	DBG("");
 
+	ipc_unregister(hal_ipc, HAL_SERVICE_ID_GATT);
 }
-- 
1.8.5.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] android/gatt: Add initial files
  2014-03-03  9:29 [PATCH 1/2] android/gatt: Add initial files Grzegorz Kolodziejczyk
  2014-03-03  9:29 ` [PATCH 2/2] android/gatt: Add stubs for GATT commands handlers Grzegorz Kolodziejczyk
@ 2014-03-03 14:39 ` Szymon Janc
  1 sibling, 0 replies; 4+ messages in thread
From: Szymon Janc @ 2014-03-03 14:39 UTC (permalink / raw)
  To: Grzegorz Kolodziejczyk; +Cc: linux-bluetooth

Hi Grzegorz,

On Monday 03 of March 2014 10:29:16 Grzegorz Kolodziejczyk wrote:
> This adds initial daemon code for GATT profile.
> ---
>  android/Android.mk  |  1 +
>  android/Makefile.am |  1 +
>  android/gatt.c      | 44 ++++++++++++++++++++++++++++++++++++++++++++
>  android/gatt.h      | 25 +++++++++++++++++++++++++
>  android/main.c      | 13 +++++++++++++
>  5 files changed, 84 insertions(+)
>  create mode 100644 android/gatt.c
>  create mode 100644 android/gatt.h
> 
> diff --git a/android/Android.mk b/android/Android.mk
> index 56b86ba..429a4b8 100644
> --- a/android/Android.mk
> +++ b/android/Android.mk
> @@ -42,6 +42,7 @@ LOCAL_SRC_FILES := \
>  	bluez/android/avrcp-lib.c \
>  	bluez/android/pan.c \
>  	bluez/android/handsfree.c \
> +	bluez/android/gatt.c
>  	bluez/src/log.c \
>  	bluez/src/shared/mgmt.c \
>  	bluez/src/shared/util.c \
> diff --git a/android/Makefile.am b/android/Makefile.am
> index 31f905c..6be6cda 100644
> --- a/android/Makefile.am
> +++ b/android/Makefile.am
> @@ -40,6 +40,7 @@ android_bluetoothd_SOURCES = android/main.c \
>  				android/socket.h android/socket.c \
>  				android/pan.h android/pan.c \
>  				android/handsfree.h android/handsfree.c \
> +				android/gatt.h android/gatt.c \
>  				btio/btio.h btio/btio.c \
>  				src/sdp-client.h src/sdp-client.c \
>  				profiles/network/bnep.h profiles/network/bnep.c
> diff --git a/android/gatt.c b/android/gatt.c
> new file mode 100644
> index 0000000..f577446
> --- /dev/null
> +++ b/android/gatt.c
> @@ -0,0 +1,44 @@
> +/*
> + *
> + *  BlueZ - Bluetooth protocol stack for Linux
> + *
> + *  Copyright (C) 2014  Intel Corporation. All rights reserved.
> + *
> + *
> + *  This library is free software; you can redistribute it and/or
> + *  modify it under the terms of the GNU Lesser General Public
> + *  License as published by the Free Software Foundation; either
> + *  version 2.1 of the License, or (at your option) any later version.
> + *
> + *  This library 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
> + *  Lesser General Public License for more details.
> + *
> + *  You should have received a copy of the GNU Lesser General Public
> + *  License along with this library; if not, write to the Free Software
> + *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> + *
> + */
> +
> +#ifdef HAVE_CONFIG_H
> +#include <config.h>
> +#endif
> +
> +#include <stdbool.h>
> +#include <stdlib.h>
> +#include <stdint.h>
> +
> +#include "ipc.h"
> +#include "lib/bluetooth.h"
> +#include "gatt.h"
> +
> +bool bt_gatt_register(struct ipc *ipc, const bdaddr_t *addr)
> +{
> +	return false;

Indentation issue here.

> +}
> +
> +void bt_gatt_unregister(void)
> +{
> +
> +}
> diff --git a/android/gatt.h b/android/gatt.h
> new file mode 100644
> index 0000000..d4392d9
> --- /dev/null
> +++ b/android/gatt.h
> @@ -0,0 +1,25 @@
> +/*
> + *
> + *  BlueZ - Bluetooth protocol stack for Linux
> + *
> + *  Copyright (C) 2014  Intel Corporation. All rights reserved.
> + *
> + *
> + *  This library is free software; you can redistribute it and/or
> + *  modify it under the terms of the GNU Lesser General Public
> + *  License as published by the Free Software Foundation; either
> + *  version 2.1 of the License, or (at your option) any later version.
> + *
> + *  This library 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
> + *  Lesser General Public License for more details.
> + *
> + *  You should have received a copy of the GNU Lesser General Public
> + *  License along with this library; if not, write to the Free Software
> + *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> + *
> + */
> +
> +bool bt_gatt_register(struct ipc *ipc, const bdaddr_t *addr);
> +void bt_gatt_unregister(void);
> diff --git a/android/main.c b/android/main.c
> index a6742ef..7b5ca9c 100644
> --- a/android/main.c
> +++ b/android/main.c
> @@ -58,6 +58,7 @@
>  #include "pan.h"
>  #include "avrcp.h"
>  #include "handsfree.h"
> +#include "gatt.h"
>  
>  #define STARTUP_GRACE_SECONDS 5
>  #define SHUTDOWN_GRACE_SECONDS 10
> @@ -125,6 +126,12 @@ static void service_register(const void *buf, uint16_t len)
>  			goto failed;
>  		}
>  

Break is missing here.

> +	case HAL_SERVICE_ID_GATT:
> +		if (!bt_gatt_register(hal_ipc, &adapter_bdaddr)) {
> +			status = HAL_STATUS_FAILED;
> +			goto failed;
> +		}
> +
>  		break;
>  	default:
>  		DBG("service %u not supported", m->service_id);
> @@ -175,6 +182,9 @@ static void service_unregister(const void *buf, uint16_t len)
>  	case HAL_SERVICE_ID_HANDSFREE:
>  		bt_handsfree_unregister();
>  		break;
> +	case HAL_SERVICE_ID_GATT:
> +		bt_gatt_unregister();
> +		break;
>  	default:
>  		/* This would indicate bug in HAL, as unregister should not be
>  		 * called in init failed */
> @@ -371,6 +381,9 @@ static void cleanup_services(void)
>  		case HAL_SERVICE_ID_HANDSFREE:
>  			bt_handsfree_unregister();
>  			break;
> +		case HAL_SERVICE_ID_GATT:
> +			bt_gatt_unregister();
> +			break;
>  		}
>  
>  		services[i] = false;
> 

-- 
Best regards, 
Szymon Janc

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] android/gatt: Add stubs for GATT commands handlers
  2014-03-03  9:29 ` [PATCH 2/2] android/gatt: Add stubs for GATT commands handlers Grzegorz Kolodziejczyk
@ 2014-03-03 14:41   ` Szymon Janc
  0 siblings, 0 replies; 4+ messages in thread
From: Szymon Janc @ 2014-03-03 14:41 UTC (permalink / raw)
  To: Grzegorz Kolodziejczyk; +Cc: linux-bluetooth

Hi Grzegorz,

On Monday 03 of March 2014 10:29:17 Grzegorz Kolodziejczyk wrote:
> Add empty handlers for GATT IPC commands.
> ---
>  android/gatt.c | 414 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 413 insertions(+), 1 deletion(-)
> 
> diff --git a/android/gatt.c b/android/gatt.c
> index f577446..7a01d15 100644
> --- a/android/gatt.c
> +++ b/android/gatt.c
> @@ -28,17 +28,429 @@
>  #include <stdbool.h>
>  #include <stdlib.h>
>  #include <stdint.h>
> +#include <glib.h>
>  
>  #include "ipc.h"
>  #include "lib/bluetooth.h"
>  #include "gatt.h"
> +#include "src/log.h"
> +#include "hal-msg.h"
> +
> +static struct ipc *hal_ipc = NULL;
> +static bdaddr_t adapter_addr;
> +
> +static void handle_client_register(const void *buf, uint16_t len)
> +{
> +	DBG("");
> +
> +	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT, HAL_OP_GATT_CLIENT_REGISTER,
> +							HAL_STATUS_FAILED);
> +}
> +
> +static void handle_client_unregister(const void *buf, uint16_t len)
> +{
> +	DBG("");
> +
> +	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
> +			HAL_OP_GATT_CLIENT_UNREGISTER, HAL_STATUS_FAILED);
> +}
> +
> +static void handle_client_scan(const void *buf, uint16_t len)
> +{
> +	DBG("");
> +
> +	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT, HAL_OP_GATT_CLIENT_SCAN,
> +							HAL_STATUS_FAILED);
> +}
> +
> +static void handle_client_connect(const void *buf, uint16_t len)
> +{
> +	DBG("");
> +
> +	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT, HAL_OP_GATT_CLIENT_CONNECT,
> +							HAL_STATUS_FAILED);
> +}
> +
> +static void handle_client_disconnect(const void *buf, uint16_t len)
> +{
> +	DBG("");
> +
> +	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
> +			HAL_OP_GATT_CLIENT_DISCONNECT, HAL_STATUS_FAILED);
> +}
> +
> +static void handle_client_listen(const void *buf, uint16_t len)
> +{
> +	DBG("");
> +
> +	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT, HAL_OP_GATT_CLIENT_LISTEN,
> +							HAL_STATUS_FAILED);
> +}
> +
> +static void handle_client_refresh(const void *buf, uint16_t len)
> +{
> +	DBG("");
> +
> +	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT, HAL_OP_GATT_CLIENT_REFRESH,
> +							HAL_STATUS_FAILED);
> +}
> +
> +static void handle_client_search_service(const void *buf, uint16_t len)
> +{
> +	DBG("");
> +
> +	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
> +			HAL_OP_GATT_CLIENT_SEARCH_SERVICE, HAL_STATUS_FAILED);
> +}
> +
> +static void handle_client_get_included_service(const void *buf, uint16_t len)
> +{
> +	DBG("");
> +
> +	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
> +					HAL_OP_GATT_CLIENT_GET_INCLUDED_SERVICE,
> +					HAL_STATUS_FAILED);
> +}
> +
> +static void handle_client_get_characteristic(const void *buf, uint16_t len)
> +{
> +	DBG("");
> +
> +	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
> +					HAL_OP_GATT_CLIENT_GET_CHARACTERISTIC,
> +					HAL_STATUS_FAILED);
> +}
> +
> +static void handle_client_get_descriptor(const void *buf, uint16_t len)
> +{
> +	DBG("");
> +
> +	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
> +			HAL_OP_GATT_CLIENT_GET_DESCRIPTOR, HAL_STATUS_FAILED);
> +}
> +
> +static void handle_client_read_characteristic(const void *buf, uint16_t len)
> +{
> +	DBG("");
> +
> +	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
> +					HAL_OP_GATT_CLIENT_READ_CHARACTERISTIC,
> +					HAL_STATUS_FAILED);
> +}
> +
> +static void handle_client_write_characteristic(const void *buf, uint16_t len)
> +{
> +	DBG("");
> +
> +	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
> +					HAL_OP_GATT_CLIENT_WRITE_CHARACTERISTIC,
> +					HAL_STATUS_FAILED);
> +}
> +
> +static void handle_client_read_descriptor(const void *buf, uint16_t len)
> +{
> +	DBG("");
> +
> +	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
> +			HAL_OP_GATT_CLIENT_READ_DESCRIPTOR, HAL_STATUS_FAILED);
> +}
> +
> +static void handle_client_write_descriptor(const void *buf, uint16_t len)
> +{
> +	DBG("");
> +
> +	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
> +			HAL_OP_GATT_CLIENT_WRITE_DESCRIPTOR, HAL_STATUS_FAILED);
> +}
> +
> +static void handle_client_execute_write(const void *buf, uint16_t len)
> +{
> +	DBG("");
> +
> +	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
> +			HAL_OP_GATT_CLIENT_EXECUTE_WRITE, HAL_STATUS_FAILED);
> +}
> +
> +static void handle_client_register_for_notification(const void *buf,
> +								uint16_t len)
> +{
> +	DBG("");
> +
> +	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
> +				HAL_OP_GATT_CLIENT_REGISTER_FOR_NOTIFICATION,
> +				HAL_STATUS_FAILED);
> +}
> +
> +static void handle_client_deregister_for_notification(const void *buf,
> +								uint16_t len)
> +{
> +	DBG("");
> +
> +	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
> +				HAL_OP_GATT_CLIENT_DEREGISTER_FOR_NOTIFICATION,
> +				HAL_STATUS_FAILED);
> +}
> +
> +static void handle_client_read_remote_rssi(const void *buf, uint16_t len)
> +{
> +	DBG("");
> +
> +	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
> +			HAL_OP_GATT_CLIENT_READ_REMOTE_RSSI, HAL_STATUS_FAILED);
> +}
> +
> +static void handle_client_get_device_type(const void *buf, uint16_t len)
> +{
> +	DBG("");
> +
> +	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
> +			HAL_OP_GATT_CLIENT_GET_DEVICE_TYPE, HAL_STATUS_FAILED);
> +}
> +
> +static void handle_client_set_adv_data(const void *buf, uint16_t len)
> +{
> +	DBG("");
> +
> +	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
> +			HAL_OP_GATT_CLIENT_SET_ADV_DATA, HAL_STATUS_FAILED);
> +}
> +
> +static void handle_client_test_command(const void *buf, uint16_t len)
> +{
> +	DBG("");
> +
> +	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
> +			HAL_OP_GATT_CLIENT_TEST_COMMAND, HAL_STATUS_FAILED);
> +}
> +
> +static void handle_server_register(const void *buf, uint16_t len)
> +{
> +	DBG("");
> +
> +	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT, HAL_OP_GATT_SERVER_REGISTER,
> +							HAL_STATUS_FAILED);
> +}
> +
> +static void handle_server_unregister(const void *buf, uint16_t len)
> +{
> +	DBG("");
> +
> +	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
> +			HAL_OP_GATT_SERVER_UNREGISTER, HAL_STATUS_FAILED);
> +}
> +
> +static void handle_server_connect(const void *buf, uint16_t len)
> +{
> +	DBG("");
> +
> +	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT, HAL_OP_GATT_SERVER_CONNECT,
> +							HAL_STATUS_FAILED);
> +}
> +
> +static void handle_server_disconnect(const void *buf, uint16_t len)
> +{
> +	DBG("");
> +
> +	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
> +			HAL_OP_GATT_SERVER_DISCONNECT, HAL_STATUS_FAILED);
> +}
> +
> +static void handle_server_add_service(const void *buf, uint16_t len)
> +{
> +	DBG("");
> +
> +	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
> +			HAL_OP_GATT_SERVER_ADD_SERVICE, HAL_STATUS_FAILED);
> +}
> +
> +static void handle_server_add_included_service(const void *buf, uint16_t len)
> +{
> +	DBG("");
> +
> +	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
> +			HAL_OP_GATT_SERVER_ADD_INC_SERVICE, HAL_STATUS_FAILED);
> +}
> +
> +static void handle_server_add_characteristic(const void *buf, uint16_t len)
> +{
> +	DBG("");
> +
> +	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
> +					HAL_OP_GATT_SERVER_ADD_CHARACTERISTIC,
> +					HAL_STATUS_FAILED);
> +}
> +
> +static void handle_server_add_descriptor(const void *buf, uint16_t len)
> +{
> +	DBG("");
> +
> +	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
> +			HAL_OP_GATT_SERVER_ADD_DESCRIPTOR, HAL_STATUS_FAILED);
> +}
> +
> +static void handle_server_start_service(const void *buf, uint16_t len)
> +{
> +	DBG("");
> +
> +	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
> +			HAL_OP_GATT_SERVER_START_SERVICE, HAL_STATUS_FAILED);
> +}
> +
> +static void handle_server_stop_service(const void *buf, uint16_t len)
> +{
> +	DBG("");
> +
> +	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
> +			HAL_OP_GATT_SERVER_STOP_SERVICE, HAL_STATUS_FAILED);
> +}
> +
> +static void handle_server_delete_service(const void *buf, uint16_t len)
> +{
> +	DBG("");
> +
> +	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
> +			HAL_OP_GATT_SERVER_DELETE_SERVICE, HAL_STATUS_FAILED);
> +}
> +
> +static void handle_server_send_indication(const void *buf, uint16_t len)
> +{
> +	DBG("");
> +
> +	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
> +			HAL_OP_GATT_SERVER_SEND_INDICATION, HAL_STATUS_FAILED);
> +}
> +
> +static void handle_server_send_response(const void *buf, uint16_t len)
> +{
> +	DBG("");
> +
> +	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
> +			HAL_OP_GATT_SERVER_SEND_RESPONSE, HAL_STATUS_FAILED);
> +}
> +
> +static const struct ipc_handler cmd_handlers[] = {
> +	/* HAL_OP_GATT_CLIENT_REGISTER */
> +	{handle_client_register, false,
> +				sizeof(struct hal_cmd_gatt_client_register)},
> +	/* HAL_OP_GATT_CLIENT_UNREGISTER */
> +	{handle_client_unregister, false,
> +				sizeof(struct hal_cmd_gatt_client_unregister)},
> +	/* HAL_OP_GATT_CLIENT_SCAN */
> +	{handle_client_scan, false,
> +				sizeof(struct hal_cmd_gatt_client_scan)},
> +	/* HAL_OP_GATT_CLIENT_CONNECT */
> +	{handle_client_connect, false,
> +				sizeof(struct hal_cmd_gatt_client_connect)},
> +	/* HAL_OP_GATT_CLIENT_DISCONNECT */
> +	{handle_client_disconnect, false,
> +				sizeof(struct hal_cmd_gatt_client_disconnect)},
> +	/* HAL_OP_GATT_CLIENT_LISTEN */
> +	{handle_client_listen, false,
> +				sizeof(struct hal_cmd_gatt_client_listen)},
> +	/* HAL_OP_GATT_CLIENT_REFRESH */
> +	{handle_client_refresh, false,
> +				sizeof(struct hal_cmd_gatt_client_refresh)},
> +	/* HAL_OP_GATT_CLIENT_SEARCH_SERVICE */
> +	{handle_client_search_service, true,
> +			sizeof(struct hal_cmd_gatt_client_search_service)},
> +	/* HAL_OP_GATT_CLIENT_GET_INCLUDED_SERVICE */
> +	{handle_client_get_included_service, true,
> +		sizeof(struct hal_cmd_gatt_client_get_included_service)},
> +	/* HAL_OP_GATT_CLIENT_GET_CHARACTERISTIC */
> +	{handle_client_get_characteristic, true,
> +			sizeof(struct hal_cmd_gatt_client_get_characteristic)},
> +	/* HAL_OP_GATT_CLIENT_GET_DESCRIPTOR */
> +	{handle_client_get_descriptor, true,
> +			sizeof(struct hal_cmd_gatt_client_get_descriptor)},
> +	/* HAL_OP_GATT_CLIENT_READ_CHARACTERISTIC */
> +	{handle_client_read_characteristic, false,
> +			sizeof(struct hal_cmd_gatt_client_read_characteristic)},
> +	/* HAL_OP_GATT_CLIENT_WRITE_CHARACTERISTIC */
> +	{handle_client_write_characteristic, true,
> +		sizeof(struct hal_cmd_gatt_client_write_characteristic)},
> +	/* HAL_OP_GATT_CLIENT_READ_DESCRIPTOR */
> +	{handle_client_read_descriptor, false,
> +			sizeof(struct hal_cmd_gatt_client_read_descriptor)},
> +	/* HAL_OP_GATT_CLIENT_WRITE_DESCRIPTOR */
> +	{handle_client_write_descriptor, true,
> +			sizeof(struct hal_cmd_gatt_client_write_descriptor)},
> +	/* HAL_OP_GATT_CLIENT_EXECUTE_WRITE */
> +	{handle_client_execute_write, false,
> +			sizeof(struct hal_cmd_gatt_client_execute_write)},
> +	/* HAL_OP_GATT_CLIENT_REGISTER_FOR_NOTIFICATION */
> +	{handle_client_register_for_notification, false,
> +		sizeof(struct hal_cmd_gatt_client_register_for_notification)},
> +	/* HAL_OP_GATT_CLIENT_DEREGISTER_FOR_NOTIFICATION */
> +	{handle_client_deregister_for_notification, false,
> +		sizeof(struct hal_cmd_gatt_client_deregister_for_notification)},
> +	/* HAL_OP_GATT_CLIENT_READ_REMOTE_RSSI */
> +	{handle_client_read_remote_rssi, false,
> +			sizeof(struct hal_cmd_gatt_client_read_remote_rssi)},
> +	/* HAL_OP_GATT_CLIENT_GET_DEVICE_TYPE */
> +	{handle_client_get_device_type, false,
> +			sizeof(struct hal_cmd_gatt_client_get_device_type)},
> +	/* HAL_OP_GATT_CLIENT_SET_ADV_DATA */
> +	{handle_client_set_adv_data, true,
> +			sizeof(struct hal_cmd_gatt_client_set_adv_data)},
> +	/* HAL_OP_GATT_CLIENT_TEST_COMMAND */
> +	{handle_client_test_command, false,
> +			sizeof(struct hal_cmd_gatt_client_test_command)},
> +	/* HAL_OP_GATT_SERVER_REGISTER */
> +	{handle_server_register, false,
> +				sizeof(struct hal_cmd_gatt_server_register)},
> +	/* HAL_OP_GATT_SERVER_UNREGISTER */
> +	{handle_server_unregister, false,
> +				sizeof(struct hal_cmd_gatt_server_unregister)},
> +	/* HAL_OP_GATT_SERVER_CONNECT */
> +	{handle_server_connect, false,
> +				sizeof(struct hal_cmd_gatt_server_connect)},
> +	/* HAL_OP_GATT_SERVER_DISCONNECT */
> +	{handle_server_disconnect, false,
> +				sizeof(struct hal_cmd_gatt_server_disconnect)},
> +	/* HAL_OP_GATT_SERVER_ADD_SERVICE */
> +	{handle_server_add_service, false,
> +				sizeof(struct hal_cmd_gatt_server_add_service)},
> +	/* HAL_OP_GATT_SERVER_ADD_INC_SERVICE */
> +	{handle_server_add_included_service, false,
> +			sizeof(struct hal_cmd_gatt_server_add_inc_service)},
> +	/* HAL_OP_GATT_SERVER_ADD_CHARACTERISTIC */
> +	{handle_server_add_characteristic, false,
> +			sizeof(struct hal_cmd_gatt_server_add_characteristic)},
> +	/* HAL_OP_GATT_SERVER_ADD_DESCRIPTOR */
> +	{handle_server_add_descriptor, false,
> +			sizeof(struct hal_cmd_gatt_server_add_descriptor)},
> +	/* HAL_OP_GATT_SERVER_START_SERVICE */
> +	{handle_server_start_service, false,
> +			sizeof(struct hal_cmd_gatt_server_start_service)},
> +	/* HAL_OP_GATT_SERVER_STOP_SERVICE */
> +	{handle_server_stop_service, false,
> +			sizeof(struct hal_cmd_gatt_server_stop_service)},
> +	/* HAL_OP_GATT_SERVER_DELETE_SERVICE */
> +	{handle_server_delete_service, false,
> +			sizeof(struct hal_cmd_gatt_server_delete_service)},
> +	/* HAL_OP_GATT_SERVER_SEND_INDICATION */
> +	{handle_server_send_indication, true,
> +			sizeof(struct hal_cmd_gatt_server_send_indication)},
> +	/* HAL_OP_GATT_SERVER_SEND_RESPONSE */
> +	{handle_server_send_response, true,
> +			sizeof(struct hal_cmd_gatt_server_send_response)},
> +};
>  
>  bool bt_gatt_register(struct ipc *ipc, const bdaddr_t *addr)
>  {
> -	return false;
> +	DBG("");
> +
> +	bacpy(&adapter_addr, addr);
> +

This seems to be missing:
hal_ipc = hal;

> +	ipc_register(hal_ipc, HAL_SERVICE_ID_GATT, cmd_handlers,
> +						G_N_ELEMENTS(cmd_handlers));
> +
> +	return true;
>  }
>  
>  void bt_gatt_unregister(void)
>  {
> +	DBG("");
>  
> +	ipc_unregister(hal_ipc, HAL_SERVICE_ID_GATT);
>  }
> 

-- 
Best regards, 
Szymon Janc

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-03-03 14:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-03  9:29 [PATCH 1/2] android/gatt: Add initial files Grzegorz Kolodziejczyk
2014-03-03  9:29 ` [PATCH 2/2] android/gatt: Add stubs for GATT commands handlers Grzegorz Kolodziejczyk
2014-03-03 14:41   ` Szymon Janc
2014-03-03 14:39 ` [PATCH 1/2] android/gatt: Add initial files Szymon Janc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).