diff options
author | Denis Kenzior <denkenz@gmail.com> | 2009-08-20 15:59:50 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2009-08-20 15:59:50 -0500 |
commit | 2fea7be017b0a25bf990227db08726a88ba3e529 (patch) | |
tree | 8daece05330b3da6684a8ee3e566c2baaa06e7b4 /src | |
parent | b8589c7cdfbf812be088cc0a2a35723f624aa86e (diff) | |
download | ofono-2fea7be017b0a25bf990227db08726a88ba3e529.tar.bz2 |
Add __ofono_modem_foreach_atom function
Diffstat (limited to 'src')
-rw-r--r-- | src/modem.c | 20 | ||||
-rw-r--r-- | src/ofono.h | 6 |
2 files changed, 26 insertions, 0 deletions
diff --git a/src/modem.c b/src/modem.c index dc571141..bf1ca330 100644 --- a/src/modem.c +++ b/src/modem.c @@ -293,6 +293,26 @@ struct ofono_atom *__ofono_modem_find_atom(struct ofono_modem *modem, return NULL; } +void __ofono_modem_foreach_atom(struct ofono_modem *modem, + enum ofono_atom_type type, + ofono_atom_func callback, void *data) +{ + GSList *l; + struct ofono_atom *atom; + + if (modem == NULL) + return; + + for (l = modem->atoms; l; l = l->next) { + atom = l->data; + + if (atom->type != type) + continue; + + callback(atom, data); + } +} + void __ofono_atom_free(struct ofono_atom *atom) { struct ofono_modem *modem = atom->modem; diff --git a/src/ofono.h b/src/ofono.h index 13fd5776..3f1f8115 100644 --- a/src/ofono.h +++ b/src/ofono.h @@ -107,6 +107,8 @@ typedef void (*ofono_atom_watch_func)(struct ofono_atom *atom, enum ofono_atom_watch_condition cond, void *data); +typedef void (*ofono_atom_func)(struct ofono_atom *atom, void *data); + struct ofono_atom *__ofono_modem_add_atom(struct ofono_modem *modem, enum ofono_atom_type type, void (*destruct)(struct ofono_atom *), @@ -115,6 +117,10 @@ struct ofono_atom *__ofono_modem_add_atom(struct ofono_modem *modem, struct ofono_atom *__ofono_modem_find_atom(struct ofono_modem *modem, enum ofono_atom_type type); +void __ofono_modem_foreach_atom(struct ofono_modem *modem, + enum ofono_atom_type type, + ofono_atom_func callback, void *data); + void *__ofono_atom_get_data(struct ofono_atom *atom); const char *__ofono_atom_get_path(struct ofono_atom *atom); struct ofono_modem *__ofono_atom_get_modem(struct ofono_atom *atom); |