* [PATCH 2/6] include: Add ofono_handsfree_audio_has_wideband()
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 ` 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
` (4 subsequent siblings)
5 siblings, 1 reply; 12+ messages in thread
From: Vinicius Costa Gomes @ 2013-04-08 22:40 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 910 bytes --]
As we can assume that the CVSD codec will be always available, the only
information that we need to export is if we have support for wideband codecs,
right now, only mSBC is defined.
---
include/handsfree-audio.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/handsfree-audio.h b/include/handsfree-audio.h
index 49b0605..82d1312 100644
--- a/include/handsfree-audio.h
+++ b/include/handsfree-audio.h
@@ -49,6 +49,8 @@ struct ofono_handsfree_card *ofono_handsfree_card_create(unsigned int vendor,
int ofono_handsfree_card_register(struct ofono_handsfree_card *card);
void ofono_handsfree_card_remove(struct ofono_handsfree_card *card);
+ofono_bool_t ofono_handsfree_audio_has_wideband(void);
+
void ofono_handsfree_card_set_data(struct ofono_handsfree_card *card,
void *data);
void *ofono_handsfree_card_get_data(struct ofono_handsfree_card *card);
--
1.8.2
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH 2/6] include: Add ofono_handsfree_audio_has_wideband()
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
0 siblings, 0 replies; 12+ messages in thread
From: Denis Kenzior @ 2013-04-09 19:35 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 403 bytes --]
Hi Vinicius,
On 04/08/2013 05:40 PM, Vinicius Costa Gomes wrote:
> As we can assume that the CVSD codec will be always available, the only
> information that we need to export is if we have support for wideband codecs,
> right now, only mSBC is defined.
> ---
> include/handsfree-audio.h | 2 ++
> 1 file changed, 2 insertions(+)
>
Patch has been applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 3/6] handsfree-audio: Implement ofono_handsfree_audio_has_wideband
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-08 22:41 ` 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
` (3 subsequent siblings)
5 siblings, 1 reply; 12+ messages in thread
From: Vinicius Costa Gomes @ 2013-04-08 22:41 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 767 bytes --]
---
src/handsfree-audio.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/handsfree-audio.c b/src/handsfree-audio.c
index 3f24a2a..699c8cc 100644
--- a/src/handsfree-audio.c
+++ b/src/handsfree-audio.c
@@ -71,6 +71,7 @@ static int ref_count = 0;
static GSList *card_list = 0;
static guint sco_watch = 0;
static GSList *drivers = 0;
+static ofono_bool_t has_wideband = FALSE;
static void send_new_connection(const char *card, int fd)
{
@@ -541,6 +542,11 @@ void ofono_handsfree_card_remove(struct ofono_handsfree_card *card)
g_free(card);
}
+ofono_bool_t ofono_handsfree_audio_has_wideband(void)
+{
+ return has_wideband;
+}
+
static void agent_free(struct agent *agent)
{
if (agent->watch > 0)
--
1.8.2
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH 4/6] include: Make HFP 1.6 codecs definition public
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-08 22:41 ` [PATCH 3/6] handsfree-audio: Implement ofono_handsfree_audio_has_wideband Vinicius Costa Gomes
@ 2013-04-08 22:41 ` 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
` (2 subsequent siblings)
5 siblings, 1 reply; 12+ messages in thread
From: Vinicius Costa Gomes @ 2013-04-08 22:41 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1248 bytes --]
As there is some knowledge about the codecs in both the core
(handsfree-audio) and the hfpmodem driver, this information should
be available from a single location.
---
include/types.h | 6 ++++++
src/handsfree-audio.c | 6 ------
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/types.h b/include/types.h
index 8c01bf4..93a403b 100644
--- a/include/types.h
+++ b/include/types.h
@@ -141,6 +141,12 @@ enum hfp_hf_feature {
HFP_HF_FEATURE_CODEC_NEGOTIATION = 0x80,
};
+/* Defined HFP 1.6 codecs */
+enum hfp_codec {
+ HFP_CODEC_CVSD = 0x01,
+ HFP_CODEC_MSBC = 0x02,
+};
+
const char *ofono_uuid_to_str(const struct ofono_uuid *uuid);
void ofono_call_init(struct ofono_call *call);
diff --git a/src/handsfree-audio.c b/src/handsfree-audio.c
index 699c8cc..69d033d 100644
--- a/src/handsfree-audio.c
+++ b/src/handsfree-audio.c
@@ -43,12 +43,6 @@
#define HFP_AUDIO_AGENT_INTERFACE OFONO_SERVICE ".HandsfreeAudioAgent"
#define HFP_AUDIO_CARD_INTERFACE OFONO_SERVICE ".HandsfreeAudioCard"
-/* Supported agent codecs */
-enum hfp_codec {
- HFP_CODEC_CVSD = 0x01,
- HFP_CODEC_MSBC = 0x02,
-};
-
struct ofono_handsfree_card {
char *remote;
char *local;
--
1.8.2
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH 5/6] hfpmodem: Send AT+BAC with the supported codecs
2013-04-08 22:40 [PATCH 1/6] hfp_hf_bluez5: Add audio card .connect() for HFP 1.6 Vinicius Costa Gomes
` (2 preceding siblings ...)
2013-04-08 22:41 ` [PATCH 4/6] include: Make HFP 1.6 codecs definition public Vinicius Costa Gomes
@ 2013-04-08 22:41 ` 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:34 ` [PATCH 1/6] hfp_hf_bluez5: Add audio card .connect() for HFP 1.6 Denis Kenzior
5 siblings, 1 reply; 12+ messages in thread
From: Vinicius Costa Gomes @ 2013-04-08 22:41 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1327 bytes --]
Before, the AT+BAC command was being sent with fixed information,
now we send the command (that inform the AG of the codecs supported by
the HF) with the codecs supported by the registered Handsfree Audio
Agent.
---
drivers/hfpmodem/slc.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/hfpmodem/slc.c b/drivers/hfpmodem/slc.c
index 646befa..6423791 100644
--- a/drivers/hfpmodem/slc.c
+++ b/drivers/hfpmodem/slc.c
@@ -34,6 +34,7 @@
#include <ofono/log.h>
#include <ofono/modem.h>
#include <ofono/emulator.h>
+#include <ofono/handsfree-audio.h>
#include <drivers/atmodem/atutil.h>
@@ -304,9 +305,18 @@ static void brsf_cb(gboolean ok, GAtResult *result, gpointer user_data)
if (info->ag_features & HFP_AG_FEATURE_CODEC_NEGOTIATION &&
info->hf_features & HFP_HF_FEATURE_CODEC_NEGOTIATION) {
+ char str[32];
+
+ memset(str, 0, sizeof(str));
+
+ if (ofono_handsfree_audio_has_wideband())
+ sprintf(str, "AT+BAC=%d,%d", HFP_CODEC_CVSD,
+ HFP_CODEC_MSBC);
+ else
+ sprintf(str, "AT+BAC=%d", HFP_CODEC_CVSD);
slc_establish_data_ref(sed);
- g_at_chat_send(info->chat, "AT+BAC=1", NULL, bac_cb, sed,
+ g_at_chat_send(info->chat, str, NULL, bac_cb, sed,
slc_establish_data_unref);
return;
}
--
1.8.2
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH 5/6] hfpmodem: Send AT+BAC with the supported codecs
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
0 siblings, 0 replies; 12+ messages in thread
From: Denis Kenzior @ 2013-04-09 19:37 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 459 bytes --]
Hi Vinicius,
On 04/08/2013 05:41 PM, Vinicius Costa Gomes wrote:
> Before, the AT+BAC command was being sent with fixed information,
> now we send the command (that inform the AG of the codecs supported by
> the HF) with the codecs supported by the registered Handsfree Audio
> Agent.
> ---
> drivers/hfpmodem/slc.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
Patch has been applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 6/6] handsfree-audio: Remove unused 'codecs' field from agent
2013-04-08 22:40 [PATCH 1/6] hfp_hf_bluez5: Add audio card .connect() for HFP 1.6 Vinicius Costa Gomes
` (3 preceding siblings ...)
2013-04-08 22:41 ` [PATCH 5/6] hfpmodem: Send AT+BAC with the supported codecs Vinicius Costa Gomes
@ 2013-04-08 22:41 ` 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
5 siblings, 1 reply; 12+ messages in thread
From: Vinicius Costa Gomes @ 2013-04-08 22:41 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1082 bytes --]
Now that we only keep track whether we support wideband speech or not, we
don't have to keep track of the list of codecs supported by the Agent.
---
src/handsfree-audio.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/src/handsfree-audio.c b/src/handsfree-audio.c
index 69d033d..188deee 100644
--- a/src/handsfree-audio.c
+++ b/src/handsfree-audio.c
@@ -55,8 +55,6 @@ struct ofono_handsfree_card {
struct agent {
char *owner;
char *path;
- unsigned char *codecs;
- int codecs_len;
guint watch;
};
@@ -548,7 +546,6 @@ static void agent_free(struct agent *agent)
g_free(agent->owner);
g_free(agent->path);
- g_free(agent->codecs);
g_free(agent);
}
@@ -660,8 +657,6 @@ static DBusMessage *am_agent_register(DBusConnection *conn,
agent = g_new0(struct agent, 1);
agent->owner = g_strdup(sender);
agent->path = g_strdup(path);
- agent->codecs = g_memdup(codecs, length);
- agent->codecs_len = length;
agent->watch = g_dbus_add_disconnect_watch(conn, sender,
agent_disconnect, NULL, NULL);
--
1.8.2
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH 1/6] hfp_hf_bluez5: Add audio card .connect() for HFP 1.6
2013-04-08 22:40 [PATCH 1/6] hfp_hf_bluez5: Add audio card .connect() for HFP 1.6 Vinicius Costa Gomes
` (4 preceding siblings ...)
2013-04-08 22:41 ` [PATCH 6/6] handsfree-audio: Remove unused 'codecs' field from agent Vinicius Costa Gomes
@ 2013-04-09 19:34 ` Denis Kenzior
5 siblings, 0 replies; 12+ messages in thread
From: Denis Kenzior @ 2013-04-09 19:34 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1068 bytes --]
Hi Vinicius,
On 04/08/2013 05:40 PM, Vinicius Costa Gomes wrote:
> ---
> plugins/hfp_hf_bluez5.c | 30 +++++++++++++++++++++++++++++-
> 1 file changed, 29 insertions(+), 1 deletion(-)
Patch has been applied.
> + 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)) {
I removed the extra parentheses in a follow on commit.
> + 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 = {
Regards,
-Denis
^ permalink raw reply [flat|nested] 12+ messages in thread