Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH v2 00/16] android: HF Client initial implementation part 1
@ 2014-09-10 11:33 Lukasz Rymanowski
  2014-09-10 11:33 ` [PATCH v2 01/16] android/hf-client: Add hf-client ID Lukasz Rymanowski
                   ` (15 more replies)
  0 siblings, 16 replies; 20+ messages in thread
From: Lukasz Rymanowski @ 2014-09-10 11:33 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: luiz.dentz, Lukasz Rymanowski

Following patches adds HF Client commands skeleton

v2:
* Szymon comment from IRC handled
* Splited patch set to smaller sets on Luiz request.

Lukasz Rymanowski (16):
  android/hf-client: Add hf-client ID
  android/hardware: Add HFP Client Interface ID.
  android/hf-client: Add hf-client daemon skeleton
  android/hf-client: Add hf-client HAL skeleton
  android/hf-client: Add hf-client to Android build
  android/readme: Add information about hf-client
  android/hf-client: Add Connect/Disconnect commands
  android/hf-client: Add Audio Connect/Disconnect commands
  android/hf-client: Add Start/Stop Voice Recognition command
  android/hf-client: Add Volume Control command
  android/hf-client: Add Dial and Dial Memory command
  android/hf-client: Add Call Action command
  android/hf-client: Add Query Current Call and Operator Name command
  android/hf-client: Add Retrieve Subscriber Info command
  android/hf-client: Add Send DTMF command
  android/hf-client: Add Get Last Voice Tag Number command

 android/Android.mk           |   4 +
 android/Makefile.am          |   3 +
 android/README               |  10 ++
 android/hal-bluetooth.c      |   3 +
 android/hal-hf-client.c      | 353 +++++++++++++++++++++++++++++++++++++++++++
 android/hal-msg.h            |  78 +++++++++-
 android/hal.h                |   2 +
 android/hardware/bluetooth.h |   1 +
 android/hf-client.c          | 222 +++++++++++++++++++++++++++
 android/hf-client.h          |  25 +++
 android/main.c               |   9 ++
 11 files changed, 709 insertions(+), 1 deletion(-)
 create mode 100644 android/hal-hf-client.c
 create mode 100644 android/hf-client.c
 create mode 100644 android/hf-client.h

-- 
1.8.4


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

* [PATCH v2 01/16] android/hf-client: Add hf-client ID
  2014-09-10 11:33 [PATCH v2 00/16] android: HF Client initial implementation part 1 Lukasz Rymanowski
@ 2014-09-10 11:33 ` Lukasz Rymanowski
  2014-09-11 11:43   ` Szymon Janc
  2014-09-10 11:34 ` [PATCH v2 02/16] android/hardware: Add HFP Client Interface ID Lukasz Rymanowski
                   ` (14 subsequent siblings)
  15 siblings, 1 reply; 20+ messages in thread
From: Lukasz Rymanowski @ 2014-09-10 11:33 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: luiz.dentz, Lukasz Rymanowski

---
 android/hal-msg.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/android/hal-msg.h b/android/hal-msg.h
index 3d95e10..5781c09 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -35,8 +35,9 @@ static const char BLUEZ_HAL_SK_PATH[] = "\0bluez_hal_socket";
 #define HAL_SERVICE_ID_HEALTH		7
 #define HAL_SERVICE_ID_AVRCP		8
 #define HAL_SERVICE_ID_GATT		9
+#define HAL_SERVICE_ID_HF_CLIENT	10
 
-#define HAL_SERVICE_ID_MAX HAL_SERVICE_ID_GATT
+#define HAL_SERVICE_ID_MAX HAL_SERVICE_ID_HF_CLIENT
 
 /* Core Service */
 
-- 
1.8.4


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

