public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: "Frédéric Danis" <frederic.danis@collabora.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 3/5] shared/hfp: Add Call hangup support
Date: Fri, 19 Sep 2025 10:23:32 +0200	[thread overview]
Message-ID: <20250919082334.1443310-3-frederic.danis@collabora.com> (raw)
In-Reply-To: <20250919082334.1443310-1-frederic.danis@collabora.com>

---
 src/shared/hfp.c | 25 +++++++++++++++++++++++++
 src/shared/hfp.h |  3 +++
 2 files changed, 28 insertions(+)

diff --git a/src/shared/hfp.c b/src/shared/hfp.c
index 7e35f239a..133bff248 100644
--- a/src/shared/hfp.c
+++ b/src/shared/hfp.c
@@ -2446,3 +2446,28 @@ bool hfp_hf_call_answer(struct hfp_hf *hfp, uint id,
 
 	return hfp_hf_send_command(hfp, resp_cb, user_data, "ATA");
 }
+
+bool hfp_hf_call_hangup(struct hfp_hf *hfp, uint id,
+				hfp_response_func_t resp_cb,
+				void *user_data)
+{
+	struct hf_call *call;
+
+	DBG(hfp, "");
+
+	if (!hfp)
+		return false;
+
+	call = queue_find(hfp->calls, call_id_match, UINT_TO_PTR(id));
+	if (!call) {
+		DBG(hfp, "hf: no call with id: %u", id);
+		return false;
+	}
+
+	if (call_setup_match(call, NULL) || call_active_match(call, NULL)) {
+		return hfp_hf_send_command(hfp, resp_cb, user_data,
+								"AT+CHUP");
+	}
+
+	return false;
+}
diff --git a/src/shared/hfp.h b/src/shared/hfp.h
index c623e48e6..4b171ad88 100644
--- a/src/shared/hfp.h
+++ b/src/shared/hfp.h
@@ -240,3 +240,6 @@ const char *hfp_hf_call_get_number(struct hfp_hf *hfp, uint id);
 bool hfp_hf_call_answer(struct hfp_hf *hfp, uint id,
 				hfp_response_func_t resp_cb,
 				void *user_data);
+bool hfp_hf_call_hangup(struct hfp_hf *hfp, uint id,
+				hfp_response_func_t resp_cb,
+				void *user_data);
-- 
2.43.0


  parent reply	other threads:[~2025-09-19  8:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-19  8:23 [PATCH BlueZ 1/5] shared/hfp: Add Call answer support Frédéric Danis
2025-09-19  8:23 ` [PATCH BlueZ 2/5] unit/test-hfp: Add Answer Incoming Call tests for HF Frédéric Danis
2025-09-19  8:23 ` Frédéric Danis [this message]
2025-09-19  8:23 ` [PATCH BlueZ 4/5] unit/test-hfp: Add Reject " Frédéric Danis
2025-09-19  8:23 ` [PATCH BlueZ 5/5] unit/test-hfp: Add Terminate " Frédéric Danis
2025-09-19  9:51 ` [BlueZ,1/5] shared/hfp: Add Call answer support bluez.test.bot
2025-09-30 16:50 ` [PATCH BlueZ 1/5] " patchwork-bot+bluetooth

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=20250919082334.1443310-3-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