Diff between c285274d17085b63d08fc308a27c81225b2d2dd5 and ff984192b4529d6684173fb098e8bd1901932ea6

Changed Files

File Additions Deletions Status
src/shared/hfp.c +16 -0 modified
src/shared/hfp.h +1 -0 modified

Full Patch

diff --git a/src/shared/hfp.c b/src/shared/hfp.c
index a6f9645..bc81a07 100644
--- a/src/shared/hfp.c
+++ b/src/shared/hfp.c
@@ -1752,6 +1752,20 @@ static bool call_active_match(const void *data, const void *match_data)
 	return (call->status == CALL_STATUS_ACTIVE);
 }
 
+static void bsir_cb(struct hfp_context *context, void *user_data)
+{
+	struct hfp_hf *hfp = user_data;
+	unsigned int val;
+
+	DBG(hfp, "");
+
+	if (!hfp_context_get_number(context, &val))
+		return;
+
+	if (hfp->callbacks && hfp->callbacks->update_inband_ring)
+		hfp->callbacks->update_inband_ring(!!val, hfp->callbacks_data);
+}
+
 static void ciev_callsetup_cb(uint8_t val, void *user_data)
 {
 	struct hfp_hf *hfp = user_data;
@@ -2083,6 +2097,8 @@ static void slc_cmer_resp(enum hfp_result result, enum hfp_error cme_err,
 	}
 
 	/* Register unsolicited results handlers */
+	if (hfp->features & HFP_AG_FEAT_IN_BAND_RING_TONE)
+		hfp_hf_register(hfp, bsir_cb, "+BSIR", hfp, NULL);
 	hfp_hf_register(hfp, ciev_cb, "+CIEV", hfp, NULL);
 	hfp_hf_register(hfp, clip_cb, "+CLIP", hfp, NULL);
 	hfp_hf_register(hfp, cops_cb, "+COPS", hfp, NULL);
diff --git a/src/shared/hfp.h b/src/shared/hfp.h
index 21214ee..27315bf 100644
--- a/src/shared/hfp.h
+++ b/src/shared/hfp.h
@@ -201,6 +201,7 @@ struct hfp_hf_callbacks {
 	void (*update_indicator)(enum hfp_indicator indicator, uint32_t val,
 							void *user_data);
 	void (*update_operator)(const char *operator_name, void *user_data);
+	void (*update_inband_ring)(bool enabled, void *user_data);
 
 	void (*call_added)(uint id, enum hfp_call_status status,
 							void *user_data);