* [PATCH v2 02/16] android/hardware: Add HFP Client Interface ID.
  2014-09-10 11:33 [PATCH v2 00/16] android: HF Client initial implementation part 1 Lukasz Rymanowski
  2014-09-10 11:33 ` [PATCH v2 01/16] android/hf-client: Add hf-client ID Lukasz Rymanowski
@ 2014-09-10 11:34 ` Lukasz Rymanowski
  2014-09-10 11:34 ` [PATCH v2 03/16] android/hf-client: Add hf-client daemon skeleton Lukasz Rymanowski
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Lukasz Rymanowski @ 2014-09-10 11:34 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: luiz.dentz, Lukasz Rymanowski

---
 android/hardware/bluetooth.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/android/hardware/bluetooth.h b/android/hardware/bluetooth.h
index c00a8f7..0d3283b 100644
--- a/android/hardware/bluetooth.h
+++ b/android/hardware/bluetooth.h
@@ -37,6 +37,7 @@ __BEGIN_DECLS
 /* Bluetooth profile interface IDs */
 
 #define BT_PROFILE_HANDSFREE_ID "handsfree"
+#define BT_PROFILE_HANDSFREE_CLIENT_ID "handsfree_client"
 #define BT_PROFILE_ADVANCED_AUDIO_ID "a2dp"
 #define BT_PROFILE_HEALTH_ID "health"
 #define BT_PROFILE_SOCKETS_ID "socket"
-- 
1.8.4


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

* [PATCH v2 03/16] android/hf-client: Add hf-client daemon skeleton
  2014-09-10 11:33 [PATCH v2 00/16] android: HF Client initial implementation part 1 Lukasz Rymanowski
  2014-09-10 11:33 ` [PATCH v2 01/16] android/hf-client: Add hf-client ID Lukasz Rymanowski
  2014-09-10 11:34 ` [PATCH v2 02/16] android/hardware: Add HFP Client Interface ID Lukasz Rymanowski
@ 2014-09-10 11:34 ` Lukasz Rymanowski
  2014-09-11 11:45   ` Szymon Janc
  2014-09-10 11:34 ` [PATCH v2 04/16] android/hf-client: Add hf-client HAL skeleton Lukasz Rymanowski
                   ` (12 subsequent siblings)
  15 siblings, 1 reply; 20+ messages in thread
From: Lukasz Rymanowski @ 2014-09-10 11:34 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: luiz.dentz, Lukasz Rymanowski

---
 android/Makefile.am |  1 +
 android/hf-client.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 android/hf-client.h | 25 +++++++++++++++++++
 android/main.c      |  9 +++++++
 4 files changed, 104 insertions(+)
 create mode 100644 android/hf-client.c
 create mode 100644 android/hf-client.h

diff --git a/android/Makefile.am b/android/Makefile.am
index 49fbddc..e92ccf1 100644
--- a/android/Makefile.am
+++ b/android/Makefile.am
@@ -52,6 +52,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/hf-client.c android/hf-client.h \
 				android/gatt.h android/gatt.c \
 				android/health.h android/health.c \
 				android/mcap-lib.h android/mcap-lib.c \
diff --git a/android/hf-client.c b/android/hf-client.c
new file mode 100644
index 0000000..f1566d0
--- /dev/null
+++ b/android/hf-client.c
@@ -0,0 +1,69 @@
+/*
+ *
+ *  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 <stdlib.h>
+#include <stdbool.h>
+#include <errno.h>
+#include <unistd.h>
+#include <glib.h>
+
+#include "lib/bluetooth.h"
+#include "ipc.h"
+#include "ipc-common.h"
+#include "src/log.h"
+#include "utils.h"
+
+#include "hal-msg.h"
+#include "hf-client.h"
+
+static bdaddr_t adapter_addr;
+
+static struct ipc *hal_ipc = NULL;
+
+static const struct ipc_handler cmd_handlers[] = {
+};
+
+bool bt_hf_client_register(struct ipc *ipc, const bdaddr_t *addr)
+{
+	DBG("");
+
+	bacpy(&adapter_addr, addr);
+
+	hal_ipc = ipc;
+	ipc_register(hal_ipc, HAL_SERVICE_ID_HF_CLIENT, cmd_handlers,
+						G_N_ELEMENTS(cmd_handlers));
+
+	return true;
+}
+
+void bt_hf_client_unregister(void)
+{
+	DBG("");
+
+	ipc_unregister(hal_ipc, HAL_SERVICE_ID_HANDSFREE);
+	hal_ipc = NULL;
+}
diff --git a/android/hf-client.h b/android/hf-client.h
new file mode 100644
index 0000000..1eb69ff
--- /dev/null
+++ b/android/hf-client.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_hf_client_register(struct ipc *ipc, const bdaddr_t *addr);
+void bt_hf_client_unregister(void);
diff --git a/android/main.c b/android/main.c
index b03a2df..49257d4 100644
--- a/android/main.c
+++ b/android/main.c
@@ -60,6 +60,7 @@
 #include "handsfree.h"
 #include "gatt.h"
 #include "health.h"
+#include "hf-client.h"
 
 #define STARTUP_GRACE_SECONDS 5
 #define SHUTDOWN_GRACE_SECONDS 10
@@ -145,6 +146,14 @@ static void service_register(const void *buf, uint16_t len)
 		}
 
 		break;
+	case HAL_SERVICE_ID_HF_CLIENT:
+		if (!bt_hf_client_register(hal_ipc, &adapter_bdaddr)) {
+			status = HAL_STATUS_FAILED;
+			goto failed;
+		}
+
+		break;
+
 	default:
 		DBG("service %u not supported", m->service_id);
 		status = HAL_STATUS_FAILED;
-- 
1.8.4


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

* [PATCH v2 04/16] android/hf-client: Add hf-client HAL skeleton
  2014-09-10 11:33 [PATCH v2 00/16] android: HF Client initial implementation part 1 Lukasz Rymanowski
                   ` (2 preceding siblings ...)
  2014-09-10 11:34 ` [PATCH v2 03/16] android/hf-client: Add hf-client daemon skeleton Lukasz Rymanowski
@ 2014-09-10 11:34 ` Lukasz Rymanowski
  2014-09-11 11:48   ` Szymon Janc
  2014-09-10 11:34 ` [PATCH v2 05/16] android/hf-client: Add hf-client to Android build Lukasz Rymanowski
                   ` (11 subsequent siblings)
  15 siblings, 1 reply; 20+ messages in thread
From: Lukasz Rymanowski @ 2014-09-10 11:34 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: luiz.dentz, Lukasz Rymanowski

---
 android/Makefile.am     |   2 +
 android/hal-bluetooth.c |   3 ++
 android/hal-hf-client.c | 101 ++++++++++++++++++++++++++++++++++++++++++++++++
 android/hal.h           |   2 +
 4 files changed, 108 insertions(+)
 create mode 100644 android/hal-hf-client.c

diff --git a/android/Makefile.am b/android/Makefile.am
index e92ccf1..9464df7 100644
--- a/android/Makefile.am
+++ b/android/Makefile.am
@@ -75,6 +75,7 @@ android_bluetooth_default_la_SOURCES = android/hal.h android/hal-bluetooth.c \
 					android/hal-a2dp.c \
 					android/hal-avrcp.c \
 					android/hal-handsfree.c \
+					android/hal-hf-client.c \
 					android/hal-gatt.c \
 					android/hardware/bluetooth.h \
 					android/hardware/bt_av.h \
@@ -88,6 +89,7 @@ android_bluetooth_default_la_SOURCES = android/hal.h android/hal-bluetooth.c \
 					android/hardware/bt_pan.h \
 					android/hardware/bt_rc.h \
 					android/hardware/bt_sock.h \
+					android/hardware/bt_hf_client.h \
 					android/hardware/hardware.h \
 					android/cutils/properties.h \
 					android/ipc-common.h \
diff --git a/android/hal-bluetooth.c b/android/hal-bluetooth.c
index 44eddbd..dd2c9b8 100644
--- a/android/hal-bluetooth.c
+++ b/android/hal-bluetooth.c
@@ -783,6 +783,9 @@ static const void *get_profile_interface(const char *profile_id)
 	if (!strcmp(profile_id, BT_PROFILE_HEALTH_ID))
 		return bt_get_health_interface();
 
+	if (!strcmp(profile_id, BT_PROFILE_HANDSFREE_CLIENT_ID))
+		return bt_get_hf_client_interface();
+
 	return NULL;
 }
 
diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
new file mode 100644
index 0000000..40553ff
--- /dev/null
+++ b/android/hal-hf-client.c
@@ -0,0 +1,101 @@
+/*
+ * 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 <stddef.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <cutils/properties.h>
+
+#include "hal-log.h"
+#include "hal.h"
+#include "hal-msg.h"
+#include "ipc-common.h"
+#include "hal-ipc.h"
+
+static const bthf_client_callbacks_t *cbs = NULL;
+
+static bool interface_ready(void)
+{
+	return cbs != NULL;
+}
+
+/*
+ * 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[] = {
+};
+
+static bt_status_t init(bthf_client_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_HF_CLIENT, ev_handlers,
+				sizeof(ev_handlers)/sizeof(ev_handlers[0]));
+
+	cmd.service_id = HAL_SERVICE_ID_HF_CLIENT;
+
+	ret = hal_ipc_cmd(HAL_SERVICE_ID_CORE, HAL_OP_REGISTER_MODULE,
+					sizeof(cmd), &cmd, NULL, NULL, NULL);
+
+	if (ret != BT_STATUS_SUCCESS) {
+		cbs = NULL;
+		hal_ipc_unregister(HAL_SERVICE_ID_HF_CLIENT);
+	}
+
+	return ret;
+}
+
+static void cleanup(void)
+{
+	struct hal_cmd_unregister_module cmd;
+
+	DBG("");
+
+	if (!interface_ready())
+		return;
+
+	cbs = NULL;
+
+	cmd.service_id = HAL_SERVICE_ID_HF_CLIENT;
+
+	hal_ipc_cmd(HAL_SERVICE_ID_CORE, HAL_OP_UNREGISTER_MODULE,
+					sizeof(cmd), &cmd, NULL, NULL, NULL);
+
+	hal_ipc_unregister(HAL_SERVICE_ID_HF_CLIENT);
+}
+
+static bthf_client_interface_t iface = {
+	.size = sizeof(iface),
+	.init = init,
+	.cleanup = cleanup
+};
+
+bthf_client_interface_t *bt_get_hf_client_interface(void)
+{
+	return &iface;
+}
diff --git a/android/hal.h b/android/hal.h
index 6998e9a..be81ed9 100644
--- a/android/hal.h
+++ b/android/hal.h
@@ -26,6 +26,7 @@
 #include <hardware/bt_gatt_client.h>
 #include <hardware/bt_gatt_server.h>
 #include <hardware/bt_hl.h>
+#include <hardware/bt_hf_client.h>
 
 btsock_interface_t *bt_get_socket_interface(void);
 bthh_interface_t *bt_get_hidhost_interface(void);
@@ -35,6 +36,7 @@ btrc_interface_t *bt_get_avrcp_interface(void);
 bthf_interface_t *bt_get_handsfree_interface(void);
 btgatt_interface_t *bt_get_gatt_interface(void);
 bthl_interface_t *bt_get_health_interface(void);
+bthf_client_interface_t *bt_get_hf_client_interface(void);
 
 void bt_thread_associate(void);
 void bt_thread_disassociate(void);
-- 
1.8.4


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

* [PATCH v2 05/16] android/hf-client: Add hf-client to Android build
  2014-09-10 11:33 [PATCH v2 00/16] android: HF Client initial implementation part 1 Lukasz Rymanowski
                   ` (3 preceding siblings ...)
  2014-09-10 11:34 ` [PATCH v2 04/16] android/hf-client: Add hf-client HAL skeleton Lukasz Rymanowski
@ 2014-09-10 11:34 ` Lukasz Rymanowski
  2014-09-10 11:34 ` [PATCH v2 06/16] android/readme: Add information about hf-client Lukasz Rymanowski
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Lukasz Rymanowski @ 2014-09-10 11:34 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: luiz.dentz, Lukasz Rymanowski

HF-Client is build for Android only when BLUEZ_EXTENSION flag is set
---
 android/Android.mk | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/android/Android.mk b/android/Android.mk
index b2b55f7..a75fe53 100644
--- a/android/Android.mk
+++ b/android/Android.mk
@@ -128,6 +128,10 @@ LOCAL_SRC_FILES := \
 	bluez/android/hal-utils.c \
 	bluez/android/hal-health.c \
 
+ifeq ($(BLUEZ_EXTENSIONS), true)
+LOCAL_SRC_FILES += bluez/android/hal-hf-client.c
+endif
+
 LOCAL_C_INCLUDES += \
 	$(call include-path-for, system-core) \
 	$(call include-path-for, libhardware) \
-- 
1.8.4


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

* [PATCH v2 06/16] android/readme: Add information about hf-client
  2014-09-10 11:33 [PATCH v2 00/16] android: HF Client initial implementation part 1 Lukasz Rymanowski
                   ` (4 preceding siblings ...)
  2014-09-10 11:34 ` [PATCH v2 05/16] android/hf-client: Add hf-client to Android build Lukasz Rymanowski
@ 2014-09-10 11:34 ` Lukasz Rymanowski
  2014-09-10 11:34 ` [PATCH v2 07/16] android/hf-client: Add Connect/Disconnect commands Lukasz Rymanowski
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Lukasz Rymanowski @ 2014-09-10 11:34 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: luiz.dentz, Lukasz Rymanowski

---
 android/README | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/android/README b/android/README
index 20b61a6..6b6a62e 100644
--- a/android/README
+++ b/android/README
@@ -37,6 +37,9 @@ features (currently epoll_create1 and ppoll calls for Android 4.4). Sample
 Bionic for Android 4.4 with all required features backported is available at
 https://code.google.com/p/aosp-bluez.platform-bionic/
 
+- Some of the bluetooth HALs are available only when BLUEZ_EXTENSIONS flag is
+set in BoardConfig.mk or similar. Please read below for detail which HALs needs
+that.
 
 Runtime requirements
 --------------------
@@ -257,6 +260,7 @@ health        bt_hl.h            complete
 pan           bt_pan.h           complete
 avrcp         bt_rc.h            complete
 socket        bt_sock.h          complete
+hf-client     bt_hf_client.h     initial
 
 
 Implementation shortcomings
@@ -323,6 +327,12 @@ methods:
 client->set_adv_data               missing kernel support for vendor data
 client->connect                    is_direct parameter is ignored
 
+HAL HF Client
+-------------
+
+Available on Android only when BLUEZ_EXTENSIONS flag set in BoardConfig.mk
+
+
 Audio SCO HAL
 =============
 
-- 
1.8.4


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

* [PATCH v2 07/16] android/hf-client: Add Connect/Disconnect commands
  2014-09-10 11:33 [PATCH v2 00/16] android: HF Client initial implementation part 1 Lukasz Rymanowski
                   ` (5 preceding siblings ...)
  2014-09-10 11:34 ` [PATCH v2 06/16] android/readme: Add information about hf-client Lukasz Rymanowski
@ 2014-09-10 11:34 ` Lukasz Rymanowski
  2014-09-10 11:34 ` [PATCH v2 08/16] android/hf-client: Add Audio " Lukasz Rymanowski
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Lukasz Rymanowski @ 2014-09-10 11:34 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: luiz.dentz, Lukasz Rymanowski

---
 android/hal-hf-client.c | 40 ++++++++++++++++++++++++++++++++++++++++
 android/hal-msg.h       | 12 ++++++++++++
 android/hf-client.c     | 21 +++++++++++++++++++++
 3 files changed, 73 insertions(+)

diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index 40553ff..5a31563 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -70,6 +70,44 @@ static bt_status_t init(bthf_client_callbacks_t *callbacks)
 	return ret;
 }
 
+static bt_status_t hf_client_connect(bt_bdaddr_t *bd_addr)
+{
+	struct hal_cmd_hf_client_connect cmd;
+
+	DBG("");
+
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
+
+	if (!bd_addr)
+		return BT_STATUS_PARM_INVALID;
+
+	memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
+
+	return hal_ipc_cmd(HAL_SERVICE_ID_HF_CLIENT, HAL_OP_HF_CLIENT_CONNECT,
+					sizeof(cmd), &cmd, NULL, NULL, NULL);
+}
+
+static bt_status_t disconnect(bt_bdaddr_t *bd_addr)
+{
+	struct hal_cmd_hf_client_disconnect cmd;
+
+	DBG("");
+
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
+
+	if (!bd_addr)
+		return BT_STATUS_PARM_INVALID;
+
+	memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
+
+	return hal_ipc_cmd(HAL_SERVICE_ID_HF_CLIENT,
+						HAL_OP_HF_CLIENT_DISCONNECT,
+						sizeof(cmd), &cmd, NULL, NULL,
+						NULL);
+}
+
 static void cleanup(void)
 {
 	struct hal_cmd_unregister_module cmd;
@@ -92,6 +130,8 @@ static void cleanup(void)
 static bthf_client_interface_t iface = {
 	.size = sizeof(iface),
 	.init = init,
+	.connect = hf_client_connect,
+	.disconnect = disconnect,
 	.cleanup = cleanup
 };
 
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 5781c09..cbab6d9 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -976,6 +976,18 @@ struct hal_cmd_gatt_server_send_response {
 	uint8_t data[0];
 } __attribute__((packed));
 
+/* Handsfree client HAL API */
+
+#define HAL_OP_HF_CLIENT_CONNECT		0x01
+struct hal_cmd_hf_client_connect {
+	uint8_t bdaddr[6];
+} __attribute__((packed));
+
+#define HAL_OP_HF_CLIENT_DISCONNECT		0x02
+struct hal_cmd_hf_client_disconnect {
+	uint8_t bdaddr[6];
+} __attribute__((packed));
+
 /* Notifications and confirmations */
 
 #define HAL_POWER_OFF			0x00
diff --git a/android/hf-client.c b/android/hf-client.c
index f1566d0..d6c2ef6 100644
--- a/android/hf-client.c
+++ b/android/hf-client.c
@@ -44,7 +44,28 @@ static bdaddr_t adapter_addr;
 
 static struct ipc *hal_ipc = NULL;
 
+static void handle_connect(const void *buf, uint16_t len)
+{
+	DBG("Not Implemented");
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HF_CLIENT,
+			HAL_OP_HF_CLIENT_CONNECT, HAL_STATUS_UNSUPPORTED);
+}
+
+static void handle_disconnect(const void *buf, uint16_t len)
+{
+	DBG("Not Implemented");
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HF_CLIENT,
+						HAL_OP_HF_CLIENT_DISCONNECT,
+						HAL_STATUS_UNSUPPORTED);
+}
+
 static const struct ipc_handler cmd_handlers[] = {
+	/* HAL_OP_HF_CLIENT_CONNECT */
+	{ handle_connect, false,
+				sizeof(struct hal_cmd_hf_client_connect) },
+	/* HAL_OP_HF_CLIENT_DISCONNECT */
+	{ handle_disconnect, false,
+				sizeof(struct hal_cmd_hf_client_disconnect) },
 };
 
 bool bt_hf_client_register(struct ipc *ipc, const bdaddr_t *addr)
-- 
1.8.4


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

* [PATCH v2 08/16] android/hf-client: Add Audio Connect/Disconnect commands
  2014-09-10 11:33 [PATCH v2 00/16] android: HF Client initial implementation part 1 Lukasz Rymanowski
                   ` (6 preceding siblings ...)
  2014-09-10 11:34 ` [PATCH v2 07/16] android/hf-client: Add Connect/Disconnect commands Lukasz Rymanowski
@ 2014-09-10 11:34 ` Lukasz Rymanowski
  2014-09-10 11:34 ` [PATCH v2 09/16] android/hf-client: Add Start/Stop Voice Recognition command Lukasz Rymanowski
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Lukasz Rymanowski @ 2014-09-10 11:34 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: luiz.dentz, Lukasz Rymanowski

---
 android/hal-hf-client.c | 40 ++++++++++++++++++++++++++++++++++++++++
 android/hal-msg.h       | 10 ++++++++++
 android/hf-client.c     | 22 ++++++++++++++++++++++
 3 files changed, 72 insertions(+)

diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index 5a31563..0ebd9d1 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -108,6 +108,44 @@ static bt_status_t disconnect(bt_bdaddr_t *bd_addr)
 						NULL);
 }
 
+static bt_status_t connect_audio(bt_bdaddr_t *bd_addr)
+{
+	struct hal_cmd_hf_client_connect_audio cmd;
+
+	DBG("");
+
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
+
+	if (!bd_addr)
+		return BT_STATUS_PARM_INVALID;
+
+	memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
+
+	return hal_ipc_cmd(HAL_SERVICE_ID_HF_CLIENT,
+					HAL_OP_HF_CLIENT_CONNECT_AUDIO,
+					sizeof(cmd), &cmd, NULL, NULL, NULL);
+}
+
+static bt_status_t disconnect_audio(bt_bdaddr_t *bd_addr)
+{
+	struct hal_cmd_hf_client_disconnect_audio cmd;
+
+	DBG("");
+
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
+
+	if (!bd_addr)
+		return BT_STATUS_PARM_INVALID;
+
+	memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
+
+	return hal_ipc_cmd(HAL_SERVICE_ID_HF_CLIENT,
+					HAL_OP_HF_CLIENT_DISCONNECT_AUDIO,
+					sizeof(cmd), &cmd, NULL, NULL, NULL);
+}
+
 static void cleanup(void)
 {
 	struct hal_cmd_unregister_module cmd;
@@ -132,6 +170,8 @@ static bthf_client_interface_t iface = {
 	.init = init,
 	.connect = hf_client_connect,
 	.disconnect = disconnect,
+	.connect_audio = connect_audio,
+	.disconnect_audio = disconnect_audio,
 	.cleanup = cleanup
 };
 
diff --git a/android/hal-msg.h b/android/hal-msg.h
index cbab6d9..7e4a077 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -988,6 +988,16 @@ struct hal_cmd_hf_client_disconnect {
 	uint8_t bdaddr[6];
 } __attribute__((packed));
 
+#define HAL_OP_HF_CLIENT_CONNECT_AUDIO		0x03
+struct hal_cmd_hf_client_connect_audio {
+	uint8_t bdaddr[6];
+} __attribute__((packed));
+
+#define HAL_OP_HF_CLIENT_DISCONNECT_AUDIO	0x04
+struct hal_cmd_hf_client_disconnect_audio {
+	uint8_t bdaddr[6];
+} __attribute__((packed));
+
 /* Notifications and confirmations */
 
 #define HAL_POWER_OFF			0x00
diff --git a/android/hf-client.c b/android/hf-client.c
index d6c2ef6..d4fca21 100644
--- a/android/hf-client.c
+++ b/android/hf-client.c
@@ -59,6 +59,22 @@ static void handle_disconnect(const void *buf, uint16_t len)
 						HAL_STATUS_UNSUPPORTED);
 }
 
+static void handle_connect_audio(const void *buf, uint16_t len)
+{
+	DBG("Not Implemented");
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HF_CLIENT,
+						HAL_OP_HF_CLIENT_CONNECT_AUDIO,
+						HAL_STATUS_UNSUPPORTED);
+}
+
+static void handle_disconnect_audio(const void *buf, uint16_t len)
+{
+	DBG("Not Implemented");
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HF_CLIENT,
+					HAL_OP_HF_CLIENT_DISCONNECT_AUDIO,
+					HAL_STATUS_UNSUPPORTED);
+}
+
 static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_HF_CLIENT_CONNECT */
 	{ handle_connect, false,
@@ -66,6 +82,12 @@ static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_HF_CLIENT_DISCONNECT */
 	{ handle_disconnect, false,
 				sizeof(struct hal_cmd_hf_client_disconnect) },
+	/* HAL_OP_HF_CLIENT_CONNECT_AUDIO */
+	{ handle_connect_audio, false,
+			sizeof(struct hal_cmd_hf_client_connect_audio) },
+	/* HAL_OP_HF_CLIENT_DISCONNECT_AUDIO */
+	{ handle_disconnect_audio, false,
+			sizeof(struct hal_cmd_hf_client_disconnect_audio) },
 };
 
 bool bt_hf_client_register(struct ipc *ipc, const bdaddr_t *addr)
-- 
1.8.4


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

* [PATCH v2 09/16] android/hf-client: Add Start/Stop Voice Recognition command
  2014-09-10 11:33 [PATCH v2 00/16] android: HF Client initial implementation part 1 Lukasz Rymanowski
                   ` (7 preceding siblings ...)
  2014-09-10 11:34 ` [PATCH v2 08/16] android/hf-client: Add Audio " Lukasz Rymanowski
@ 2014-09-10 11:34 ` Lukasz Rymanowski
  2014-09-10 11:34 ` [PATCH v2 10/16] android/hf-client: Add Volume Control command Lukasz Rymanowski
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Lukasz Rymanowski @ 2014-09-10 11:34 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: luiz.dentz, Lukasz Rymanowski

---
 android/hal-hf-client.c | 24 ++++++++++++++++++++++++
 android/hal-msg.h       |  3 +++
 android/hf-client.c     | 20 ++++++++++++++++++++
 3 files changed, 47 insertions(+)

diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index 0ebd9d1..5ae13f8 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -146,6 +146,28 @@ static bt_status_t disconnect_audio(bt_bdaddr_t *bd_addr)
 					sizeof(cmd), &cmd, NULL, NULL, NULL);
 }
 
+static bt_status_t start_voice_recognition(void)
+{
+	DBG("");
+
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
+
+	return hal_ipc_cmd(HAL_SERVICE_ID_HF_CLIENT, HAL_OP_HF_CLIENT_START_VR,
+						0, NULL, NULL, NULL, NULL);
+}
+
+static bt_status_t stop_voice_recognition(void)
+{
+	DBG("");
+
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
+
+	return hal_ipc_cmd(HAL_SERVICE_ID_HF_CLIENT, HAL_OP_HF_CLIENT_STOP_VR,
+						0, NULL, NULL, NULL, NULL);
+}
+
 static void cleanup(void)
 {
 	struct hal_cmd_unregister_module cmd;
@@ -172,6 +194,8 @@ static bthf_client_interface_t iface = {
 	.disconnect = disconnect,
 	.connect_audio = connect_audio,
 	.disconnect_audio = disconnect_audio,
+	.start_voice_recognition = start_voice_recognition,
+	.stop_voice_recognition = stop_voice_recognition,
 	.cleanup = cleanup
 };
 
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 7e4a077..e46dffc 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -998,6 +998,9 @@ struct hal_cmd_hf_client_disconnect_audio {
 	uint8_t bdaddr[6];
 } __attribute__((packed));
 
+#define HAL_OP_HF_CLIENT_START_VR		0x05
+#define HAL_OP_HF_CLIENT_STOP_VR		0x06
+
 /* Notifications and confirmations */
 
 #define HAL_POWER_OFF			0x00
diff --git a/android/hf-client.c b/android/hf-client.c
index d4fca21..c49b895 100644
--- a/android/hf-client.c
+++ b/android/hf-client.c
@@ -75,6 +75,22 @@ static void handle_disconnect_audio(const void *buf, uint16_t len)
 					HAL_STATUS_UNSUPPORTED);
 }
 
+static void handle_start_vr(const void *buf, uint16_t len)
+{
+	DBG("Not Implemented");
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HF_CLIENT,
+						HAL_OP_HF_CLIENT_START_VR,
+						HAL_STATUS_UNSUPPORTED);
+}
+
+static void handle_stop_vr(const void *buf, uint16_t len)
+{
+	DBG("Not Implemented");
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HF_CLIENT,
+						HAL_OP_HF_CLIENT_STOP_VR,
+						HAL_STATUS_UNSUPPORTED);
+}
+
 static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_HF_CLIENT_CONNECT */
 	{ handle_connect, false,
@@ -88,6 +104,10 @@ static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_HF_CLIENT_DISCONNECT_AUDIO */
 	{ handle_disconnect_audio, false,
 			sizeof(struct hal_cmd_hf_client_disconnect_audio) },
+	/* define HAL_OP_HF_CLIENT_START_VR */
+	{ handle_start_vr, false, 0 },
+	/* define HAL_OP_HF_CLIENT_STOP_VR */
+	{ handle_stop_vr, false, 0 },
 };
 
 bool bt_hf_client_register(struct ipc *ipc, const bdaddr_t *addr)
-- 
1.8.4


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

* [PATCH v2 10/16] android/hf-client: Add Volume Control command
  2014-09-10 11:33 [PATCH v2 00/16] android: HF Client initial implementation part 1 Lukasz Rymanowski
                   ` (8 preceding siblings ...)
  2014-09-10 11:34 ` [PATCH v2 09/16] android/hf-client: Add Start/Stop Voice Recognition command Lukasz Rymanowski
@ 2014-09-10 11:34 ` Lukasz Rymanowski
  2014-09-10 11:34 ` [PATCH v2 11/16] android/hf-client: Add Dial and Dial Memory command Lukasz Rymanowski
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Lukasz Rymanowski @ 2014-09-10 11:34 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: luiz.dentz, Lukasz Rymanowski

---
 android/hal-hf-client.c | 19 +++++++++++++++++++
 android/hal-msg.h       |  9 +++++++++
 android/hf-client.c     | 11 +++++++++++
 3 files changed, 39 insertions(+)

diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index 5ae13f8..52f3113 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -168,6 +168,24 @@ static bt_status_t stop_voice_recognition(void)
 						0, NULL, NULL, NULL, NULL);
 }
 
+static bt_status_t volume_control(bthf_client_volume_type_t type,
+								int volume)
+{
+	struct hal_cmd_hf_client_volume_control cmd;
+
+	DBG("");
+
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
+
+	cmd.type = type;
+	cmd.volume = volume;
+
+	return hal_ipc_cmd(HAL_SERVICE_ID_HF_CLIENT,
+					HAL_OP_HF_CLIENT_VOLUME_CONTROL,
+					sizeof(cmd), &cmd, NULL, NULL, NULL);
+}
+
 static void cleanup(void)
 {
 	struct hal_cmd_unregister_module cmd;
@@ -196,6 +214,7 @@ static bthf_client_interface_t iface = {
 	.disconnect_audio = disconnect_audio,
 	.start_voice_recognition = start_voice_recognition,
 	.stop_voice_recognition = stop_voice_recognition,
+	.volume_control = volume_control,
 	.cleanup = cleanup
 };
 
diff --git a/android/hal-msg.h b/android/hal-msg.h
index e46dffc..7665d27 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1001,6 +1001,15 @@ struct hal_cmd_hf_client_disconnect_audio {
 #define HAL_OP_HF_CLIENT_START_VR		0x05
 #define HAL_OP_HF_CLIENT_STOP_VR		0x06
 
+#define HF_CLIENT_VOLUME_TYPE_SPEAKER	0x00
+#define HF_CLIENT_VOLUME_TYPE_MIC	0x01
+
+#define HAL_OP_HF_CLIENT_VOLUME_CONTROL		0x07
+struct hal_cmd_hf_client_volume_control {
+	uint8_t type;
+	uint8_t volume;
+} __attribute__((packed));
+
 /* Notifications and confirmations */
 
 #define HAL_POWER_OFF			0x00
diff --git a/android/hf-client.c b/android/hf-client.c
index c49b895..74f0181 100644
--- a/android/hf-client.c
+++ b/android/hf-client.c
@@ -91,6 +91,14 @@ static void handle_stop_vr(const void *buf, uint16_t len)
 						HAL_STATUS_UNSUPPORTED);
 }
 
+static void handle_volume_control(const void *buf, uint16_t len)
+{
+	DBG("Not Implemented");
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HF_CLIENT,
+					HAL_OP_HF_CLIENT_VOLUME_CONTROL,
+					HAL_STATUS_UNSUPPORTED);
+}
+
 static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_HF_CLIENT_CONNECT */
 	{ handle_connect, false,
@@ -108,6 +116,9 @@ static const struct ipc_handler cmd_handlers[] = {
 	{ handle_start_vr, false, 0 },
 	/* define HAL_OP_HF_CLIENT_STOP_VR */
 	{ handle_stop_vr, false, 0 },
+	/* HAL_OP_HF_CLIENT_VOLUME_CONTROL */
+	{ handle_volume_control, false,
+			sizeof(struct hal_cmd_hf_client_volume_control) },
 };
 
 bool bt_hf_client_register(struct ipc *ipc, const bdaddr_t *addr)
-- 
1.8.4


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

* [PATCH v2 11/16] android/hf-client: Add Dial and Dial Memory command
  2014-09-10 11:33 [PATCH v2 00/16] android: HF Client initial implementation part 1 Lukasz Rymanowski
                   ` (9 preceding siblings ...)
  2014-09-10 11:34 ` [PATCH v2 10/16] android/hf-client: Add Volume Control command Lukasz Rymanowski
@ 2014-09-10 11:34 ` Lukasz Rymanowski
  2014-09-10 11:34 ` [PATCH v2 12/16] android/hf-client: Add Call Action command Lukasz Rymanowski
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Lukasz Rymanowski @ 2014-09-10 11:34 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: luiz.dentz, Lukasz Rymanowski

---
 android/hal-hf-client.c | 42 ++++++++++++++++++++++++++++++++++++++++++
 android/hal-msg.h       | 11 +++++++++++
 android/hf-client.c     | 19 +++++++++++++++++++
 3 files changed, 72 insertions(+)

diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index 52f3113..b2c1513 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -186,6 +186,46 @@ static bt_status_t volume_control(bthf_client_volume_type_t type,
 					sizeof(cmd), &cmd, NULL, NULL, NULL);
 }
 
+static bt_status_t dial(const char *number)
+{
+	char buf[IPC_MTU];
+	struct hal_cmd_hf_client_dial *cmd = (void *) buf;
+	size_t len;
+
+	DBG("");
+
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
+
+	if (number) {
+		cmd->number_len = strlen(number) + 1;
+		memcpy(cmd->number, number, cmd->number_len);
+	} else {
+		cmd->number_len = 0;
+	}
+
+	len = sizeof(*cmd) + cmd->number_len;
+
+	return hal_ipc_cmd(HAL_SERVICE_ID_HF_CLIENT, HAL_OP_HF_CLIENT_DIAL,
+					len, cmd, NULL, NULL, NULL);
+}
+
+static bt_status_t dial_memory(int location)
+{
+	struct hal_cmd_hf_client_dial_memory cmd;
+
+	DBG("");
+
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
+
+	cmd.location = location;
+
+	return hal_ipc_cmd(HAL_SERVICE_ID_HF_CLIENT,
+				HAL_OP_HF_CLIENT_DIAL_MEMORY, sizeof(cmd),
+				&cmd, NULL, NULL, NULL);
+}
+
 static void cleanup(void)
 {
 	struct hal_cmd_unregister_module cmd;
@@ -215,6 +255,8 @@ static bthf_client_interface_t iface = {
 	.start_voice_recognition = start_voice_recognition,
 	.stop_voice_recognition = stop_voice_recognition,
 	.volume_control = volume_control,
+	.dial = dial,
+	.dial_memory = dial_memory,
 	.cleanup = cleanup
 };
 
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 7665d27..8886741 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1010,6 +1010,17 @@ struct hal_cmd_hf_client_volume_control {
 	uint8_t volume;
 } __attribute__((packed));
 
+#define HAL_OP_HF_CLIENT_DIAL			0x08
+struct hal_cmd_hf_client_dial {
+	uint16_t number_len;
+	uint8_t number[0];
+} __attribute__((packed));
+
+#define HAL_OP_HF_CLIENT_DIAL_MEMORY		0x09
+struct hal_cmd_hf_client_dial_memory {
+	uint16_t location;
+} __attribute__((packed));
+
 /* Notifications and confirmations */
 
 #define HAL_POWER_OFF			0x00
diff --git a/android/hf-client.c b/android/hf-client.c
index 74f0181..e1cb88d 100644
--- a/android/hf-client.c
+++ b/android/hf-client.c
@@ -99,6 +99,20 @@ static void handle_volume_control(const void *buf, uint16_t len)
 					HAL_STATUS_UNSUPPORTED);
 }
 
+static void handle_dial(const void *buf, uint16_t len)
+{
+	DBG("Not Implemented");
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HF_CLIENT,
+				HAL_OP_HF_CLIENT_DIAL, HAL_STATUS_UNSUPPORTED);
+}
+
+static void handle_dial_memory(const void *buf, uint16_t len)
+{
+	DBG("Not Implemented");
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HF_CLIENT,
+			HAL_OP_HF_CLIENT_DIAL_MEMORY, HAL_STATUS_UNSUPPORTED);
+}
+
 static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_HF_CLIENT_CONNECT */
 	{ handle_connect, false,
@@ -119,6 +133,11 @@ static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_HF_CLIENT_VOLUME_CONTROL */
 	{ handle_volume_control, false,
 			sizeof(struct hal_cmd_hf_client_volume_control) },
+	/* HAL_OP_HF_CLIENT_DIAL */
+	{ handle_dial, true, sizeof(struct hal_cmd_hf_client_dial) },
+	/* HAL_OP_HF_CLIENT_DIAL_MEMORY */
+	{ handle_dial_memory, false,
+				sizeof(struct hal_cmd_hf_client_dial_memory) },
 };
 
 bool bt_hf_client_register(struct ipc *ipc, const bdaddr_t *addr)
-- 
1.8.4


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

* [PATCH v2 12/16] android/hf-client: Add Call Action command
  2014-09-10 11:33 [PATCH v2 00/16] android: HF Client initial implementation part 1 Lukasz Rymanowski
                   ` (10 preceding siblings ...)
  2014-09-10 11:34 ` [PATCH v2 11/16] android/hf-client: Add Dial and Dial Memory command Lukasz Rymanowski
@ 2014-09-10 11:34 ` Lukasz Rymanowski
  2014-09-10 11:34 ` [PATCH v2 13/16] android/hf-client: Add Query Current Call and Operator Name command Lukasz Rymanowski
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Lukasz Rymanowski @ 2014-09-10 11:34 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: luiz.dentz, Lukasz Rymanowski

---
 android/hal-hf-client.c | 18 ++++++++++++++++++
 android/hal-msg.h       | 19 +++++++++++++++++++
 android/hf-client.c     | 10 ++++++++++
 3 files changed, 47 insertions(+)

diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index b2c1513..8ebbac1 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -226,6 +226,23 @@ static bt_status_t dial_memory(int location)
 				&cmd, NULL, NULL, NULL);
 }
 
+static bt_status_t call_action(bthf_client_call_action_t action, int index)
+{
+	struct hal_cmd_hf_client_call_action cmd;
+
+	DBG("");
+
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
+
+	cmd.action = action;
+	cmd.index = index;
+
+	return hal_ipc_cmd(HAL_SERVICE_ID_HF_CLIENT,
+					HAL_OP_HF_CLIENT_CALL_ACTION,
+					sizeof(cmd), &cmd, NULL, NULL, NULL);
+}
+
 static void cleanup(void)
 {
 	struct hal_cmd_unregister_module cmd;
@@ -257,6 +274,7 @@ static bthf_client_interface_t iface = {
 	.volume_control = volume_control,
 	.dial = dial,
 	.dial_memory = dial_memory,
+	.handle_call_action = call_action,
 	.cleanup = cleanup
 };
 
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 8886741..b1fe2b6 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1021,6 +1021,25 @@ struct hal_cmd_hf_client_dial_memory {
 	uint16_t location;
 } __attribute__((packed));
 
+#define HF_CLIENT_ACTION_CHLD_0		0x00
+#define HF_CLIENT_ACTION_CHLD_1		0x01
+#define HF_CLIENT_ACTION_CHLD_2		0x02
+#define HF_CLIENT_ACTION_CHLD_3		0x03
+#define HF_CLIENT_ACTION_CHLD_4		0x04
+#define HF_CLIENT_ACTION_CHLD_1x	0x05
+#define HF_CLIENT_ACTION_CHLD_2x	0x06
+#define HF_CLIENT_ACTION_ATA		0x07
+#define HF_CLIENT_ACTION_CHUP		0x08
+#define HF_CLIENT_ACTION_BRTH_0		0x09
+#define HF_CLIENT_ACTION_BRTH_1		0x10
+#define HF_CLIENT_ACTION_BRTH_02	0x11
+
+#define HAL_OP_HF_CLIENT_CALL_ACTION		0x10
+struct hal_cmd_hf_client_call_action {
+	uint8_t action;
+	uint8_t index;
+} __attribute__((packed));
+
 /* Notifications and confirmations */
 
 #define HAL_POWER_OFF			0x00
diff --git a/android/hf-client.c b/android/hf-client.c
index e1cb88d..66954b9 100644
--- a/android/hf-client.c
+++ b/android/hf-client.c
@@ -113,6 +113,13 @@ static void handle_dial_memory(const void *buf, uint16_t len)
 			HAL_OP_HF_CLIENT_DIAL_MEMORY, HAL_STATUS_UNSUPPORTED);
 }
 
+static void handle_call_action(const void *buf, uint16_t len)
+{
+	DBG("Not Implemented");
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HF_CLIENT,
+			HAL_OP_HF_CLIENT_CALL_ACTION, HAL_STATUS_UNSUPPORTED);
+}
+
 static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_HF_CLIENT_CONNECT */
 	{ handle_connect, false,
@@ -138,6 +145,9 @@ static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_HF_CLIENT_DIAL_MEMORY */
 	{ handle_dial_memory, false,
 				sizeof(struct hal_cmd_hf_client_dial_memory) },
+	/* HAL_OP_HF_CLIENT_CALL_ACTION */
+	{ handle_call_action, false,
+				sizeof(struct hal_cmd_hf_client_call_action) },
 };
 
 bool bt_hf_client_register(struct ipc *ipc, const bdaddr_t *addr)
-- 
1.8.4


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

* [PATCH v2 13/16] android/hf-client: Add Query Current Call and Operator Name command
  2014-09-10 11:33 [PATCH v2 00/16] android: HF Client initial implementation part 1 Lukasz Rymanowski
                   ` (11 preceding siblings ...)
  2014-09-10 11:34 ` [PATCH v2 12/16] android/hf-client: Add Call Action command Lukasz Rymanowski
@ 2014-09-10 11:34 ` Lukasz Rymanowski
  2014-09-10 11:34 ` [PATCH v2 14/16] android/hf-client: Add Retrieve Subscriber Info command Lukasz Rymanowski
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Lukasz Rymanowski @ 2014-09-10 11:34 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: luiz.dentz, Lukasz Rymanowski

---
 android/hal-hf-client.c | 26 ++++++++++++++++++++++++++
 android/hal-msg.h       |  3 +++
 android/hf-client.c     | 20 ++++++++++++++++++++
 3 files changed, 49 insertions(+)

diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index 8ebbac1..85a0718 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -243,6 +243,30 @@ static bt_status_t call_action(bthf_client_call_action_t action, int index)
 					sizeof(cmd), &cmd, NULL, NULL, NULL);
 }
 
+static bt_status_t query_current_calls(void)
+{
+	DBG("");
+
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
+
+	return hal_ipc_cmd(HAL_SERVICE_ID_HF_CLIENT,
+					HAL_OP_HF_CLIENT_QUERY_CURRENT_CALLS,
+					0, NULL, NULL, NULL, NULL);
+}
+
+static bt_status_t query_operator_name(void)
+{
+	DBG("");
+
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
+
+	return hal_ipc_cmd(HAL_SERVICE_ID_HF_CLIENT,
+					HAL_OP_HF_CLIENT_QUERY_OPERATOR_NAME,
+					0, NULL, NULL, NULL, NULL);
+}
+
 static void cleanup(void)
 {
 	struct hal_cmd_unregister_module cmd;
@@ -275,6 +299,8 @@ static bthf_client_interface_t iface = {
 	.dial = dial,
 	.dial_memory = dial_memory,
 	.handle_call_action = call_action,
+	.query_current_calls = query_current_calls,
+	.query_current_operator_name = query_operator_name,
 	.cleanup = cleanup
 };
 
diff --git a/android/hal-msg.h b/android/hal-msg.h
index b1fe2b6..9e8a477 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1040,6 +1040,9 @@ struct hal_cmd_hf_client_call_action {
 	uint8_t index;
 } __attribute__((packed));
 
+#define HAL_OP_HF_CLIENT_QUERY_CURRENT_CALLS	0x11
+#define HAL_OP_HF_CLIENT_QUERY_OPERATOR_NAME	0x12
+
 /* Notifications and confirmations */
 
 #define HAL_POWER_OFF			0x00
diff --git a/android/hf-client.c b/android/hf-client.c
index 66954b9..8b7386c 100644
--- a/android/hf-client.c
+++ b/android/hf-client.c
@@ -120,6 +120,22 @@ static void handle_call_action(const void *buf, uint16_t len)
 			HAL_OP_HF_CLIENT_CALL_ACTION, HAL_STATUS_UNSUPPORTED);
 }
 
+static void handle_query_current_calls(const void *buf, uint16_t len)
+{
+	DBG("Not Implemented");
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HF_CLIENT,
+					HAL_OP_HF_CLIENT_QUERY_CURRENT_CALLS,
+					HAL_STATUS_UNSUPPORTED);
+}
+
+static void handle_query_operator_name(const void *buf, uint16_t len)
+{
+	DBG("Not Implemented");
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HF_CLIENT,
+					HAL_OP_HF_CLIENT_QUERY_OPERATOR_NAME,
+					HAL_STATUS_UNSUPPORTED);
+}
+
 static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_HF_CLIENT_CONNECT */
 	{ handle_connect, false,
@@ -148,6 +164,10 @@ static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_HF_CLIENT_CALL_ACTION */
 	{ handle_call_action, false,
 				sizeof(struct hal_cmd_hf_client_call_action) },
+	/* HAL_OP_HF_CLIENT_QUERY_CURRENT_CALLS */
+	{ handle_query_current_calls, false, 0 },
+	/* HAL_OP_HF_CLIENT_QUERY_OPERATOR_NAME */
+	{ handle_query_operator_name, false, 0 },
 };
 
 bool bt_hf_client_register(struct ipc *ipc, const bdaddr_t *addr)
-- 
1.8.4


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

* [PATCH v2 14/16] android/hf-client: Add Retrieve Subscriber Info command
  2014-09-10 11:33 [PATCH v2 00/16] android: HF Client initial implementation part 1 Lukasz Rymanowski
                   ` (12 preceding siblings ...)
  2014-09-10 11:34 ` [PATCH v2 13/16] android/hf-client: Add Query Current Call and Operator Name command Lukasz Rymanowski
@ 2014-09-10 11:34 ` Lukasz Rymanowski
  2014-09-10 11:34 ` [PATCH v2 15/16] android/hf-client: Add Send DTMF command Lukasz Rymanowski
  2014-09-10 11:34 ` [PATCH v2 16/16] android/hf-client: Add Get Last Voice Tag Number command Lukasz Rymanowski
  15 siblings, 0 replies; 20+ messages in thread
