bluetoothengine/btnotif/btnotifsrv/inc/btnotifsettingstracker.h
branchRCL_3
changeset 56 9386f31cc85b
parent 55 613943a21004
child 61 269724087bed
equal deleted inserted replaced
55:613943a21004 56:9386f31cc85b
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: Class for tracking Bluetooth settings, and also for 
       
    15 * handling notes unrelated to specific connection.
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef BTNOTIFSETTINGSTRACKER_H
       
    20 #define BTNOTIFSETTINGSTRACKER_H
       
    21 
       
    22 
       
    23 #include <e32base.h>
       
    24 #include <btengsettings.h>
       
    25 
       
    26 #include "bluetoothnotification.h"
       
    27 
       
    28 class CBTNotifServer;
       
    29 
       
    30 /**
       
    31  * CBTNotifSettingsTracker keeps track of local device settings
       
    32  * 
       
    33  * @since Symbian^4
       
    34  */
       
    35 NONSHARABLE_CLASS( CBTNotifSettingsTracker ) : public CBase,
       
    36                                                public MBTEngSettingsObserver,
       
    37                                                public MBTNotificationResult
       
    38     {
       
    39 
       
    40 public:
       
    41 
       
    42     /**
       
    43      * Two-phased constructor.
       
    44      * @param aServer Pointer to our parent
       
    45      */
       
    46     static CBTNotifSettingsTracker* NewL( CBTNotifServer* aServer );
       
    47 
       
    48     /**
       
    49     * Destructor.
       
    50     */
       
    51     virtual ~CBTNotifSettingsTracker();
       
    52 
       
    53     /**
       
    54      * Return the current power state
       
    55      *
       
    56      * @since Symbian^4
       
    57      * @return The current power state.
       
    58      */
       
    59     inline TBTPowerStateValue GetPowerState() const
       
    60         { return iPowerState; }
       
    61 
       
    62     /**
       
    63      * Processes a message from a notifier client related to settings.
       
    64      *
       
    65      * @since Symbian^4
       
    66      * @param aMessage The message containing the details of the client request.
       
    67      */
       
    68     void DispatchNotifierMessageL( const RMessage2& aMessage );
       
    69 
       
    70     /**
       
    71      * Cancels an oustanding message from a notifier client related to settings.
       
    72      *
       
    73      * @since Symbian^4
       
    74      * @param aMessage The message containing the details of the original client request.
       
    75      */
       
    76     void CancelNotifierMessageL( const RMessage2& aMessage );
       
    77 
       
    78 // from base class MBTEngSettingsObserver
       
    79 
       
    80     /**
       
    81      * From MBTEngSettingsObserver.
       
    82      * Provides notification of changes in the power state 
       
    83      * of the Bluetooth hardware.
       
    84      *
       
    85      * @since Symbian^4
       
    86      * @param aState EBTPowerOff if the BT hardware has been turned off, 
       
    87      *               EBTPowerOn if it has been turned off.
       
    88      */
       
    89     virtual void PowerStateChanged( TBTPowerStateValue aState );
       
    90 
       
    91     /**
       
    92      * From MBTEngSettingsObserver.
       
    93      * Provides notification of changes in the discoverability 
       
    94      * mode of the Bluetooth hardware.
       
    95      *
       
    96      * @since Symbian^4
       
    97      * @param aState EBTDiscModeHidden if the BT hardware is in hidden mode, 
       
    98      *               EBTDiscModeGeneral if it is in visible mode.
       
    99      */
       
   100     virtual void VisibilityModeChanged( TBTVisibilityMode aState );
       
   101 
       
   102 // from base class MBTNotificationResult
       
   103 
       
   104     /**
       
   105      * From MBTNotificationResult.
       
   106      * Handle an intermediate result from a user query.
       
   107      * This ffunction is called if the user query passes information
       
   108      * back before it has finished i.e. is dismissed. The final acceptance/
       
   109      * denial of a query is passed back in MBRNotificationClosed.
       
   110      *
       
   111      * @since Symbian^4
       
   112      * @param aData the returned data. The actual format 
       
   113      *              is dependent on the actual notifier.
       
   114      */
       
   115     virtual void MBRDataReceived( CHbSymbianVariantMap& aData );
       
   116 
       
   117     /**
       
   118      * From MBTNotificationResult.
       
   119      * The notification is finished. The resulting data (e.g. user input or
       
   120      * acceptance/denial of the query) is passed back here.
       
   121      *
       
   122      * @since Symbian^4
       
   123      * @param aErr KErrNone or one of the system-wide error codes.
       
   124      * @param aData the returned data. The actual format 
       
   125      *              is dependent on the actual notifier.
       
   126      */
       
   127     virtual void MBRNotificationClosed( TInt aError, const TDesC8& aData );
       
   128 
       
   129 private:
       
   130 
       
   131     CBTNotifSettingsTracker( CBTNotifServer* aServer );
       
   132 
       
   133     void ConstructL();
       
   134 
       
   135 private: // data
       
   136 
       
   137     /**
       
   138      * Local copy of current power state.
       
   139      */
       
   140     TBTPowerStateValue iPowerState;
       
   141 
       
   142     /**
       
   143      * Local copy of current visibility mode.
       
   144      */
       
   145     TBTVisibilityMode iVisibilityMode;
       
   146 
       
   147     /**
       
   148      * ?description_of_pointer_member
       
   149      * Own.
       
   150      */
       
   151     CBTEngSettings* iSettings;
       
   152 
       
   153     /**
       
   154      * Pointer to an outstanding user interaction.
       
   155      * Not own.
       
   156      */
       
   157     CBluetoothNotification* iNotification;
       
   158 
       
   159     /**
       
   160      * Reference to our parent the server class.
       
   161      * Not own.
       
   162      */
       
   163     CBTNotifServer* iServer;
       
   164 
       
   165     };
       
   166 
       
   167 #endif // BTNOTIFSETTINGSTRACKER_H