diff mbox series

[RFC,BlueZ,07/10] audio/hfp-hf: Add answer a specific call support

Message ID 20250528085930.227816-8-frederic.danis@collabora.com
State New
Headers show
Series New Telephony interface for HSP, HFP and CCP | expand

Commit Message

Frédéric Danis May 28, 2025, 8:59 a.m. UTC
---
 profiles/audio/hfp-hf.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
diff mbox series

Patch

diff --git a/profiles/audio/hfp-hf.c b/profiles/audio/hfp-hf.c
index 5cd5f663b..5737c60cf 100644
--- a/profiles/audio/hfp-hf.c
+++ b/profiles/audio/hfp-hf.c
@@ -1107,9 +1107,31 @@  failed:
 	return btd_error_failed(msg, "Hang up all command failed");
 }
 
+static DBusMessage *call_answer(DBusConnection *conn, DBusMessage *msg,
+	void *call_data)
+{
+	struct call *call = call_data;
+	struct hfp_device *dev = telephony_get_profile_data(call->device);
+
+	DBG("");
+
+	if (call->state != CALL_STATE_INCOMING)
+		return btd_error_failed(msg, "Invalid state call");
+
+	if (!hfp_hf_send_command(dev->hf, cmd_complete_cb,
+			dbus_message_ref(msg), "ATA"))
+		goto failed;
+
+	return NULL;
+
+failed:
+	return btd_error_failed(msg, "Answer command failed");
+}
+
 struct telephony_callbacks hfp_callbacks = {
 	.dial = hfp_dial,
 	.hangup_all = hfp_hangup_all,
+	.call_answer = call_answer,
 };
 
 static int hfp_connect(struct btd_service *service)