00001
00025 #ifndef _GW_OBEX_H_
00026 #define _GW_OBEX_H_
00027
00028 #include <glib.h>
00029 #include <openobex/obex.h>
00030
00040 #define GW_OBEX_ERROR_DISCONNECT 256
00041
00043 #define GW_OBEX_ERROR_ABORT 257
00044
00046 #define GW_OBEX_ERROR_INTERNAL 258
00047
00049 #define GW_OBEX_ERROR_NO_SERVICE 259
00050
00052 #define GW_OBEX_ERROR_CONNECT_FAILED 260
00053
00055 #define GW_OBEX_ERROR_TIMEOUT 261
00056
00058 #define GW_OBEX_ERROR_INVALID_DATA 262
00059
00061 #define GW_OBEX_ERROR_INVALID_PARAMS 263
00062
00064 #define GW_OBEX_ERROR_LOCAL_ACCESS 264
00065
00067 #define GW_OBEX_ERROR_BUSY 265
00068
00070 #define GW_OBEX_ERROR_NO_DATA 266
00071
00072
00076 #define GW_OBEX_UNKNOWN_LENGTH -1
00077
00080 #define OBEX_FTP_UUID \
00081 "\xF9\xEC\x7B\xC4\x95\x3C\x11\xD2\x98\x4E\x52\x54\x00\xDC\x9E\x09"
00082
00083 #define OBEX_FTP_UUID_LEN 16
00084
00086 #define OBEX_PBAP_UUID \
00087 "\x79\x61\x35\xF0\xF0\xC5\x11\xD8\x09\x66\x08\x00\x20\x0C\x9A\x66"
00088
00089 #define OBEX_PBAP_UUID_LEN 16
00090
00092 typedef struct gw_obex GwObex;
00093
00095 typedef struct gw_obex_xfer GwObexXfer;
00096
00101 typedef void (*gw_obex_xfer_cb_t) (GwObexXfer *xfer,
00102 gpointer data);
00103
00108 typedef void (*gw_obex_disconnect_cb_t) (GwObex *ctx,
00109 gpointer data);
00110
00118 typedef void (*gw_obex_progress_cb_t) (GwObex *ctx, gint obex_cmd,
00119 gint current, gint target,
00120 gpointer data);
00121
00128 typedef gboolean (*gw_obex_cancel_cb_t) (gpointer data);
00129
00130
00153 GwObex *gw_obex_setup_dev(const gchar *device,
00154 const gchar *uuid,
00155 gint uuid_len,
00156 GMainContext *context,
00157 gint *error);
00158
00159
00174 GwObex *gw_obex_setup_fd(int fd,
00175 const gchar *uuid,
00176 gint uuid_len,
00177 GMainContext *context,
00178 gint *error);
00179
00180
00186 void gw_obex_close(GwObex *ctx);
00187
00204 void gw_obex_set_disconnect_callback(GwObex *ctx,
00205 gw_obex_disconnect_cb_t callback,
00206 gpointer data);
00207
00208
00215 void gw_obex_set_progress_callback(GwObex *ctx,
00216 gw_obex_progress_cb_t callback,
00217 gpointer data);
00218
00219
00229 void gw_obex_set_cancel_callback(GwObex *ctx,
00230 gw_obex_cancel_cb_t callback,
00231 gpointer data);
00232
00253 gboolean gw_obex_get_capability(GwObex *ctx,
00254 gchar **cap,
00255 gint *cap_len,
00256 gint *error);
00257
00258
00270 gboolean gw_obex_get_file(GwObex *ctx,
00271 const gchar *local,
00272 const gchar *remote,
00273 const gchar *type,
00274 gint *error);
00275
00276
00288 gboolean gw_obex_put_file(GwObex *ctx,
00289 const gchar *local,
00290 const gchar *remote,
00291 const gchar *type,
00292 gint *error);
00293
00294
00306 gboolean gw_obex_get_fd(GwObex *ctx, gint fd,
00307 const gchar *remote,
00308 const gchar *type,
00309 gint *error);
00310
00322 gboolean gw_obex_put_fd(GwObex *ctx, gint fd,
00323 const gchar *remote,
00324 const gchar *type,
00325 gint *error);
00326
00341 gboolean gw_obex_get_buf(GwObex *ctx, const gchar *remote, const gchar *type,
00342 gchar **buf, gint *buf_size, gint *error);
00343
00344
00359 gboolean gw_obex_put_buf(GwObex *ctx, const gchar *remote, const gchar *type,
00360 const gchar *buf, gint buf_size, gint time, gint *error);
00361
00362
00372 gboolean gw_obex_chdir(GwObex *ctx, const gchar *dir, gint *error);
00373
00374
00383 gboolean gw_obex_mkdir(GwObex *ctx, const gchar *dir, gint *error);
00384
00385
00397 gboolean gw_obex_read_dir(GwObex *ctx, const gchar *dir,
00398 gchar **buf, gint *buf_size, gint *error);
00399
00400
00409 gboolean gw_obex_delete(GwObex *ctx, const gchar *name, gint *error);
00410
00411
00421 gboolean gw_obex_move(GwObex *ctx, const gchar *src, const gchar *dst,
00422 gint *error);
00423
00424
00434 gboolean gw_obex_copy(GwObex *ctx, const gchar *src, const gchar *dst,
00435 gint *error);
00436
00457 GwObexXfer *gw_obex_put_async(GwObex *ctx, const char *name, const char *type,
00458 gint size, time_t time, gint *error);
00459
00460
00470 GwObexXfer *gw_obex_get_async(GwObex *ctx, const char *name, const char *type, gint *error);
00471
00472
00488 void gw_obex_xfer_set_callback(GwObexXfer *xfer, gw_obex_xfer_cb_t cb, gpointer user_data);
00489
00490
00497 time_t gw_obex_xfer_object_time(GwObexXfer *xfer);
00498
00499
00506 gint gw_obex_xfer_object_size(GwObexXfer *xfer);
00507
00508
00519 gboolean gw_obex_xfer_write(GwObexXfer *xfer, const char *buf, gint buf_size,
00520 gint *bytes_written, gint *error);
00521
00534 gboolean gw_obex_xfer_read(GwObexXfer *xfer, char *buf, gint buf_size,
00535 gint *bytes_read, gint *error);
00536
00537
00545 gboolean gw_obex_xfer_flush(GwObexXfer *xfer, gint *error);
00546
00547
00558 gboolean gw_obex_xfer_close(GwObexXfer *xfer, gint *error);
00559
00560
00572 gboolean gw_obex_xfer_abort(GwObexXfer *xfer, gint *error);
00573
00574
00579 void gw_obex_xfer_free(struct gw_obex_xfer *xfer);
00580
00581
00591 void gw_obex_xfer_set_blocking(GwObexXfer *xfer, gboolean block);
00592
00595 #endif
00596