usbuis/usbuinotif/inc/usbnotifier.h
changeset 34 7858bc6ead78
parent 31 dfdd8240f7c8
child 35 9d8b04ca6939
equal deleted inserted replaced
31:dfdd8240f7c8 34:7858bc6ead78
     1 /*
       
     2  * Copyright (c) 2005, 2009 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 USB UI notifiers base class.
       
    15  *
       
    16  */
       
    17 #ifndef USBUINOTIFIER_H
       
    18 #define USBUINOTIFIER_H
       
    19 // INCLUDES
       
    20 #include <usbuinotif.h>
       
    21 #include <eikenv.h>
       
    22 #include <data_caging_path_literals.hrh> 
       
    23 #include <usbman.h>
       
    24 #include <usbwatcher.h>
       
    25 #include <AknCapServerClient.h>  
       
    26 #include "usbuinotifdebug.h"
       
    27 // CONSTANTS
       
    28 // Literal resource filename 
       
    29 _LIT(KResourceFileName, "usbuinotif.rsc");
       
    30 
       
    31 // FORWARD DECLARATIONS
       
    32 
       
    33 
       
    34 // CLASS DECLARATION
       
    35 
       
    36 /**
       
    37  *  This class is the base class for all notifiers.
       
    38  *
       
    39  *  @lib
       
    40  */
       
    41 NONSHARABLE_CLASS(CUSBUINotifierBase) : public CActive, public MEikSrvNotifierBase2
       
    42     {
       
    43 public:
       
    44     // Constructors and destructor
       
    45 
       
    46     /**
       
    47      * Destructor.
       
    48      */
       
    49     virtual ~CUSBUINotifierBase();
       
    50 
       
    51 protected:
       
    52     // Constructors and destructor
       
    53 
       
    54     /**
       
    55      * C++ default constructor.
       
    56      */
       
    57     CUSBUINotifierBase();
       
    58 
       
    59     /**
       
    60      * Symbian 2nd phase constructor.
       
    61      */
       
    62     virtual void ConstructL();
       
    63 
       
    64 protected:
       
    65     // New functions
       
    66 
       
    67     /**
       
    68      * Used in asynchronous notifier launch to store received parameters 
       
    69      * into members variables and make needed initializations.        
       
    70      * @param aBuffer A buffer containing received parameters
       
    71      * @param aReplySlot a Reply slot.
       
    72      * @param aMessage Should be completed when the notifier is deactivated.
       
    73      * @return None.
       
    74      */
       
    75     virtual void GetParamsL(const TDesC8& aBuffer, TInt aReplySlot,
       
    76             const RMessagePtr2& aMessage)=0;
       
    77 
       
    78     /**
       
    79      * A function for checking the status of Apps key.
       
    80      * @param aEnable A Boolean according to Apps key status
       
    81      * @return None.
       
    82      */
       
    83     void SuppressAppSwitching(TBool aEnable);
       
    84 
       
    85     /**
       
    86      * Check if message needs to be completed and complete it
       
    87      * @param aReason   The completetion code
       
    88      */
       
    89     void CompleteMessage(TInt aReason);
       
    90 
       
    91     /*
       
    92      * Check whether the keylock is on. If yes turn it off.
       
    93      * @since S60 3.2
       
    94      */
       
    95     void DisableKeylock();
       
    96 
       
    97     /*
       
    98      * Restore the keyguard on if it has been disabled by DisableKeylock.
       
    99      * @since S60 3.2
       
   100      */
       
   101     void RestoreKeylock();
       
   102 
       
   103 protected:
       
   104     // Functions from base classes        
       
   105 
       
   106     /**
       
   107      * From CActive Gets called when a request completes.
       
   108      * @param None.
       
   109      * @return None.
       
   110      */
       
   111     virtual void RunL()=0;
       
   112 
       
   113     /**
       
   114      * From CActive Gets called when a leave occurres in RunL.
       
   115      * @param aError Symbian OS errorcode.
       
   116      * @return error code.
       
   117      */
       
   118     virtual TInt RunError(TInt aError);
       
   119 
       
   120     /**
       
   121      * From MEikSrvNotifierBase2 Called when a notifier is first loaded 
       
   122      * to allow any initial construction that is required.
       
   123      * @param None.
       
   124      * @return A structure containing priority and channel info.
       
   125      */
       
   126     virtual TNotifierInfo RegisterL()=0;
       
   127 
       
   128     /**
       
   129      * From MEikSrvNotifierBase2 The notifier has been deactivated 
       
   130      * so resources can be freed and outstanding messages completed.
       
   131      * @param None.
       
   132      * @return None.
       
   133      */
       
   134     virtual void Cancel();
       
   135 
       
   136 private:
       
   137     // Functions from base classes        
       
   138 
       
   139     /**
       
   140      * From MEikSrvNotifierBase2 Called when all resources allocated 
       
   141      * by notifiers should be freed.
       
   142      * @param None.
       
   143      * @return None.
       
   144      */
       
   145     virtual void Release();
       
   146 
       
   147     /**
       
   148      * From MEikSrvNotifierBase2 Return the priority a notifier takes 
       
   149      * and the channels it acts on.
       
   150      * @param None.
       
   151      * @return A structure containing priority and channel info.
       
   152      */
       
   153     virtual TNotifierInfo Info() const;
       
   154 
       
   155     /**
       
   156      * From MEikSrvNotifierBase2 Synchronic notifier launch.        
       
   157      * @param aBuffer Received parameter data.
       
   158      * @return A pointer to return value.
       
   159      */
       
   160     virtual TPtrC8 StartL(const TDesC8& aBuffer);
       
   161 
       
   162     /**
       
   163      * From MEikSrvNotifierBase2 Asynchronic notifier launch.
       
   164      * @param aBuffer A buffer containing received parameters
       
   165      * @param aReturnVal The return value to be passed back.
       
   166      * @param aMessage Should be completed when the notifier is deactivated.
       
   167      * @return A pointer to return value.
       
   168      */
       
   169     virtual void StartL(const TDesC8& aBuffer, TInt aReplySlot,
       
   170             const RMessagePtr2& aMessage);
       
   171 
       
   172     /**
       
   173      * From MEikSrvNotifierBase2 Updates a currently active notifier.
       
   174      * @param aBuffer The updated data.
       
   175      * @return A pointer to return value.
       
   176      */
       
   177     virtual TPtrC8 UpdateL(const TDesC8& aBuffer);
       
   178 
       
   179     /**
       
   180      * From CActive Gets called when a request is cancelled.
       
   181      * @param None.
       
   182      * @return None.
       
   183      */
       
   184     virtual void DoCancel();
       
   185 
       
   186 private:
       
   187     TBool iKeylockChanged; // Flag used to restore the keylock
       
   188     RAknUiServer iAknServer;
       
   189 protected:
       
   190     // Data
       
   191 
       
   192     RMessagePtr2 iMessage; // Received message
       
   193     TInt iReplySlot; // Reply slot
       
   194     TBool iNeedToCompleteMessage; // Flag for releasing messages
       
   195 
       
   196     TInt iResourceFileFlag; // Flag for eikon env.
       
   197     TNotifierInfo iInfo; // Notifier parameters structure    
       
   198     CEikonEnv* iEikEnv; // Local eikonenv, not own
       
   199     TBool iAppsKeyBlocked; // Apps key status 
       
   200 
       
   201     TBool iCoverDisplaySupported; // Cover Display UI feature support
       
   202 
       
   203     };
       
   204 
       
   205 #endif // USBUINOTIFIER_H
       
   206 // End of File