diff options
author | Denis Kenzior <denkenz@gmail.com> | 2009-06-16 16:33:05 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2009-06-16 16:42:02 -0500 |
commit | 5fa4cd895c8aa1dc604e8751978f1f6da71d46c4 (patch) | |
tree | 202de070abf454cb885a71f18cfb3595dc823ac8 /src/driver.h | |
parent | fc98cf91a8a4e8d6b39ea1ec1ac87c428dd47859 (diff) | |
download | ofono-5fa4cd895c8aa1dc604e8751978f1f6da71d46c4.tar.bz2 |
Refactor phonebook code
Use immediate mode reporting, which means that the individual CPBR
lines are reported up to the core immediately. This has a couple
advantages:
- We do not need to malloc/free a bunch of single variables
and copy them over. Helps performance.
- The lines are not buffered up and given to the plugin in one
shot, instead processing is performed piecemeal. This helps
with keeping memory consumption down to a minimum
Diffstat (limited to 'src/driver.h')
-rw-r--r-- | src/driver.h | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/src/driver.h b/src/driver.h index 9cf3c01c..3a690f0f 100644 --- a/src/driver.h +++ b/src/driver.h @@ -102,21 +102,6 @@ struct ofono_own_number { int itc; }; -struct ofono_phonebook_entry { - int index; - char *number; - int type; - char *text; - int hidden; - char *group; - char *adnumber; - int adtype; - char *secondtext; - char *email; - char *sip_uri; - char *tel_uri; -}; - /* Notification functions, the integer values here should map to * values obtained from the modem. The enumerations are the same * as the values for the fields found in 3GPP TS 27.007 @@ -192,10 +177,6 @@ typedef void (*ofono_sca_query_cb_t)(const struct ofono_error *error, const struct ofono_phone_number *ph, void *data); -typedef void (*ofono_phonebook_export_entries_t)( - const struct ofono_error *error, int num_entries, - const struct ofono_phonebook_entry *entries, void *data); - struct ofono_modem_attribute_ops { void (*query_manufacturer)(struct ofono_modem *modem, ofono_modem_attribute_query_cb_t cb, void *data); @@ -417,12 +398,22 @@ void ofono_sms_deliver_notify(struct ofono_modem *modem, unsigned char *pdu, void ofono_sms_status_notify(struct ofono_modem *modem, unsigned char *pdu, int len, int tpdu_len); +/* Export entries reports results through ofono_phonebook_entry, if an error + * occurs, ofono_phonebook_entry should not be called + */ struct ofono_phonebook_ops { void (*export_entries)(struct ofono_modem *modem, const char *storage, - ofono_phonebook_export_entries_t cb, void *data); + ofono_generic_cb_t cb, void *data); }; int ofono_phonebook_register(struct ofono_modem *modem, struct ofono_phonebook_ops *ops); void ofono_phonebook_unregister(struct ofono_modem *modem); +void ofono_phonebook_entry(struct ofono_modem *modem, int index, + const char *number, int type, + const char *text, int hidden, + const char *group, + const char *adnumber, int adtype, + const char *secondtext, const char *email, + const char *sip_uri, const char *tel_uri); |