Tux
Communication
Mailing lists
Documentation
User Manual
Target board info.
Target chip info.
Support
Linux support
Bugzilla
Downloads
STLinux
Updates
Search
Google


The web
stlinux.com
Distribution Guide
Device drivers
Bluetooth: BlueZ and Obex HowTo
Obex: HowTo and ussp-push
ST Logo
Previous   Contents  


OBEX (abbreviation of OBject EXchange, also termed IrOBEX) is a communications protocol that facilitates the exchange of binary objects between devices. It is maintained by the Infrared Data Association but has also been adopted by the Bluetooth Special Interest Group and the SyncML wing of the Open Mobile Alliance (OMA). OBEX is similar in design and function to HTTP in that a client uses a reliable transport to connect to a server and may then request or provide objects. But OBEX differs in many important respects:
Transports: HTTP is normally layered above a TCP/IP port. OBEX is commonly implemented over an IrLAP/IrLMP/Tiny TP stack on an IrDA device. In Bluetooth, OBEX is implemented above Baseband/Link Manager/L2CAP/RFCOMM stack. Other such "bindings" of OBEX are possible.
Binary transmissions: HTTP uses human-readable text, but OBEX uses binary-formatted type-length-value triplets called "Headers" to exchange information about a request or an object. These are much easier to parse by devices with limited resources.
Session support: HTTP transactions are inherently stateless; generally an HTTP client opens a connection, makes a single request, receives its response, and closes the connection. In OBEX, a single transport connection may bear many related operations. In fact, recent additions to the OBEX specification allow an abruptly closed transaction to be resumed with all state information intact.
OBEX is the foundation for many Bluetooth higher-layer "profiles":

  • Generic Object Exchange Profile
  • Object Push Profile (phone to phone transfers)
  • File Transfer Profile (phone to PC transfers)
  • Synchronization Profile
  • Basic Imaging Profile
  • Basic Printing Profile

[Top]

The Obex packages

Before to use Obex for files exchanging via Bluetooth, you should install the following packages:

    stlinux23-sh4-openobex-1.3-1.sh4.rpm
    stlinux23-sh4-obexserver-1.1-1.sh4.rpm
    stlinux23-sh4-ussp-push-0.9-1.sh4.rpm
    

The Openobex package is a free open source implementation of the Object Exchange (OBEX) protocol. The Obexserver is a Obex server for retrieving files from a Bluetooth device which is an Obex client as well.The ussp-push package is able to push files from an obex server device to a Bluetooth device (Obex client).

[Top]

Obex System: How to get files from a Bluetooth device

In order to get file from a previously discovered Bluetooth device, we have to set the right Obex channel. It can be obtained as follow:

    target% sdptool add --channel=CHANNEL_ID OPUSH
    

The field CHANNEL_ID can be obtained from the features previously got by the command sdptool browse as described in the related section (BlueZ HowTo). A typical value of this channel is 10. Finally, we can run the Obexserver as follow:

    target% obexserver
    

In case of no errors, we get the following prompt:

    target% obexserver
    Waiting for connection...
    

The system waits till the corresponding handled Bluetooth device will send a file (images, music, video, etc..) to the Obexserver. The file sent from the Bluetooth device will be available in the current directory.

[Top]

Obex System: How to send files to a Bluetooth device

In order to send file to a Bluetooth device previously discovered, the ussp-push tool is needed. It is enough to know the MAC address of the Bluetooth device at which we have to send the file. For istance, we suppose to consider the address "00:16:CF:DC:B9:81" as hypothetical MAC of the Bluetooth device (mobile phones, PDA, etc..) to be used as receiver. Clearly, we can get easily the MAC address of the enabled Bluetooth devices using the hcitool utility as described in the related section(BlueZ HowTo). Moreover, we suppose the file to be sent is an image named "Image.jpeg". In order to send file to the selected Bluetooth device we can setup the RFCOMM establishing a connection. This target can be achieved using the rfcomm tool (provided by Bluez-utils package) as follow:

    target% rfcomm bind /dev/rfcomm0 MAC_ADDRESS CHANNELID
    

Typically, the used rfcomm is rfcomm0 but rfcommx with x>0 can be used. The MAC_ADDRESS is known and the CHANNEL_ID is the used channel for transmission and obtained from a simple "sdptool browse MAC_ADDRESS" command. For instance, using the hypothetical info above described and supposing a transmission channel equal to 9 (typical value), we can send the file "Image.jpeg" to the Bluetooth device (MAC_ADDRESS: 00:16:CF:DC:B9:81) using the following istructions:

    target% rfcomm bind /dev/rfcomm0 00:16:CF:DC:B9:81 9
    target% ussp-push /dev/rfcomm0 Image.jpeg Image_client.jpeg
    

Where Image_client.jpeg is the name of the sent file in the remote filesystem of the Bluetooth receiver.

[Top]

Previous   Contents  
Valid HTML 4.01! Last updated: 2007/11/26 13:17:20
© Copyright STMicroelectronics Limited, 2005
Printer