messagingfw/alwaysonline/AlwaysOnlineManager/inc/HandleServerCommandOperation.h
changeset 0 8e480a14352b
equal deleted inserted replaced
-1:000000000000 0:8e480a14352b
       
     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: AlwaysOnline server command handler
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __HANDLESERVERCOMMANDOPERATION_H__
       
    21 #define __HANDLESERVERCOMMANDOPERATION_H__
       
    22 
       
    23 //  INCLUDES
       
    24 #include <msvapi.h>
       
    25 #include <AlwaysOnlineManagerCommon.h>
       
    26 
       
    27 #include "AlwaysOnlineEComInterface.h"
       
    28 
       
    29 // CONSTANTS
       
    30 
       
    31 // FORWARD DECLARATIONS
       
    32 
       
    33 // CLASS DECLARATION
       
    34 
       
    35 /**
       
    36 *  Used to call Alwaysonline plugin's HandleServerCommand function
       
    37 *  async. This is needed because if that function implementation isn't
       
    38 *  done properly, it may take long time before it completes and as a sync
       
    39 *  function it would prevent server to call other plugins until the 
       
    40 *  previous call returns
       
    41 *
       
    42 *  @lib alwaysonlinemanagerserver.lib
       
    43 *  @since 2.6
       
    44 */
       
    45 class CAOServerCommandHandler : public CMsvOperation
       
    46     {
       
    47     public:  // Constructors and destructor
       
    48         
       
    49         /**
       
    50         * Two-phased constructor.
       
    51         */
       
    52         static CAOServerCommandHandler* NewL( CMsvSession& aMsvSession,
       
    53             TRequestStatus& aObserverRequestStatus,
       
    54             TManagerServerCommands aCommand,
       
    55             TDes8& aParameter,
       
    56             CAlwaysOnlineEComInterface& aPlugin );
       
    57         
       
    58         /**
       
    59         * Destructor.
       
    60         */
       
    61         virtual ~CAOServerCommandHandler();
       
    62 
       
    63 
       
    64     public: // Functions from base classes
       
    65 
       
    66         /**
       
    67         * From MsvOperation
       
    68         * @since 2.6
       
    69         * @return, progress of an operation
       
    70         */
       
    71         virtual const TDesC8& ProgressL();
       
    72         
       
    73         /**
       
    74         * From MsvOperation
       
    75         * @since 3.1
       
    76         * @return, final progress of an operation
       
    77         */
       
    78         virtual const TDesC8& FinalProgress();
       
    79         
       
    80     protected:  // Functions from base classes
       
    81         
       
    82         /**
       
    83         * From CActive
       
    84         */
       
    85 		virtual void DoCancel();
       
    86 
       
    87         /**
       
    88         * From CActive
       
    89         */
       
    90 		virtual void RunL();
       
    91 		
       
    92         /**
       
    93 		* Function to handle error during running the operation
       
    94 		* @since Series60 2.6
       
    95 		* @return KErrNone, when error has been handled
       
    96 		*/
       
    97 		virtual TInt RunError( TInt aError );
       
    98 
       
    99     private:
       
   100 
       
   101         /**
       
   102         * C++ default constructor.
       
   103         */
       
   104         CAOServerCommandHandler( CMsvSession& aMsvSession,
       
   105             TInt aPriority,
       
   106             TRequestStatus& aObserverRequestStatus,
       
   107             CAlwaysOnlineEComInterface& aPlugin,
       
   108             TManagerServerCommands aCommand );
       
   109 
       
   110         /**
       
   111         * By default Symbian 2nd phase constructor is private.
       
   112         */
       
   113         void ConstructL( const TDes8& aParameter );
       
   114 
       
   115         /**
       
   116         * Starts the operation
       
   117         */
       
   118         void StartOperationL();
       
   119 
       
   120 
       
   121         /**
       
   122         * Sets final progress, which is received from operation.
       
   123         * @since S60 3.1
       
   124         * @param aResponse, response from operation
       
   125         */
       
   126         void SetFinalProgressFromResult( TAny* aResponse );
       
   127 
       
   128 
       
   129         /**
       
   130         * Handles response based on command.
       
   131         * @since S60 3.1
       
   132         * @param aResponse, response from operation
       
   133         */
       
   134         void HandleResponse( TAny* aResponse );
       
   135         
       
   136     protected:  // Data
       
   137 
       
   138         //dummy progress
       
   139         TBuf8<1> iProgress;
       
   140         //final progress to server
       
   141         TBuf8<KAOFinalProgressLength> iFinalProgress;
       
   142         //reference to plugin
       
   143         CAlwaysOnlineEComInterface& iPlugin;
       
   144 
       
   145     private:    // Data
       
   146         TManagerServerCommands iCommand;
       
   147         HBufC8*  iParameterBuf;
       
   148         
       
   149     };
       
   150 
       
   151 #endif      // __HANDLESERVERCOMMANDOPERATION_H__
       
   152             
       
   153 // End of File