All of lore.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 5/5] unit/test-hfp: Add Terminate Call tests for HF
Date: Fri, 19 Sep 2025 10:23:34 +0200	[thread overview]
Message-ID: <20250919082334.1443310-5-frederic.danis@collabora.com> (raw)
In-Reply-To: <20250919082334.1443310-1-frederic.danis@collabora.com>

This add the following tests:
- /HFP/HF/TCA/BV-01-C
  Verify that the HF can terminate an ongoing call in the AG.
- /HFP/HF/TCA/BV-02-C
  Verify that the AG, upon the corresponding action, terminates an
  ongoing call. The AG then indicates this event to the HF.
- /HFP/HF/TCA/BV-04-C
  Verify that the HF can release a call after dialing and prior to
  call completion.

/HFP/HF/TCA/BV-03-C (Verify that after a call is terminated from the
remote party, the HF receives the proper indication from the AG) is
similar to /HFP/HF/TCA/BV-02-C for the HF side.
---
 unit/test-hfp.c | 88 +++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 85 insertions(+), 3 deletions(-)

diff --git a/unit/test-hfp.c b/unit/test-hfp.c
index a0faf98d7..190604ba2 100644
--- a/unit/test-hfp.c
+++ b/unit/test-hfp.c
@@ -831,9 +831,22 @@ static void hf_call_added(uint id, enum hfp_call_status status,
 	if (g_str_equal(test_name, "/HFP/HF/CLI/BV-01-C") ||
 		g_str_equal(test_name, "/HFP/HF/ICA/BV-04-C") ||
 		g_str_equal(test_name, "/HFP/HF/ICA/BV-06-C") ||
-		g_str_equal(test_name, "/HFP/HF/ICR/BV-01-C")) {
+		g_str_equal(test_name, "/HFP/HF/ICR/BV-01-C") ||
+		g_str_equal(test_name, "/HFP/HF/TCA/BV-01-C") ||
+		g_str_equal(test_name, "/HFP/HF/TCA/BV-02-C")) {
 		g_assert_cmpint(id, ==, 1);
 		g_assert_cmpint(status, ==, CALL_STATUS_INCOMING);
+	} else if (g_str_equal(test_name, "/HFP/HF/TCA/BV-04-C")) {
+		bool ret;
+
+		g_assert_cmpint(id, ==, 1);
+		g_assert_cmpint(status, ==, CALL_STATUS_DIALING);
+
+		if (tester_use_debug())
+			tester_debug("call %d: ending call", id);
+		ret = hfp_hf_call_hangup(context->hfp_hf, id, hf_cmd_complete,
+							context);
+		g_assert(ret);
 	}
 }
 
