|
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:
The Obex packagesBefore to use Obex for files exchanging via Bluetooth, you should install the following packages:
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).
Obex System: How to get files from a Bluetooth deviceIn order to get file from a previously discovered Bluetooth device, we have to set the right Obex channel. It can be obtained as follow:
The field CHANNEL_ID can be obtained from the features previously got by the command sdptool browse
In case of no errors, we get the following prompt:
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. Obex System: How to send files to a Bluetooth deviceIn 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:
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:
Where Image_client.jpeg is the name of the sent file in the remote filesystem of the Bluetooth receiver.
|
|||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||