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 #define OBEX_SYNC_UUID \
00093 "IRMC-SYNC"
00094
00095 #define OBEX_SYNC_UUID_LEN 9
00096
00098 typedef struct gw_obex GwObex;
00099
00101 typedef struct gw_obex_xfer GwObexXfer;
00102
00107 typedef void (*gw_obex_xfer_cb_t) (GwObexXfer *xfer,
00108 gpointer data);
00109
00114 typedef void (*gw_obex_disconnect_cb_t) (GwObex *ctx,
00115 gpointer data);
00116
00125 typedef void (*gw_obex_progress_cb_t) (GwObex *ctx, gint obex_cmd,
00126 gint current, gint target,
00127 gpointer data);
00128
00136 typedef gboolean (*gw_obex_cancel_cb_t) (gpointer data);
00137
00138
00161 GwObex *gw_obex_setup_dev(const gchar *device,
00162 const gchar *uuid,
00163 gint uuid_len,
00164 GMainContext *context,
00165 gint *error);
00166
00167
00182 GwObex *gw_obex_setup_fd(int fd,
00183 const gchar *uuid,
00184 gint uuid_len,
00185 GMainContext *context,
00186 gint *error);
00187
00188
00194 void gw_obex_close(GwObex *ctx);
00195
00212 void gw_obex_set_disconnect_callback(GwObex *ctx,
00213 gw_obex_disconnect_cb_t callback,
00214 gpointer data);
00215
00216
00224 void gw_obex_set_progress_callback(GwObex *ctx,
00225 gw_obex_progress_cb_t callback,
00226 gpointer data);
00227
00228
00240 void gw_obex_set_cancel_callback(GwObex *ctx,
00241 gw_obex_cancel_cb_t callback,
00242 gpointer data);
00243
00264 gboolean gw_obex_get_capability(GwObex *ctx,
00265 gchar **cap,
00266 gint *cap_len,
00267 gint *error);
00268
00269
00281 gboolean gw_obex_get_file(GwObex *ctx,
00282 const gchar *local,
00283 const gchar *remote,
00284 const gchar *type,
00285 gint *error);
00286
00287
00299 gboolean gw_obex_put_file(GwObex *ctx,
00300 const gchar *local,
00301 const gchar *remote,
00302 const gchar *type,
00303 gint *error);
00304
00305
00317 gboolean gw_obex_get_fd(GwObex *ctx, gint fd,
00318 const gchar *remote,
00319 const gchar *type,
00320 gint *error);
00321
00333 gboolean gw_obex_put_fd(GwObex *ctx, gint fd,
00334 const gchar *remote,
00335 const gchar *type,
00336 gint *error);
00337
00352 gboolean gw_obex_get_buf(GwObex *ctx, const gchar *remote, const gchar *type,
00353 gchar **buf, gint *buf_size, gint *error);
00354
00355
00370 gboolean gw_obex_put_buf(GwObex *ctx, const gchar *remote, const gchar *type,
00371 const gchar *buf, gint buf_size, gint time, gint *error);
00372
00373
00390 gboolean gw_obex_get_buf_with_apparam(GwObex *ctx, const gchar *remote, const gchar *type,
00391 const guint8 *apparam, gint apparam_size,
00392 gchar **buf, gint *buf_size, gint *error);
00393
00394
00411 gboolean gw_obex_put_buf_with_apparam(GwObex *ctx, const gchar *remote, const gchar *type,
00412 const guint8 *apparam, gint apparam_size,
00413 const gchar *buf, gint buf_size, gint time, gint *error);
00414
00415
00425 gboolean gw_obex_chdir(GwObex *ctx, const gchar *dir, gint *error);
00426
00427
00436 gboolean gw_obex_mkdir(GwObex *ctx, const gchar *dir, gint *error);
00437
00438
00450 gboolean gw_obex_read_dir(GwObex *ctx, const gchar *dir,
00451 gchar **buf, gint *buf_size, gint *error);
00452
00453
00462 gboolean gw_obex_delete(GwObex *ctx, const gchar *name, gint *error);
00463
00464
00474 gboolean gw_obex_move(GwObex *ctx, const gchar *src, const gchar *dst,
00475 gint *error);
00476
00477
00487 gboolean gw_obex_copy(GwObex *ctx, const gchar *src, const gchar *dst,
00488 gint *error);
00489
00510 GwObexXfer *gw_obex_put_async(GwObex *ctx, const char *name, const char *type,
00511 gint size, time_t time, gint *error);
00512
00513
00523 GwObexXfer *gw_obex_get_async(GwObex *ctx, const char *name, const char *type, gint *error);
00524
00537 GwObexXfer *gw_obex_get_async_with_apparam(GwObex *ctx, const char *name, const char *type,
00538 const guint8 *apparam, gint apparam_size, gint *error);
00539
00540
00556 void gw_obex_xfer_set_callback(GwObexXfer *xfer, gw_obex_xfer_cb_t cb, gpointer user_data);
00557
00558
00565 time_t gw_obex_xfer_object_time(GwObexXfer *xfer);
00566
00567
00574 gint gw_obex_xfer_object_size(GwObexXfer *xfer);
00575
00576
00584 unsigned char *gw_obex_xfer_object_apparam(GwObexXfer *xfer, size_t *apparam_size);
00585
00586
00593 gboolean gw_obex_xfer_object_done(GwObexXfer *xfer);
00594
00595
00606 gboolean gw_obex_xfer_write(GwObexXfer *xfer, const char *buf, gint buf_size,
00607 gint *bytes_written, gint *error);
00608
00621 gboolean gw_obex_xfer_read(GwObexXfer *xfer, char *buf, gint buf_size,
00622 gint *bytes_read, gint *error);
00623
00624
00632 gboolean gw_obex_xfer_flush(GwObexXfer *xfer, gint *error);
00633
00634
00645 gboolean gw_obex_xfer_close(GwObexXfer *xfer, gint *error);
00646
00647
00659 gboolean gw_obex_xfer_abort(GwObexXfer *xfer, gint *error);
00660
00661
00666 void gw_obex_xfer_free(struct gw_obex_xfer *xfer);
00667
00668
00678 void gw_obex_xfer_set_blocking(GwObexXfer *xfer, gboolean block);
00679
00682 #endif
00683