Now that you have decided on the best method of selecting a remote device you will need to go through the process. For the purposes of this tutorial we will assume you are going to allow the program to determine the remote device with which to connect.
Each Bluetooth device has a 48-bit unique address built into its hardware. A basic inquiry for devices in range returns zero or more of these addresses.
As well as an address, a Bluetooth device has a text name suitable for display to users. If you want to display a list of available devices to the user, you will also need to obtain these names.
The address and the name inquiries can occur simultaneously, if the underlying hardware supports this. Otherwise, the address inquiry must finish before the name request can be issued over the air.
Address and name inquiries are performed through the generic Symbian OS sockets class
Basic Procedure
To inquire for the addresses of remote devices, take the following steps:
Connect to the Sockets Server (
Create and initialise an
Set the
The query can then be started with
When
To get all the devices discovered, call
Getting the addresses of remote devices
The following example shows how to start a remote device address inquiry.
Connect to the socket server
Create and initialise an
Set up a discovery query and start it
Process the information returned in
Notes:
The host resolver caches the results of inquiries so that devices that are no longer present may appear in the list of results. This does not cause any additional complications, as it is always possible for a device to go out of range between when it is discovered and when a connection to it is made.
Communications API calls are typically asynchronous (indicated by a
Getting the name of a remote device
The name of a remote device can be queried for by taking the same steps as for an address query, but setting the action flag of a
Example
Notes
To do a simultaneous address and name inquiry, use
This tutorial set takes you through all the steps involved in setting up and communicating over a Bluetooth connection.
Inquiring About Remote Devices - This document
Now that you have decided on the best method of selecting a remote device +you will need to go through the process. For the purposes of this tutorial +we will assume you are going to allow the program to determine the remote +device with which to connect.
+Each Bluetooth +device has a 48-bit unique address built into its hardware. A basic inquiry +for devices in range returns zero or more of these addresses.
As well +as an address, a Bluetooth device has a text name suitable for display to +users. If you want to display a list of available devices to the user, you +will also need to obtain these names.
The address and the name inquiries +can occur simultaneously, if the underlying hardware supports this. Otherwise, +the address inquiry must finish before the name request can be issued over +the air.
Address and name inquiries are performed through the generic
+Symbian platform sockets class
Basic +Procedure
To inquire for the addresses of remote devices, take +the following steps:
Connect to the Sockets
+Server (
Create and initialise
+an
Set the
The
+query can then be started with
When
To get all the devices
+discovered, call
Getting +the addresses of remote devices
The following example shows how +to start a remote device address inquiry.
Connect to the socket +server
Create and initialise
+an
Set up a discovery query +and start it
Process the information
+returned in
Notes:
The host resolver caches +the results of inquiries so that devices that are no longer present may appear +in the list of results. This does not cause any additional complications, +as it is always possible for a device to go out of range between when it is +discovered and when a connection to it is made.
Communications API calls
+are typically asynchronous (indicated by a
Getting +the name of a remote device
The name of a remote device can be
+queried for by taking the same steps as for an address query, but setting
+the action flag of a
Example
Notes
To do a simultaneous
+address and name inquiry, use
This tutorial set takes you through +all the steps involved in setting up and communicating over a Bluetooth connection.
Inquiring About +Remote Devices - This document