From: Philippe Nunes <philippe.nunes@linux.intel.com>
To: ofono@ofono.org
Subject: [PATCH 11/11] gprs: Add API to set a 'detach'notification callback
Date: Tue, 28 Jun 2011 19:16:23 +0200 [thread overview]
Message-ID: <1309281383-6605-12-git-send-email-philippe.nunes@linux.intel.com> (raw)
In-Reply-To: <1309281383-6605-1-git-send-email-philippe.nunes@linux.intel.com>
[-- Attachment #1: Type: text/plain, Size: 2471 bytes --]
---
src/gprs.c | 37 +++++++++++++++++++++++++++++++++++++
src/ofono.h | 6 ++++++
2 files changed, 43 insertions(+), 0 deletions(-)
diff --git a/src/gprs.c b/src/gprs.c
index b3e6869..0166e70 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -1495,6 +1495,28 @@ static void gprs_attached_update(struct ofono_gprs *gprs)
"Active", DBUS_TYPE_BOOLEAN, &value);
}
+ for (l = g_private_contexts; l; l = l->next) {
+ struct gprs_private_context *ctx = l->data;
+ struct context_settings *settings =
+ ctx->context_driver->settings;
+
+ pri_set_ipv4_addr(settings->interface, NULL);
+ pri_ifupdown(settings->interface, FALSE);
+ context_settings_free(settings);
+
+ DBG("Release private context cid %d", ctx->cid);
+
+ gprs_cid_release(gprs, ctx->cid);
+ ctx->context_driver->inuse = FALSE;
+
+ if (ctx->notify)
+ ((__ofono_gprs_deactivated_on_detach_cb_t)
+ ctx->notify)(ctx->notify_data);
+
+ g_private_contexts = g_slist_remove(g_private_contexts,
+ ctx);
+ }
+
gprs->bearer = -1;
}
@@ -3223,3 +3245,18 @@ int __ofono_gprs_deactivate_context(unsigned int id,
deactivate_request_callback, private_ctx);
return 0;
}
+
+int __ofono_gprs_set_deactivated_on_detach_notify(unsigned int id,
+ __ofono_gprs_deactivated_on_detach_cb_t cb,
+ void *data)
+{
+ struct gprs_private_context *private_ctx;
+
+ private_ctx = gprs_private_context_by_id(id);
+ if (private_ctx == NULL)
+ return -EINVAL;
+
+ private_ctx->notify = cb;
+ private_ctx->notify_data = data;
+ return 0;
+}
diff --git a/src/ofono.h b/src/ofono.h
index 6b72816..a1215e8 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -248,6 +248,8 @@ typedef void (*__ofono_gprs_activate_context_cb_t)(int error,
typedef void (*__ofono_gprs_deactivate_context_cb_t)(int error, void *data);
+typedef void (*__ofono_gprs_deactivated_on_detach_cb_t)(void *data);
+
int __ofono_gprs_deactivate_context(unsigned int id,
__ofono_gprs_deactivate_context_cb_t cb,
void *data);
@@ -257,6 +259,10 @@ int __ofono_gprs_activate_context(struct ofono_gprs *gprs,
__ofono_gprs_activate_context_cb_t cb,
void *data);
+int __ofono_gprs_set_deactivated_on_detach_notify(unsigned int id,
+ __ofono_gprs_deactivated_on_detach_cb_t cb,
+ void *data);
+
#include <ofono/radio-settings.h>
#include <ofono/audio-settings.h>
#include <ofono/ctm.h>
--
1.7.1
next prev parent reply other threads:[~2011-06-28 17:16 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-28 17:16 [PATCH 00/11] Add BIP command support Philippe Nunes
2011-06-28 17:16 ` [PATCH 01/11] gprs: Add private APIs to activate/deactivate private contexts Philippe Nunes
2011-06-29 22:22 ` Denis Kenzior
2011-06-30 16:24 ` Philippe Nunes
2011-06-30 6:11 ` Denis Kenzior
2011-06-28 17:16 ` [PATCH 02/11] stk: Add support for the proactive command 'Open channel' Philippe Nunes
2011-06-29 22:38 ` Denis Kenzior
2011-06-28 17:16 ` [PATCH 03/11] stk: Add support for the proactive command 'Get channel status' Philippe Nunes
2011-06-28 17:16 ` [PATCH 04/11] stk: Add support for the proactive command 'Close channel' Philippe Nunes
2011-06-28 17:16 ` [PATCH 05/11] stk: Add 'ofono_stk_activate_cb' definition Philippe Nunes
2011-06-28 17:16 ` [PATCH 06/11] stk: Add 'ofono_stk_deactivate_context_cb' definition Philippe Nunes
2011-06-28 17:16 ` [PATCH 07/11] stk: Add support for the proactive command 'Receive data' Philippe Nunes
2011-06-28 17:16 ` [PATCH 08/11] stk: Add support for the proactive command 'Send data' Philippe Nunes
2011-06-28 17:16 ` [PATCH 09/11] stk: Add support of the Setup event list proactive command Philippe Nunes
2011-06-28 17:16 ` [PATCH 10/11] stk: Add host route to route the traffic through the stk interface Philippe Nunes
2011-06-28 17:16 ` Philippe Nunes [this message]
2011-06-29 22:46 ` [PATCH 11/11] gprs: Add API to set a 'detach'notification callback 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=1309281383-6605-12-git-send-email-philippe.nunes@linux.intel.com \
--to=philippe.nunes@linux.intel.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