
![]() |
![]() |
|
This document describes how a Bluetooth device can allow incoming remote device connections.
Incoming Bluetooth connection examples include:
one end of a chat application,
the Audio Gateway role in HSP (licensee),
or the Gateway in DUNP (licensee).
Incoming requests for a Bluetooth connection are handled through the
RSocket
API (as with outgoing connections).
To receive an incoming connection a service must open a listening socket, register the socket with the Bluetooth security manager, and advertise the socket, then connection requests can be accepted.
The steps are given below:
Get a connection |
Connect to the Sockets Server and select the protocol to be used.
|
|
Open a socket |
Open a socket for that protocol.
|
|
Create the Bluetooth socket address |
Create a Bluetooth socket address object
(
|
|
Register with the Bluetooth security manager |
Add the connection to the Bluetooth security manager. Incoming connections will not work unless they have been registered with the Bluetooth security manager, thus allowing the incoming traffic through the security wall, which by default denies access to all connection attempts.
The security profile is created and packaged in serviceSecurity and
applied using |
|
Add to the Bluetooth Service Discovery Database |
Enter record into the database.
|
|
Start listening for connections |
Tell the socket to listen for incoming connections using
|
|
Start listening for data over a connection |
Create a blank socket and pass it to the listening socket through
|
|
Shutdown remote Bluetooth connection |
Shutdown connection and unregister security settings. When the receiver wishes to shutdown, it must ensure that it closes the listening socket as well as any connected ones. This releases the Bluetooth connection to other applications.
The socket server is closed using the
|
If the channel is already in use, as indicated if Bind()
returns an error, you can find a free channel using the
KRFCOMMGetAvailableServerChannel
ioctl.
For more information on:
setting security requirements for incoming connections to the service, see Using Bluetooth Security Manager.
advertising the service's availability, see Using Bluetooth Service Discovery Database.
Working with sockets, see Using Socket Clients.
Also search the Symbian DevNet for white papers and example applications.
This tutorial set takes you through all the steps involved in setting up and communicating over a Bluetooth connection.
Listening for Incoming Bluetooth Connections - This document