Symbian3/PDK/Source/GUID-783D0B50-0E8A-5199-A07E-749D4A71E671.dita
changeset 12 80ef3a206772
parent 5 f345bda72bc4
equal deleted inserted replaced
11:5072524fcc79 12:80ef3a206772
     7     Nokia Corporation - initial contribution.
     7     Nokia Corporation - initial contribution.
     8 Contributors: 
     8 Contributors: 
     9 -->
     9 -->
    10 <!DOCTYPE concept
    10 <!DOCTYPE concept
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
    12 <concept xml:lang="en" id="GUID-783D0B50-0E8A-5199-A07E-749D4A71E671"><title>Processing an Extended Inquiry Response</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>This tutorial shows you how to retrieve and process the data from a Bluetooth Extended Inquiry Response (EIR). </p> <section><title>Introduction</title> <p>This tutorial shows you how to retrieve the EIR data and how to access the various types of data within it. </p> <p><b>Basic Procedure</b> </p> <p>The high level steps to access the EIR are shown here: </p> <ol id="GUID-27E2F081-EE4A-516D-8D04-29D1A4601045"><li id="GUID-2F5F1046-3335-53CA-AD6D-01D1981348B5"><p>Create the <codeph>EIR</codeph> object and during construction fill it with the data from the Extended Inquiry Response </p> </li> <li id="GUID-541D9DF2-816B-5057-B116-8A587F7A2146"><p>Use access functions to retrieve the different types of data. </p> </li> </ol> </section> <section><title>Environment</title> <p>This tutorial assumes that you have your device correctly configured, active and with Bluetooth enabled and the Bluetooth Stack initialised. <codeph>iResult</codeph> is in scope and contains a <xref href="GUID-C625E339-6726-3FB9-8F8A-F4DB0CAC15FF.dita"><apiname>TNameEntry</apiname></xref> object as the result of a successful Inquiry request. See <xref href="GUID-58F65411-CF08-5F46-8222-3FDB9E571FCC.dita">Inquiring About Remote Devices</xref>. </p> <p> <b>Note:</b> When the Inquiry Request is made, set the <codeph>aDoEIR</codeph> flag to specify that Extended Inquire Response data is required. The Bluetooth Stack will set the <codeph>aDoEIR</codeph> flag if an older version of the API (non-EIR) is used. </p> </section> <section><title>Tutorial</title> <p><b>Create an object to hold the Extended Inquiry Response data </b> </p> <ul><li id="GUID-0837BC7D-58A1-5E84-B64F-D2705DA2A844"><codeblock id="GUID-945D5812-6C22-595F-BE1F-F384C72121E1" xml:space="preserve">TBluetoothNameRecordWrapper eir(iResult());</codeblock> </li> </ul> <p><b> Use access functions to retrieve the various kinds of data</b> </p> <ol id="GUID-2733C57E-2A4B-58CD-9340-A0DA609F5705"><li id="GUID-0CA4F35B-23D4-570C-BAAC-520B5CEA62D2"><p>Get the Bluetooth device local name </p> <p> <b>Note:</b> The device local name may be truncated if it is too long to fit in the EIR data packet. If the name is not truncated then the <codeph>isNameComplete</codeph> flag will be set to <codeph>TRUE</codeph>. </p> <codeblock id="GUID-5F03D407-41FD-53AB-8DA7-B5F465719CFD" xml:space="preserve">
    12 <concept id="GUID-783D0B50-0E8A-5199-A07E-749D4A71E671" xml:lang="en"><title>Processing an Extended Inquiry Response</title><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    13 <p>This tutorial shows you how to retrieve and process the data from
       
    14 a Bluetooth Extended Inquiry Response (EIR). </p>
       
    15 <section id="GUID-5BD30F69-2DE0-40C6-8F45-3DDBC3F79A35"><title>Introduction</title> <p>This tutorial shows you how
       
    16 to retrieve the EIR data and how to access the various types of data
       
    17 within it. </p> <p><b>Basic Procedure</b> </p> <p>The high level steps to access the
       
    18 EIR are shown here: </p> <ol id="GUID-27E2F081-EE4A-516D-8D04-29D1A4601045">
       
    19 <li id="GUID-2F5F1046-3335-53CA-AD6D-01D1981348B5"><p>Create the <codeph>EIR</codeph> object and during construction fill it with the data
       
    20 from the Extended Inquiry Response </p> </li>
       
    21 <li id="GUID-541D9DF2-816B-5057-B116-8A587F7A2146"><p>Use access functions
       
    22 to retrieve the different types of data. </p> </li>
       
    23 </ol> </section>
       
    24 <section id="GUID-ED477BF8-1A81-49C2-9566-682D70A9DC3A"><title>Environment</title> <p>This tutorial assumes that
       
    25 you have your device correctly configured, active and with Bluetooth
       
    26 enabled and the Bluetooth Stack initialised. <codeph>iResult</codeph> is in scope and contains a <xref href="GUID-C625E339-6726-3FB9-8F8A-F4DB0CAC15FF.dita"><apiname>TNameEntry</apiname></xref> object
       
    27 as the result of a successful Inquiry request. See <xref href="GUID-58F65411-CF08-5F46-8222-3FDB9E571FCC.dita">Inquiring About Remote
       
    28 Devices</xref>. </p> <p> <b>Note:</b> When the Inquiry Request is
       
    29 made, set the <codeph>aDoEIR</codeph> flag to specify that Extended
       
    30 Inquire Response data is required. The Bluetooth Stack will set the <codeph>aDoEIR</codeph> flag if an older version of the API (non-EIR) is
       
    31 used. </p> </section>
       
    32 <section id="GUID-38AF6CEE-4F78-4113-AE85-CDD0390F1DC7"><title>Tutorial</title> <p><b>Create an object to hold the Extended Inquiry Response data </b> </p> <ul>
       
    33 <li id="GUID-0837BC7D-58A1-5E84-B64F-D2705DA2A844"><codeblock id="GUID-945D5812-6C22-595F-BE1F-F384C72121E1" xml:space="preserve">TBluetoothNameRecordWrapper eir(iResult());</codeblock> </li>
       
    34 </ul> <p><b> Use access functions to retrieve the various kinds of data</b> </p> <ol id="GUID-2733C57E-2A4B-58CD-9340-A0DA609F5705">
       
    35 <li id="GUID-0CA4F35B-23D4-570C-BAAC-520B5CEA62D2"><p>Get the Bluetooth
       
    36 device local name </p> <p> <b>Note:</b> The device local name may
       
    37 be truncated if it is too long to fit in the EIR data packet. If the
       
    38 name is not truncated then the <codeph>isNameComplete</codeph> flag
       
    39 will be set to <codeph>TRUE</codeph>. </p> <codeblock id="GUID-5F03D407-41FD-53AB-8DA7-B5F465719CFD" xml:space="preserve">
    13 TBool isNameComplete;
    40 TBool isNameComplete;
    14 TInt error = KErrNone;
    41 TInt error = KErrNone;
    15 TInt length = 0;
    42 TInt length = 0;
    16             
    43             
    17 // Get name
    44 // Get name
    38         {
    65         {
    39         iHROutputConsole-&gt;Printf(_L("%d Bytes [Complete] Name: "), length);
    66         iHROutputConsole-&gt;Printf(_L("%d Bytes [Complete] Name: "), length);
    40         }
    67         }
    41         iHROutputConsole-&gt;Printf(_L("%S \n"),&amp;name);
    68         iHROutputConsole-&gt;Printf(_L("%S \n"),&amp;name);
    42     }
    69     }
    43 </codeblock> </li> <li id="GUID-323875EC-7012-537A-935A-74A91DE0F8D7"><p>Get the Transmission Power level </p> <codeblock id="GUID-870F61A6-F827-5B6D-BD4D-A8BB9EFAB0C6" xml:space="preserve">// Get TxPowerLevel
    70 </codeblock> </li>
       
    71 <li id="GUID-323875EC-7012-537A-935A-74A91DE0F8D7"><p>Get the Transmission
       
    72 Power level </p> <codeblock id="GUID-870F61A6-F827-5B6D-BD4D-A8BB9EFAB0C6" xml:space="preserve">// Get TxPowerLevel
    44 TInt8 txPowerLevel;
    73 TInt8 txPowerLevel;
    45 error = eir.GetTxPowerLevel(txPowerLevel);
    74 error = eir.GetTxPowerLevel(txPowerLevel);
    46 if(error == KErrNone)
    75 if(error == KErrNone)
    47     // TxPowerLevel present
    76     // TxPowerLevel present
    48     {
    77     {
    49     iHROutputConsole-&gt;Printf(_L("TxPowerLevel: %ddBm\n"), txPowerLevel);
    78     iHROutputConsole-&gt;Printf(_L("TxPowerLevel: %ddBm\n"), txPowerLevel);
    50     }</codeblock> </li> <li id="GUID-2C67FE67-0652-5840-BA1F-04891A95CAB6"><p>Get the Service Class UUIDs. </p> <p> </p> <codeblock id="GUID-132B642E-EC0A-54D5-B0F6-4F4218578EB5" xml:space="preserve">// Get UUIDs
    79     }</codeblock> </li>
       
    80 <li id="GUID-2C67FE67-0652-5840-BA1F-04891A95CAB6"><p>Get the Service
       
    81 Class UUIDs. </p> <p> </p> <codeblock id="GUID-132B642E-EC0A-54D5-B0F6-4F4218578EB5" xml:space="preserve">// Get UUIDs
    51 RExtendedInquiryResponseUUIDContainer uuidContainer;
    82 RExtendedInquiryResponseUUIDContainer uuidContainer;
    52 error = eir.GetServiceClassUuids(uuidContainer);
    83 error = eir.GetServiceClassUuids(uuidContainer);
    53 if(error &gt;= KErrNone)
    84 if(error &gt;= KErrNone)
    54     {
    85     {
    55     RArray&lt;TUUID&gt; uuids;
    86     RArray&lt;TUUID&gt; uuids;
    69                 }
   100                 }
    70                 
   101                 
    71             iHROutputConsole-&gt;Printf(_L(" \n"));
   102             iHROutputConsole-&gt;Printf(_L(" \n"));
    72             }
   103             }
    73         }
   104         }
    74     }</codeblock> </li> <li id="GUID-C694FBFB-496F-5936-B542-BDB3CD0C063B"><p>Get Manufacturer Specific data. </p> <p> <b>Note:</b> This data is entirely defined by the individual Manufacturer. </p> <codeblock id="GUID-A53768A5-9644-5D56-84BC-EAA4580E8280" xml:space="preserve">// Get Manufacturer Specific Data
   105     }</codeblock> </li>
       
   106 <li id="GUID-C694FBFB-496F-5936-B542-BDB3CD0C063B"><p>Get Manufacturer
       
   107 Specific data. </p> <p> <b>Note:</b> This data is entirely defined
       
   108 by the individual Manufacturer. </p> <codeblock id="GUID-A53768A5-9644-5D56-84BC-EAA4580E8280" xml:space="preserve">// Get Manufacturer Specific Data
    75 length = eir.GetVendorSpecificDataLength();
   109 length = eir.GetVendorSpecificDataLength();
    76 TBuf8&lt;255&gt; msd;
   110 TBuf8&lt;255&gt; msd;
    77 if(length &gt; 0)
   111 if(length &gt; 0)
    78     {
   112     {
    79     error = eir.GetVendorSpecificData(msd);
   113     error = eir.GetVendorSpecificData(msd);
    92     if(error &gt;= KErrNone &amp;&amp; length &gt; 0)
   126     if(error &gt;= KErrNone &amp;&amp; length &gt; 0)
    93         {
   127         {
    94         iHROutputConsole-&gt;Printf(_L("%d Bytes Manufacturer Specific Data: %S\n"), length, &amp;name);
   128         iHROutputConsole-&gt;Printf(_L("%d Bytes Manufacturer Specific Data: %S\n"), length, &amp;name);
    95         }
   129         }
    96     }
   130     }
    97 }</codeblock> </li> </ol> </section> </conbody><related-links><link href="GUID-F2A793F1-A5B5-526B-B147-771D440B13A2.dita"><linktext>Bluetooth Extended Inquiry
   131 }</codeblock> </li>
    98              Response</linktext> </link> <link><linktext/></link></related-links></concept>
   132 </ol> </section>
       
   133 
       
   134 </conbody><related-links>
       
   135 <link href="GUID-F2A793F1-A5B5-526B-B147-771D440B13A2.dita"><linktext>Bluetooth Extended Inquiry Response</linktext></link>
       
   136 </related-links></concept>