IMPSengine/engsrv/inc/impsapplauncherproxy.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2004 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: Including  CLaunchRequest,CImpsAppLauncherProxy,MImpsAppLaunchHandler.
       
    15 *              Starts a separate process to launch application
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CIMPSAPPLAUNCHERPROXY_H
       
    21 #define CIMPSAPPLAUNCHERPROXY_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 #include "impsservercommon.h"
       
    26 
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class MImpsAppLaunchHandler;
       
    30 
       
    31 // CLASS DECLARATION
       
    32 /**
       
    33 *  Launch request
       
    34 */
       
    35 
       
    36 class CLaunchRequest : public CBase
       
    37     {
       
    38     public:
       
    39         static CLaunchRequest* NewL(
       
    40             const TDesC& aCID,
       
    41             const TDesC& aSAP,
       
    42             const TDesC& aUserId );
       
    43 
       
    44         ~CLaunchRequest();
       
    45         void Destroy();
       
    46         bool operator==( CLaunchRequest& rhs );
       
    47         const TDesC& ApplicationId();
       
    48         const TDesC& Sap();
       
    49         const TDesC& UserId();
       
    50 
       
    51 
       
    52     public: //data
       
    53         TDblQueLink             iLink;          //lint !e1925
       
    54 
       
    55     private:
       
    56         CLaunchRequest( );
       
    57         void ConstructL(
       
    58             const TDesC& aCID,
       
    59             const TDesC& aSAP,
       
    60             const TDesC& aUserId );
       
    61     private:
       
    62         HBufC*                  iCID;
       
    63         HBufC*                  iSAP;
       
    64         HBufC*                  iUserId;
       
    65     };
       
    66 
       
    67 // CLASS DECLARATION
       
    68 /**
       
    69 *  Application launcher proxy
       
    70 *  Starts a separate process to launch application
       
    71 *  and manages the launch requests
       
    72 *
       
    73 *  @since 2.6
       
    74 */
       
    75 class CImpsAppLauncherProxy : public CActive
       
    76     {
       
    77     public:  // Constructors and destructor
       
    78 
       
    79         /**
       
    80         * Two-phased constructor.
       
    81         * @param aLaunchObserver the application launch observer
       
    82         * @return CImpsAppLauncherProxy instance
       
    83         */
       
    84         static CImpsAppLauncherProxy* NewL( MImpsAppLaunchHandler* aLaunchObserver );
       
    85 
       
    86         /**
       
    87         * Destructor.
       
    88         */
       
    89         virtual ~CImpsAppLauncherProxy();
       
    90 
       
    91     public: // New functions
       
    92 
       
    93         /**
       
    94         * Initiates the application launch for the given Client ID
       
    95         * @since 2.6
       
    96         * @param aApplicationId the Application ID of the application to be started
       
    97         * @param aSAP the remote SAP server from where the pending IM came
       
    98         * @param aUserId teh user ID who received the IM
       
    99         * @return error Application
       
   100         */
       
   101         TInt LaunchApplicationL( const TDesC& aApplicationId,
       
   102                                  const TDesC& aSAP,
       
   103                                  const TDesC& aUserID );
       
   104 
       
   105     protected:  // New functions
       
   106 
       
   107         /**
       
   108         * Starts the process which loads the launcher ECom plugin
       
   109         * @since 2.6
       
   110         * @param aRequest
       
   111         * @return error status
       
   112         */
       
   113         TInt DoStartProcess( CLaunchRequest& aRequest );
       
   114 
       
   115     protected:  // Functions from base classes
       
   116 
       
   117         /**
       
   118         * From CActive
       
   119         */
       
   120         void DoCancel();
       
   121         void RunL();
       
   122         TInt RunError( TInt aError );
       
   123 
       
   124     private:
       
   125 
       
   126         /**
       
   127         * C++ default constructor.
       
   128         * @param aLaunchObserver the application launch observer
       
   129         */
       
   130         CImpsAppLauncherProxy( MImpsAppLaunchHandler* aLaunchObserver );
       
   131 
       
   132         /**
       
   133         * By default Symbian 2nd phase constructor is private.
       
   134         */
       
   135         void ConstructL();
       
   136 
       
   137         /**
       
   138         * Queues the request
       
   139         */
       
   140         void QueueRequest( CLaunchRequest& aRequest );
       
   141 
       
   142         /**
       
   143         * Process the next request in queue
       
   144         */
       
   145         void ProcessNextRequestL();
       
   146 
       
   147         /**
       
   148         * Checks whether the request is already in queue
       
   149         */
       
   150         TBool IsDuplicate( CLaunchRequest& aRequest );
       
   151 
       
   152     private:    // Data
       
   153         CLaunchRequest*         iCurrentRequest;   // the request being handled curently
       
   154         MImpsAppLaunchHandler*  iLaunchObserver; // callback handler
       
   155         TDblQue<CLaunchRequest> iRequestList; // request queue
       
   156 
       
   157     };
       
   158 
       
   159 
       
   160 // CLASS DECLARATION
       
   161 /**
       
   162 *  Application launcher observer
       
   163 *  Informs the result of the application launch
       
   164 *
       
   165 *  @since 2.6
       
   166 */
       
   167 class MImpsAppLaunchHandler
       
   168     {
       
   169     public:
       
   170         virtual void HandleAppLaunch( const TDesC& aApplicationId, TInt aStatus ) = 0;
       
   171     };
       
   172 
       
   173 #endif      // CIMPSAPPLAUNCHERPROXY_H   
       
   174 
       
   175 // End of File