Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License
"Eclipse Public License v1.0" which accompanies this distribution,
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
Nokia Corporation - initial contribution.
Contributors:
-->
<!DOCTYPE concept
PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept xml:lang="en" id="GUID-A13494B9-C1E4-506A-B236-8AE0A6D6D557"><title>Inquiring about Services on a Remote Device</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>You will normally connect to a device to perform a specific task over Bluetooth. Connecting to any random device is not sensible. A better way is to check that the device you are about to establish a connection with is able to provide the required functionality. This document discusses the service discovery options. </p> <section><title>How to inquire about services on a remote device</title> <p>There are two ways to inquire about the services on offer on a remote device, they are: </p> <ol id="GUID-64E55628-0CA6-5D59-AC4F-0D28A313D4C4"><li id="GUID-711C218D-5A7C-5966-8570-457A7C49BC2E"><p>Use <xref href="GUID-A5BBFFE0-7B86-3FD0-BC9E-D9EABB60C25C.dita"><apiname>MajorClassOfDevice()</apiname></xref> to examine the class of device attribute when making an address inquiry. </p> </li> <li id="GUID-E9E5C4D8-0BA5-5914-80D0-1F4DBA6E86B5"><p>Use the Bluetooth Service Discovery Protocol (SDP) Agent APIs. </p> </li> </ol> <p><b>Examining the Class of Device</b> </p> <p>A broad indicator of the services provided can be read from the class of device. This could be used, for example, to decide the appropriate icon with which to represent a device to the user. The class of device is got through <xref href="GUID-0ECE42E1-5E04-3BFB-BA17-F8036510798D.dita#GUID-0ECE42E1-5E04-3BFB-BA17-F8036510798D/GUID-67A45289-4919-3B0B-BE96-95202940D198"><apiname>TInquirySockAddr::MajorClassOfDevice()</apiname></xref> after an address inquiry. </p> <p>How it works: </p> <ol id="GUID-D7C0ECC4-38E7-592A-A3B3-ECAADE5665E9"><li id="GUID-B94C52B2-54DC-53DF-8ABC-C750ED23FBFD"><p>Perform a device inquiry. </p> </li> <li id="GUID-A3DC575B-0378-5CB1-89B6-64549BDC83DC"><p>Check the class of device. </p> </li> <li id="GUID-13A46F03-5475-5DB2-8DDF-D23BF17C2AE3"><p>Make the connect or pass decision. </p> </li> </ol> <p>When the service discovery provided by the class of device is not adequate to determine which device to select, use the SDP Agent, discussed below. </p> <p><b>Using the Bluetooth SDP Agent</b> </p> <p>The Bluetooth SDP database contains information about the services available on a device. Service discovery queries can be used on each device found to establish if it is a suitable choice. SDP queries are performed through the <xref href="GUID-2F1C6B4C-2C23-5A35-A0D2-223EC6238F7D.dita">Bluetooth Service Discovery Agent Overview</xref>. </p> <p>You can use the SDP Agent to discover the services available on a device and to look up specific attributes of a service. Several tutorials exist to show how the SDP Agent is used. See <xref href="GUID-2F1C6B4C-2C23-5A35-A0D2-223EC6238F7D.dita">Bluetooth Service Discovery Agent Overview</xref> for more information. </p> </section> <section><title>Where Next?</title> <p>This tutorial set takes you through all the steps involved in setting up and communicating over a Bluetooth connection. </p> <ul><li id="GUID-21D01027-20A5-5FD6-AEC0-71DC8D84B61F"><p> <xref href="GUID-301488F8-B6D8-569A-B05E-19B740FE4C00.dita">Selecting a Remote Device</xref> </p> </li> <li id="GUID-F5A3B917-F0B1-525C-98EC-F28AA6C4D95E"><p> <xref href="GUID-CED041C8-D68D-55D1-957E-1A48EEFFF851.dita">Inquiring About Remote Devices</xref> </p> </li> <li id="GUID-BFFCABA0-BAFF-5515-91A2-03A070B2990C"><p> <b>Inquiring About Services on a Remote Device</b> - This document </p> </li> <li id="GUID-46194C36-BD1A-530E-8B2F-9D3E729DAA6E"><p> <xref href="GUID-A24D2CEF-88C9-5C63-A14D-85EFFBEF3C92.dita">Connecting and Transferring Data to a Remote Device</xref> </p> </li> <li id="GUID-1F1F844D-827A-55CE-96B0-8C59292387B3"><p> <xref href="GUID-4F0C4B9D-AA42-59C4-900A-7045FEAAF2F4.dita">Using security on outgoing sockets</xref> </p> </li> </ul> </section> </conbody></concept>