Symbian3/PDK/Source/GUID-834BD3BB-B39C-5EE9-8A62-9DC435930F95.dita
changeset 1 25a17d01db0c
child 3 46218c8b8afa
equal deleted inserted replaced
0:89d6a7a84779 1:25a17d01db0c
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE concept
       
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
       
    12 <concept id="GUID-834BD3BB-B39C-5EE9-8A62-9DC435930F95" xml:lang="en"><title>Handling
       
    13 the Local Device Name</title><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    14 <p>Each Bluetooth device has a name for identifying the device to users or
       
    15 applications. This document shows you how to get or set device names. </p>
       
    16 <section><title>How to get and set the local device name</title> <p>The local
       
    17 device name is read and set through the <xref href="GUID-B16CAD6D-85B1-3482-AAC0-9BADEDB6ABDD.dita"><apiname>RHostResolver</apiname></xref> functions <xref href="GUID-B16CAD6D-85B1-3482-AAC0-9BADEDB6ABDD.dita"><apiname>GetHostName()</apiname></xref> and <xref href="GUID-B16CAD6D-85B1-3482-AAC0-9BADEDB6ABDD.dita"><apiname>SetHostName()</apiname></xref> respectively. </p> <p><b>Getting the Local Device Name</b> </p> <p>The following code shows how
       
    18 to get the local name: </p> <ol id="GUID-B9D75B4C-8184-5E04-A805-422D1D86D1E1">
       
    19 <li id="GUID-34A055C7-6A4C-531B-8625-75539FBD6E3B"><p>Connect to the socket
       
    20 server </p> <codeblock id="GUID-B398F8BC-F409-5A71-9051-8010FFF543D7" xml:space="preserve">RSocketServ socketServ;
       
    21 socketServ.Connect();
       
    22 TProtocolDesc pInfo;
       
    23 _LIT(KL2Cap, "L2CAP");
       
    24 socketServ.FindProtocol(KL2Cap,pInfo);</codeblock> </li>
       
    25 <li id="GUID-52E77D28-A2BE-5FB7-A880-E71307832013"><p>Create and initialise
       
    26 an <xref href="GUID-B16CAD6D-85B1-3482-AAC0-9BADEDB6ABDD.dita"><apiname>RHostResolver</apiname></xref> </p> <codeblock id="GUID-F53163E6-49F8-529A-9A9F-7BC76E0BD9F7" xml:space="preserve">RHostResolver hr;
       
    27 hr.Open(socketServ,pInfo.iAddrFamily,pInfo.iProtocol);</codeblock> </li>
       
    28 <li id="GUID-499255A3-BC66-5BC5-A37A-B883A0E4EE6A"><p>Get the local device
       
    29 name </p> <codeblock id="GUID-F880ACBE-5184-5A64-A287-1C7560233D70" xml:space="preserve">THostName name;
       
    30 TInt ret=hr.GetHostName(name);</codeblock> </li>
       
    31 </ol> <p><b>Setting
       
    32 the Local Device Name</b> </p> <p>Setting the device name differs only in
       
    33 the final step, where you will use the <xref href="GUID-B16CAD6D-85B1-3482-AAC0-9BADEDB6ABDD.dita"><apiname>RHostResolver::SetHostName()</apiname></xref> function. </p> <codeblock id="GUID-091A827B-197A-5672-AFA0-69E329058762" xml:space="preserve">_LIT(KDeviceName,"myDeviceName");
       
    34 TInt ret=hr.SetHostName(KDeviceName);</codeblock><note>  <xref href="GUID-4CF02002-FB24-376F-A84E-B26296539386.dita"><apiname>THostName</apiname></xref> is
       
    35 a descriptor buffer of a suitable  minimum size.</note> </section>
       
    36 <section><title>Where Next?</title> <p>This tutorial set takes you through
       
    37 all the steps involved in setting up and communicating over a Bluetooth connection. </p> <ul>
       
    38 <li id="GUID-CAA9C24D-4A3C-5D03-B6C7-EE21686BF869"><p> <xref href="GUID-70339E6A-63CD-5A74-846C-50771FDAC763.dita">Listening
       
    39 for Incoming Bluetooth Connections</xref> </p> </li>
       
    40 <li id="GUID-674A5D9A-4685-50F2-9FAC-36FA2E02F577"><p> <b>Handling the Local
       
    41 Device Name</b> - This document </p> </li>
       
    42 <li id="GUID-F3A7D62A-9FC8-5C74-8EF2-3E149FD81345"><p> <xref href="GUID-FDA7B932-B9C6-502D-8699-C18C8D86BCC6.dita">Performing
       
    43 Low-level Configuration</xref> </p> </li>
       
    44 <li id="GUID-518978F0-6BBD-5A63-936B-8640BBBBFC9A"><p> <xref href="GUID-5C63EF5C-826D-5838-BB7E-12FF4EA1DFCE.dita">Debugging
       
    45 the Host Controller</xref> </p> </li>
       
    46 <li id="GUID-D839475B-9640-5FE6-BD70-94002A0B1D3E"><p> <xref href="GUID-01A0682A-50B1-57AB-9939-6CC8FCCD782D.dita">Disconnecting
       
    47 ACL links</xref> </p> </li>
       
    48 </ul> </section>
       
    49 </conbody></concept>