iaupdate/IAD/api/client/inc/iaupdatemanager.h
changeset 0 ba25891c3a9e
child 18 f9033e605ee2
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2007-2008 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:   This file contains the header file of the CIAUpdateManager class 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef IA_UPDATE_MANAGER_H
       
    21 #define IA_UPDATE_MANAGER_H
       
    22 
       
    23 
       
    24 //INCLUDES
       
    25 #include <e32base.h>
       
    26 #include <e32std.h>
       
    27 #include <coemain.h>
       
    28 
       
    29 #include "iaupdateclient.h"
       
    30 
       
    31 //FORWARD DECLARATIONS
       
    32 class CIAUpdateParameters;
       
    33 class MIAUpdateObserver;
       
    34 class CEikonEnv;
       
    35 
       
    36 
       
    37 
       
    38 
       
    39 /**
       
    40  * CIAUpdateManager object provides methods for update actions.
       
    41  * Updating will be targeted to the update items that qualify the requirements
       
    42  * of CIAUpdateParameters objects. In asynchronous actions, the callback 
       
    43  * functions of MIAUpdateObserver objects will be informed about the progress 
       
    44  * of update actions.
       
    45  *
       
    46  * @see MIAUpdateObserver
       
    47  * @see CIAUpdateParameters
       
    48  * @see CIAUpdate
       
    49  *
       
    50  * @since S60 v3.2
       
    51  */
       
    52 NONSHARABLE_CLASS( CIAUpdateManager ) : public CActive, public MCoeForegroundObserver
       
    53     {
       
    54 
       
    55 public:
       
    56 
       
    57     /**
       
    58      * These values inform what operation has been requested.
       
    59      *
       
    60      * @since S60 v3.2
       
    61      */
       
    62     enum TIAUpdateType
       
    63         {
       
    64         /**
       
    65          * No operation is going on.
       
    66          */ 
       
    67         EIAUpdateIdle,       
       
    68         
       
    69         /**
       
    70          * Update check has been requested.
       
    71          */
       
    72         EIAUpdateCheck,
       
    73 
       
    74         /**
       
    75          * Update operation has been requested.
       
    76          */
       
    77         EIAUpdateUpdate,     
       
    78         
       
    79         /**
       
    80          * Update query has been requested.
       
    81          */
       
    82         EIAUpdateQuery   
       
    83         };
       
    84 
       
    85 
       
    86     /**
       
    87      * @param aObserver Callback functions of the observer are called
       
    88      * when operations progress.    
       
    89      * @return CIAUpdateManager* Pointer to the created CIAUpdateManager 
       
    90      * object that can be used for update actions.
       
    91      *
       
    92      * @since S60 v3.2
       
    93      */
       
    94     static CIAUpdateManager* NewL( MIAUpdateObserver& aObserver );
       
    95     
       
    96     /**
       
    97      * @see NewL
       
    98      *
       
    99      * @since S60 v3.2
       
   100      */
       
   101     static CIAUpdateManager* NewLC( MIAUpdateObserver& aObserver );
       
   102     
       
   103 
       
   104     /**
       
   105      * Destructor
       
   106      *
       
   107      * @since S60 v3.2
       
   108      */
       
   109     virtual ~CIAUpdateManager();
       
   110     
       
   111 
       
   112     /** 
       
   113      * @see CIAUpdate::CheckUpdates
       
   114      *
       
   115      * @since S60 v3.2
       
   116      */
       
   117     void CheckUpdates( const CIAUpdateParameters& aUpdateParameters );
       
   118     
       
   119         
       
   120     /** 
       
   121      * @see CIAUpdate::ShowUpdates
       
   122      *
       
   123      * @since S60 v3.2
       
   124      */
       
   125     void ShowUpdates( const CIAUpdateParameters& aUpdateParameters );
       
   126     
       
   127 
       
   128     /** 
       
   129      * @see CIAUpdate::Update
       
   130      *
       
   131      * @since S60 v3.2
       
   132      */
       
   133     void Update( const CIAUpdateParameters& aUpdateParameters );
       
   134     
       
   135      /** 
       
   136      * @see CIAUpdate::UpdateQuery
       
   137      *
       
   138      * @since S60 v3.2
       
   139      */   
       
   140     void UpdateQuery();
       
   141 
       
   142 
       
   143 protected: // CActive
       
   144 
       
   145     /**
       
   146      * @see CActive::DoCancel
       
   147      *
       
   148      * @since S60 v3.2
       
   149      */
       
   150     virtual void DoCancel();
       
   151 
       
   152     /**
       
   153      * When the server side has finished operation, the CActive object will
       
   154      * be informed about it, and as a result RunL will be called. This function
       
   155      * well inform the observer that the operation has been completed.
       
   156      * @see CActive::RunL
       
   157      *
       
   158      * @since S60 v3.2
       
   159      */
       
   160     virtual void RunL();
       
   161 
       
   162 
       
   163 protected:
       
   164 
       
   165     /**
       
   166      * @see NewL
       
   167      *
       
   168      * @since S60 v3.2
       
   169      */
       
   170     CIAUpdateManager( MIAUpdateObserver& aObserver );
       
   171     
       
   172     /**
       
   173      * @see NewL
       
   174      *
       
   175      * @since S60 v3.2
       
   176      */
       
   177     virtual void ConstructL();
       
   178 
       
   179 
       
   180     /**
       
   181      * Resets all the result variables to their default values.
       
   182      *
       
   183      * @since S60 v3.2
       
   184      */
       
   185     virtual void ResetResults();
       
   186 
       
   187 
       
   188     /**
       
   189      * @return ETrue if an operation is going on. Else EFalse.
       
   190      *
       
   191      * @since S60 v3.2
       
   192      */
       
   193     TBool BusyCheck() const;
       
   194 
       
   195 
       
   196     /**
       
   197      * @return RIAUpdateClient& Handles the client server communication.
       
   198      *
       
   199      * @since S60 v3.2
       
   200      */
       
   201     RIAUpdateClient& UpdateClient();
       
   202 
       
   203 
       
   204     /**
       
   205      * @return MUpdateObserver& Observer who will be informed about the
       
   206      * completion of the operations.
       
   207      *
       
   208      * @since S60 v3.2
       
   209      */
       
   210     MIAUpdateObserver& Observer() const;
       
   211 
       
   212 
       
   213     /**
       
   214      * @return TIAUpdateType Informs what kind of operation is going on.
       
   215      *
       
   216      * @since S60 v3.2
       
   217      */
       
   218     TIAUpdateType UpdateType() const;
       
   219     
       
   220     /**
       
   221      * @param aUpdateType Informs what kind of operation is going on.
       
   222      *
       
   223      * @since S60 v3.2
       
   224      */
       
   225     void SetUpdateType( TIAUpdateType aUpdateType );
       
   226 
       
   227 
       
   228 private:
       
   229 
       
   230     // Prevent these if not implemented
       
   231     CIAUpdateManager( const CIAUpdateManager& aObject );
       
   232     CIAUpdateManager& operator =( const CIAUpdateManager& aObject );
       
   233     
       
   234 private: // Functions from MCoeForegroundObserver
       
   235 
       
   236 	/**
       
   237 	* Handles the application coming to the foreground.
       
   238 	*/
       
   239 	void HandleGainingForeground();
       
   240 
       
   241 	/**
       
   242 	* Handles the application going into the background.
       
   243 	*/
       
   244 	void HandleLosingForeground();
       
   245 
       
   246 
       
   247 private: // data
       
   248 
       
   249     // Observer who will be informed about the completion of the operations. 
       
   250     MIAUpdateObserver& iObserver;    
       
   251     
       
   252     // Handles the client server communication.
       
   253     RIAUpdateClient iUpdateClient;
       
   254 
       
   255     // Informs what kind of operation is going on.
       
   256     TIAUpdateType iUpdateType;
       
   257 
       
   258     // This is used to storage the success count values for update operations.
       
   259     TInt iSuccessCount;
       
   260     
       
   261     // This is used to storage the fail count values for update operations.
       
   262     TInt iFailCount;
       
   263     
       
   264     // This is used to storage the cancel count values for update operations.
       
   265     TInt iCancelCount;
       
   266 
       
   267     TBool iUpdateNow;
       
   268     
       
   269     CEikonEnv* iEikEnv; //not owned
       
   270 
       
   271     };
       
   272 
       
   273 #endif // IA_UPDATE_IMPL_H