All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/6] hfp_hf_bluez5: Add audio card .connect() for HFP 1.6
@ 2013-04-08 22:40 Vinicius Costa Gomes
  2013-04-08 22:40 ` [PATCH 2/6] include: Add ofono_handsfree_audio_has_wideband() Vinicius Costa Gomes
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Vinicius Costa Gomes @ 2013-04-08 22:40 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1581 bytes --]

---
 plugins/hfp_hf_bluez5.c | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/plugins/hfp_hf_bluez5.c b/plugins/hfp_hf_bluez5.c
index ac6189d..d4a9b23 100644
--- a/plugins/hfp_hf_bluez5.c
+++ b/plugins/hfp_hf_bluez5.c
@@ -324,11 +324,39 @@ static void hfp16_card_remove(struct ofono_handsfree_card *card)
 
 }
 
+static void bcc_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+	struct cb_data *cbd = user_data;
+	ofono_handsfree_card_connect_cb_t cb = cbd->cb;
+	struct ofono_error error;
+
+	decode_at_error(&error, g_at_result_final_response(result));
+
+	cb(&error, cbd->data);
+}
+
 static void hfp16_card_connect(struct ofono_handsfree_card *card,
 					ofono_handsfree_card_connect_cb_t cb,
 					void *data)
 {
-	CALLBACK_WITH_FAILURE(cb, data);
+	struct hfp *hfp = ofono_handsfree_card_get_data(card);
+	struct hfp_slc_info *info = &hfp->info;
+
+	if ((info->hf_features & HFP_HF_FEATURE_CODEC_NEGOTIATION &&
+			info->ag_features & HFP_AG_FEATURE_CODEC_NEGOTIATION)) {
+		struct cb_data *cbd = cb_data_new(cb, data);
+
+		g_at_chat_send(info->chat, "AT+BCC", NULL, bcc_cb, cbd, g_free);
+		return;
+	}
+
+	/*
+	 * If any side (remote or local) doesn't support codec negotiation,
+	 * fallback to direct SCO connection. Calling connect_sco()
+	 * hands the connection responsibility to the core, so no need
+	 * to call the callback
+	 */
+	ofono_handsfree_card_connect_sco(card);
 }
 
 static struct ofono_handsfree_card_driver hfp16_hf_driver = {
-- 
1.8.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-04-09 19:37 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-08 22:40 [PATCH 1/6] hfp_hf_bluez5: Add audio card .connect() for HFP 1.6 Vinicius Costa Gomes
2013-04-08 22:40 ` [PATCH 2/6] include: Add ofono_handsfree_audio_has_wideband() Vinicius Costa Gomes
2013-04-09 19:35   ` Denis Kenzior
2013-04-08 22:41 ` [PATCH 3/6] handsfree-audio: Implement ofono_handsfree_audio_has_wideband Vinicius Costa Gomes
2013-04-09 19:35   ` Denis Kenzior
2013-04-08 22:41 ` [PATCH 4/6] include: Make HFP 1.6 codecs definition public Vinicius Costa Gomes
2013-04-09 19:36   ` Denis Kenzior
2013-04-08 22:41 ` [PATCH 5/6] hfpmodem: Send AT+BAC with the supported codecs Vinicius Costa Gomes
2013-04-09 19:37   ` Denis Kenzior
2013-04-08 22:41 ` [PATCH 6/6] handsfree-audio: Remove unused 'codecs' field from agent Vinicius Costa Gomes
2013-04-09 19:36   ` Denis Kenzior
2013-04-09 19:34 ` [PATCH 1/6] hfp_hf_bluez5: Add audio card .connect() for HFP 1.6 Denis Kenzior

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.