From 53dad9731bb059b9ca88d44c4f76fb0e71bf551d Mon Sep 17 00:00:00 2001 From: Raymond Liu Date: Thu, 27 Nov 2008 08:50:56 +0800 Subject: [PATCH] obexd: Add gw_obex_get_async_with_apparam function --- obexd/gwobex/gw-obex.h | 15 +++++++++++++++ obexd/gwobex/obex-xfer.c | 12 ++++++++++++ 2 files changed, 27 insertions(+) diff --git a/obexd/gwobex/gw-obex.h b/obexd/gwobex/gw-obex.h index 94a6a64e1..fcbb40ab1 100644 --- a/obexd/gwobex/gw-obex.h +++ b/obexd/gwobex/gw-obex.h @@ -474,6 +474,21 @@ GwObexXfer *gw_obex_put_async(GwObex *ctx, const char *name, const char *type, */ GwObexXfer *gw_obex_get_async(GwObex *ctx, const char *name, const char *type, gint *error); +/** Start a GET operation asynchronously with application parameters + * + * @param ctx Pointer returned by gw_obex_setup() + * @param name Name of the object (null terminated UTF-8) + * @param type Type of the object (null terminated UTF-8), or NULL + * @param apparam Application parameters of the object + * @param apparam_size Application paramters' size + * @param error Place to store error code on failure (NULL if not interested) + * + * @returns a new GwObexXfer object on success, NULL on failure + */ + +GwObexXfer *gw_obex_get_async_with_apparam(GwObex *ctx, const char *name, const char *type, + const guint8 *apparam, gint apparam_size, gint *error); + /** Set a callback function for a GwObexXfer object * The callback function will be called in the following situations: diff --git a/obexd/gwobex/obex-xfer.c b/obexd/gwobex/obex-xfer.c index c7ebbd553..fcbee35e1 100644 --- a/obexd/gwobex/obex-xfer.c +++ b/obexd/gwobex/obex-xfer.c @@ -135,6 +135,18 @@ GwObexXfer *gw_obex_get_async(GwObex *ctx, const char *name, const char *type, g return ret ? ctx->xfer : NULL; } +GwObexXfer *gw_obex_get_async_with_apparam(GwObex *ctx, const char *name, const char *type, + const guint8 *apparam, gint apparam_size, gint *error) { + gboolean ret; + GW_OBEX_LOCK(ctx); + CHECK_DISCONNECT(NULL, error, ctx); + ret = gw_obex_get(ctx, NULL, name, type, apparam, apparam_size, NULL, NULL, -1, TRUE); + if (ret == FALSE) + gw_obex_get_error(ctx, error); + GW_OBEX_UNLOCK(ctx); + return ret ? ctx->xfer : NULL; +} + static gboolean gw_obex_put_idle(GwObexXfer *xfer) { struct gw_obex *ctx = xfer->ctx; -- 2.47.3