--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Symbian3/SDK/Source/GUID-197648C4-A42C-5769-82B7-F8BA510631D9.dita Thu Jan 21 18:18:20 2010 +0000
@@ -0,0 +1,19 @@
+<?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-197648C4-A42C-5769-82B7-F8BA510631D9"><title>Disconnecting a PAN member</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>So far in this tutorial series we have looked at the steps involved in creating a Personal Area Network and adding devices to that PAN. Now we will look at disconnecting devices from the 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 remove a device from a PAN are: </p> <ul><li id="GUID-0B26D9AB-15AB-58AB-8A7F-94DBEB6A75C9"><p>Request the connection be closed. </p> </li> <li id="GUID-325B2E51-D296-5FCC-A664-71B1FEAE6CD6"><p>Extract the device address for the connection being closed. </p> </li> <li id="GUID-F4A48DCC-2220-55F9-897F-C0698F175D2A"><p>Disconnect the device from the PAN. </p> </li> </ul> <section><title>Request the disconnection</title> <p>The user will select the option to 'Remove current active device' from the PAN. This will cause 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>Identify the device being removed</title> <p>As the device being removed is the currently active device the following will get its Bluetooth address: </p> <codeblock id="GUID-E8F217B7-F687-502F-9E50-2E96340CAF5C" xml:space="preserve">...
+else if(iActivePanConn != KErrNotFound)
+{
+ TPtr8 ptr = iActiveConnections[iActivePanConn].Des();</codeblock> <p>It is also possible that instead of a device removing itself from the PAN the host can eject a member. The user of the PAN host device would need to be presented with a list of the active members where selecting the member would pass the device address details to the disconnect function. </p> </section> <section><title>Disconnect from PAN</title> <p>Regardless of how the disconnect function has been called you have a Bluetooth device address that has been added to the <codeph>ptr</codeph> pointer (above). The following will remove the device from the PAN: </p> <codeblock id="GUID-0E5B4B6F-900B-551B-A1B8-FC6C4D69FA03" xml:space="preserve"> ...
+ rerr = iConnection.Control(KCOLAgent, KCOAgentPanDisconnectDevice, ptr);
+ ...
+}
+return rerr;</codeblock> <p>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> function contains three parameters. They are explained here: </p> <table id="GUID-72AA9C66-5316-5B69-8D38-D30CCB0A4B19"><tgroup cols="2"><colspec colname="col0"/><colspec colname="col1"/><thead><row><entry>Attribute</entry> <entry>Description</entry> </row> </thead> <tbody><row><entry><p> <codeph>KCOLAgent</codeph> </p> </entry> <entry><p>Sets the scope of the Control() function to the agent. </p> </entry> </row> <row><entry><p> <codeph>KCOAgentPanDisconnectDevice</codeph> </p> </entry> <entry><p>The actual command being passed to the <codeph>RConnection</codeph>. In this case the connection is being told to disconnect the device identified by <codeph>ptr</codeph>. </p> </entry> </row> <row><entry><p> <codeph>ptr</codeph> </p> </entry> <entry><p>The pointer to the Bluetooth device address. </p> </entry> </row> </tbody> </tgroup> </table> </section> <section><title>What's next?</title> <p>Having created a PAN and added and removed devices from the PAN you will need learn about closing the PAN. The following will help: </p> <ul><li id="GUID-D4A977E1-F9C2-5DE9-B520-D727943B2D96"><p> <xref href="GUID-91C4F00B-E241-57DC-8520-8C16A302C983.dita">Creating a Personal Area Network</xref> </p> </li> <li id="GUID-AB96A936-A6B7-5CBD-B2AE-E38A75B20899"><p> <xref href="GUID-685AD682-10DC-553B-9C3A-04D0376138C4.dita">Adding a device to the PAN</xref> </p> </li> <li id="GUID-FF22F925-6459-5352-A266-B718EDD05F36"><p> <b>Removing a device from the PAN</b> - This document </p> </li> <li id="GUID-ED407CD5-E216-51C2-A107-1D27538A2B88"><p> <xref href="GUID-50CDF6E0-C352-5771-8686-B551267C6BE6.dita">Closing the PAN</xref> </p> </li> </ul> </section> </conbody></concept>
\ No newline at end of file