Logo Search packages:      
Sourcecode: obexd version File versions  Download package

void gw_obex_xfer_set_callback ( GwObexXfer xfer,
gw_obex_xfer_cb_t  cb,
gpointer  user_data 
)

Set a callback function for a GwObexXfer object The callback function will be called in the following situations:

  • Data can be written (i.e. xfer_write will succeed)
  • Data can be read (i.e. xfer_read will succees)
  • An error ocured
  • The transfer is finished

Parameters:
xfer Pointer returned by gw_obex_put_async or gw_obex_get_async
cb Pointer to the callback function
user_data Optional user data which will be passed to the callback function
Returns:
a new GwObexXfer object on success, NULL on failure

Definition at line 173 of file obex-xfer.c.

                                                                                           {
    GwObex *ctx = xfer->ctx;

    GW_OBEX_LOCK(ctx);

    xfer->cb = cb;
    xfer->cb_data = user_data;

    if (xfer->do_cb && xfer->idle_source == NULL) {
        xfer->idle_source = g_idle_source_new();
        g_source_set_callback(xfer->idle_source, (GSourceFunc)gw_obex_put_idle, xfer, NULL);
        (void) g_source_attach(xfer->idle_source, ctx->main_ctx);
        g_source_unref(xfer->idle_source);
    }

    GW_OBEX_UNLOCK(ctx);
}


Generated by  Doxygen 1.6.0   Back to index