Symbian3/SDK/Source/GUID-7F2C1C45-43FA-5F19-81E3-4DBC0328E4A7.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Fri, 11 Jun 2010 15:24:34 +0100
changeset 9 59758314f811
parent 0 89d6a7a84779
permissions -rw-r--r--
Week 23 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 2714, Bug 462.

<?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-7F2C1C45-43FA-5F19-81E3-4DBC0328E4A7"><title>Bluetooth Sockets Overview</title><prolog><metadata><keywords/></metadata></prolog><conbody><section><title>Purpose</title> <p>Discovers other Bluetooth devices, and reads and writes data over Bluetooth. </p> <p>There are two roles to be played in establishing a communications channel over Bluetooth, they are: </p> <ul><li id="GUID-0FA9E876-A712-5F53-8F14-7B8AA8318B45"><p>Initiator </p> </li> <li id="GUID-A0D3EF0E-26DD-59BA-89BA-88F6E134A4CA"><p>Receiver </p> </li> </ul> <p>The receiver starts the Bluetooth system and waits for an initiator to make the connection. Once the connection has been made, both ends are equals, and either can send and receive data and terminate the connection. This API allows either role to be programmed. </p> </section> <section><title>Architectural relationships</title> <p>The API supports communication over both the L2CAP and RFCOMM layers of the Bluetooth protocol suite. The API is based on the Sockets Client-Side API, which provides a standard API that allows a client to make a connection to a remote device or have the remote device connect to it, then to send and receive data before disconnecting. </p> </section> <section><title>Description</title> <p>The API has five key concepts: socket address, remote device inquiry, RFCOMM commands and options, L2CAP commands, and HCI commands. </p> <p><b>Socket address</b> </p> <p>Each Bluetooth device has a unique 48-bit address. This is encapsulated by <xref href="GUID-D6B126B5-A6AA-37E1-845F-4D650033C603.dita"><apiname>TBTDevAddr</apiname></xref>. </p> <p>The sockets API encapsulates a generic communications end point through a <xref href="GUID-66228064-B6E7-3CE9-8F5E-5DED4CD9A49B.dita"><apiname>TSockAddr</apiname></xref>. Bluetooth provides a specialised version of this, <xref href="GUID-DFE19A3C-9E18-3B27-8748-FA0DB48A599C.dita"><apiname>TBTSockAddr</apiname></xref>, which adds a Bluetooth device address field. </p> <p><b>Remote device inquiry</b> </p> <p>A client can query for available remote devices through the sockets class <xref href="GUID-B16CAD6D-85B1-3482-AAC0-9BADEDB6ABDD.dita"><apiname>RHostResolver</apiname></xref>. A parameter of type <xref href="GUID-0ECE42E1-5E04-3BFB-BA17-F8036510798D.dita"><apiname>TInquirySockAddr</apiname></xref> is supplied for such queries: principally, this allows you to limit discovery to specific classes of device. </p> <p><b>Commands and options</b> </p> <p>You can send commands to an RFCOMM socket through an <xref href="GUID-D4F08503-F1EF-3531-9C3C-4AF24A6255F0.dita#GUID-D4F08503-F1EF-3531-9C3C-4AF24A6255F0/GUID-1DEB83AF-C681-30D4-951C-4C2A5572E59C"><apiname>RSocket::Ioctl()</apiname></xref> call. It is possible to get and set options on a socket through <xref href="GUID-D4F08503-F1EF-3531-9C3C-4AF24A6255F0.dita#GUID-D4F08503-F1EF-3531-9C3C-4AF24A6255F0/GUID-F6BB908A-2E57-3259-8F7F-AC089C6D0C56"><apiname>RSocket::GetOpt()</apiname></xref> and <xref href="GUID-D4F08503-F1EF-3531-9C3C-4AF24A6255F0.dita#GUID-D4F08503-F1EF-3531-9C3C-4AF24A6255F0/GUID-0DD7A667-7043-3D6B-A086-32DD222C199B"><apiname>RSocket::SetOpt()</apiname></xref> respectively. </p> <p>You can send commands to L2CAP sockets and to the HCI layer through <xref href="GUID-D4F08503-F1EF-3531-9C3C-4AF24A6255F0.dita#GUID-D4F08503-F1EF-3531-9C3C-4AF24A6255F0/GUID-1DEB83AF-C681-30D4-951C-4C2A5572E59C"><apiname>RSocket::Ioctl()</apiname></xref>. </p> </section> </conbody><related-links><link href="GUID-5FE7D4DB-B853-57C4-8A90-16DF92F6231A.dita"><linktext>Bluetooth User
                Tutorials</linktext> </link> <link href="GUID-D92F7F23-6A32-5F5B-8782-3DBAF9CACEE6.dita"><linktext>Bluetooth Stack
                Overview</linktext> </link> </related-links></concept>