From: Lukasz Rymanowski @ 2014-09-10 11:34 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: luiz.dentz, Lukasz Rymanowski

---
 android/hal-hf-client.c | 13 +++++++++++++
 android/hal-msg.h       |  1 +
 android/hf-client.c     | 10 ++++++++++
 3 files changed, 24 insertions(+)

diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index 85a0718..572f06e 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -267,6 +267,18 @@ static bt_status_t query_operator_name(void)
 					0, NULL, NULL, NULL, NULL);
 }
 
+static bt_status_t retrieve_subsr_info(void)
+{
+	DBG("");
+
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
+
+	return hal_ipc_cmd(HAL_SERVICE_ID_HF_CLIENT,
+					HAL_OP_HF_CLIENT_RETRIEVE_SUBSCR_INFO,
+					0, NULL, NULL, NULL, NULL);
+}
+
 static void cleanup(void)
 {
 	struct hal_cmd_unregister_module cmd;
@@ -301,6 +313,7 @@ static bthf_client_interface_t iface = {
 	.handle_call_action = call_action,
 	.query_current_calls = query_current_calls,
 	.query_current_operator_name = query_operator_name,
+	.retrieve_subscriber_info = retrieve_subsr_info,
 	.cleanup = cleanup
 };
 
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 9e8a477..ad075fc 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1042,6 +1042,7 @@ struct hal_cmd_hf_client_call_action {
 
 #define HAL_OP_HF_CLIENT_QUERY_CURRENT_CALLS	0x11
 #define HAL_OP_HF_CLIENT_QUERY_OPERATOR_NAME	0x12
+#define HAL_OP_HF_CLIENT_RETRIEVE_SUBSCR_INFO	0x13
 
 /* Notifications and confirmations */
 
diff --git a/android/hf-client.c b/android/hf-client.c
index 8b7386c..bdd60b1 100644
--- a/android/hf-client.c
+++ b/android/hf-client.c
@@ -136,6 +136,14 @@ static void handle_query_operator_name(const void *buf, uint16_t len)
 					HAL_STATUS_UNSUPPORTED);
 }
 
