diff --git a/obexd/plugins/pbap.c b/obexd/plugins/pbap.c
index fc0eabe..f72a7f7 100644
--- a/obexd/plugins/pbap.c
+++ b/obexd/plugins/pbap.c
gpointer context, size_t *size, int *err)
{
struct pbap_session *pbap = context;
+ const gchar *type = obex_get_type(pbap->os);
+ phonebook_cb cb;
int ret;
if (oflag != O_RDONLY) {
goto fail;
}
- /*
- * Zero means that the PCE wants to know the number of used indexes in
- * the phone book of interest. PSE shall ignore all other application
- * parameter that may be present in the request.
- */
if (pbap->params->maxlistcount == 0)
- ret = phonebook_pull(name, pbap->params,
- phonebook_size_result, pbap);
+ cb = phonebook_size_result;
else
- ret = phonebook_pull(name, pbap->params, query_result, pbap);
+ cb = query_result;
+
+ if (g_strcmp0(type, "x-bt/phonebook") == 0)
+ ret = phonebook_pull(name, pbap->params, cb, pbap);
+ else if (g_strcmp0(type, "x-bt/vcard-listing") == 0)
+ ret = phonebook_list(name, pbap->params, cb, pbap);
+ else if (g_strcmp0(type, "x-bt/vcard") == 0)
+ ret = phonebook_get_entry(name, pbap->params, query_result, pbap);
+ else {
+ ret = -EINVAL;
+ goto fail;
+ }
if (ret < 0)
goto fail;
diff --git a/obexd/plugins/phonebook-dummy.c b/obexd/plugins/phonebook-dummy.c
index 8bff79d..b44bb94 100644
--- a/obexd/plugins/phonebook-dummy.c
+++ b/obexd/plugins/phonebook-dummy.c
dummy_result, dummy, g_free);
return 0;
}
+
+int phonebook_get_entry(const gchar *name, const struct apparam_field *params,
+ phonebook_cb cb, gpointer user_data)
+{
+ return -1;
+}
+
+int phonebook_list(const gchar *name, const struct apparam_field *params,
+ phonebook_cb cb, gpointer user_data)
+{
+ return -1;
+}
diff --git a/obexd/plugins/phonebook-ebook.c b/obexd/plugins/phonebook-ebook.c
index f36180d..a31f8e0 100644
--- a/obexd/plugins/phonebook-ebook.c
+++ b/obexd/plugins/phonebook-ebook.c
return 0;
}
+
+int phonebook_get_entry(const gchar *name, const struct apparam_field *params,
+ phonebook_cb cb, gpointer user_data)
+{
+ return -1;
+}
+
+int phonebook_list(const gchar *name, const struct apparam_field *params,
+ phonebook_cb cb, gpointer user_data)
+{
+ return -1;
+}
diff --git a/obexd/plugins/phonebook.h b/obexd/plugins/phonebook.h
index 9eaf095..b0878fb 100644
--- a/obexd/plugins/phonebook.h
+++ b/obexd/plugins/phonebook.h
int phonebook_pull(const gchar *name, const struct apparam_field *params,
phonebook_cb cb, gpointer user_data);
+
+int phonebook_get_entry(const gchar *name, const struct apparam_field *params,
+ phonebook_cb cb, gpointer user_data);
+
+int phonebook_list(const gchar *name, const struct apparam_field *params,
+ phonebook_cb cb, gpointer user_data);