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

gw-obex.h File Reference


Detailed Description

OSSO GW OBEX Connectivity Library and API

Author:
Johan Hedberg <johan.hedberg@nokia.com>
Copyright (C) 2004-2005 Nokia Corporation. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.

This library 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 Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

Definition in file gw-obex.h.

#include <glib.h>
#include <openobex/obex.h>

Go to the source code of this file.

Defines

#define GW_OBEX_UNKNOWN_LENGTH   -1
#define OBEX_FTP_UUID   "\xF9\xEC\x7B\xC4\x95\x3C\x11\xD2\x98\x4E\x52\x54\x00\xDC\x9E\x09"
#define OBEX_FTP_UUID_LEN   16
#define OBEX_PBAP_UUID   "\x79\x61\x35\xF0\xF0\xC5\x11\xD8\x09\x66\x08\x00\x20\x0C\x9A\x66"
#define OBEX_PBAP_UUID_LEN   16
#define OBEX_SYNC_UUID   "IRMC-SYNC"
#define OBEX_SYNC_UUID_LEN   9
GW OBEX Error Codes
The error codes returned by many of the functions refer either to an OBEX Protocol error or to a GW OBEX error. If the error code is less that 256, it refers to an OBEX error, othervice it refers to a GW_OBEX_ERROR_* error.

#define GW_OBEX_ERROR_ABORT   257
#define GW_OBEX_ERROR_BUSY   265
#define GW_OBEX_ERROR_CONNECT_FAILED   260
#define GW_OBEX_ERROR_DISCONNECT   256
#define GW_OBEX_ERROR_INTERNAL   258
#define GW_OBEX_ERROR_INVALID_DATA   262
#define GW_OBEX_ERROR_INVALID_PARAMS   263
#define GW_OBEX_ERROR_LOCAL_ACCESS   264
#define GW_OBEX_ERROR_NO_DATA   266
#define GW_OBEX_ERROR_NO_SERVICE   259
#define GW_OBEX_ERROR_TIMEOUT   261

Typedefs

typedef gboolean(* gw_obex_cancel_cb_t )(gpointer data)
typedef void(* gw_obex_disconnect_cb_t )(GwObex *ctx, gpointer data)
typedef void(* gw_obex_progress_cb_t )(GwObex *ctx, gint obex_cmd, gint current, gint target, gpointer data)
typedef void(* gw_obex_xfer_cb_t )(GwObexXfer *xfer, gpointer data)
typedef struct gw_obex GwObex
typedef struct gw_obex_xfer GwObexXfer

Functions

Functions for performing synchronous remote operations
Once you have setup a connection using one of the gw_obex_setup_* functions, you can perform different remote transactions using these functions.

gboolean gw_obex_chdir (GwObex *ctx, const gchar *dir, gint *error)
gboolean gw_obex_copy (GwObex *ctx, const gchar *src, const gchar *dst, gint *error)
gboolean gw_obex_delete (GwObex *ctx, const gchar *name, gint *error)
gboolean gw_obex_get_buf (GwObex *ctx, const gchar *remote, const gchar *type, gchar **buf, gint *buf_size, gint *error)
gboolean gw_obex_get_buf_with_apparam (GwObex *ctx, const gchar *remote, const gchar *type, const guint8 *apparam, gint apparam_size, gchar **buf, gint *buf_size, gint *error)
gboolean gw_obex_get_capability (GwObex *ctx, gchar **cap, gint *cap_len, gint *error)
gboolean gw_obex_get_fd (GwObex *ctx, gint fd, const gchar *remote, const gchar *type, gint *error)
gboolean gw_obex_get_file (GwObex *ctx, const gchar *local, const gchar *remote, const gchar *type, gint *error)
gboolean gw_obex_mkdir (GwObex *ctx, const gchar *dir, gint *error)
gboolean gw_obex_move (GwObex *ctx, const gchar *src, const gchar *dst, gint *error)
gboolean gw_obex_put_buf (GwObex *ctx, const gchar *remote, const gchar *type, const gchar *buf, gint buf_size, gint time, gint *error)
gboolean gw_obex_put_buf_with_apparam (GwObex *ctx, const gchar *remote, const gchar *type, const guint8 *apparam, gint apparam_size, const gchar *buf, gint buf_size, gint time, gint *error)
gboolean gw_obex_put_fd (GwObex *ctx, gint fd, const gchar *remote, const gchar *type, gint *error)
gboolean gw_obex_put_file (GwObex *ctx, const gchar *local, const gchar *remote, const gchar *type, gint *error)
gboolean gw_obex_read_dir (GwObex *ctx, const gchar *dir, gchar **buf, gint *buf_size, gint *error)
Functions for connecting and disconnecting
With these functions you can create and and disconnect connections. You can either connect using a filename (e.g. "/dev/rfcomm0") or using a file descriptor (e.g. a RFCOMM socket).

void gw_obex_close (GwObex *ctx)
GwObexgw_obex_setup_dev (const gchar *device, const gchar *uuid, gint uuid_len, GMainContext *context, gint *error)
GwObexgw_obex_setup_fd (int fd, const gchar *uuid, gint uuid_len, GMainContext *context, gint *error)
Functions for performing transfers in an asynchronous manner
With these functions you can do transfers in smaller steps. The steps are split up in a open, read/write, close manner.

GwObexXfergw_obex_get_async (GwObex *ctx, const char *name, const char *type, gint *error)
GwObexXfergw_obex_get_async_with_apparam (GwObex *ctx, const char *name, const char *type, const guint8 *apparam, gint apparam_size, gint *error)
GwObexXfergw_obex_put_async (GwObex *ctx, const char *name, const char *type, gint size, time_t time, gint *error)
gboolean gw_obex_xfer_abort (GwObexXfer *xfer, gint *error)
gboolean gw_obex_xfer_close (GwObexXfer *xfer, gint *error)
gboolean gw_obex_xfer_flush (GwObexXfer *xfer, gint *error)
void gw_obex_xfer_free (struct gw_obex_xfer *xfer)
unsigned char * gw_obex_xfer_object_apparam (GwObexXfer *xfer, size_t *apparam_size)
gboolean gw_obex_xfer_object_done (GwObexXfer *xfer)
gint gw_obex_xfer_object_size (GwObexXfer *xfer)
time_t gw_obex_xfer_object_time (GwObexXfer *xfer)
gboolean gw_obex_xfer_read (GwObexXfer *xfer, char *buf, gint buf_size, gint *bytes_read, gint *error)
void gw_obex_xfer_set_blocking (GwObexXfer *xfer, gboolean block)
void gw_obex_xfer_set_callback (GwObexXfer *xfer, gw_obex_xfer_cb_t cb, gpointer user_data)
gboolean gw_obex_xfer_write (GwObexXfer *xfer, const char *buf, gint buf_size, gint *bytes_written, gint *error)
Registering callback functions
With these functions you can register your own callback functions to gwobex to receive indications about special events.

void gw_obex_set_cancel_callback (GwObex *ctx, gw_obex_cancel_cb_t callback, gpointer data)
void gw_obex_set_disconnect_callback (GwObex *ctx, gw_obex_disconnect_cb_t callback, gpointer data)
void gw_obex_set_progress_callback (GwObex *ctx, gw_obex_progress_cb_t callback, gpointer data)


Generated by  Doxygen 1.6.0   Back to index