+static void handle_retrieve_subscr_info(const void *buf, uint16_t len)
+{
+	DBG("Not Implemented");
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HF_CLIENT,
+					HAL_OP_HF_CLIENT_RETRIEVE_SUBSCR_INFO,
+					HAL_STATUS_UNSUPPORTED);
+}
+
 static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_HF_CLIENT_CONNECT */
 	{ handle_connect, false,
@@ -168,6 +176,8 @@ static const struct ipc_handler cmd_handlers[] = {
 	{ handle_query_current_calls, false, 0 },
 	/* HAL_OP_HF_CLIENT_QUERY_OPERATOR_NAME */
 	{ handle_query_operator_name, false, 0 },
+	/* HAL_OP_HF_CLIENT_RETRIEVE_SUBSCR_INFO */
+	{ handle_retrieve_subscr_info, false, 0 },
 };
 
 bool bt_hf_client_register(struct ipc *ipc, const bdaddr_t *addr)
-- 
1.8.4


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

* [PATCH v2 15/16] android/hf-client: Add Send DTMF command
  2014-09-10 11:33 [PATCH v2 00/16] android: HF Client initial implementation part 1 Lukasz Rymanowski
                   ` (13 preceding siblings ...)
  2014-09-10 11:34 ` [PATCH v2 14/16] android/hf-client: Add Retrieve Subscriber Info command Lukasz Rymanowski
@ 2014-09-10 11:34 ` Lukasz Rymanowski
  2014-09-10 11:34 ` [PATCH v2 16/16] android/hf-client: Add Get Last Voice Tag Number command Lukasz Rymanowski
  15 siblings, 0 replies; 20+ messages in thread
From: Lukasz Rymanowski @ 2014-09-10 11:34 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: luiz.dentz, Lukasz Rymanowski

---
 android/hal-hf-client.c | 17 +++++++++++++++++
 android/hal-msg.h       |  5 +++++
 android/hf-client.c     | 10 ++++++++++
 3 files changed, 32 insertions(+)

diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index 572f06e..72f1b6d 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -279,6 +279,22 @@ static bt_status_t retrieve_subsr_info(void)
 					0, NULL, NULL, NULL, NULL);
 }
 
