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
00119 typedef void (*gw_obex_progress_cb_t) (GwObex *ctx, gint obex_cmd,
00120 gint current, gint target,
00121 gpointer data);
00122
00130 typedef gboolean (*gw_obex_cancel_cb_t) (gpointer data);
00131
00132
00155 GwObex *gw_obex_setup_dev(const gchar *device,
00156 const gchar *uuid,
00157 gint uuid_len,
00158 GMainContext *context,
00159 gint *error);
00160
00161
00176 GwObex *gw_obex_setup_fd(int fd,
00177 const gchar *uuid,
00178 gint uuid_len,
00179 GMainContext *context,
00180 gint *error);
00181
00182
00188 void gw_obex_close(GwObex *ctx);
00189
00206 void gw_obex_set_disconnect_callback(GwObex *ctx,
00207 gw_obex_disconnect_cb_t callback,
00208 gpointer data);
00209
00210
00218 void gw_obex_set_progress_callback(GwObex *ctx,
00219 gw_obex_progress_cb_t callback,
00220 gpointer data);
00221
00222
00234 void gw_obex_set_cancel_callback(GwObex *ctx,
00235 gw_obex_cancel_cb_t callback,
00236 gpointer data);
00237
00258 gboolean gw_obex_get_capability(GwObex *ctx,
00259 gchar **cap,
00260 gint *cap_len,
00261 gint *error);
00262
00263
00275 gboolean gw_obex_get_file(GwObex *ctx,
00276 const gchar *local,
00277 const gchar *remote,
00278 const gchar *type,
00279 gint *error);
00280
00281
00293 gboolean gw_obex_put_file(GwObex *ctx,
00294 const gchar *local,
00295 const gchar *remote,
00296 const gchar *type,
00297 gint *error);
00298
00299
00311 gboolean gw_obex_get_fd(GwObex *ctx, gint fd,
00312 const gchar *remote,
00313 const gchar *type,
00314 gint *error);
00315
00327 gboolean gw_obex_put_fd(GwObex *ctx, gint fd,
00328 const gchar *remote,
00329 const gchar *type,
00330 gint *error);
00331
00346 gboolean gw_obex_get_buf(GwObex *ctx, const gchar *remote, const gchar *type,
00347 gchar **buf, gint *buf_size, gint *error);
00348
00349
00364 gboolean gw_obex_put_buf(GwObex *ctx, const gchar *remote, const gchar *type,
00365 const gchar *buf, gint buf_size, gint time, gint *error);
00366
00367
00377 gboolean gw_obex_chdir(GwObex *ctx, const gchar *dir, gint *error);
00378
00379
00388 gboolean gw_obex_mkdir(GwObex *ctx, const gchar *dir, gint *error);
00389
00390
00402 gboolean gw_obex_read_dir(GwObex *ctx, const gchar *dir,
00403 gchar **buf, gint *buf_size, gint *error);
00404
00405
00414 gboolean gw_obex_delete(GwObex *ctx, const gchar *name, gint *error);
00415
00416
00426 gboolean gw_obex_move(GwObex *ctx, const gchar *src, const gchar *dst,
00427 gint *error);
00428
00429
00439 gboolean gw_obex_copy(GwObex *ctx, const gchar *src, const gchar *dst,
00440 gint *error);
00441
00462 GwObexXfer *gw_obex_put_async(GwObex *ctx, const char *name, const char *type,
00463 gint size, time_t time, gint *error);
00464
00465
00475 GwObexXfer *gw_obex_get_async(GwObex *ctx, const char *name, const char *type, gint *error);
00476
00477
00493 void gw_obex_xfer_set_callback(GwObexXfer *xfer, gw_obex_xfer_cb_t cb, gpointer user_data);
00494
00495
00502 time_t gw_obex_xfer_object_time(GwObexXfer *xfer);
00503
00504
00511 gint gw_obex_xfer_object_size(GwObexXfer *xfer);
00512
00513
00524 gboolean gw_obex_xfer_write(GwObexXfer *xfer, const char *buf, gint buf_size,
00525 gint *bytes_written, gint *error);
00526
00539 gboolean gw_obex_xfer_read(GwObexXfer *xfer, char *buf, gint buf_size,
00540 gint *bytes_read, gint *error);
00541
00542
00550 gboolean gw_obex_xfer_flush(GwObexXfer *xfer, gint *error);
00551
00552
00563 gboolean gw_obex_xfer_close(GwObexXfer *xfer, gint *error);
00564
00565
00577 gboolean gw_obex_xfer_abort(GwObexXfer *xfer, gint *error);
00578
00579
00584 void gw_obex_xfer_free(struct gw_obex_xfer *xfer);
00585
00586
00596 void gw_obex_xfer_set_blocking(GwObexXfer *xfer, gboolean block);
00597
00600 #endif
00601