Thread (3 messages) 3 messages, 1 author, 2011-08-31
STALE5508d

[PATCH obexd 1/2] Add gw_obex_put_async_with_apparam()

From: Slawomir Bochenski <hidden>
Date: 2011-08-31 13:35:13
Subsystem: the rest · Maintainer: Linus Torvalds

---
 gwobex/gw-obex.h   |   17 +++++++++++++++++
 gwobex/obex-xfer.c |   13 +++++++++++++
 2 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/gwobex/gw-obex.h b/gwobex/gw-obex.h
index c858341..d21e299 100644
--- a/gwobex/gw-obex.h
+++ b/gwobex/gw-obex.h
@@ -510,6 +510,23 @@ gboolean gw_obex_copy(GwObex *ctx, const gchar *src, const gchar *dst,
 GwObexXfer *gw_obex_put_async(GwObex *ctx, const char *name, const char *type,
                               gint size, time_t time, gint *error);
 
+/** Start an asynchrounous PUT operation supporting 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 size  Size of the object (GW_OBEX_UNKNOWN_LENGTH if not known)
+ * @param time  Last modification time of the object (-1 if not known)
+ * @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_put_async_with_apparam(GwObex *ctx, const char *name,
+				const char *type, const guint8 *apparam,
+				gint apparam_size, gint size,
+				time_t time, gint *error);
 
 /** Start a GET operation asynchronously
  *
diff --git a/gwobex/obex-xfer.c b/gwobex/obex-xfer.c
index 3a2ada8..20edb99 100644
--- a/gwobex/obex-xfer.c
+++ b/gwobex/obex-xfer.c
@@ -116,6 +116,19 @@ GwObexXfer *gw_obex_put_async(GwObex *ctx, const char *name, const char *type,
     return ret ? ctx->xfer : NULL;
 }
 
+GwObexXfer *gw_obex_put_async_with_apparam(GwObex *ctx, const char *name,
+		const char *type, const guint8 *apparam, gint apparam_size,
+		gint size, time_t time, gint *error) {
+    gboolean ret;
+    GW_OBEX_LOCK(ctx);
+    CHECK_DISCONNECT(NULL, error, ctx);
+    ret = gw_obex_put(ctx, NULL, name, type, apparam, apparam_size, NULL, size, time, -1, TRUE);
+    if (ret == FALSE)
+        gw_obex_get_error(ctx, error);
+    GW_OBEX_UNLOCK(ctx);
+    return ret ? ctx->xfer : NULL;
+}
+
 GwObexXfer *gw_obex_get_async(GwObex *ctx, const char *name, const char *type, gint *error) {
     gboolean ret;
     GW_OBEX_LOCK(ctx);
-- 
1.7.4.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help