@@ -854,7 +867,9 @@ static void hf_call_line_id_updated(uint id, const char *number,
 	str = hfp_hf_call_get_number(context->hfp_hf, id);
 	g_assert_cmpstr(number, ==, str);
 
-	if (g_str_equal(test_name, "/HFP/HF/ICA/BV-04-C")) {
+	if (g_str_equal(test_name, "/HFP/HF/ICA/BV-04-C") ||
+		g_str_equal(test_name, "/HFP/HF/TCA/BV-01-C") ||
+		g_str_equal(test_name, "/HFP/HF/TCA/BV-02-C")) {
 		bool ret;
 
 		if (tester_use_debug())
@@ -890,7 +905,8 @@ static void hf_call_status_updated(uint id, enum hfp_call_status status,
 		tester_debug("call %d updated: status %u", id, status);
 
 	if (g_str_equal(test_name, "/HFP/HF/ICA/BV-04-C") ||
-		g_str_equal(test_name, "/HFP/HF/ICA/BV-06-C")) {
+		g_str_equal(test_name, "/HFP/HF/ICA/BV-06-C") ||
+		g_str_equal(test_name, "/HFP/HF/TCA/BV-02-C")) {
 		const char *number;
 
 		g_assert_cmpint(id, ==, 1);
@@ -901,6 +917,20 @@ static void hf_call_status_updated(uint id, enum hfp_call_status status,
 		if (tester_use_debug())
 			tester_debug("Error: unexpected update");
 		tester_test_failed();
+	} else if (g_str_equal(test_name, "/HFP/HF/TCA/BV-01-C")) {
+		const char *number;
+		bool ret;
+
+		g_assert_cmpint(id, ==, 1);
+		g_assert_cmpint(status, ==, CALL_STATUS_ACTIVE);
+		number = hfp_hf_call_get_number(context->hfp_hf, id);
+		g_assert_cmpstr(number, ==, "1234567");
+
+		if (tester_use_debug())
+			tester_debug("call %d: ending call", id);
+		ret = hfp_hf_call_hangup(context->hfp_hf, id, hf_cmd_complete,
+							context);
+		g_assert(ret);
 	}
 }
 
@@ -1233,6 +1263,58 @@ int main(int argc, char *argv[])
 			MINIMAL_SLC_SESSION('1', '0', '0', '0'),
 			data_end());
 
+	/* Terminate ongoing call - HF */
+	define_hf_test("/HFP/HF/TCA/BV-01-C", test_hf_session,
+			NULL, test_hf_session_done,
+			MINIMAL_SLC_SESSION('1', '0', '0', '0'),
+			frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
+				'3', ',', '1', '\r', '\n'),
+			frg_pdu('\r', '\n', 'R', 'I', 'N', 'G', '\r', '\n'),
+			frg_pdu('\r', '\n', '+', 'C', 'L', 'I', 'P', ':',
+				'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
+				',', '1', '2', '9', ',', ',', '\r', '\n'),
+			raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
+			frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
+				'2', ',', '1', '\r', '\n'),
+			frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
+				'3', ',', '0', '\r', '\n'),
+			raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
+			frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
+				'2', ',', '0', '\r', '\n'),
+			data_end());
+
+	/* Terminate ongoing call on AG - HF
+	 * idem for /HFP/HF/TCA/BV-03-C Remote party terminates the call
+	 */
+	define_hf_test("/HFP/HF/TCA/BV-02-C", test_hf_session,
+			NULL, test_hf_session_done,
+			MINIMAL_SLC_SESSION('1', '0', '0', '0'),
+			frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
+				'3', ',', '1', '\r', '\n'),
+			frg_pdu('\r', '\n', 'R', 'I', 'N', 'G', '\r', '\n'),
+			frg_pdu('\r', '\n', '+', 'C', 'L', 'I', 'P', ':',
+				'\"', '1', '2', '3', '4', '5', '6', '7', '\"',
+				',', '1', '2', '9', ',', ',', '\r', '\n'),
+			raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
+			frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
+				'2', ',', '1', '\r', '\n'),
+			frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
+				'3', ',', '0', '\r', '\n'),
+			frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
+				'2', ',', '0', '\r', '\n'),
+			data_end());
+
+	/* Abandon outgoing call - HF */
+	define_hf_test("/HFP/HF/TCA/BV-04-C", test_hf_session,
+			NULL, test_hf_session_done,
+			MINIMAL_SLC_SESSION('1', '0', '0', '0'),
+			frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
+				'3', ',', '2', '\r', '\n'),
+			raw_pdu('\r', '\n', 'O', 'K', '\r', '\n'),
+			frg_pdu('\r', '\n', '+', 'C', 'I', 'E', 'V', ':', ' ',
+				'3', ',', '0', '\r', '\n'),
+			data_end());
+
 	/* Transfer Registration Status - HF */
 	define_hf_test("/HFP/HF/TRS/BV-01-C", test_hf_session,
 			NULL, test_hf_session_done,
-- 
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 ` [PATCH BlueZ 3/5] shared/hfp: Add Call hangup support Frédéric Danis
2025-09-19  8:23 ` [PATCH BlueZ 4/5] unit/test-hfp: Add Reject Incoming Call tests for HF Frédéric Danis
2025-09-19  8:23 ` Frédéric Danis [this message]
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-5-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.