+static bt_status_t send_dtmf(char tone)
+{
+	struct hal_cmd_hf_client_send_dtmf cmd;
+
+	DBG("");
+
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
+
+	cmd.tone = tone;
+
+	return hal_ipc_cmd(HAL_SERVICE_ID_HF_CLIENT,
+					HAL_OP_HF_CLIENT_SEND_DTMF,
+					sizeof(cmd), &cmd, NULL, NULL, NULL);
+}
+
 static void cleanup(void)
 {
 	struct hal_cmd_unregister_module cmd;
@@ -314,6 +330,7 @@ static bthf_client_interface_t iface = {
 	.query_current_calls = query_current_calls,
 	.query_current_operator_name = query_operator_name,
 	.retrieve_subscriber_info = retrieve_subsr_info,
+	.send_dtmf = send_dtmf,
 	.cleanup = cleanup
 };
 
diff --git a/android/hal-msg.h b/android/hal-msg.h
index ad075fc..e84fa41 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1044,6 +1044,11 @@ struct hal_cmd_hf_client_call_action {
 #define HAL_OP_HF_CLIENT_QUERY_OPERATOR_NAME	0x12
 #define HAL_OP_HF_CLIENT_RETRIEVE_SUBSCR_INFO	0x13
 
+#define HAL_OP_HF_CLIENT_SEND_DTMF		0x14
+struct hal_cmd_hf_client_send_dtmf {
+	uint8_t tone;
+} __attribute__((packed));
+
 /* Notifications and confirmations */
 
 #define HAL_POWER_OFF			0x00
diff --git a/android/hf-client.c b/android/hf-client.c
index bdd60b1..bcb2f51 100644
--- a/android/hf-client.c
+++ b/android/hf-client.c
@@ -144,6 +144,13 @@ static void handle_retrieve_subscr_info(const void *buf, uint16_t len)
 					HAL_STATUS_UNSUPPORTED);
 }
 
