From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH v0 4/8] hfpmodem: Add support for storing the supported codecs
Date: Thu, 17 Jan 2013 11:29:29 -0600 [thread overview]
Message-ID: <50F834F9.4010409@gmail.com> (raw)
In-Reply-To: <1358435591-14757-5-git-send-email-claudio.takahasi@openbossa.org>
[-- Attachment #1: Type: text/plain, Size: 5285 bytes --]
Hi Claudio,
On 01/17/2013 09:13 AM, Claudio Takahasi wrote:
> From: Vinicius Costa Gomes<vinicius.gomes@openbossa.org>
>
> As informing the AG of the supported codecs is part of the setup
> of the SLC, it makes sense to have this information inside the SLC
> establishment part.
>
> Now the hfp_slc_info structure has dynamic information, and so the
> hfp_slc_info_free() function is used.
> ---
> drivers/hfpmodem/slc.c | 14 +++++++++++++-
> drivers/hfpmodem/slc.h | 10 +++++++++-
> plugins/hfp_hf_bluez4.c | 5 ++++-
> plugins/phonesim.c | 12 +++++++-----
> 4 files changed, 33 insertions(+), 8 deletions(-)
This patch needs to be broken up. First it needs to implement the
hfp_slc_info_free function, then update all existing plugins to use
that. Then introduce hfp_slc_info_init changes and whatever else.
>
> diff --git a/drivers/hfpmodem/slc.c b/drivers/hfpmodem/slc.c
> index 646befa..288afdd 100644
> --- a/drivers/hfpmodem/slc.c
> +++ b/drivers/hfpmodem/slc.c
> @@ -52,7 +52,8 @@ struct slc_establish_data {
> gpointer userdata;
> };
>
> -void hfp_slc_info_init(struct hfp_slc_info *info, guint16 version)
> +void hfp_slc_info_init(struct hfp_slc_info *info, guint16 version,
> + unsigned char *codecs, int len)
> {
> info->ag_features = 0;
> info->ag_mpty_features = 0;
> @@ -72,11 +73,22 @@ void hfp_slc_info_init(struct hfp_slc_info *info, guint16 version)
>
> info->hf_features |= HFP_HF_FEATURE_CODEC_NEGOTIATION;
>
> + info->codecs = g_memdup(codecs, len);
> + info->codecs_len = len;
> +
> done:
> memset(info->cind_val, 0, sizeof(info->cind_val));
> memset(info->cind_pos, 0, sizeof(info->cind_pos));
> }
>
> +void hfp_slc_info_free(struct hfp_slc_info *info)
> +{
> + g_free(info->codecs);
> +
> + g_at_chat_unref(info->chat);
> + info->chat = NULL;
> +}
> +
> static void slc_establish_data_unref(gpointer userdata)
> {
> struct slc_establish_data *sed = userdata;
> diff --git a/drivers/hfpmodem/slc.h b/drivers/hfpmodem/slc.h
> index b71ffe9..d7c90a2 100644
> --- a/drivers/hfpmodem/slc.h
> +++ b/drivers/hfpmodem/slc.h
> @@ -44,6 +44,11 @@ enum hfp_indicator {
> HFP_INDICATOR_LAST
> };
>
> +enum hfp_codec {
> + HFP_CODEC_CVSD = 0x01,
> + HFP_CODEC_MSBC = 0x02,
> +};
> +
> typedef void (*hfp_slc_cb_t)(void *userdata);
>
> struct hfp_slc_info {
> @@ -53,9 +58,12 @@ struct hfp_slc_info {
> unsigned int hf_features;
> unsigned char cind_pos[HFP_INDICATOR_LAST];
> unsigned int cind_val[HFP_INDICATOR_LAST];
> + unsigned char *codecs;
> + int codecs_len;
> };
>
> -void hfp_slc_info_init(struct hfp_slc_info *info, guint16 version);
> +void hfp_slc_info_init(struct hfp_slc_info *info, guint16 version,
> + unsigned char *codecs, int len);
> void hfp_slc_info_free(struct hfp_slc_info *info);
>
> void hfp_slc_establish(struct hfp_slc_info *info, hfp_slc_cb_t connect_cb,
> diff --git a/plugins/hfp_hf_bluez4.c b/plugins/hfp_hf_bluez4.c
> index 450c183..f27b0e1 100644
> --- a/plugins/hfp_hf_bluez4.c
> +++ b/plugins/hfp_hf_bluez4.c
> @@ -165,12 +165,15 @@ static DBusMessage *hfp_agent_new_connection(DBusConnection *conn,
> struct ofono_modem *modem = data;
> struct hfp_data *hfp_data = ofono_modem_get_data(modem);
> guint16 version;
> + unsigned char codecs[1];
>
> if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_UNIX_FD,&fd,
> DBUS_TYPE_UINT16,&version, DBUS_TYPE_INVALID))
> return __ofono_error_invalid_args(msg);
>
> - hfp_slc_info_init(&hfp_data->info, version);
> + memset(&codecs, 0, sizeof(codecs));
> + codecs[0] = HFP_CODEC_CVSD;
> + hfp_slc_info_init(&hfp_data->info, version, codecs, 1);
Why do you need this info for HFP 1.5?
>
> err = service_level_connection(modem, fd);
> if (err< 0&& err != -EINPROGRESS)
> diff --git a/plugins/phonesim.c b/plugins/phonesim.c
> index 26f96d0..63590a9 100644
> --- a/plugins/phonesim.c
> +++ b/plugins/phonesim.c
> @@ -885,8 +885,7 @@ static void slc_failed(gpointer userdata)
>
> ofono_modem_set_powered(modem, FALSE);
>
> - g_at_chat_unref(info->chat);
> - info->chat = NULL;
> + hfp_slc_info_free(info);
> }
>
> static int localhfp_enable(struct ofono_modem *modem)
> @@ -896,6 +895,7 @@ static int localhfp_enable(struct ofono_modem *modem)
> GAtSyntax *syntax;
> GAtChat *chat;
> const char *address;
> + unsigned char codecs[1];
> int sk, port;
>
> address = ofono_modem_get_string(modem, "Address");
> @@ -929,7 +929,10 @@ static int localhfp_enable(struct ofono_modem *modem)
>
> g_at_chat_set_disconnect_function(chat, slc_failed, modem);
>
> - hfp_slc_info_init(info, HFP_VERSION_LATEST);
> + memset(codecs, 0, sizeof(codecs));
> + codecs[0] = HFP_CODEC_CVSD;
> +
> + hfp_slc_info_init(info, HFP_VERSION_LATEST, codecs, 1);
> info->chat = chat;
> hfp_slc_establish(info, slc_established, slc_failed, modem);
>
> @@ -940,8 +943,7 @@ static int localhfp_disable(struct ofono_modem *modem)
> {
> struct hfp_slc_info *info = ofono_modem_get_data(modem);
>
> - g_at_chat_unref(info->chat);
> - info->chat = NULL;
> + hfp_slc_info_free(info);
>
> return 0;
> }
Regards,
-Denis
next prev parent reply other threads:[~2013-01-17 17:29 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-17 15:13 [PATCH v0 0/8] HFP HF: Service Level/Codec negotiation Claudio Takahasi
2013-01-17 15:13 ` [PATCH v0 1/8] hfp_hf: Add NewConnection arguments parsing Claudio Takahasi
2013-01-17 17:10 ` Denis Kenzior
2013-01-17 17:58 ` Claudio Takahasi
2013-01-17 18:38 ` Denis Kenzior
2013-01-17 15:13 ` [PATCH v0 2/8] hfpmodem: Add version defines for HFP 1.6 Claudio Takahasi
2013-01-17 17:22 ` Denis Kenzior
2013-01-17 15:13 ` [PATCH v0 3/8] hfpmodem: Add support for sending the supported codecs Claudio Takahasi
2013-01-17 17:22 ` Denis Kenzior
2013-01-17 15:13 ` [PATCH v0 4/8] hfpmodem: Add support for storing " Claudio Takahasi
2013-01-17 17:29 ` Denis Kenzior [this message]
2013-01-17 18:55 ` Vinicius Costa Gomes
2013-01-17 15:13 ` [PATCH v0 5/8] hfpmodem: Send the AT+BAC command with " Claudio Takahasi
2013-01-17 15:13 ` [PATCH v0 6/8] hfp_hf: Register the HFP modem Claudio Takahasi
2013-01-17 15:13 ` [PATCH v0 7/8] hfp_hf: Add service level negotiation Claudio Takahasi
2013-01-17 15:13 ` [PATCH v0 8/8] hfp_hf: Add support for codec negotiation Claudio Takahasi
2013-01-18 23:21 ` [PATCH v1 00/10] HFP HF: Service Level/Codec negotiation Claudio Takahasi
2013-01-18 23:21 ` [PATCH v1 01/10] dbus: Add ofono_dbus_iter_parse_properties() Claudio Takahasi
2013-01-18 23:21 ` [PATCH v1 02/10] bluez5: Rename register/unregister profile Claudio Takahasi
2013-01-18 23:21 ` [PATCH v1 03/10] hfp_hf: Add NewConnection arguments parsing Claudio Takahasi
2013-01-18 23:21 ` [PATCH v1 04/10] hfpmodem: Add support for storing the supported codecs Claudio Takahasi
2013-01-18 23:21 ` [PATCH v1 05/10] hfpmodem: Implement hfp_slc_info_free Claudio Takahasi
2013-01-18 23:21 ` [PATCH v1 06/10] phonesim: Use hfp_slc_info_free() Claudio Takahasi
2013-01-18 23:21 ` [PATCH v1 07/10] hfpmodem: Send the AT+BAC command with the supported codecs Claudio Takahasi
2013-01-18 23:21 ` [PATCH v1 08/10] hfp_hf: Register the HFP modem Claudio Takahasi
2013-01-18 23:21 ` [PATCH v1 09/10] hfp_hf: Add service level negotiation Claudio Takahasi
2013-01-18 23:21 ` [PATCH v1 10/10] hfp_hf: Add support for codec negotiation Claudio Takahasi
2013-01-18 23:38 ` [PATCH v2 00/10] HFP HF: Service Level/Codec negotiation Claudio Takahasi
2013-01-18 23:38 ` [PATCH v2 01/10] dbus: Add ofono_dbus_iter_parse_properties() Claudio Takahasi
2013-01-18 23:38 ` [PATCH v2 02/10] bluez5: Rename register/unregister profile Claudio Takahasi
2013-01-18 23:38 ` [PATCH v2 03/10] hfp_hf: Add NewConnection arguments parsing Claudio Takahasi
2013-01-18 23:38 ` [PATCH v2 04/10] hfpmodem: Add support for storing the supported codecs Claudio Takahasi
2013-01-18 23:38 ` [PATCH v2 05/10] hfpmodem: Implement hfp_slc_info_free Claudio Takahasi
2013-01-18 23:38 ` [PATCH v2 06/10] phonesim: Use hfp_slc_info_free() Claudio Takahasi
2013-01-18 23:38 ` [PATCH v2 07/10] hfpmodem: Send the AT+BAC command with the supported codecs Claudio Takahasi
2013-01-18 23:38 ` [PATCH v2 08/10] hfp_hf: Register the HFP modem Claudio Takahasi
2013-01-18 23:38 ` [PATCH v2 09/10] hfp_hf: Add service level negotiation Claudio Takahasi
2013-01-18 23:39 ` [PATCH v2 10/10] hfp_hf: Add support for codec negotiation Claudio Takahasi
2013-01-22 21:42 ` [PATCH v2 00/10] HFP HF: Service Level/Codec negotiation Vinicius Costa Gomes
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=50F834F9.4010409@gmail.com \
--to=denkenz@gmail.com \
--cc=ofono@ofono.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