From: "Frédéric Danis" <frederic.danis@collabora.com>
To: linux-bluetooth@vger.kernel.org
Subject: [RFC BlueZ 06/10] audio/hfp-hf: Add hangup all calls support
Date: Wed, 28 May 2025 10:59:26 +0200 [thread overview]
Message-ID: <20250528085930.227816-7-frederic.danis@collabora.com> (raw)
In-Reply-To: <20250528085930.227816-1-frederic.danis@collabora.com>
---
profiles/audio/hfp-hf.c | 57 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 57 insertions(+)
diff --git a/profiles/audio/hfp-hf.c b/profiles/audio/hfp-hf.c
index 395f7ba61..5cd5f663b 100644
--- a/profiles/audio/hfp-hf.c
+++ b/profiles/audio/hfp-hf.c
@@ -1051,8 +1051,65 @@ failed:
return btd_error_failed(msg, "Dial command failed");
}
+static DBusMessage *hfp_hangup_all(DBusConnection *conn, DBusMessage *msg,
+ void *profile_data)
+{
+ struct hfp_device *dev = profile_data;
+ bool found_active = FALSE;
+ bool found_held = FALSE;
+ GSList *l;
+
+ DBG("");
+
+ for (l = dev->calls; l; l = l->next) {
+ struct call *call = l->data;
+
+ switch (call->state) {
+ case CALL_STATE_ACTIVE:
+ case CALL_STATE_DIALING:
+ case CALL_STATE_ALERTING:
+ case CALL_STATE_INCOMING:
+ found_active = TRUE;
+ break;
+ case CALL_STATE_HELD:
+ case CALL_STATE_WAITING:
+ found_held = TRUE;
+ break;
+ case CALL_STATE_DISCONNECTED:
+ break;
+ }
+ }
+
+ if (!found_active && !found_held)
+ return btd_error_failed(msg, "No call to hang up");
+
+ if (found_held) {
+ if (!hfp_hf_send_command(dev->hf, cmd_complete_cb,
+ found_active ? NULL : dbus_message_ref(msg),
+ "AT+CHLD=0")) {
+ warn("Failed to hangup held calls");
+ goto failed;
+ }
+ }
+
+ if (found_active) {
+ if (!hfp_hf_send_command(dev->hf, cmd_complete_cb,
+ dbus_message_ref(msg),
+ "AT+CHUP")) {
+ warn("Failed to hangup active calls");
+ goto failed;
+ }
+ }
+
+ return NULL;
+
+failed:
+ return btd_error_failed(msg, "Hang up all command failed");
+}
+
struct telephony_callbacks hfp_callbacks = {
.dial = hfp_dial,
+ .hangup_all = hfp_hangup_all,
};
static int hfp_connect(struct btd_service *service)
--
2.43.0
next prev parent reply other threads:[~2025-05-28 8:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-28 8:59 [RFC BlueZ 00/10] New Telephony interface for HSP, HFP and CCP Frédéric Danis
2025-05-28 8:59 ` [RFC BlueZ 01/10] doc: Add new telephony related profiles interfaces Frédéric Danis
2025-05-28 10:33 ` New Telephony interface for HSP, HFP and CCP bluez.test.bot
2025-05-28 8:59 ` [RFC BlueZ 02/10] audio/telephony: Add shared interfaces implementation Frédéric Danis
2025-05-28 8:59 ` [RFC BlueZ 03/10] audio/telephony: Add skeleton for HFP profile Frédéric Danis
2025-05-28 8:59 ` [RFC BlueZ 04/10] audio/hfp-hf: Add HFP SLC connection and event support Frédéric Danis
2025-05-28 8:59 ` [RFC BlueZ 05/10] audio/hfp-hf: Add dial support Frédéric Danis
2025-05-28 8:59 ` Frédéric Danis [this message]
2025-05-28 8:59 ` [RFC BlueZ 07/10] audio/hfp-hf: Add answer a specific call support Frédéric Danis
2025-05-28 8:59 ` [RFC BlueZ 08/10] client/telephony: Add new submenu Frédéric Danis
2025-05-28 8:59 ` [RFC BlueZ 09/10] audio/hfp-hf: Remove call interface during profile disconnection Frédéric Danis
2025-05-28 8:59 ` [RFC BlueZ 10/10] audio/hfp-hf: Create existing call during SLC phase Frédéric Danis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250528085930.227816-7-frederic.danis@collabora.com \
--to=frederic.danis@collabora.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox