[PATCH 11/39] android/hf-client: Add Volume Control command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 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 57e57a7..816fb45 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -997,6 +997,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

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux