User Manual

Table Of Contents
USER'S AND DEVELOPER'S GUIDE WRAP MULTIRADIO ACCESS SERVER
9.8 WRAP O
BEX LIBRARIES
There are two libraries for making your own OBEX clients. See include/obex.h. libobex contains
mostly low level functions and libobexclient high level functions. Their usage in practice can be
studied using the source code of the "obexbrowser" application found in
src/examples/obexbrowser/.
9.8.1
LIBOBEX
int obex_init(int s_in, int s_out)
Initialize the OBEX library. Must be the first function called. s_in and s_out are data
handles for reading and writing.
int obex_deinit(void)
Deinitialize the OBEX library. Must be the last function called.
struct obex_t *obex_recv_packet(int timeout)
Receive one OBEX packet. You have to free() the received packet! If NULL is
returned, you have to disconnect next (timeout, dead socket, ...). If timeout is
zero, wait forever. If timeout is nonzero, wait up to timeout seconds.
int obex_send_packet(struct obex_t *o)
Send one packet. Does not call free().
void obex_packet(struct obex_t *o, int command)
Initialize an OBEX packet to empty command type packet.
void obex_packet_byte(struct obex_t *o, int header, char c)
void obex_packet_long(struct obex_t *o, int header, long l)
void obex_packet_string(struct obex_t *o, int header, char *s)
void obex_packet_binary(struct obex_t *o, int header, char *data, int len)
void obex_packet_ascii(struct obex_t *o, int header, char *s)
Add byte/long/unicode-string/binary/ascii data to an OBEX packet.
int obex_find_string(struct obex_t *o, int startoffset, int header, char *dest)
int obex_find_binary(struct obex_t *o, int startoffset, int header, char *dest)
int obex_find_ascii(struct obex_t *o, int startoffset, int header, char *dest)
int obex_find_long(struct obex_t *o, int startoffset, int header, long *dest)
Find header data from an OBEX packet. Returns -1 if not found, otherwise the
length of the data.
void obex_mime(char *filename, char *mime)
Return mime type for filename.
Bluegiga Proprietary, Copyright © Bluegiga Technologies 2001-2004 86 (94)