From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH 2/4] Core support for packet switched bearer reporting
Date: Fri, 07 Jan 2011 10:25:32 -0600 [thread overview]
Message-ID: <4D273E7C.7080605@gmail.com> (raw)
In-Reply-To: <1294416127-22432-2-git-send-email-remi.denis-courmont@nokia.com>
[-- Attachment #1: Type: text/plain, Size: 3229 bytes --]
Hi Rémi,
On 01/07/2011 10:02 AM, Rémi Denis-Courmont wrote:
> ---
> include/gprs.h | 2 ++
> src/gprs.c | 32 ++++++++++++++++++++++++++++++++
> 2 files changed, 34 insertions(+), 0 deletions(-)
>
please see the 'Submitting patches' section in HACKING
> diff --git a/include/gprs.h b/include/gprs.h
> index 1c1d116..cd62f2f 100644
> --- a/include/gprs.h
> +++ b/include/gprs.h
> @@ -59,6 +59,8 @@ void ofono_gprs_status_notify(struct ofono_gprs *gprs, int status, int tech);
> void ofono_gprs_detached_notify(struct ofono_gprs *gprs);
> void ofono_gprs_suspend_notify(struct ofono_gprs *gprs, int cause);
> void ofono_gprs_resume_notify(struct ofono_gprs *gprs);
> +void ofono_gprs_bearer_notify(struct ofono_gprs *gprs,
> + unsigned int cid, int bearer);
>
> int ofono_gprs_driver_register(const struct ofono_gprs_driver *d);
> void ofono_gprs_driver_unregister(const struct ofono_gprs_driver *d);
> diff --git a/src/gprs.c b/src/gprs.c
> index bd52676..3d4b1a8 100644
> --- a/src/gprs.c
> +++ b/src/gprs.c
> @@ -107,6 +107,7 @@ struct context_settings {
>
> struct pri_context {
> ofono_bool_t active;
> + int bearer;
> enum ofono_gprs_context_type type;
> char name[MAX_CONTEXT_NAME_LENGTH + 1];
> char message_proxy[MAX_MESSAGE_PROXY_LENGTH + 1];
> @@ -596,6 +597,13 @@ static void append_context_properties(struct pri_context *ctx,
> value = ctx->active;
> ofono_dbus_dict_append(dict, "Active", DBUS_TYPE_BOOLEAN, &value);
>
> + if (ctx->active) {
> + const char *bearer = packet_bearer_to_string(ctx->bearer);
> +
> + ofono_dbus_dict_append(dict, "Bearer",
> + DBUS_TYPE_STRING, &bearer);
> + }
> +
> ofono_dbus_dict_append(dict, "Type", DBUS_TYPE_STRING, &type);
>
> ofono_dbus_dict_append(dict, "Protocol", DBUS_TYPE_STRING, &proto);
> @@ -1591,6 +1599,7 @@ static struct pri_context *add_context(struct ofono_gprs *gprs,
> return NULL;
> }
>
> + context->bearer = -1;
You might also want to reset the bearer to -1 when the context is
deactivated.
> context->id = id;
>
> DBG("Registering new context");
> @@ -2001,6 +2010,29 @@ void ofono_gprs_add_context(struct ofono_gprs *gprs,
> __ofono_atom_register(gc->atom, gprs_context_unregister);
> }
>
> +void ofono_gprs_bearer_notify(struct ofono_gprs *gprs,
> + unsigned int cid, int bearer)
> +{
> + DBusConnection *conn = ofono_dbus_get_connection();
> + GSList *l;
> + const char *value = packet_bearer_to_string(bearer);
Why bother running this operation before you're sure you're going to
emit the signal? Please move this down.
> +
> + for (l = gprs->contexts; l; l = l->next) {
> + struct pri_context *ctx = l->data;
> +
> + if (ctx->context.cid != cid)
> + continue;
> +
> + if (ctx->bearer == bearer)
> + continue;
Shouldn't this be return instead of continue?
> +
> + ctx->bearer = bearer;
> + ofono_dbus_signal_property_changed(conn, ctx->path,
> + OFONO_CONNECTION_CONTEXT_INTERFACE,
> + "Bearer", DBUS_TYPE_STRING, &value);
> + }
> +}
> +
> void ofono_gprs_context_deactivated(struct ofono_gprs_context *gc,
> unsigned int cid)
> {
Regards,
-Denis
next prev parent reply other threads:[~2011-01-07 16:25 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-07 16:02 [PATCH 1/4] Define packet switched bearers =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
2011-01-07 16:02 ` [PATCH 2/4] Core support for packet switched bearer reporting =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
2011-01-07 16:25 ` Denis Kenzior [this message]
2011-01-10 11:19 ` =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
2011-01-10 16:16 ` Denis Kenzior
2011-01-10 11:33 ` =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
2011-01-10 16:19 ` Denis Kenzior
2011-01-07 16:02 ` [PATCH 3/4] Bearer documentation =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
2011-01-07 16:23 ` Denis Kenzior
2011-01-10 11:21 ` =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
2011-01-10 16:27 ` Denis Kenzior
2011-01-10 16:34 ` =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
2011-01-11 0:26 ` Marcel Holtmann
2011-01-11 7:53 ` Aki Niemi
2011-01-12 16:40 ` Marcel Holtmann
2011-01-13 8:17 ` =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
2011-01-10 12:41 ` =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
2011-01-10 16:20 ` Denis Kenzior
2011-01-07 16:02 ` [PATCH 4/4] atmodem: packet switch bearer support =?unknown-8bit?q?R=C3=A9mi?= Denis-Courmont
2011-01-07 16:27 ` Denis Kenzior
2011-01-07 16:23 ` [PATCH 1/4] Define packet switched bearers Denis Kenzior
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=4D273E7C.7080605@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