diff --git a/obexd/client/main.c b/obexd/client/main.c
index 9595af9..0ce274a 100644
--- a/obexd/client/main.c
+++ b/obexd/client/main.c
data->agent = g_strdup(agent);
data->files = files;
- if (session_create(NULL, dest, NULL, create_callback, data) == 0)
+ if (session_create(NULL, dest, "OPP", create_callback, data) == 0)
return NULL;
g_ptr_array_free(data->files, TRUE);
data->message = dbus_message_ref(message);
data->sender = g_strdup(dbus_message_get_sender(message));
- if (session_create(source, dest, NULL,
+ if (session_create(source, dest, "OPP",
pull_session_callback, data) == 0)
return NULL;
diff --git a/obexd/client/pbap.c b/obexd/client/pbap.c
new file mode 100644
index 0000000..c70286e
--- /dev/null
+++ b/obexd/client/pbap.c
+/*
+ *
+ * OBEX Client
+ *
+ * Copyright (C) 2007-2008 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#include <glib.h>
+#include <gdbus.h>
+
+#include "session.h"
+
+static DBusMessage *pbap_pull_phone_book(DBusConnection *connection,
+ DBusMessage *message, void *user_data)
+{
+ return NULL;
+}
+
+static DBusMessage *pbap_set_phone_book(DBusConnection *connection,
+ DBusMessage *message, void *user_data)
+{
+ return NULL;
+}
+
+static DBusMessage *pbap_pull_vcard_listing(DBusConnection *connection,
+ DBusMessage *message, void *user_data)
+{
+ return NULL;
+}
+
+static DBusMessage *pbap_pull_vcard_entry(DBusConnection *connection,
+ DBusMessage *message, void *user_data)
+{
+ return NULL;
+}
+
+GDBusMethodTable pbap_methods[] = {
+/* PullPhoneBook input parameters : Name, Filter, Format, MaxListCount, ListStartOffset */
+ { "PullPhoneBook", "styqq", "s", pbap_pull_phone_book,
+ G_DBUS_METHOD_FLAG_ASYNC },
+/* SetPhoneBook input parameters : Name */
+ { "SetPhoneBook", "s", "", pbap_set_phone_book },
+/* PullvCardListing input parameters : Name, Order, SearchValue, SearchAttribute, MaxListCount, ListStartOffset */
+ { "PullvCardListing", "sysyqq", "s", pbap_pull_vcard_listing,
+ G_DBUS_METHOD_FLAG_ASYNC },
+/* PullPhoneBook input parameters : Name, Filter, Format */
+ { "PullvCardEntry", "sty", "s", pbap_pull_vcard_entry,
+ G_DBUS_METHOD_FLAG_ASYNC },
+ { }
+};
diff --git a/obexd/client/session.c b/obexd/client/session.c
index 03ddffd..2e2c159 100644
--- a/obexd/client/session.c
+++ b/obexd/client/session.c
#define SESSION_BASEPATH "/org/openobex"
#define FTP_INTERFACE "org.openobex.FileTransfer"
+#define PBAP_INTERFACE "org.openobex.PhonebookAccess"
#define DEFAULT_BUFFER_SIZE 4096
+extern GDBusMethodTable pbap_methods[];
+
static guint64 counter = 0;
struct callback_data {
str2ba(destination, &session->dst);
- if (target != NULL) {
+ if (!g_ascii_strncasecmp(target, "OPP", 3)) {
+ session->uuid = OBEX_OBJPUSH_SVCLASS_ID;
+ } else if (!g_ascii_strncasecmp(target, "FTP", 3)) {
session->uuid = OBEX_FILETRANS_SVCLASS_ID;
session->target = OBEX_FTP_UUID;
session->target_len = OBEX_FTP_UUID_LEN;
- } else
- session->uuid = OBEX_OBJPUSH_SVCLASS_ID;
+ } else if (!g_ascii_strncasecmp(target, "PBAP", 4)) {
+ session->uuid = PBAP_PSE_SVCLASS_ID;
+ session->target = OBEX_PBAP_UUID;
+ session->target_len = OBEX_PBAP_UUID_LEN;
+ } else {
+ return -EINVAL;
+ }
callback = g_try_malloc0(sizeof(*callback));
if (callback == NULL) {
int session_get(struct session_data *session, const char *type,
const char *filename, const char *targetname,
+ const guint8 *apparam, gint apparam_size,
session_callback_t func)
{
struct callback_data *callback;
fprintf(stderr, "open(): %s(%d)\n", strerror(err), err);
return -err;
}
+ }
+ session->transfer_path = register_transfer(session->conn, session);
+ if (session->transfer_path == NULL) {
+ if (fd)
+ close(fd);
+
+ return -EIO;
+ }
+
+ if (!g_str_equal(type, "x-obex/folder-listing")) {
session->transfer_path = register_transfer(session->conn, session);
if (session->transfer_path == NULL) {
if (fd)
session_ref(session);
- xfer = gw_obex_get_async(session->obex,
- filename, type, NULL);
+ xfer = gw_obex_get_async_with_apparam(session->obex,
+ filename, type, apparam, apparam_size, NULL);
if (xfer == NULL) {
close(session->fd);
session_unref(session);
callback->session = session;
callback->func = func;
- if (type && g_str_equal(type, "x-obex/folder-listing"))
- gw_obex_xfer_set_callback(xfer, get_xfer_listing_progress,
- callback);
- else
+ if (type == NULL)
gw_obex_xfer_set_callback(xfer, get_xfer_progress, callback);
+ else
+ gw_obex_xfer_set_callback(xfer, get_xfer_listing_progress,
+ callback);
session->xfer = xfer;
"Transfer in progress");
if (session_get(session, "x-obex/folder-listing",
- NULL, NULL, list_folder_callback) < 0)
+ NULL, NULL, NULL, 0, list_folder_callback) < 0)
return g_dbus_create_error(message,
"org.openobex.Error.Failed",
"Failed");
"org.openobex.Error.InvalidArguments", NULL);
if (session_get(session, NULL, source_file,
- target_file, get_file_callback) < 0)
+ target_file, NULL, 0, get_file_callback) < 0)
return g_dbus_create_error(message,
"org.openobex.Error.Failed",
"Failed");
iface = FTP_INTERFACE;
methods = ftp_methods;
break;
+ case PBAP_PSE_SVCLASS_ID:
+ iface = PBAP_INTERFACE;
+ methods = pbap_methods;
+ break;
default:
return -EINVAL;
}