On Wed, Apr 10, 2013 at 4:24 PM, Paulo Borges <paulo.borges(a)openbossa.org>wrote:
---
src/emulator.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/src/emulator.c b/src/emulator.c
index 0817b5d..4a748f0 100644
--- a/src/emulator.c
+++ b/src/emulator.c
@@ -37,6 +37,11 @@
#define RING_TIMEOUT 3
+struct removed_cb {
+ ofono_emulator_removed_cb_t cb;
+ void *data;
+};
+
struct ofono_emulator {
struct ofono_atom *atom;
enum ofono_emulator_type type;
@@ -53,6 +58,7 @@ struct ofono_emulator {
gboolean clip;
gboolean ccwa;
int pns_id;
+ struct removed_cb *removed_cb;
};
struct indicator {
@@ -952,6 +958,11 @@ static void emulator_remove(struct ofono_atom *atom)
DBG("atom: %p", atom);
+ if (em->removed_cb) {
+ em->removed_cb->cb(em->removed_cb->data);
+ g_free(em->removed_cb);
+ }
+
g_free(em);
}
@@ -995,6 +1006,21 @@ void ofono_emulator_remove(struct ofono_emulator *em)
__ofono_atom_free(em->atom);
}
+void ofono_emulator_set_removed_cb(struct ofono_emulator* em,
+ ofono_emulator_removed_cb_t cb, void *data)
+{
+ struct removed_cb *removed_cb;
+
+ if (em == NULL)
+ return;
+
+ removed_cb = g_try_new0(struct removed_cb, 1);
+ removed_cb->cb = cb;
+ removed_cb->data = data;
+
+ em->removed_cb = removed_cb;
+}
+
void ofono_emulator_send_final(struct ofono_emulator *em,
const struct ofono_error *final)
{
--
1.7.9.5
Hi,
please ignore this patch. I'm now using cb_data from atutil.h to handle the
callback in a new series. I will send it again soon, but all other patchs
from this series remains the same.
Paulo