bluetoothengine/btnotif/inc/btnauthnotifier.h
branchRCL_3
changeset 56 9386f31cc85b
parent 0 f63038272f30
child 61 269724087bed
equal deleted inserted replaced
55:613943a21004 56:9386f31cc85b
       
     1 /*
       
     2 * Copyright (c) 2002 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:  Declares authorisation notifier class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef BTNAUTHNOTIFIER_H
       
    20 #define BTNAUTHNOTIFIER_H
       
    21 
       
    22 // INCLUDES
       
    23 
       
    24 #include "btnotifier.h" // Base class
       
    25 #include "btnotiflock.h"
       
    26 #include "btnotifactive.h"
       
    27 #include <btdevice.h>
       
    28 #include <e32property.h>
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 
       
    32 // CLASS DECLARATION
       
    33 NONSHARABLE_CLASS(CBTAuthNotifier): public CBTNotifierBase, public MBTNotifActiveObserver
       
    34     {
       
    35     public: // Constructors and destructor
       
    36 
       
    37         /**
       
    38         * Two-phased constructor.
       
    39         */
       
    40         static CBTAuthNotifier* NewL();
       
    41 
       
    42         /**
       
    43         * Destructor.
       
    44         */
       
    45         virtual ~CBTAuthNotifier();
       
    46 
       
    47     private: // Functions from base classes
       
    48 
       
    49         /**
       
    50         * From CBTNotifierBase Called when a notifier is first loaded.        
       
    51         * @param None.
       
    52         * @return A structure containing priority and channel info.
       
    53         */
       
    54         TNotifierInfo   RegisterL();
       
    55 
       
    56         /**
       
    57         * From CBTNotifierBase Updates a currently active notifier.
       
    58         * @param aBuffer The updated data.
       
    59         * @return A pointer to return value.
       
    60         */
       
    61         TPtrC8 UpdateL(const TDesC8& aBuffer);
       
    62 
       
    63         /**
       
    64         * From CBTNotifierBase The notifier has been deactivated 
       
    65         * so resources can be freed and outstanding messages completed.
       
    66         * @param None.
       
    67         * @return None.
       
    68         */
       
    69         void Cancel();
       
    70 
       
    71         
       
    72         /**
       
    73         * From CBTNotifierBase Used in asynchronous notifier launch to 
       
    74         * store received parameters into members variables and 
       
    75         * make needed initializations.
       
    76         * @param aBuffer A buffer containing received parameters
       
    77         * @param aReturnVal The return value to be passed back.
       
    78         * @param aMessage Should be completed when the notifier is deactivated.
       
    79         * @return None.
       
    80         */
       
    81         void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage);
       
    82 
       
    83         /**
       
    84         * From CBTNotifierBase
       
    85         */      
       
    86         void HandleGetDeviceCompletedL(const CBTDevice* aDev);        
       
    87         
       
    88         /**
       
    89          * From MBTNotifActiveObserver
       
    90          * Gets called when P&S key notifies change.
       
    91          */
       
    92         void RequestCompletedL( CBTNotifActive* aActive, TInt aId, TInt aStatus );
       
    93         
       
    94         /**
       
    95          * From MBTNotifActiveObserver
       
    96          */
       
    97         void HandleError( CBTNotifActive* aActive, TInt aId, TInt aError );
       
    98         
       
    99         /**
       
   100          * From MBTNotifActiveObserver
       
   101          */
       
   102         void DoCancelRequest( CBTNotifActive* aActive, TInt aId );
       
   103 
       
   104     private:
       
   105 
       
   106         /** Checks if the notifier should be replied automatically and not shown to user.
       
   107 		 *
       
   108 		 *@the device
       
   109 		 *@ return TRUE if the notifier should be replied immediately yes or no, without showing query.
       
   110 		 */
       
   111 		TBool GetByPassAudioNotifier(const TBTDevAddr& aDevice,TBool& aAccept);
       
   112 		
       
   113 		/**
       
   114 		 *@param aAccepted. ETrue if user accepted the incoming audio connection. EFalse if not.
       
   115 		 *@param aDeviceAddress. The address of the device that attempted audio connection. 
       
   116 		 */
       
   117 		void MemorizeCurrentAudioAttempt(const TBool aAccept,const TBTDevAddr& aDeviceAddress);
       
   118 		
       
   119         /**
       
   120         * C++ default constructor.
       
   121         */
       
   122         CBTAuthNotifier();
       
   123 
       
   124         /**
       
   125          * Ask user's response for authorization query
       
   126          */
       
   127         void ShowAuthoQueryL();
       
   128         
       
   129         /**
       
   130          * After user rejects authorization, provide user the chance to turn BT off
       
   131          * if it is a within a threshold. Query block the device according to logic of 
       
   132          * "second time for the same paired device". 
       
   133          */
       
   134         void DoRejectAuthorizationL();
       
   135         
       
   136         /**
       
   137          * Subscribe to P&S Key and check its value
       
   138          */
       
   139         void CheckAndSubscribeNotifLocks();
       
   140         
       
   141     private: // Data definitions
       
   142 
       
   143         enum TBTAuthState
       
   144             {
       
   145             EBTNormalAuthorisation,                     // Normal authorisation
       
   146             EBTAutoAuthorisation,                       // Automated Authorisation
       
   147             EBTAutoAuthorisationNotAuthorisedOnPhone,   
       
   148             EBTObexAuthorisation,                   // Obex authorisation for non paired devices
       
   149             EBTObexAuthForPairedDevice             // Obex authorisation for paired devices
       
   150            
       
   151             };
       
   152 
       
   153     private: // Data
       
   154 
       
   155         TBTAuthState    iAuthState;             // Authorisation state
       
   156         TInt            iStrResourceId;
       
   157         TSecondaryDisplayBTnotifDialogs iCoverUiDlgId;
       
   158 		TUint			iServiceUid;
       
   159 		TBool           iSuspended;
       
   160 		RProperty       iNotifLockProp;
       
   161 		CBTNotifActive* iLockActive;    
       
   162     };
       
   163 
       
   164 #endif
       
   165 
       
   166 // End of File