Symbian3/PDK/Source/GUID-C49F63A4-BA9D-5C99-8C82-EB3163E30D3E.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Fri, 13 Aug 2010 16:47:46 +0100
changeset 14 578be2adaf3e
parent 5 f345bda72bc4
permissions -rw-r--r--
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
     1
<?xml version="1.0" encoding="utf-8"?>
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
     2
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
     3
<!-- This component and the accompanying materials are made available under the terms of the License 
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
     4
"Eclipse Public License v1.0" which accompanies this distribution, 
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
     5
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
     6
<!-- Initial Contributors:
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
     7
    Nokia Corporation - initial contribution.
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
     8
Contributors: 
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
     9
-->
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    10
<!DOCTYPE concept
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    11
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    12
<concept xml:lang="en" id="GUID-C49F63A4-BA9D-5C99-8C82-EB3163E30D3E"><title>How to prompt the user to select a remote device</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>When there are several suitable remote devices, you can want to prompt the user to pick the one to which a connection should be made. A dialog to do this is supplied. Note that the dialog is not provided by a standard dialog class as this would require a Bluetooth client to have its own UI, and for this to be brought to the foreground. Instead, clients request a background thread called the notifier server to create the dialog: the server can put a dialog over the UI of whatever application happens to have the foreground.</p> <p>To use the dialog:</p> <ol id="GUID-3EAFB634-327F-578B-B739-E1C689999D39"><li id="GUID-E5598C77-5F6D-5D45-84E2-60B2F2463561"><p>Create an <xref href="GUID-A6B66713-FECA-3BE7-BB81-1AE5551AD83D.dita"><apiname>RNotifier</apiname></xref> object, and connect it with <xref href="GUID-A6B66713-FECA-3BE7-BB81-1AE5551AD83D.dita#GUID-A6B66713-FECA-3BE7-BB81-1AE5551AD83D/GUID-C3191BF8-2F6F-36CC-B5CF-92AC58249E09"><apiname>RNotifier::Connect()</apiname></xref> </p> </li> <li id="GUID-9E199C38-33A9-5E49-BF21-6917D2D5110F"><p>Call <xref href="GUID-A6B66713-FECA-3BE7-BB81-1AE5551AD83D.dita#GUID-A6B66713-FECA-3BE7-BB81-1AE5551AD83D/GUID-A5E799C6-E6E4-3C58-A053-F4307179060F"><apiname>RNotifier::StartNotifierAndGetResponse()</apiname></xref> passing in:</p> <ul><li id="GUID-5B591C13-E8EC-53E6-BD26-90345D31C8BC"><p>the UID of the authorisation plug-in (<xref href="GUID-8297F7B3-980E-3E82-B30C-6AF583C8ED02.dita"><apiname>KDeviceSelectionNotifierUid</apiname></xref>)</p> </li> <li id="GUID-87019B90-CC1F-55A9-B447-03C13E86E10E"><p>the device and/or service classes by which to filter suitable remote devices; these are packaged in a <xref href="GUID-6A7B0905-3B9C-367D-AA6C-720C77465206.dita"><apiname>TBTDeviceSelectionParamsPckg</apiname></xref> </p> </li> <li id="GUID-918D02D7-46D5-513E-A31F-8E2C06452EF3"><p>a Bluetooth address object that on completion of the dialog will hold information about the device the user selected in a packaged <xref href="GUID-C6AB3507-A05F-3AC3-9C73-58529D4A106C.dita"><apiname>TBTDeviceResponseParams</apiname></xref>.</p> </li> </ul> </li> <li id="GUID-A2CF8242-B588-5463-8714-D2E59712EAB0"><p>When the <codeph>StartNotifierAndGetResponse()</codeph> calls completes, extract the device information returned from its buffer.</p> </li> <li id="GUID-B1CC149D-7EB7-5B97-9846-3940C544D643"><p>Clean up by cancelling and closing the notifier.</p> </li> </ol> <p><b>Example</b> </p> <codeblock id="GUID-7BF59FB9-4FAC-5CF9-AD47-FB50A4024642" xml:space="preserve">// 1. Create a notifier
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    13
RNotifier not;
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    14
User::LeaveIfError(not.Connect());
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    15
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    16
// 2. Start the device selection plug-in
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    17
TBTDeviceSelectionParams selectionFilter;
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    18
TUUID targetServiceClass(0x2345);
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    19
selectionFilter.SetUUID(targetServiceClass);
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    20
TBTDeviceSelectionParamsPckg pckg(selectionFilter);
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    21
TBTDeviceResponseParams result;
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    22
TBTDeviceResponseParamsPckg resultPckg(result);
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    23
TRequestStatus status;
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    24
not.StartNotifierAndGetResponse(status, KDeviceSelectionNotifierUid, pckg, resultPckg);
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    25
User::After(2000000);
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    26
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    27
// 3. Extract device name if it was returned
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    28
User::WaitForRequest(status);
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    29
TPtrC name;
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    30
if (status.Int() == KErrNone)
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    31
    {
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    32
    if (resultPckg.IsValidDeviceName())
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    33
        {
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    34
     name.Set(resultPckg().DeviceName());
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    35
        }
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    36
    }
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    37
    
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    38
// 4. Clean up
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    39
not.CancelNotifier(KDeviceSelectionNotifierUid);
578be2adaf3e Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582
Dominic Pinkman <dominic.pinkman@nokia.com>
parents: 5
diff changeset
    40
not.Close();
1
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    41
</codeblock> </conbody></concept>