summaryrefslogtreecommitdiff
path: root/src/libgsmd
diff options
context:
space:
mode:
authorjserv <jserv@99fdad57-331a-0410-800a-d7fa5415bdb3>2007-10-17 06:18:34 +0000
committerjserv <jserv@99fdad57-331a-0410-800a-d7fa5415bdb3>2007-10-17 06:18:34 +0000
commit5e988040575d346c4ca41061248e72d676467ed0 (patch)
tree804279635df37b273e9318fd8ec944502f9c8a9f /src/libgsmd
parent7247d56f6787bc1c7e573c2b3df78d0d46fee9eb (diff)
Improvement for find and read phonebooks in gsmd.
From: Sean Chiang <sean_chiang@openmoko.com> Subject: [PATCH] Improvement for find and read phonebooks in gsmd This patch is an improvement for find and read phonebooks. After clients make a request to find / read phonebooks, then clients should make a request to retrieve all the records. git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@3202 99fdad57-331a-0410-800a-d7fa5415bdb3
Diffstat (limited to 'src/libgsmd')
-rw-r--r--src/libgsmd/libgsmd_phonebook.c48
1 files changed, 47 insertions, 1 deletions
diff --git a/src/libgsmd/libgsmd_phonebook.c b/src/libgsmd/libgsmd_phonebook.c
index 671566b..1f59e34 100644
--- a/src/libgsmd/libgsmd_phonebook.c
+++ b/src/libgsmd/libgsmd_phonebook.c
@@ -33,7 +33,7 @@ int lgsm_pb_set_storage(struct lgsm_handle *lh, char *storage)
gmh->data[2] = '\0';
rc = lgsm_send(lh, gmh);
- if (rc < gmh->len + 3) {
+ if (rc < gmh->len + sizeof(*gmh)) {
lgsm_gmh_free(gmh);
return -EIO;
}
@@ -177,3 +177,49 @@ int lgsm_pb_get_support(struct lgsm_handle *lh)
{
return lgsm_send_simple(lh, GSMD_MSG_PHONEBOOK, GSMD_PHONEBOOK_GET_SUPPORT);
}
+
+int lgsm_pb_retrieve_readrg(struct lgsm_handle *lh, int num)
+{
+ struct gsmd_msg_hdr *gmh;
+ int rc;
+
+ gmh = lgsm_gmh_fill(GSMD_MSG_PHONEBOOK,
+ GSMD_PHONEBOOK_RETRIEVE_READRG, sizeof(int));
+ if (!gmh)
+ return -ENOMEM;
+
+ *(int *)(gmh->data) = num;
+
+ rc = lgsm_send(lh, gmh);
+ if (rc < gmh->len + sizeof(*gmh)) {
+ lgsm_gmh_free(gmh);
+ return -EIO;
+ }
+
+ lgsm_gmh_free(gmh);
+
+ return 0;
+}
+
+int lgsm_pb_retrieve_find(struct lgsm_handle *lh, int num)
+{
+ struct gsmd_msg_hdr *gmh;
+ int rc;
+
+ gmh = lgsm_gmh_fill(GSMD_MSG_PHONEBOOK,
+ GSMD_PHONEBOOK_RETRIEVE_FIND, sizeof(int));
+ if (!gmh)
+ return -ENOMEM;
+
+ *(int *)(gmh->data) = num;
+
+ rc = lgsm_send(lh, gmh);
+ if (rc < gmh->len + sizeof(*gmh)) {
+ lgsm_gmh_free(gmh);
+ return -EIO;
+ }
+
+ lgsm_gmh_free(gmh);
+
+ return 0;
+}
personal git repositories of Harald Welte. Your mileage may vary