Symbian3/SDK/Source/GUID-783D0B50-0E8A-5199-A07E-749D4A71E671.dita
changeset 13 48780e181b38
parent 0 89d6a7a84779
--- a/Symbian3/SDK/Source/GUID-783D0B50-0E8A-5199-A07E-749D4A71E671.dita	Fri Jul 16 17:23:46 2010 +0100
+++ b/Symbian3/SDK/Source/GUID-783D0B50-0E8A-5199-A07E-749D4A71E671.dita	Tue Jul 20 12:00:49 2010 +0100
@@ -1,98 +1,136 @@
-<?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-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">
-TBool isNameComplete;
-TInt error = KErrNone;
-TInt length = 0;
-            
-// Get name
-// This length could be used to create the TBuf to be passed into GetDeviceName()
-length = eir.GetDeviceNameLength();
-TBuf&lt;255&gt; name;
-if(length &gt;= 0)
- {
- // name will contain a Unicode encoded 16-bit string
-    error = eir.GetDeviceName(name, isNameComplete);
-    }
- else
-    {
-        error = length;
-    }
-if(error == KErrNone)
-// we have name here
-    {
-    if(isNameComplete == EFalse)
-        {
-        iHROutputConsole-&gt;Printf(_L("%d Bytes [Partial] Name: "), length);
-        }
-    else
-        {
-        iHROutputConsole-&gt;Printf(_L("%d Bytes [Complete] Name: "), length);
-        }
-        iHROutputConsole-&gt;Printf(_L("%S \n"),&amp;name);
-    }
-</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
-TInt8 txPowerLevel;
-error = eir.GetTxPowerLevel(txPowerLevel);
-if(error == KErrNone)
-    // TxPowerLevel present
-    {
-    iHROutputConsole-&gt;Printf(_L("TxPowerLevel: %ddBm\n"), txPowerLevel);
-    }</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
-RExtendedInquiryResponseUUIDContainer uuidContainer;
-error = eir.GetServiceClassUuids(uuidContainer);
-if(error &gt;= KErrNone)
-    {
-    RArray&lt;TUUID&gt; uuids;
-    TInt uuidCount = uuidContainer.UUIDs().Count();
-    if(uuidCount &gt; 0)
-     {
-        iHROutputConsole-&gt;Printf(_L("*** UUID Count: %d\n"), uuidCount);
-        TInt i;
-        for(i=0;i&lt;uuidCount;i++)
-            {
-            TInt j;
-            TPtrC8 uuid(uuidContainer.UUIDs()[i].ShortestForm());
-            // Treat it as a big endian
-            for(j=0;j&lt;uuid.Length();j++)
-                {
-                iHROutputConsole-&gt;Printf(_L("%02X"), uuid[j]);
-                }
-                
-            iHROutputConsole-&gt;Printf(_L(" \n"));
-            }
-        }
-    }</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
-length = eir.GetVendorSpecificDataLength();
-TBuf8&lt;255&gt; msd;
-if(length &gt; 0)
-    {
-    error = eir.GetVendorSpecificData(msd);
-    }
-else
-    {
-    error = length;
- }
-if(error == KErrNone)
-// we have Manufacturer Specific Data here
-    {
-    // This conversion is for display reason, in a real world this may not be necessary as 
-    // Manufacturer specific data can be just raw 8-bit data, however GetDeviceName() is
-    // different as it always return Unicode encoded 16-bit string
-    error = CnvUtfConverter::ConvertToUnicodeFromUtf8(name, msd);
-    if(error &gt;= KErrNone &amp;&amp; length &gt; 0)
-        {
-        iHROutputConsole-&gt;Printf(_L("%d Bytes Manufacturer Specific Data: %S\n"), length, &amp;name);
-        }
-    }
-}</codeblock> </li> </ol> </section> </conbody><related-links><link href="GUID-F2A793F1-A5B5-526B-B147-771D440B13A2.dita"><linktext>Bluetooth Extended Inquiry
-             Response</linktext> </link> <link><linktext/></link></related-links></concept>
\ No newline at end of file
+<?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 id="GUID-783D0B50-0E8A-5199-A07E-749D4A71E671" xml:lang="en"><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 id="GUID-5BD30F69-2DE0-40C6-8F45-3DDBC3F79A35"><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 id="GUID-ED477BF8-1A81-49C2-9566-682D70A9DC3A"><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 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>
+<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">
+TBool isNameComplete;
+TInt error = KErrNone;
+TInt length = 0;
+            
+// Get name
+// This length could be used to create the TBuf to be passed into GetDeviceName()
+length = eir.GetDeviceNameLength();
+TBuf&lt;255&gt; name;
+if(length &gt;= 0)
+ {
+ // name will contain a Unicode encoded 16-bit string
+    error = eir.GetDeviceName(name, isNameComplete);
+    }
+ else
+    {
+        error = length;
+    }
+if(error == KErrNone)
+// we have name here
+    {
+    if(isNameComplete == EFalse)
+        {
+        iHROutputConsole-&gt;Printf(_L("%d Bytes [Partial] Name: "), length);
+        }
+    else
+        {
+        iHROutputConsole-&gt;Printf(_L("%d Bytes [Complete] Name: "), length);
+        }
+        iHROutputConsole-&gt;Printf(_L("%S \n"),&amp;name);
+    }
+</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
+TInt8 txPowerLevel;
+error = eir.GetTxPowerLevel(txPowerLevel);
+if(error == KErrNone)
+    // TxPowerLevel present
+    {
+    iHROutputConsole-&gt;Printf(_L("TxPowerLevel: %ddBm\n"), txPowerLevel);
+    }</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
+RExtendedInquiryResponseUUIDContainer uuidContainer;
+error = eir.GetServiceClassUuids(uuidContainer);
+if(error &gt;= KErrNone)
+    {
+    RArray&lt;TUUID&gt; uuids;
+    TInt uuidCount = uuidContainer.UUIDs().Count();
+    if(uuidCount &gt; 0)
+     {
+        iHROutputConsole-&gt;Printf(_L("*** UUID Count: %d\n"), uuidCount);
+        TInt i;
+        for(i=0;i&lt;uuidCount;i++)
+            {
+            TInt j;
+            TPtrC8 uuid(uuidContainer.UUIDs()[i].ShortestForm());
+            // Treat it as a big endian
+            for(j=0;j&lt;uuid.Length();j++)
+                {
+                iHROutputConsole-&gt;Printf(_L("%02X"), uuid[j]);
+                }
+                
+            iHROutputConsole-&gt;Printf(_L(" \n"));
+            }
+        }
+    }</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
+length = eir.GetVendorSpecificDataLength();
+TBuf8&lt;255&gt; msd;
+if(length &gt; 0)
+    {
+    error = eir.GetVendorSpecificData(msd);
+    }
+else
+    {
+    error = length;
+ }
+if(error == KErrNone)
+// we have Manufacturer Specific Data here
+    {
+    // This conversion is for display reason, in a real world this may not be necessary as 
+    // Manufacturer specific data can be just raw 8-bit data, however GetDeviceName() is
+    // different as it always return Unicode encoded 16-bit string
+    error = CnvUtfConverter::ConvertToUnicodeFromUtf8(name, msd);
+    if(error &gt;= KErrNone &amp;&amp; length &gt; 0)
+        {
+        iHROutputConsole-&gt;Printf(_L("%d Bytes Manufacturer Specific Data: %S\n"), length, &amp;name);
+        }
+    }
+}</codeblock> </li>
+</ol> </section>
+
+</conbody><related-links>
+<link href="GUID-F2A793F1-A5B5-526B-B147-771D440B13A2.dita"><linktext>Bluetooth Extended Inquiry Response</linktext></link>
+</related-links></concept>
\ No newline at end of file