bluetoothengine/btnotif/btnotifsrv/inc/btnotifdeviceselector.h
changeset 19 43824b19ee35
child 31 a0ea99b6fa53
equal deleted inserted replaced
17:f05641c183ff 19:43824b19ee35
       
     1 /*
       
     2 * ============================================================================
       
     3 *  Name        : btnotifdeviceselector.h
       
     4 *  Part of     : BTProximity / BTProximity
       
     5 *  Description : Class for tracking Bluetooth settings, and also for 
       
     6 *                handling notes unrelated to specific connection.
       
     7 *
       
     8 *  Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     9 *  All rights reserved.
       
    10 *  This component and the accompanying materials are made available
       
    11 *  under the terms of "Eclipse Public License v1.0"
       
    12 *  which accompanies this distribution, and is available
       
    13 *  at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
    14 *
       
    15 *  Initial Contributors:
       
    16 *  Nokia Corporation - initial contribution.
       
    17 *
       
    18 *  Contributors:
       
    19 *  Nokia Corporation
       
    20 * ============================================================================
       
    21 * Template version: 4.2
       
    22 */
       
    23 
       
    24 #ifndef BTNOTIFDEVICESELECTOR_H
       
    25 #define BTNOTIFDEVICESELECTOR_H
       
    26 
       
    27 
       
    28 #include <e32base.h>
       
    29 #include <btengsettings.h>
       
    30 #include <btservices/devdiscoveryobserver.h>
       
    31 #include "bluetoothnotification.h"
       
    32 
       
    33 class CBTNotifServer;
       
    34 class CAdvanceDevDiscoverer;
       
    35 class CBtDevExtension;
       
    36 
       
    37 /**
       
    38  *  ?one_line_short_description
       
    39  *  ?more_complete_description
       
    40  *
       
    41  *  @code
       
    42  *   ?good_class_usage_example(s)
       
    43  *  @endcode
       
    44  *
       
    45  *  @lib ?library
       
    46  *  @since S60 ?S60_version *** for example, S60 v3.0
       
    47  */
       
    48 NONSHARABLE_CLASS( CBTNotifDeviceSelector ) : 
       
    49         public CBase,
       
    50         public MBTNotificationResult,
       
    51         public MDevDiscoveryObserver
       
    52     {
       
    53 
       
    54 public:
       
    55 
       
    56     /**
       
    57      * Two-phased constructor.
       
    58      * @param aServer Pointer to our parent
       
    59      */
       
    60     static CBTNotifDeviceSelector* NewL( CBTNotifServer& aServer );
       
    61 
       
    62     /**
       
    63     * Destructor.
       
    64     */
       
    65     virtual ~CBTNotifDeviceSelector();
       
    66 
       
    67     /**
       
    68      * Processes a message from a notifier client related to settings.
       
    69      *
       
    70      * @since Symbian^4
       
    71      * @param aMessage The message containing the details of the client request.
       
    72      */
       
    73     void DispatchNotifierMessageL( const RMessage2& aMessage );
       
    74 
       
    75     /**
       
    76      * Cancels an oustanding message from a notifier client related to settings.
       
    77      *
       
    78      * @since Symbian^4
       
    79      * @param aMessage The message containing the details of the original client request.
       
    80      */
       
    81     void CancelNotifierMessageL( const RMessage2& aMessage );
       
    82 
       
    83 private:
       
    84 // from base class MBTNotificationResult
       
    85 
       
    86     /**
       
    87      * From MBTNotificationResult.
       
    88      * Handle an intermediate result from a user query.
       
    89      * This ffunction is called if the user query passes information
       
    90      * back before it has finished i.e. is dismissed. The final acceptance/
       
    91      * denial of a query is passed back in MBRNotificationClosed.
       
    92      *
       
    93      * @since Symbian^4
       
    94      * @param aData the returned data. The actual format 
       
    95      *              is dependent on the actual notifier.
       
    96      */
       
    97     virtual void MBRDataReceived( CHbSymbianVariantMap& aData );
       
    98 
       
    99     /**
       
   100      * From MBTNotificationResult.
       
   101      * The notification is finished. The resulting data (e.g. user input or
       
   102      * acceptance/denial of the query) is passed back here.
       
   103      *
       
   104      * @since Symbian^4
       
   105      * @param aErr KErrNone or one of the system-wide error codes.
       
   106      * @param aData the returned data. The actual format 
       
   107      *              is dependent on the actual notifier.
       
   108      */
       
   109     virtual void MBRNotificationClosed( TInt aError, const TDesC8& aData );
       
   110     
       
   111     // From MDevDiscoveryObserver
       
   112     
       
   113     /**
       
   114      * Callback to notify that a device has been found.
       
   115      *
       
   116      * @param aAddr the inquiry address that contains the inquiry information
       
   117      *  of the found device.
       
   118      * @param aName the Bluetooth device name of the found device
       
   119      */
       
   120     virtual void HandleNextDiscoveryResultL( 
       
   121             const TInquirySockAddr& aAddr, const TDesC& aName );
       
   122     
       
   123     /**
       
   124      * Callback to notify that the device search has completed.
       
   125      *
       
   126      * @param aErr the error code of device search result.
       
   127      */
       
   128     virtual void HandleDiscoveryCompleted( TInt aErr );
       
   129     
       
   130 private:
       
   131 
       
   132     CBTNotifDeviceSelector( CBTNotifServer& aServer );
       
   133 
       
   134     void ConstructL();
       
   135     
       
   136     void PrepareNotificationL( 
       
   137             TBluetoothDialogParams::TBTDialogType aType,
       
   138             TBTDialogResourceId aResourceId );
       
   139     
       
   140 private: // data    
       
   141 
       
   142     /**
       
   143      * Reference to our parent the server class.
       
   144      * Not own.
       
   145      */
       
   146     CBTNotifServer& iServer;
       
   147     
       
   148     /**
       
   149      * Pointer to an outstanding user interaction.
       
   150      * Not own.
       
   151      */
       
   152     CBluetoothNotification* iNotification;
       
   153     
       
   154     /**
       
   155      * device inquiry handler:
       
   156      */
       
   157     CAdvanceDevDiscoverer* iDiscoverer;
       
   158     
       
   159     /**
       
   160      * do not own the elements in the array.
       
   161      */
       
   162     RPointerArray<CBtDevExtension> iDevices;
       
   163     
       
   164     /**
       
   165      * The message for a pending device selection request from a RNotifier client.
       
   166      */
       
   167     RMessage2 iMessage;
       
   168     
       
   169     };
       
   170 
       
   171 #endif // BTNOTIFDEVICESELECTOR_H