Open Source Telephony
 help / color / mirror / Atom feed
From: Philippe Nunes <philippe.nunes@linux.intel.com>
To: ofono@ofono.org
Subject: [PATCH v2 11/11] gprs: Add API to set a 'detach'notification callback
Date: Mon, 04 Jul 2011 18:06:42 +0200	[thread overview]
Message-ID: <1309795602-26046-12-git-send-email-philippe.nunes@linux.intel.com> (raw)
In-Reply-To: <1309795602-26046-1-git-send-email-philippe.nunes@linux.intel.com>

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

---
 src/gprs.c  |   28 ++++++++++++++++++++++++++++
 src/ofono.h |    5 +++++
 2 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/src/gprs.c b/src/gprs.c
index f6090ba..a8b8e7d 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -155,6 +155,7 @@ struct gprs_private_context {
 	union {
 		__ofono_gprs_private_context_activate_cb_t act;
 		__ofono_gprs_private_context_deactivate_cb_t deact;
+		__ofono_gprs_private_context_detached_cb_t detach;
 	};
 	void *cb_data;
 };
@@ -1502,6 +1503,10 @@ static void gprs_attached_update(struct ofono_gprs *gprs)
 
 		if (stk_context) {
 			gprs_private_context_release(stk_context);
+
+			if (stk_context->detach)
+				stk_context->detach(stk_context->cb_data);
+
 			g_free(stk_context);
 			stk_context = NULL;
 		}
@@ -2210,6 +2215,10 @@ static void gprs_context_unregister(struct ofono_atom *atom)
 
 	if (stk_context && stk_context->context_driver == gc) {
 		gprs_private_context_release(stk_context);
+
+		if (stk_context->detach)
+			stk_context->detach(stk_context->cb_data);
+
 		g_free(stk_context);
 		stk_context = NULL;
 	}
@@ -2287,6 +2296,10 @@ void ofono_gprs_context_deactivated(struct ofono_gprs_context *gc,
 
 	if (stk_context && stk_context->context_driver == gc) {
 		gprs_private_context_release(stk_context);
+
+		if (stk_context->detach)
+			stk_context->detach(stk_context->cb_data);
+
 		g_free(stk_context);
 		stk_context = NULL;
 	}
@@ -3240,3 +3253,18 @@ int __ofono_gprs_private_context_deactivate(struct ofono_gprs *gprs,
 				deactivate_request_callback, stk_context);
 	return 0;
 }
+
+int __ofono_gprs_private_context_set_detached_notify(struct ofono_gprs *gprs,
+				__ofono_gprs_private_context_detached_cb_t cb,
+				void *data)
+{
+	if (stk_context == NULL)
+		return -ENOENT;
+
+	if (stk_context->context_driver->gprs != gprs)
+		return -EINVAL;
+
+	stk_context->detach = cb;
+	stk_context->cb_data = data;
+	return 0;
+}
diff --git a/src/ofono.h b/src/ofono.h
index 274912d..9ea16c5 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -248,6 +248,7 @@ typedef void (*__ofono_gprs_private_context_activate_cb_t)(int error,
 						const char *interface,
 						const char *ip,
 						void *data);
+typedef void (*__ofono_gprs_private_context_detached_cb_t)(void *data);
 
 int __ofono_gprs_private_context_deactivate(struct ofono_gprs *gprs,
 				__ofono_gprs_private_context_deactivate_cb_t cb,
@@ -258,6 +259,10 @@ int __ofono_gprs_private_context_activate(struct ofono_gprs *gprs,
 				__ofono_gprs_private_context_activate_cb_t cb,
 				void *data);
 
+int __ofono_gprs_private_context_set_detached_notify(struct ofono_gprs *gprs,
+				__ofono_gprs_private_context_detached_cb_t cb,
+				void *data);
+
 #include <ofono/radio-settings.h>
 #include <ofono/audio-settings.h>
 #include <ofono/ctm.h>
-- 
1.7.1


      parent reply	other threads:[~2011-07-04 16:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-04 16:06 [PATCH v2 00/11] Add BIP commands support Philippe Nunes
2011-07-04 16:06 ` [PATCH v2 01/11] gprs: Add private APIs to activate/deactivate a private context for STK Philippe Nunes
2011-07-04 16:06 ` [PATCH v2 02/11] stk: Add support for the proactive command 'Open channel' Philippe Nunes
2011-07-04 16:06 ` [PATCH v2 03/11] stk: Add support for the proactive command 'Get channel status' Philippe Nunes
2011-07-04 16:06 ` [PATCH v2 04/11] stk: Add support for the proactive command 'Close channel' Philippe Nunes
2011-07-04 16:06 ` [PATCH v2 05/11] stk: Add 'ofono_stk_activate_cb' definition Philippe Nunes
2011-07-04 16:06 ` [PATCH v2 06/11] stk: Add 'ofono_stk_deactivate_context_cb' definition Philippe Nunes
2011-07-04 16:06 ` [PATCH v2 07/11] stk: Add support for the proactive command 'Receive data' Philippe Nunes
2011-07-04 16:06 ` [PATCH v2 08/11] stk: Add support for the proactive command 'Send data' Philippe Nunes
2011-07-04 16:06 ` [PATCH v2 09/11] stk: Add support of the Setup event list proactive command Philippe Nunes
2011-07-04 16:06 ` [PATCH v2 10/11] stk: Add host route to route the traffic through the stk interface Philippe Nunes
2011-07-04 16:06 ` Philippe Nunes [this message]

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=1309795602-26046-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