Diff between 7281f6a133ca6837ff1305116eb12d01e5b11f17 and ca9366619bfefcadba6235f5637da9d8b8329889

Changed Files

File Additions Deletions Status
android/Android.mk +4 -1 modified
android/Makefile.am +1 -0 modified
android/hal-bluetooth.c +3 -0 modified
android/hal-map-client.c +93 -0 added
android/hal-msg.h +2 -1 modified
android/hal.h +2 -0 modified
android/hardware/bluetooth.h +1 -0 modified

Full Patch

diff --git a/android/Android.mk b/android/Android.mk
index 3daa260..f25d60e 100644
--- a/android/Android.mk
+++ b/android/Android.mk
@@ -134,7 +134,10 @@ LOCAL_SRC_FILES := \
 	bluez/android/hal-health.c \
 
 ifeq ($(BLUEZ_EXTENSIONS), true)
-LOCAL_SRC_FILES += bluez/android/hal-handsfree-client.c
+LOCAL_SRC_FILES += \
+	bluez/android/hal-handsfree-client.c \
+	bluez/android/hal-map-client.c \
+
 endif
 
 LOCAL_C_INCLUDES += \
diff --git a/android/Makefile.am b/android/Makefile.am
index 53bca33..f11cff6 100644
--- a/android/Makefile.am
+++ b/android/Makefile.am
@@ -67,6 +67,7 @@ android_bluetooth_default_la_SOURCES = android/hal.h android/hal-bluetooth.c \
 					android/hal-handsfree.c \
 					android/hal-handsfree-client.c \
 					android/hal-gatt.c \
+					android/hal-map-client.c \
 					android/hardware/bluetooth.h \
 					android/hardware/bt_av.h \
 					android/hardware/bt_gatt.h \
diff --git a/android/hal-bluetooth.c b/android/hal-bluetooth.c
index 6754279..97440e2 100644
--- a/android/hal-bluetooth.c
+++ b/android/hal-bluetooth.c
@@ -854,6 +854,9 @@ static const void *get_profile_interface(const char *profile_id)
 #if BLUEZ_EXTENSIONS
 	if (!strcmp(profile_id, BT_PROFILE_HANDSFREE_CLIENT_ID))
 		return bt_get_hf_client_interface();
+
+	if (!strcmp(profile_id, BT_PROFILE_MAP_CLIENT_ID))
+		return bt_get_map_client_interface();
 #endif
 
 	return NULL;
diff --git a/android/hal-map-client.c b/android/hal-map-client.c
new file mode 100644
index 0000000..ac7d031
--- /dev/null
+++ b/android/hal-map-client.c
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2014 Intel Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <stdbool.h>
+
+#include "hal-log.h"
+#include "hal.h"
+#include "hal-msg.h"
+#include "hal-ipc.h"
+
+static const btmce_callbacks_t *cbs = NULL;
+
+static bool interface_ready(void)
+{
+	return cbs != NULL;
+}
+
+/* Event Handlers */
+
+static void handle_remote_mas_instances(void *buf, uint16_t len, int fd)
+{
+
+}
+
+/*
+ * handlers will be called from notification thread context,
+ * index in table equals to 'opcode - HAL_MINIMUM_EVENT'
+ */
+static const struct hal_ipc_handler ev_handlers[] = {
+	/* HAL_EV_MCE_REMOTE_MAS_INSTANCES */
+	{ handle_remote_mas_instances, true,
+			sizeof(struct hal_ev_map_client_remote_mas_instances) }
+};
+
+/* API */
+
+static bt_status_t get_remote_mas_instances(bt_bdaddr_t *bd_addr)
+{
+	return BT_STATUS_UNSUPPORTED;
+}
+
+static bt_status_t init(btmce_callbacks_t *callbacks)
+{
+	struct hal_cmd_register_module cmd;
+	int ret;
+
+	DBG("");
+
+	if (interface_ready())
+		return BT_STATUS_DONE;
+
+	cbs = callbacks;
+
+	hal_ipc_register(HAL_SERVICE_ID_MAP_CLIENT, ev_handlers,
+				sizeof(ev_handlers)/sizeof(ev_handlers[0]));
+
+	cmd.service_id = HAL_SERVICE_ID_MAP_CLIENT;
+
+	ret = hal_ipc_cmd(HAL_SERVICE_ID_CORE, HAL_OP_REGISTER_MODULE,
+					sizeof(cmd), &cmd, 0, NULL, NULL);
+
+	if (ret != BT_STATUS_SUCCESS) {
+		cbs = NULL;
+		hal_ipc_unregister(HAL_SERVICE_ID_MAP_CLIENT);
+	}
+
+	return ret;
+}
+
+static btmce_interface_t iface = {
+	.size = sizeof(iface),
+	.init = init,
+	.get_remote_mas_instances = get_remote_mas_instances
+};
+
+btmce_interface_t *bt_get_map_client_interface(void)
+{
+	return &iface;
+}
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 94f8e7c..12efcef 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -36,8 +36,9 @@ static const char BLUEZ_HAL_SK_PATH[] = "\0bluez_hal_socket";
 #define HAL_SERVICE_ID_AVRCP		8
 #define HAL_SERVICE_ID_GATT		9
 #define HAL_SERVICE_ID_HANDSFREE_CLIENT	10
+#define HAL_SERVICE_ID_MAP_CLIENT	11
 
-#define HAL_SERVICE_ID_MAX HAL_SERVICE_ID_HANDSFREE_CLIENT
+#define HAL_SERVICE_ID_MAX HAL_SERVICE_ID_MAP_CLIENT
 
 /* Core Service */
 
diff --git a/android/hal.h b/android/hal.h
index c34022d..9b41952 100644
--- a/android/hal.h
+++ b/android/hal.h
@@ -29,6 +29,7 @@
 
 #ifdef BLUEZ_EXTENSIONS
 #include <hardware/bt_hf_client.h>
+#include <hardware/bt_mce.h>
 #endif
 
 btsock_interface_t *bt_get_socket_interface(void);
@@ -42,6 +43,7 @@ bthl_interface_t *bt_get_health_interface(void);
 
 #ifdef BLUEZ_EXTENSIONS
 bthf_client_interface_t *bt_get_hf_client_interface(void);
+btmce_interface_t *bt_get_map_client_interface(void);
 #endif
 
 void bt_thread_associate(void);
diff --git a/android/hardware/bluetooth.h b/android/hardware/bluetooth.h
index 0d3283b..b957c6f 100644
--- a/android/hardware/bluetooth.h
+++ b/android/hardware/bluetooth.h
@@ -43,6 +43,7 @@ __BEGIN_DECLS
 #define BT_PROFILE_SOCKETS_ID "socket"
 #define BT_PROFILE_HIDHOST_ID "hidhost"
 #define BT_PROFILE_PAN_ID "pan"
+#define BT_PROFILE_MAP_CLIENT_ID "map_client"
 
 #define BT_PROFILE_GATT_ID "gatt"
 #define BT_PROFILE_AV_RC_ID "avrcp"