iaupdate/IAD/api/client/inc/iaupdatemanager.h
branchRCL_3
changeset 26 8b7f4e561641
parent 25 7333d7932ef7
--- a/iaupdate/IAD/api/client/inc/iaupdatemanager.h	Tue Aug 31 15:21:33 2010 +0300
+++ b/iaupdate/IAD/api/client/inc/iaupdatemanager.h	Wed Sep 01 12:22:02 2010 +0100
@@ -15,6 +15,8 @@
 *
 */
 
+
+
 #ifndef IA_UPDATE_MANAGER_H
 #define IA_UPDATE_MANAGER_H
 
@@ -24,8 +26,9 @@
 #include <e32std.h>
 #include <coemain.h>
 
+#include "iaupdateclient.h"
+
 //FORWARD DECLARATIONS
-class IAUpdateClient;
 class CIAUpdateParameters;
 class MIAUpdateObserver;
 class CEikonEnv;
@@ -46,34 +49,189 @@
  *
  * @since S60 v3.2
  */
-NONSHARABLE_CLASS( CIAUpdateManager ) : public CBase, public MCoeForegroundObserver
+NONSHARABLE_CLASS( CIAUpdateManager ) : public CActive, public MCoeForegroundObserver
     {
 
 public:
 
+    /**
+     * These values inform what operation has been requested.
+     *
+     * @since S60 v3.2
+     */
+    enum TIAUpdateType
+        {
+        /**
+         * No operation is going on.
+         */ 
+        EIAUpdateIdle,    
+        /**
+         * SWUpdate app start requested.
+         */
+        
+        EIAUpdateStartServer,
+        
+        /**
+         * Update check has been requested.
+         */
+        EIAUpdateCheck,
+
+        /**
+         * Update operation has been requested.
+         */
+        EIAUpdateUpdate,     
+        
+        /**
+         * Update query has been requested.
+         */
+        EIAUpdateQuery   
+        };
+
+
+    /**
+     * @param aObserver Callback functions of the observer are called
+     * when operations progress.    
+     * @return CIAUpdateManager* Pointer to the created CIAUpdateManager 
+     * object that can be used for update actions.
+     *
+     * @since S60 v3.2
+     */
     static CIAUpdateManager* NewL( MIAUpdateObserver& aObserver );
     
+    /**
+     * @see NewL
+     *
+     * @since S60 v3.2
+     */
     static CIAUpdateManager* NewLC( MIAUpdateObserver& aObserver );
     
 
+    /**
+     * Destructor
+     *
+     * @since S60 v3.2
+     */
+    virtual ~CIAUpdateManager();
+    
 
-    ~CIAUpdateManager();
-  
+    /** 
+     * @see CIAUpdate::CheckUpdates
+     *
+     * @since S60 v3.2
+     */
     void CheckUpdates( const CIAUpdateParameters& aUpdateParameters );
-  
+    
+        
+    /** 
+     * @see CIAUpdate::ShowUpdates
+     *
+     * @since S60 v3.2
+     */
     void ShowUpdates( const CIAUpdateParameters& aUpdateParameters );
- 
+    
+
+    /** 
+     * @see CIAUpdate::Update
+     *
+     * @since S60 v3.2
+     */
+    void Update( const CIAUpdateParameters& aUpdateParameters );
+    
+     /** 
+     * @see CIAUpdate::UpdateQuery
+     *
+     * @since S60 v3.2
+     */   
     void UpdateQuery();
+
+
+protected: // CActive
+
+    /**
+     * @see CActive::DoCancel
+     *
+     * @since S60 v3.2
+     */
+    virtual void DoCancel();
+
+    /**
+     * When the server side has finished operation, the CActive object will
+     * be informed about it, and as a result RunL will be called. This function
+     * well inform the observer that the operation has been completed.
+     * @see CActive::RunL
+     *
+     * @since S60 v3.2
+     */
+    virtual void RunL();
+
+
+protected:
+
+    /**
+     * @see NewL
+     *
+     * @since S60 v3.2
+     */
+    CIAUpdateManager( MIAUpdateObserver& aObserver );
     
-    void Update( const CIAUpdateParameters& aUpdateParameters );
+    /**
+     * @see NewL
+     *
+     * @since S60 v3.2
+     */
+    virtual void ConstructL();
+
+
+    /**
+     * Resets all the result variables to their default values.
+     *
+     * @since S60 v3.2
+     */
+    virtual void ResetResults();
+
+
+    /**
+     * @return ETrue if an operation is going on. Else EFalse.
+     *
+     * @since S60 v3.2
+     */
+    TBool BusyCheck() const;
+
+
+    /**
+     * @return RIAUpdateClient& Handles the client server communication.
+     *
+     * @since S60 v3.2
+     */
+    RIAUpdateClient& UpdateClient();
+
+
+    /**
+     * @return MUpdateObserver& Observer who will be informed about the
+     * completion of the operations.
+     *
+     * @since S60 v3.2
+     */
+    MIAUpdateObserver& Observer() const;
+
+
+    /**
+     * @return TIAUpdateType Informs what kind of operation is going on.
+     *
+     * @since S60 v3.2
+     */
+    TIAUpdateType UpdateType() const;
+    
+    /**
+     * @param aUpdateType Informs what kind of operation is going on.
+     *
+     * @since S60 v3.2
+     */
+    void SetUpdateType( TIAUpdateType aUpdateType );
 
 
 private:
 
-    CIAUpdateManager();
-    
-    void ConstructL( MIAUpdateObserver& aObserver );
-
     // Prevent these if not implemented
     CIAUpdateManager( const CIAUpdateManager& aObject );
     CIAUpdateManager& operator =( const CIAUpdateManager& aObject );
@@ -89,14 +247,39 @@
 	* Handles the application going into the background.
 	*/
 	void HandleLosingForeground();
-
+	
+private:// new functions
+	
+	void CheckUpdatesContinue();
+	
+	void CopyUpdateParamsL( const CIAUpdateParameters& aUpdateParameters );
 
 private: // data
-   
+
+	CIAUpdateParameters* iUpdateParameters;
+	
+    // Observer who will be informed about the completion of the operations. 
+    MIAUpdateObserver& iObserver;    
+    
     // Handles the client server communication.
-    IAUpdateClient* iUpdateClient;
+    RIAUpdateClient iUpdateClient;
+
+    // Informs what kind of operation is going on.
+    TIAUpdateType iUpdateType;
 
+    // This is used to storage the success count values for update operations.
+    TInt iSuccessCount;
+    
+    // This is used to storage the fail count values for update operations.
+    TInt iFailCount;
+    
+    // This is used to storage the cancel count values for update operations.
+    TInt iCancelCount;
+
+    TBool iUpdateNow;
+    
     CEikonEnv* iEikEnv; //not owned
+
     };
 
 #endif // IA_UPDATE_IMPL_H