Symbian3/PDK/Source/GUID-834BD3BB-B39C-5EE9-8A62-9DC435930F95.dita
changeset 5 f345bda72bc4
parent 3 46218c8b8afa
child 14 578be2adaf3e
equal deleted inserted replaced
4:4816d766a08a 5:f345bda72bc4
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
    12 <concept id="GUID-834BD3BB-B39C-5EE9-8A62-9DC435930F95" xml:lang="en"><title>Handling
    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>
    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
    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>
    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
    16 <section id="GUID-62D2F4F0-C69E-4D51-904F-CEC8E7827740"><title>How to get
    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
    17 and set the local device name</title> <p>The local device name is read and
       
    18 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 to get the local name: </p> <ol id="GUID-B9D75B4C-8184-5E04-A805-422D1D86D1E1">
       
    20 <li id="GUID-FBB8E853-7E12-40F7-9776-1DA124B79B27"><p>Link against the following
       
    21 libraries:</p><codeblock xml:space="preserve">esock.lib
       
    22 bluetooth.lib
       
    23 sdpdatabase.lib
       
    24 </codeblock></li>
    19 <li id="GUID-34A055C7-6A4C-531B-8625-75539FBD6E3B"><p>Connect to the socket
    25 <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;
    26 server </p> <codeblock id="GUID-B398F8BC-F409-5A71-9051-8010FFF543D7" xml:space="preserve">RSocketServ socketServ;
    21 socketServ.Connect();
    27 User::LeaveIfError(socketServ.Connect());
    22 TProtocolDesc pInfo;
    28 TProtocolDesc pInfo;
    23 _LIT(KL2Cap, "L2CAP");
    29 _LIT(KL2Cap, "L2CAP");
    24 socketServ.FindProtocol(KL2Cap,pInfo);</codeblock> </li>
    30 User::LeaveIfError(socketServ.FindProtocol(KL2Cap,pInfo));</codeblock> </li>
    25 <li id="GUID-52E77D28-A2BE-5FB7-A880-E71307832013"><p>Create and initialise
    31 <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;
    32 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>
    33 User::LeaveIfError(hr.Open(socketServ,pInfo.iAddrFamily,pInfo.iProtocol));</codeblock> </li>
    28 <li id="GUID-499255A3-BC66-5BC5-A37A-B883A0E4EE6A"><p>Get the local device
    34 <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;
    35 name </p> <codeblock id="GUID-F880ACBE-5184-5A64-A287-1C7560233D70" xml:space="preserve">THostName name;
    30 TInt ret=hr.GetHostName(name);</codeblock> </li>
    36 TInt ret=hr.GetHostName(name);</codeblock> </li>
    31 </ol> <p><b>Setting
    37 </ol> <p><b>Setting
    32 the Local Device Name</b> </p> <p>Setting the device name differs only in
    38 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");
    39 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
    40 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>
    41 a descriptor buffer of a suitable  minimum size.</note> </section>
    36 <section><title>Where Next?</title> <p>This tutorial set takes you through
    42 <section id="GUID-0761E1CF-F1C1-4DD7-B8C5-04A1B0A59778"><title>Where Next?</title> <p>This
    37 all the steps involved in setting up and communicating over a Bluetooth connection. </p> <ul>
    43 tutorial set takes you through all the steps involved in setting up and communicating
       
    44 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
    45 <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>
    46 for Incoming Bluetooth Connections</xref> </p> </li>
    40 <li id="GUID-674A5D9A-4685-50F2-9FAC-36FA2E02F577"><p> <b>Handling the Local
    47 <li id="GUID-674A5D9A-4685-50F2-9FAC-36FA2E02F577"><p> <b>Handling the Local
    41 Device Name</b> - This document </p> </li>
    48 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
    49 <li id="GUID-F3A7D62A-9FC8-5C74-8EF2-3E149FD81345"><p> <xref href="GUID-FDA7B932-B9C6-502D-8699-C18C8D86BCC6.dita">Performing