Header Sep
Symbian Tips, Tricks & Code
My Rating Score
Login to rate page
 
June 2005
BTCon: establishing and using a Bluetooth connection between two Symbian OS smartphones

[Back]

This code sample shows how to easily create a connection between two Symbian OS mobile devices, enabling text messages to be sent between them.

To run this application, two Bluetooth-enabled smartphones that can be connected to each other are required. One smartphone works as a client and the other as a server. The user can select these modes in the application:

  • Smartphone working as a server and waiting for incoming connection.
  • Smartphone working as a client application and the user manually choosing which device to connect to.

How the application works:

1. The application starts in idle mode showing a welcome message with the name set to a random number. Both "server" and "client" can be chosen.


2. On the smartphone selected to work as a server, choose the option "Start Server".

 

3. On the client side, choose "Connect Client".

4. When the server mobile device that client user wants to connect to appears on the list of available Bluetooth devices, select this device by tapping on the name of the server device on the client smartphone screen. The process of establishing a connection with this smartphone has started, as illustrated by the images below.

 

5. During the connection process, the client sends a test message to make sure that the connection is valid. If it is not, the client connects again to a different port.

6. When the connection is complete, both server and client smartphones confirm the connection.

 

7. After the connection is fully established, both server and client smartphones are set to listen for incoming messages. As soon as a message is received, it is displayed.

8. The user can send a text message by tapping any of three possible software buttons. By clicking, the application stops listening for any incoming messages and as soon as this is completed, the process of sending a message is started.

 

To build the BTCon example for a Sony Ericsson smartphone us the following:

$ bldmake bldfiles
$ abld build thumb urel
$ makesis BTCon.pkg

This example also has a small program (supply.bat) that can call these commands for you. Edit it before your first use to update paths, so they will reflect your folders.

Download the program with source code>>


 

My Rating Score
Login to rate page