BtctlObex

BtctlObex — GObject OBEX server

Synopsis




            BtctlObex;
BtctlObex*  btctl_obex_new                  (void);
gboolean    btctl_obex_is_initialised       (BtctlObex *bo);
void        btctl_obex_set_response         (BtctlObex *bo,
                                             gboolean resp);
void        btctl_obex_cancel_operation     (BtctlObex *bo);
void        btctl_obex_cancel_operation_forcibly
                                            (BtctlObex *bo);
#define     BTCTL_OBEX_ERR_PARSE
#define     BTCTL_OBEX_ERR_LINK
#define     BTCTL_OBEX_ERR_ABORT


Object Hierarchy


  GObject
   +----BtctlObex

Signals


"complete"  void        user_function      (BtctlObex *btctlobex,
                                            gchar     *arg1,
                                            gpointer   user_data)      : Run first
"connect"   void        user_function      (BtctlObex *btctlobex,
                                            gchar     *arg1,
                                            gpointer   user_data)      : Run first
"disconnect"
            void        user_function      (BtctlObex *btctlobex,
                                            gchar     *arg1,
                                            gpointer   user_data)      : Run first
"error"     void        user_function      (BtctlObex *btctlobex,
                                            gchar     *arg1,
                                            guint      arg2,
                                            gpointer   user_data)      : Run first
"progress"  void        user_function      (BtctlObex *btctlobex,
                                            gchar     *arg1,
                                            gpointer   user_data)      : Run first
"put"       void        user_function      (BtctlObex *btctlobex,
                                            gchar     *arg1,
                                            gchar     *arg2,
                                            gpointer   arg3,
                                            guint      arg4,
                                            guint      arg5,
                                            gpointer   user_data)      : Run first
"request-put"
            void        user_function      (BtctlObex *btctlobex,
                                            gchar     *arg1,
                                            gpointer   user_data)      : Run first

Description

Details

BtctlObex

typedef struct _BtctlObex BtctlObex;


btctl_obex_new ()

BtctlObex*  btctl_obex_new                  (void);

Create a new Bluetooth OBEX object. This will attempt to open an OBEX server socket. Use btctl_obex_is_initialised() to check whether this was successful.

Returns : a pointer to the controller object.

btctl_obex_is_initialised ()

gboolean    btctl_obex_is_initialised       (BtctlObex *bo);

Check if OBEX was able to initialise OK. If not, we won't be able to do anything.

bo : Bluetooth OBEX object.
Returns : TRUE if initialised OK.

btctl_obex_set_response ()

void        btctl_obex_set_response         (BtctlObex *bo,
                                             gboolean resp);

Sets TRUE or FALSE response in signal handlers that must decide whether an operation can proceed or not.

bo : Bluetooth OBEX object.
resp : Boolean response.

btctl_obex_cancel_operation ()

void        btctl_obex_cancel_operation     (BtctlObex *bo);

Requests the cancel of a currently running transfer, disconnecting the client.

bo : Bluetooth OBEX object.

btctl_obex_cancel_operation_forcibly ()

void        btctl_obex_cancel_operation_forcibly
                                            (BtctlObex *bo);

Forcibly causes the closing of a client connection. Use if the client isn't responding to a cancel request, e.g. where the connection's timing out.

bo : Bluetooth OBEX object.

BTCTL_OBEX_ERR_PARSE

#define BTCTL_OBEX_ERR_PARSE    0x01

A parse error has occured on incoming packets. Usually this happens when the connection is aborted.


BTCTL_OBEX_ERR_LINK

#define BTCTL_OBEX_ERR_LINK     0x02

The remote link was dropped.


BTCTL_OBEX_ERR_ABORT

#define BTCTL_OBEX_ERR_ABORT    0x03

The remote peer aborted the connection.

Signal Details

The "complete" signal

void        user_function                  (BtctlObex *btctlobex,
                                            gchar     *arg1,
                                            gpointer   user_data)      : Run first

bo : the object which received the signal.
bdaddr : the remote address of the requestor.
user_data : user data set when the signal handler was connected.

The "connect" signal

void        user_function                  (BtctlObex *btctlobex,
                                            gchar     *arg1,
                                            gpointer   user_data)      : Run first

btctlobex : the object which received the signal.
arg1 :
user_data : user data set when the signal handler was connected.

The "disconnect" signal

void        user_function                  (BtctlObex *btctlobex,
                                            gchar     *arg1,
                                            gpointer   user_data)      : Run first

btctlobex : the object which received the signal.
arg1 :
user_data : user data set when the signal handler was connected.

The "error" signal

void        user_function                  (BtctlObex *btctlobex,
                                            gchar     *arg1,
                                            guint      arg2,
                                            gpointer   user_data)      : Run first

bo : the object which received the signal.
bdaddr : the remote address of the requestor.
reason : the error code of the signal.
user_data : user data set when the signal handler was connected.

The "progress" signal

void        user_function                  (BtctlObex *btctlobex,
                                            gchar     *arg1,
                                            gpointer   user_data)      : Run first

bo : the object which received the signal.
bdaddr : the remote address of the requestor.
user_data : user data set when the signal handler was connected.

The "put" signal

void        user_function                  (BtctlObex *btctlobex,
                                            gchar     *arg1,
                                            gchar     *arg2,
                                            gpointer   arg3,
                                            guint      arg4,
                                            guint      arg5,
                                            gpointer   user_data)      : Run first

Emitted when a remote peer has completed transmission of an OBEX PUT. Use btctl_obex_set_response() to indicate whether you accepted or denied the PUT.

bo : the object which received the signal.
bdaddr : the remote address of the requestor.
fname : the suggested filename of the transferred object.
body : the data of the object.
len : the length in bytes of the data.
timestamp : the last-modified time of the data (seconds since 1970-01-01).
user_data : user data set when the signal handler was connected.

The "request-put" signal

void        user_function                  (BtctlObex *btctlobex,
                                            gchar     *arg1,
                                            gpointer   user_data)      : Run first

Emitted when a peer hints it is about to PUT. Use btctl_obex_set_response() to indicate whether you want the PUT to continue or not. For small payloads, the PUT will still happen regardless, so you should be prepared to deny it when receiving the "put" signal. For larger payloads, the connection will be aborted and dropped.

btctlobex : the object which received the signal.
bdaddr : the remote address of the requestor.
user_data : user data set when the signal handler was connected.