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 4/4] unit/test-hfp: Add Call Line Identification test for HF
Date: Thu, 11 Sep 2025 12:28:40 +0200	[thread overview]
Message-ID: <20250911102840.2090361-4-frederic.danis@collabora.com> (raw)
In-Reply-To: <20250911102840.2090361-1-frederic.danis@collabora.com>

This add the following test:
- HFP/HF/CLI/BV-01-C
  Verify that the HF receives the caller ID.
---
 unit/test-hfp.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 48 insertions(+), 1 deletion(-)

diff --git a/unit/test-hfp.c b/unit/test-hfp.c
index 8ab6c7bf5..060230196 100644
--- a/unit/test-hfp.c
+++ b/unit/test-hfp.c
@@ -730,7 +730,8 @@ static void test_hf_robustness(gconstpointer data)
 	raw_pdu('\r', '\n', '+', 'C', 'O', 'P', 'S', ':', ' '), \
 	frg_pdu('0', ',', '0', ',', '\"', 'T', 'E', 'S', 'T'), \
 	frg_pdu('\"', '\r', '\n'), \
-	frg_pdu('\r', '\n', 'O', 'K', '\r', '\n')
+	frg_pdu('\r', '\n', 'O', 'K', '\r', '\n'), \
+	raw_pdu('\r', '\n', 'O', 'K', '\r', '\n')
 
 static void hf_session_ready_cb(enum hfp_result res, enum hfp_error cme_err,
 							void *user_data)
@@ -812,10 +813,44 @@ static void hf_update_operator(const char *operator_name, void *user_data)
 		g_assert_cmpstr(operator_name, ==, "TEST");
 }
 
+static void hf_call_added(uint id, enum hfp_call_status status,
+							void *user_data)
+{
+	struct context *context = user_data;
+	const char *test_name = context->data->test_name;
+
+	if (tester_use_debug())
+		tester_debug("call %d added: status %u", id, status);
+
+	if (g_str_equal(test_name, "/HFP/HF/CLI/BV-01-C")) {
+		g_assert_cmpint(id, ==, 1);
+		g_assert_cmpint(status, ==, CALL_STATUS_INCOMING);
+	}
+}
+
+static void hf_call_line_id_updated(uint id, const char *number,
+							unsigned int type,
+							void *user_data)
+{
+	struct context *context = user_data;
+	const char *str;
+
+	if (tester_use_debug())
+		tester_debug("call %d line id updated: %s, %u", id, number,
+									type);
+	g_assert_cmpint(id, ==, 1);
+	g_assert_cmpstr(number, ==, "1234567");
+	g_assert_cmpint(type, ==, 129);
+	str = hfp_hf_call_get_number(context->hfp_hf, id);
+	g_assert_cmpstr(number, ==, str);
+}
+
 static struct hfp_hf_callbacks hf_session_callbacks = {
 	.session_ready = hf_session_ready_cb,
 	.update_indicator = hf_update_indicator,
 	.update_operator = hf_update_operator,
+	.call_added = hf_call_added,
+	.call_line_id_updated = hf_call_line_id_updated,
 };
 
 static void test_hf_session_done(enum hfp_result res, enum hfp_error cme_err,
@@ -1023,6 +1058,18 @@ int main(int argc, char *argv[])
 			MINIMAL_SLC_SESSION('0', '0', '0', '0'),
 			data_end());
 
+	/* Calling Line Identification - HF */
+	define_hf_test("/HFP/HF/CLI/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'),
+			data_end());
+
 	/* Transfer Signal Strength Indication - HF */
 	define_hf_test("/HFP/HF/PSI/BV-01-C", test_hf_session,
 			NULL, test_hf_session_done,
-- 
2.43.0


  parent reply	other threads:[~2025-09-11 10:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-11 10:28 [PATCH BlueZ 1/4] shared/hfp: Add Operator name support Frédéric Danis
2025-09-11 10:28 ` [PATCH BlueZ 2/4] unit/test-hfp: Add Operator name test for HF Frédéric Danis
2025-09-11 17:28   ` Luiz Augusto von Dentz
2025-09-11 17:32     ` Frédéric Danis
2025-09-15 13:30       ` Luiz Augusto von Dentz
2025-09-11 10:28 ` [PATCH BlueZ 3/4] shared/hfp: Add Call Line Identification support Frédéric Danis
2025-09-11 10:28 ` Frédéric Danis [this message]
2025-09-11 11:59 ` [BlueZ,1/4] shared/hfp: Add Operator name support bluez.test.bot

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=20250911102840.2090361-4-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