00001
00026 #ifndef _GW_OBEX_H_
00027 #define _GW_OBEX_H_
00028
00029 #include <glib.h>
00030 #include <openobex/obex.h>
00031
00041 #define GW_OBEX_ERROR_DISCONNECT 256
00042
00044 #define GW_OBEX_ERROR_ABORT 257
00045
00047 #define GW_OBEX_ERROR_INTERNAL 258
00048
00050 #define GW_OBEX_ERROR_NO_SERVICE 259
00051
00053 #define GW_OBEX_ERROR_CONNECT_FAILED 260
00054
00056 #define GW_OBEX_ERROR_TIMEOUT 261
00057
00059 #define GW_OBEX_ERROR_INVALID_DATA 262
00060
00062 #define GW_OBEX_ERROR_INVALID_PARAMS 263
00063
00065 #define GW_OBEX_ERROR_LOCAL_ACCESS 264
00066
00070 #define GW_OBEX_UNKNOWN_LENGTH -1
00071
00073 typedef struct gw_obex GwObex;
00074
00077 #define OBEX_FTP_UUID \
00078 "\xF9\xEC\x7B\xC4\x95\x3C\x11\xD2\x98\x4E\x52\x54\x00\xDC\x9E\x09"
00079
00080 #define OBEX_FTP_UUID_LEN 16
00081
00086 typedef void (*gw_obex_disconnect_cb_t) (GwObex *ctx,
00087 gpointer data);
00088
00096 typedef void (*gw_obex_progress_cb_t) (GwObex *ctx, gint obex_cmd,
00097 gint current, gint target,
00098 gpointer data);
00099
00106 typedef gboolean (*gw_obex_cancel_cb_t) (gpointer data);
00107
00108
00123 GwObex *gw_obex_setup_dev(const gchar *device,
00124 const gchar *uuid,
00125 gint uuid_len,
00126 GMainContext *context,
00127 gint *error);
00128
00129
00144 GwObex *gw_obex_setup_fd(int fd,
00145 const gchar *uuid,
00146 gint uuid_len,
00147 GMainContext *context,
00148 gint *error);
00149
00150
00156 void gw_obex_close(GwObex *ctx);
00157
00158
00170 gboolean gw_obex_get_capability(GwObex *ctx,
00171 gchar **cap,
00172 gint *cap_len,
00173 gint *error);
00174
00175
00188 gboolean gw_obex_get_type(GwObex *ctx,
00189 const gchar *type,
00190 gchar **buf,
00191 gint *buf_len,
00192 gint *error);
00193
00194
00202 void gw_obex_set_disconnect_callback(GwObex *ctx,
00203 gw_obex_disconnect_cb_t callback,
00204 gpointer data);
00205
00206
00213 void gw_obex_set_progress_callback(GwObex *ctx,
00214 gw_obex_progress_cb_t callback,
00215 gpointer data);
00216
00217
00227 void gw_obex_set_cancel_callback(GwObex *ctx,
00228 gw_obex_cancel_cb_t callback,
00229 gpointer data);
00230
00231
00242 gboolean gw_obex_get_file(GwObex *ctx,
00243 const gchar *local,
00244 const gchar *remote,
00245 gint *error);
00246
00247
00258 gboolean gw_obex_put_file(GwObex *ctx,
00259 const gchar *local,
00260 const gchar *remote,
00261 gint *error);
00262
00263
00274 gboolean gw_obex_get_fd(GwObex *ctx, gint fd, const gchar *remote, gint *error);
00275
00286 gboolean gw_obex_put_fd(GwObex *ctx, gint fd, const gchar *remote, gint *error);
00287
00302 gboolean gw_obex_get_buf(GwObex *ctx, const gchar *remote, const gchar *type,
00303 gchar **buf, gint *buf_size, gint *error);
00304
00305
00319 gboolean gw_obex_put_buf(GwObex *ctx, const gchar *remote, const gchar *type,
00320 const gchar *buf, gint buf_size, gint *error);
00321
00322
00332 gboolean gw_obex_chdir(GwObex *ctx, const gchar *dir, gint *error);
00333
00334
00343 gboolean gw_obex_mkdir(GwObex *ctx, const gchar *dir, gint *error);
00344
00345
00357 gboolean gw_obex_read_dir(GwObex *ctx, const gchar *dir,
00358 gchar **buf, gint *buf_size, gint *error);
00359
00360
00369 gboolean gw_obex_delete(GwObex *ctx, const gchar *name, gint *error);
00370
00371
00381 gboolean gw_obex_move(GwObex *ctx, const gchar *src, const gchar *dst,
00382 gint *error);
00383
00384
00394 gboolean gw_obex_copy(GwObex *ctx, const gchar *src, const gchar *dst,
00395 gint *error);
00396
00397
00398 #endif
00399