From: "Frédéric Danis" <frederic.danis@collabora.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ RESEND 3/4] shared/hfp: Add +CIEV event support
Date: Tue, 19 Aug 2025 15:33:20 +0200 [thread overview]
Message-ID: <20250819133321.382279-3-frederic.danis@collabora.com> (raw)
In-Reply-To: <20250819133321.382279-1-frederic.danis@collabora.com>
Register +CIEV handler on SLC completion to call the update_indicator
call back on unsolicited events.
---
src/shared/hfp.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/src/shared/hfp.c b/src/shared/hfp.c
index c1bcb61cf..71f193f83 100644
--- a/src/shared/hfp.c
+++ b/src/shared/hfp.c
@@ -1694,6 +1694,22 @@ static void set_indicator_value(uint8_t index, unsigned int val,
}
}
+static void ciev_cb(struct hfp_context *context, void *user_data)
+{
+ struct hfp_hf *hfp = user_data;
+ unsigned int index, val;
+
+ DBG(hfp, "");
+
+ if (!hfp_context_get_number(context, &index))
+ return;
+
+ if (!hfp_context_get_number(context, &val))
+ return;
+
+ set_indicator_value(index, val, hfp->ag_ind, hfp);
+}
+
static void slc_cmer_resp(enum hfp_result result, enum hfp_error cme_err,
void *user_data)
{
@@ -1709,6 +1725,10 @@ static void slc_cmer_resp(enum hfp_result result, enum hfp_error cme_err,
if (hfp->callbacks->session_ready)
hfp->callbacks->session_ready(HFP_RESULT_OK, 0,
hfp->callbacks_data);
+
+ /* Register unsolicited results handlers */
+ hfp_hf_register(hfp, ciev_cb, "+CIEV", hfp, NULL);
+
return;
failed:
--
2.43.0
next prev parent reply other threads:[~2025-08-19 13:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-19 13:33 [PATCH BlueZ RESEND 1/4] shared/hfp: Add HF SLC connection function Frédéric Danis
2025-08-19 13:33 ` [PATCH BlueZ RESEND 2/4] unit/test-hfp: Add SLC connection test Frédéric Danis
2025-08-19 13:33 ` Frédéric Danis [this message]
2025-08-19 13:33 ` [PATCH BlueZ RESEND 4/4] unit/test-hfp: Add indicators tests for HF Frédéric Danis
2025-08-19 14:59 ` [BlueZ,RESEND,1/4] shared/hfp: Add HF SLC connection function bluez.test.bot
2025-08-19 21:13 ` [PATCH BlueZ RESEND 1/4] " Luiz Augusto von Dentz
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=20250819133321.382279-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 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.