Symbian3/SDK/Source/GUID-01A0682A-50B1-57AB-9939-6CC8FCCD782D.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Tue, 20 Jul 2010 12:00:49 +0100
changeset 13 48780e181b38
parent 0 89d6a7a84779
permissions -rw-r--r--
Week 28 contribution of SDK documentation content. See release notes for details. Fixes bugs Bug 1897 and Bug 1522.

<?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-01A0682A-50B1-57AB-9939-6CC8FCCD782D"><title>Disconnecting ACL links</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>A link layer level <codeph>ioctl</codeph> is provided to disconnect an baseband link without first closing the open sockets using that link. This provides the ability to quickly disconnect one or all current Bluetooth asynchronous connection-oriented links (ACL) open on a device. </p> <section><title>How to disconnect ACL links</title> <p>The <xref href="GUID-8C16D394-89A5-3D26-84C0-B1E27CB93D82.dita"><apiname>TLMDisconnectACLIoctl</apiname></xref> structure contains the device address of the remote device to be disconnected and the reason code to be supplied during the disconnection. </p> <p><b>Basic Procedure</b> </p> <p>To directly disconnect individual Bluetooth ACL links: </p> <ol id="GUID-3C90E888-F916-5C02-892E-23B8EFBF5611"><li id="GUID-43EEBD38-73D0-5435-BCB3-8E68F8A5EA86"><p>Create a <xref href="GUID-C9F64608-D4E1-3CD4-A25D-22F26D8E81EF.dita"><apiname>TLMDisconnectACLBuf</apiname></xref> packaged structure, which contains the address of the Bluetooth device to be disconnected and the reason to be given to the other device for its disconnection. </p> </li> <li id="GUID-048AC487-6C80-52D7-AA98-A66FBC9B05FE"><p>Call the <codeph>KLMDisconnectACLIoctl</codeph> ioctl on the socket with the link manager level <codeph>KSolBtLM</codeph>, passing the package buffer. </p> </li> </ol> <p><b>Example: Disconnecting ACL links</b> </p> <p>Here is a simple disconnect example. </p> <ol id="GUID-DCC41584-154F-5D87-9FE8-84780EA77DB9"><li id="GUID-982FF396-8845-5850-B969-42D5238A4471"><p>Starting with an open socket </p> <codeblock id="GUID-B492479C-BFAA-5925-A63E-300739D1DD16" xml:space="preserve">RSocket sock;
ret=sock.Open(ss,pInfo.iAddrFamily,pInfo.iSockType,pInfo.iProtocol);</codeblock> </li> <li id="GUID-20985159-E0C5-56FA-BD3C-BC57CEE334AA"><p>Identify the Bluetooth device to be disconnected and provide a reason for the disconnect. </p> <codeblock id="GUID-994ED249-45D0-5519-8425-6C697FCEF60F" xml:space="preserve">TLMDisconnectACLBuf aclConnBuf;
aclConnBuf().iDevAddr = devAddr; // devAddr is a TBTDevAddr
aclConnBuf().iReason = 0x13; // Remote User Ended Connection
TRequestStatus stat;</codeblock> </li> <li id="GUID-25D62E85-3017-5762-8545-7279B5B019A4"><p>Send <codeph>Ioctl</codeph> command to disconnect. </p> <codeblock id="GUID-98010DF4-BCE1-5165-A286-65E37C8BCDC9" xml:space="preserve">sock.Ioctl(KLMDisconnectACLIoctl, stat,  &amp;aclConnBuf, KSolBtLM);
User::WaitForRequest(stat);</codeblock> </li> </ol> </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-F8A5A2B6-E93D-5615-BC8E-FF8A4C54D30C"><p> <xref href="GUID-70339E6A-63CD-5A74-846C-50771FDAC763.dita">Listening for Incoming Bluetooth Connections</xref>  </p> </li> <li id="GUID-B2107098-26AA-5B59-AEBE-2D39363AEB8A"><p> <xref href="GUID-834BD3BB-B39C-5EE9-8A62-9DC435930F95.dita">Handling the Local Device Name</xref>  </p> </li> <li id="GUID-3D789CC2-B228-5710-8DA1-5C23DDEF4D27"><p> <xref href="GUID-FDA7B932-B9C6-502D-8699-C18C8D86BCC6.dita">Performing Low-level Configuration</xref>  </p> </li> <li id="GUID-D758F0E1-DBF4-5189-91EF-3D58E7F212EA"><p> <xref href="GUID-5C63EF5C-826D-5838-BB7E-12FF4EA1DFCE.dita">Debugging the Host Controller</xref>  </p> </li> <li id="GUID-7BE63877-6C7E-5F57-9E2F-D585AD3C6986"><p> <b>Disconnecting ACL links</b> - This document </p> </li> </ul> </section> </conbody></concept>