The S60 platform allows you to send to or receive data from other devices over a Bluetooth connection, once your application has discovered a suitable device within the range of the Bluetooth technology.
Typical use cases include:
Sending information over an interactive connection (uses CBluetoothSocket)
Sending a file in a single-shot operation (OBEX) (uses CObexServer, CObexClient, TObexBluetoothProtocolInfo and CObexBaseObject)
Sending a file wrapped up in a message over a Bluetooth OBEX connection (uses the Send UI API)
Important implementation considerations include:
OBEX is usually considered a session-based connection, while L2CAP ad RFCOMM are used for continuous connections. OBEX does not require the maintenance of a continuous connection but it can add overhead that results in a poor throughput. L2CAP and RFCOMM can be more efficient in sending data.
There are limitations in implementing audio related Bluetooth connections from your application. You can send audio files over a Bluetooth connection, but you cannot stream audio over a Bluetooth SCO link.
Use of some Bluetooth configurations may require additional capabilities for your application. Note that most Bluetooth use cases can be used with the most basic signing method.
Mobility may cause breaks in Bluetooth connections if any of the connected devices moves out of the range during the connection. Your application must be prepared for unexpected connection breaks and always keep responsive to user actions.
Prerequisites:
A connection has been initialized with another Bluetooth device or devices.
To transfer data over a Bluetooth connection:
Use one of the following methods to send information to or receive information from the selected device(s):
To use a Bluetooth connection interactively, use the methods of the CBluetoothSocket class of the Bluetooth Sockets API.
Note that you need to specify the underlying Bluetooth protocol to be used for the transfer.
To send or receive a file in a single-shot operation (OBEX), use the methods of the OBEX API.
Note that you need to specify the underlying Bluetooth protocol to be used for the transfer.
The following classes are particularly relevant:
To send a file wrapped up in a message over a Bluetooth connection, use the methods of the Send UI API through the CSendUI class.
This connection is OBEX-based, as it uses the standard Bluetooth Object Push Profile (OPP).
If you are using the Bluetooth connection interactively and you wish to include user authentication or data encryption for the data transfer, use the Bluetooth Security Manager API to set the security requirements for the outgoing socket. Typically the device that accepts the connection request sets these requirements.
Unless you are sending a file wrapped up in a message (using the Send UI API), you need to close the connection when you have finished transferring data. The connection can also be closed by the remote application that has accepted the Bluetooth connection request.
Make sure you have the correct capabilities information set for your application.
Make sure
the following libraries are accessible to your linker when compiling your
application by including them in your mmp
file
or by editing the project properties in your IDE, depending on your build
environment:
sendui.lib
(to send a message over a Bluetooth
connection)
obex.lib
(to send or receive data in a single-shot
operation)
bluetooth.lib
and esock.lib
(to
use the Bluetooth connection interactively)
For more information, see:
Bluetooth OBEX Example provided by Forum Nokia for a reference example of how to use the OBEX API or the Send UI API for sending data over a Bluetooth connection
How to connect and transfer data to a remote device in the Symbian OS Library for instructions on how to use the Bluetooth Sockets API to connect to another Bluetooth device and transfer data
Bluetooth Point to Multipoint Example provided by Forum Nokia for a reference example of how to use a socket for transferring data over a Bluetooth connection
S60 Platform: Bluetooth API Developer's Guide available on Forum Nokia for a discussion about the options you have for implementing Bluetooth applications and about the relevant components and APIs
The S60 platform also provides the following services:
Messaging for sending a file wrapped up in a message over a Bluetooth OBEX connection