+static void handle_send_dtmf(const void *buf, uint16_t len)
+{
+	DBG("Not Implemented");
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HF_CLIENT,
+			HAL_OP_HF_CLIENT_SEND_DTMF, HAL_STATUS_UNSUPPORTED);
+}
+
 static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_HF_CLIENT_CONNECT */
 	{ handle_connect, false,
@@ -178,6 +185,9 @@ static const struct ipc_handler cmd_handlers[] = {
 	{ handle_query_operator_name, false, 0 },
 	/* HAL_OP_HF_CLIENT_RETRIEVE_SUBSCR_INFO */
 	{ handle_retrieve_subscr_info, false, 0 },
+	/* HAL_OP_HF_CLIENT_SEND_DTMF */
+	{ handle_send_dtmf, false,
+				sizeof(struct hal_cmd_hf_client_send_dtmf) },
 };
 
 bool bt_hf_client_register(struct ipc *ipc, const bdaddr_t *addr)
-- 
1.8.4


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

* [PATCH v2 16/16] android/hf-client: Add Get Last Voice Tag Number command
  2014-09-10 11:33 [PATCH v2 00/16] android: HF Client initial implementation part 1 Lukasz Rymanowski
                   ` (14 preceding siblings ...)
  2014-09-10 11:34 ` [PATCH v2 15/16] android/hf-client: Add Send DTMF command Lukasz Rymanowski
@ 2014-09-10 11:34 ` Lukasz Rymanowski
  15 siblings, 0 replies; 20+ messages in thread
From: Lukasz Rymanowski @ 2014-09-10 11:34 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: luiz.dentz, Lukasz Rymanowski

---
 android/hal-hf-client.c | 13 +++++++++++++
 android/hal-msg.h       |  2 ++
 android/hf-client.c     | 10 ++++++++++
 3 files changed, 25 insertions(+)

diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
index 72f1b6d..a6f285b 100644
--- a/android/hal-hf-client.c
+++ b/android/hal-hf-client.c
@@ -295,6 +295,18 @@ static bt_status_t send_dtmf(char tone)
 					sizeof(cmd), &cmd, NULL, NULL, NULL);
 }
 
+static bt_status_t request_last_voice_tag_number(void)
+{
+	DBG("");
+
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
+
+	return hal_ipc_cmd(HAL_SERVICE_ID_HF_CLIENT,
+					HAL_OP_HF_CLIENT_GET_LAST_VOICE_TAG_NUM,
+					0, NULL, NULL, NULL, NULL);
+}
+
 static void cleanup(void)
 {
 	struct hal_cmd_unregister_module cmd;
@@ -331,6 +343,7 @@ static bthf_client_interface_t iface = {
 	.query_current_operator_name = query_operator_name,
 	.retrieve_subscriber_info = retrieve_subsr_info,
 	.send_dtmf = send_dtmf,
+	.request_last_voice_tag_number = request_last_voice_tag_number,
 	.cleanup = cleanup
 };
 
diff --git a/android/hal-msg.h b/android/hal-msg.h
index e84fa41..b6d5907 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -1049,6 +1049,8 @@ struct hal_cmd_hf_client_send_dtmf {
 	uint8_t tone;
 } __attribute__((packed));
 
+#define HAL_OP_HF_CLIENT_GET_LAST_VOICE_TAG_NUM	0x15
+
 /* Notifications and confirmations */
 
 #define HAL_POWER_OFF			0x00
diff --git a/android/hf-client.c b/android/hf-client.c
index bcb2f51..1d03c46 100644
--- a/android/hf-client.c
+++ b/android/hf-client.c
@@ -151,6 +151,14 @@ static void handle_send_dtmf(const void *buf, uint16_t len)
 			HAL_OP_HF_CLIENT_SEND_DTMF, HAL_STATUS_UNSUPPORTED);
 }
 
+static void handle_get_last_vc_tag_num(const void *buf, uint16_t len)
+{
+	DBG("Not Implemented");
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HF_CLIENT,
+					HAL_OP_HF_CLIENT_GET_LAST_VOICE_TAG_NUM,
+					HAL_STATUS_UNSUPPORTED);
+}
+
 static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_HF_CLIENT_CONNECT */
 	{ handle_connect, false,
@@ -188,6 +196,8 @@ static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_HF_CLIENT_SEND_DTMF */
 	{ handle_send_dtmf, false,
 				sizeof(struct hal_cmd_hf_client_send_dtmf) },
+	/* HAL_OP_HF_CLIENT_GET_LAST_VOICE_TAG_NUM */
+	{ handle_get_last_vc_tag_num, false, 0 },
 };
 
 bool bt_hf_client_register(struct ipc *ipc, const bdaddr_t *addr)
-- 
1.8.4


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

* Re: [PATCH v2 01/16] android/hf-client: Add hf-client ID
  2014-09-10 11:33 ` [PATCH v2 01/16] android/hf-client: Add hf-client ID Lukasz Rymanowski
@ 2014-09-11 11:43   ` Szymon Janc
  0 siblings, 0 replies; 20+ messages in thread
From: Szymon Janc @ 2014-09-11 11:43 UTC (permalink / raw)
  To: Lukasz Rymanowski; +Cc: linux-bluetooth, luiz.dentz

Hi Łukasz,

On Wednesday 10 of September 2014 13:33:59 Lukasz Rymanowski wrote:
> ---
>  android/hal-msg.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/android/hal-msg.h b/android/hal-msg.h
> index 3d95e10..5781c09 100644
> --- a/android/hal-msg.h
> +++ b/android/hal-msg.h
> @@ -35,8 +35,9 @@ static const char BLUEZ_HAL_SK_PATH[] = "\0bluez_hal_socket";
>  #define HAL_SERVICE_ID_HEALTH		7
>  #define HAL_SERVICE_ID_AVRCP		8
>  #define HAL_SERVICE_ID_GATT		9
> +#define HAL_SERVICE_ID_HF_CLIENT	10

To follow convention this should be named HAL_SERVICE_ID_HANDSFREE_CLIENT.

>  
> -#define HAL_SERVICE_ID_MAX HAL_SERVICE_ID_GATT
> +#define HAL_SERVICE_ID_MAX HAL_SERVICE_ID_HF_CLIENT
>  
>  /* Core Service */
>  
> 

-- 
Best regards, 
Szymon Janc

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

* Re: [PATCH v2 03/16] android/hf-client: Add hf-client daemon skeleton
  2014-09-10 11:34 ` [PATCH v2 03/16] android/hf-client: Add hf-client daemon skeleton Lukasz Rymanowski
@ 2014-09-11 11:45   ` Szymon Janc
  0 siblings, 0 replies; 20+ messages in thread
From: Szymon Janc @ 2014-09-11 11:45 UTC (permalink / raw)
  To: Lukasz Rymanowski; +Cc: linux-bluetooth, luiz.dentz

Hi Łukasz,

On Wednesday 10 of September 2014 13:34:01 Lukasz Rymanowski wrote:
> ---
>  android/Makefile.am |  1 +
>  android/hf-client.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  android/hf-client.h | 25 +++++++++++++++++++
>  android/main.c      |  9 +++++++
>  4 files changed, 104 insertions(+)
>  create mode 100644 android/hf-client.c
>  create mode 100644 android/hf-client.h
> 
> diff --git a/android/Makefile.am b/android/Makefile.am
> index 49fbddc..e92ccf1 100644
> --- a/android/Makefile.am
> +++ b/android/Makefile.am
> @@ -52,6 +52,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/hf-client.c android/hf-client.h \

Should be named handsfree-client.{ch}.

>  				android/gatt.h android/gatt.c \
>  				android/health.h android/health.c \
>  				android/mcap-lib.h android/mcap-lib.c \
> diff --git a/android/hf-client.c b/android/hf-client.c
> new file mode 100644
> index 0000000..f1566d0
> --- /dev/null
> +++ b/android/hf-client.c
> @@ -0,0 +1,69 @@
> +/*
> + *
> + *  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 <stdlib.h>
> +#include <stdbool.h>
> +#include <errno.h>
> +#include <unistd.h>
> +#include <glib.h>
> +
> +#include "lib/bluetooth.h"
> +#include "ipc.h"
> +#include "ipc-common.h"
> +#include "src/log.h"
> +#include "utils.h"
> +
> +#include "hal-msg.h"
> +#include "hf-client.h"
> +
> +static bdaddr_t adapter_addr;
> +
> +static struct ipc *hal_ipc = NULL;
> +
> +static const struct ipc_handler cmd_handlers[] = {
> +};
> +
> +bool bt_hf_client_register(struct ipc *ipc, const bdaddr_t *addr)
> +{
> +	DBG("");
> +
> +	bacpy(&adapter_addr, addr);
> +
> +	hal_ipc = ipc;
> +	ipc_register(hal_ipc, HAL_SERVICE_ID_HF_CLIENT, cmd_handlers,
> +						G_N_ELEMENTS(cmd_handlers));
> +
> +	return true;
> +}
> +
> +void bt_hf_client_unregister(void)
> +{
> +	DBG("");
> +
> +	ipc_unregister(hal_ipc, HAL_SERVICE_ID_HANDSFREE);
> +	hal_ipc = NULL;
> +}
> diff --git a/android/hf-client.h b/android/hf-client.h
> new file mode 100644
> index 0000000..1eb69ff
> --- /dev/null
> +++ b/android/hf-client.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_hf_client_register(struct ipc *ipc, const bdaddr_t *addr);
> +void bt_hf_client_unregister(void);
> diff --git a/android/main.c b/android/main.c
> index b03a2df..49257d4 100644
> --- a/android/main.c
> +++ b/android/main.c
> @@ -60,6 +60,7 @@
>  #include "handsfree.h"
>  #include "gatt.h"
>  #include "health.h"
> +#include "hf-client.h"
>  
>  #define STARTUP_GRACE_SECONDS 5
>  #define SHUTDOWN_GRACE_SECONDS 10
> @@ -145,6 +146,14 @@ static void service_register(const void *buf, uint16_t len)
>  		}
>  
>  		break;
> +	case HAL_SERVICE_ID_HF_CLIENT:
> +		if (!bt_hf_client_register(hal_ipc, &adapter_bdaddr)) {
> +			status = HAL_STATUS_FAILED;
> +			goto failed;
> +		}
> +
> +		break;
> +
>  	default:
>  		DBG("service %u not supported", m->service_id);
>  		status = HAL_STATUS_FAILED;
> 

-- 
Best regards, 
Szymon Janc

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

* Re: [PATCH v2 04/16] android/hf-client: Add hf-client HAL skeleton
  2014-09-10 11:34 ` [PATCH v2 04/16] android/hf-client: Add hf-client HAL skeleton Lukasz Rymanowski
@ 2014-09-11 11:48   ` Szymon Janc
  0 siblings, 0 replies; 20+ messages in thread
From: Szymon Janc @ 2014-09-11 11:48 UTC (permalink / raw)
  To: Lukasz Rymanowski; +Cc: linux-bluetooth, luiz.dentz

Hi Łukasz,

On Wednesday 10 of September 2014 13:34:02 Lukasz Rymanowski wrote:
> ---
>  android/Makefile.am     |   2 +
>  android/hal-bluetooth.c |   3 ++
>  android/hal-hf-client.c | 101 ++++++++++++++++++++++++++++++++++++++++++++++++
>  android/hal.h           |   2 +
>  4 files changed, 108 insertions(+)
>  create mode 100644 android/hal-hf-client.c
> 
> diff --git a/android/Makefile.am b/android/Makefile.am
> index e92ccf1..9464df7 100644
> --- a/android/Makefile.am
> +++ b/android/Makefile.am
> @@ -75,6 +75,7 @@ android_bluetooth_default_la_SOURCES = android/hal.h android/hal-bluetooth.c \
>  					android/hal-a2dp.c \
>  					android/hal-avrcp.c \
>  					android/hal-handsfree.c \
> +					android/hal-hf-client.c \

hal-handsfree-client.c

>  					android/hal-gatt.c \
>  					android/hardware/bluetooth.h \
>  					android/hardware/bt_av.h \
> @@ -88,6 +89,7 @@ android_bluetooth_default_la_SOURCES = android/hal.h android/hal-bluetooth.c \
>  					android/hardware/bt_pan.h \
>  					android/hardware/bt_rc.h \
>  					android/hardware/bt_sock.h \
> +					android/hardware/bt_hf_client.h \
>  					android/hardware/hardware.h \
>  					android/cutils/properties.h \
>  					android/ipc-common.h \
> diff --git a/android/hal-bluetooth.c b/android/hal-bluetooth.c
> index 44eddbd..dd2c9b8 100644
> --- a/android/hal-bluetooth.c
> +++ b/android/hal-bluetooth.c
> @@ -783,6 +783,9 @@ static const void *get_profile_interface(const char *profile_id)
>  	if (!strcmp(profile_id, BT_PROFILE_HEALTH_ID))
>  		return bt_get_health_interface();
>  
> +	if (!strcmp(profile_id, BT_PROFILE_HANDSFREE_CLIENT_ID))
> +		return bt_get_hf_client_interface();
> +
>  	return NULL;
>  }
>  
> diff --git a/android/hal-hf-client.c b/android/hal-hf-client.c
> new file mode 100644
> index 0000000..40553ff
> --- /dev/null
> +++ b/android/hal-hf-client.c
> @@ -0,0 +1,101 @@
> +/*
> + * 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 <stddef.h>
> +#include <string.h>
> +#include <stdlib.h>
> +
> +#include <cutils/properties.h>
> +
> +#include "hal-log.h"
> +#include "hal.h"
> +#include "hal-msg.h"
> +#include "ipc-common.h"
> +#include "hal-ipc.h"
> +
> +static const bthf_client_callbacks_t *cbs = NULL;
> +
> +static bool interface_ready(void)
> +{
> +	return cbs != NULL;
> +}
> +
> +/*
> + * 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[] = {
> +};
> +
> +static bt_status_t init(bthf_client_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_HF_CLIENT, ev_handlers,
> +				sizeof(ev_handlers)/sizeof(ev_handlers[0]));
> +
> +	cmd.service_id = HAL_SERVICE_ID_HF_CLIENT;
> +
> +	ret = hal_ipc_cmd(HAL_SERVICE_ID_CORE, HAL_OP_REGISTER_MODULE,
> +					sizeof(cmd), &cmd, NULL, NULL, NULL);
> +
> +	if (ret != BT_STATUS_SUCCESS) {
> +		cbs = NULL;
> +		hal_ipc_unregister(HAL_SERVICE_ID_HF_CLIENT);
> +	}
> +
> +	return ret;
> +}
> +
> +static void cleanup(void)
> +{
> +	struct hal_cmd_unregister_module cmd;
> +
> +	DBG("");
> +
> +	if (!interface_ready())
> +		return;
> +
> +	cbs = NULL;
> +
> +	cmd.service_id = HAL_SERVICE_ID_HF_CLIENT;
> +
> +	hal_ipc_cmd(HAL_SERVICE_ID_CORE, HAL_OP_UNREGISTER_MODULE,
> +					sizeof(cmd), &cmd, NULL, NULL, NULL);
> +
> +	hal_ipc_unregister(HAL_SERVICE_ID_HF_CLIENT);
> +}
> +
> +static bthf_client_interface_t iface = {
> +	.size = sizeof(iface),
> +	.init = init,
> +	.cleanup = cleanup
> +};
> +
> +bthf_client_interface_t *bt_get_hf_client_interface(void)
> +{
> +	return &iface;
> +}
> diff --git a/android/hal.h b/android/hal.h
> index 6998e9a..be81ed9 100644
> --- a/android/hal.h
> +++ b/android/hal.h
> @@ -26,6 +26,7 @@
>  #include <hardware/bt_gatt_client.h>
>  #include <hardware/bt_gatt_server.h>
>  #include <hardware/bt_hl.h>
> +#include <hardware/bt_hf_client.h>
>  
>  btsock_interface_t *bt_get_socket_interface(void);
>  bthh_interface_t *bt_get_hidhost_interface(void);
> @@ -35,6 +36,7 @@ btrc_interface_t *bt_get_avrcp_interface(void);
>  bthf_interface_t *bt_get_handsfree_interface(void);
>  btgatt_interface_t *bt_get_gatt_interface(void);
>  bthl_interface_t *bt_get_health_interface(void);
> +bthf_client_interface_t *bt_get_hf_client_interface(void);
>  
>  void bt_thread_associate(void);
>  void bt_thread_disassociate(void);
> 

-- 
Best regards, 
Szymon Janc

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

end of thread, other threads:[~2014-09-11 11:48 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-10 11:33 [PATCH v2 00/16] android: HF Client initial implementation part 1 Lukasz Rymanowski
2014-09-10 11:33 ` [PATCH v2 01/16] android/hf-client: Add hf-client ID Lukasz Rymanowski
2014-09-11 11:43   ` Szymon Janc
2014-09-10 11:34 ` [PATCH v2 02/16] android/hardware: Add HFP Client Interface ID Lukasz Rymanowski
2014-09-10 11:34 ` [PATCH v2 03/16] android/hf-client: Add hf-client daemon skeleton Lukasz Rymanowski
2014-09-11 11:45   ` Szymon Janc
2014-09-10 11:34 ` [PATCH v2 04/16] android/hf-client: Add hf-client HAL skeleton Lukasz Rymanowski
2014-09-11 11:48   ` Szymon Janc
2014-09-10 11:34 ` [PATCH v2 05/16] android/hf-client: Add hf-client to Android build Lukasz Rymanowski
2014-09-10 11:34 ` [PATCH v2 06/16] android/readme: Add information about hf-client Lukasz Rymanowski
2014-09-10 11:34 ` [PATCH v2 07/16] android/hf-client: Add Connect/Disconnect commands Lukasz Rymanowski
2014-09-10 11:34 ` [PATCH v2 08/16] android/hf-client: Add Audio " Lukasz Rymanowski
2014-09-10 11:34 ` [PATCH v2 09/16] android/hf-client: Add Start/Stop Voice Recognition command Lukasz Rymanowski
2014-09-10 11:34 ` [PATCH v2 10/16] android/hf-client: Add Volume Control command Lukasz Rymanowski
2014-09-10 11:34 ` [PATCH v2 11/16] android/hf-client: Add Dial and Dial Memory command Lukasz Rymanowski
2014-09-10 11:34 ` [PATCH v2 12/16] android/hf-client: Add Call Action command Lukasz Rymanowski
2014-09-10 11:34 ` [PATCH v2 13/16] android/hf-client: Add Query Current Call and Operator Name command Lukasz Rymanowski
2014-09-10 11:34 ` [PATCH v2 14/16] android/hf-client: Add Retrieve Subscriber Info command Lukasz Rymanowski
2014-09-10 11:34 ` [PATCH v2 15/16] android/hf-client: Add Send DTMF command Lukasz Rymanowski
2014-09-10 11:34 ` [PATCH v2 16/16] android/hf-client: Add Get Last Voice Tag Number command Lukasz Rymanowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox