Symbian3/PDK/Source/GUID-685AD682-10DC-553B-9C3A-04D0376138C4.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Wed, 16 Jun 2010 10:24:13 +0100
changeset 10 d4524d6a4472
parent 5 f345bda72bc4
child 14 578be2adaf3e
permissions -rw-r--r--
removal of PIPS 'antiword' example pending a decision on its license
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5
f345bda72bc4 Week 12 contribution of PDK documentation_content. See release notes for details. Fixes Bug 2054, Bug 1583, Bug 381, Bug 390, Bug 463, Bug 1897, Bug 344, Bug 1319, Bug 394, Bug 1520, Bug 1522, Bug 1892"
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents: 3
diff changeset
     1
<?xml version="1.0" encoding="utf-8"?>
f345bda72bc4 Week 12 contribution of PDK documentation_content. See release notes for details. Fixes Bug 2054, Bug 1583, Bug 381, Bug 390, Bug 463, Bug 1897, Bug 344, Bug 1319, Bug 394, Bug 1520, Bug 1522, Bug 1892"
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents: 3
diff changeset
     2
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
f345bda72bc4 Week 12 contribution of PDK documentation_content. See release notes for details. Fixes Bug 2054, Bug 1583, Bug 381, Bug 390, Bug 463, Bug 1897, Bug 344, Bug 1319, Bug 394, Bug 1520, Bug 1522, Bug 1892"
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents: 3
diff changeset
     3
<!-- This component and the accompanying materials are made available under the terms of the License 
f345bda72bc4 Week 12 contribution of PDK documentation_content. See release notes for details. Fixes Bug 2054, Bug 1583, Bug 381, Bug 390, Bug 463, Bug 1897, Bug 344, Bug 1319, Bug 394, Bug 1520, Bug 1522, Bug 1892"
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents: 3
diff changeset
     4
"Eclipse Public License v1.0" which accompanies this distribution, 
f345bda72bc4 Week 12 contribution of PDK documentation_content. See release notes for details. Fixes Bug 2054, Bug 1583, Bug 381, Bug 390, Bug 463, Bug 1897, Bug 344, Bug 1319, Bug 394, Bug 1520, Bug 1522, Bug 1892"
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents: 3
diff changeset
     5
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
f345bda72bc4 Week 12 contribution of PDK documentation_content. See release notes for details. Fixes Bug 2054, Bug 1583, Bug 381, Bug 390, Bug 463, Bug 1897, Bug 344, Bug 1319, Bug 394, Bug 1520, Bug 1522, Bug 1892"
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents: 3
diff changeset
     6
<!-- Initial Contributors:
f345bda72bc4 Week 12 contribution of PDK documentation_content. See release notes for details. Fixes Bug 2054, Bug 1583, Bug 381, Bug 390, Bug 463, Bug 1897, Bug 344, Bug 1319, Bug 394, Bug 1520, Bug 1522, Bug 1892"
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents: 3
diff changeset
     7
    Nokia Corporation - initial contribution.
f345bda72bc4 Week 12 contribution of PDK documentation_content. See release notes for details. Fixes Bug 2054, Bug 1583, Bug 381, Bug 390, Bug 463, Bug 1897, Bug 344, Bug 1319, Bug 394, Bug 1520, Bug 1522, Bug 1892"
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents: 3
diff changeset
     8
Contributors: 
f345bda72bc4 Week 12 contribution of PDK documentation_content. See release notes for details. Fixes Bug 2054, Bug 1583, Bug 381, Bug 390, Bug 463, Bug 1897, Bug 344, Bug 1319, Bug 394, Bug 1520, Bug 1522, Bug 1892"
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents: 3
diff changeset
     9
-->
f345bda72bc4 Week 12 contribution of PDK documentation_content. See release notes for details. Fixes Bug 2054, Bug 1583, Bug 381, Bug 390, Bug 463, Bug 1897, Bug 344, Bug 1319, Bug 394, Bug 1520, Bug 1522, Bug 1892"
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents: 3
diff changeset
    10
<!DOCTYPE concept
f345bda72bc4 Week 12 contribution of PDK documentation_content. See release notes for details. Fixes Bug 2054, Bug 1583, Bug 381, Bug 390, Bug 463, Bug 1897, Bug 344, Bug 1319, Bug 394, Bug 1520, Bug 1522, Bug 1892"
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents: 3
diff changeset
    11
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
f345bda72bc4 Week 12 contribution of PDK documentation_content. See release notes for details. Fixes Bug 2054, Bug 1583, Bug 381, Bug 390, Bug 463, Bug 1897, Bug 344, Bug 1319, Bug 394, Bug 1520, Bug 1522, Bug 1892"
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents: 3
diff changeset
    12
<concept xml:lang="en" id="GUID-685AD682-10DC-553B-9C3A-04D0376138C4"><title>Adding a device to the PAN</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>In the last tutorial we looked at the steps involved in creating a Personal Area Network. Now we will look at adding devices to that PAN. </p> <p><b>Using the Tutorial </b> </p> <p>The code fragments in this tutorial are derived from the Bluetooth Example application available in <filepath>/src/COMMON/DEVELOPERLIBRARY/examples/Bluetooth/BTExample1</filepath>. Although the code has been reformatted to the requirements of the tutorial there is always enough information included with the code to find the actual example code. </p> <p><b>Intended Audience: </b> </p> <p>This tutorial is designed for Symbian licensees only. Several APIs mentioned ad used throughout this tutorial series are only available in a device creators kit environment. </p> <p><b>Basic procedure: </b> </p> <p>The high level steps to add a device to a PAN are: </p> <ul><li id="GUID-F5CF3FAF-9DEF-5DB8-8462-864D941C15ED"><p>Connect to the listening device. </p> <p>(See previous tutorial) </p> </li> <li id="GUID-62C8D049-42EE-5311-9D03-E694F230F6B2"><p>Check if there are any open slots on the PAN. </p> </li> <li id="GUID-6A984F04-4F83-5718-8482-36C1A9EB0EE7"><p>Add the device to an open slot. </p> <p>This will start the new device to the PAN connection created in the previous tutorial. </p> </li> </ul> <section><title>Connecting to a PAN Host</title> <p>The user will launch the application (BTExample1) and be presented with a list of options. One of the options is to invite another user to join the PAN. This will cause an <xref href="GUID-A6B66713-FECA-3BE7-BB81-1AE5551AD83D.dita#GUID-A6B66713-FECA-3BE7-BB81-1AE5551AD83D/GUID-A5E799C6-E6E4-3C58-A053-F4307179060F"><apiname>RNotifier::StartNotifierAndGetResponse()</apiname></xref> to prompt the user to select a device. The result of this operation is that the Bluetooth device address is known. See "<xref href="GUID-91C4F00B-E241-57DC-8520-8C16A302C983.dita#GUID-91C4F00B-E241-57DC-8520-8C16A302C983/GUID-DE57E5EA-1C46-5AE4-86CF-06AC92203383">Finding the Bluetooth Device Address</xref> " for more. </p> </section> <section><title>Checking for open slots</title> <p>The PAN host will need to check to see if there are any open connections. You may recall from the PAN Overview that there are currently two possible roles a member of a PAN may take, PANU or PAN-GN. If the PAN will only require two members the role of both can be PANU, the host will simply check that there are not any current connections before going on to open a connection for the new member. If however the PAN supports two or more connections the host will be operating in the PAN-GN role, which allows up to seven connections. </p> <p>Check that there is a slot available. </p> <codeblock id="GUID-27257112-FF2E-574E-92F7-28306A48A3FF" xml:space="preserve">if(iActiveConnections.Count() == 7)
f345bda72bc4 Week 12 contribution of PDK documentation_content. See release notes for details. Fixes Bug 2054, Bug 1583, Bug 381, Bug 390, Bug 463, Bug 1897, Bug 344, Bug 1319, Bug 394, Bug 1520, Bug 1522, Bug 1892"
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents: 3
diff changeset
    13
{
f345bda72bc4 Week 12 contribution of PDK documentation_content. See release notes for details. Fixes Bug 2054, Bug 1583, Bug 381, Bug 390, Bug 463, Bug 1897, Bug 344, Bug 1319, Bug 394, Bug 1520, Bug 1522, Bug 1892"
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents: 3
diff changeset
    14
 err = KErrOverflow;
f345bda72bc4 Week 12 contribution of PDK documentation_content. See release notes for details. Fixes Bug 2054, Bug 1583, Bug 381, Bug 390, Bug 463, Bug 1897, Bug 344, Bug 1319, Bug 394, Bug 1520, Bug 1522, Bug 1892"
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents: 3
diff changeset
    15
}</codeblock> <p>If all the slots are currently used return <codeph>KErrOverflow</codeph> and end the connection attempt. If there are open slots add the device to one as explained in the next section. </p> </section> <section><title>Adding your device to the PAN</title> <p>To recap, we have a configured PAN and it has at least one open slot. </p> <p>Add the device address to one of the open connections of the PAN. </p> <codeblock id="GUID-E1A69C4C-C29E-5A1A-AE64-5FF587A9CF10" xml:space="preserve">else if(aDevAddr)
f345bda72bc4 Week 12 contribution of PDK documentation_content. See release notes for details. Fixes Bug 2054, Bug 1583, Bug 381, Bug 390, Bug 463, Bug 1897, Bug 344, Bug 1319, Bug 394, Bug 1520, Bug 1522, Bug 1892"
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents: 3
diff changeset
    16
{
f345bda72bc4 Week 12 contribution of PDK documentation_content. See release notes for details. Fixes Bug 2054, Bug 1583, Bug 381, Bug 390, Bug 463, Bug 1897, Bug 344, Bug 1319, Bug 394, Bug 1520, Bug 1522, Bug 1892"
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents: 3
diff changeset
    17
 // Add the BT address of the device to the existing RConnection
f345bda72bc4 Week 12 contribution of PDK documentation_content. See release notes for details. Fixes Bug 2054, Bug 1583, Bug 381, Bug 390, Bug 463, Bug 1897, Bug 344, Bug 1319, Bug 394, Bug 1520, Bug 1522, Bug 1892"
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents: 3
diff changeset
    18
 iControlAddr = *aDevAddr;
f345bda72bc4 Week 12 contribution of PDK documentation_content. See release notes for details. Fixes Bug 2054, Bug 1583, Bug 381, Bug 390, Bug 463, Bug 1897, Bug 344, Bug 1319, Bug 394, Bug 1520, Bug 1522, Bug 1892"
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents: 3
diff changeset
    19
 TPtr8 ptr = iControlAddr.Des();
f345bda72bc4 Week 12 contribution of PDK documentation_content. See release notes for details. Fixes Bug 2054, Bug 1583, Bug 381, Bug 390, Bug 463, Bug 1897, Bug 344, Bug 1319, Bug 394, Bug 1520, Bug 1522, Bug 1892"
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents: 3
diff changeset
    20
 err = iConnection.Control(KCOLAgent, KCOAgentPanConnectDevice, ptr);
f345bda72bc4 Week 12 contribution of PDK documentation_content. See release notes for details. Fixes Bug 2054, Bug 1583, Bug 381, Bug 390, Bug 463, Bug 1897, Bug 344, Bug 1319, Bug 394, Bug 1520, Bug 1522, Bug 1892"
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents: 3
diff changeset
    21
 ...
f345bda72bc4 Week 12 contribution of PDK documentation_content. See release notes for details. Fixes Bug 2054, Bug 1583, Bug 381, Bug 390, Bug 463, Bug 1897, Bug 344, Bug 1319, Bug 394, Bug 1520, Bug 1522, Bug 1892"
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents: 3
diff changeset
    22
}
1
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    23
return err;</codeblock> <p> <codeph>aDevAddr</codeph> will contain the Bluetooth device address if the notifier was used as discussed above. The device address is packaged into the <codeph>ptr</codeph> pointer, which is passed into the <xref href="GUID-BED8A733-2ED7-31AD-A911-C1F4707C67FD.dita#GUID-BED8A733-2ED7-31AD-A911-C1F4707C67FD/GUID-28A35F19-1B05-3922-8E80-36F00DF3DB65"><apiname>RConnection::Control()</apiname></xref>. The control function adds the device address to the PAN. </p> <p>The device is now a member of the PAN. </p> </section> <section><title>What's next?</title> <p>Having created a PAN and added a device you will need to remove a device and close the PAN. The following will help: </p> <ul><li id="GUID-F2F7907A-5561-5059-B27B-AE822CE8C6F7"><p> <xref href="GUID-91C4F00B-E241-57DC-8520-8C16A302C983.dita">Creating a Personal Area Network</xref>  </p> </li> <li id="GUID-C0FEADF4-82E3-5A2D-8635-EF78790232AD"><p> <b>Adding a device to the PAN</b> - This document </p> </li> <li id="GUID-6A1ACE35-C68B-5A5F-A5A7-A45195324BA3"><p> <xref href="GUID-197648C4-A42C-5769-82B7-F8BA510631D9.dita">Removing a device from the PAN</xref>  </p> </li> <li id="GUID-6B28FE51-3E08-5B74-B7F4-0A7E0FF18142"><p> <xref href="GUID-50CDF6E0-C352-5771-8686-B551267C6BE6.dita">Closing the PAN</xref>  </p> </li> </ul> </section> </conbody></concept>