IMPSengine/impswatcher/Inc/ImpsPushHandler.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     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:  ECOM plugin .dll for handling IMPS related WAP push messages.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CIMPSPUSHHANDLER_H
       
    21 #define CIMPSPUSHHANDLER_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <CPushHandlerBase.h>
       
    25 #include "ImpsWatchCli.h"
       
    26 #ifdef _DEBUG
       
    27 #include <flogger.h>
       
    28 #endif
       
    29 
       
    30 //MACROS
       
    31 #ifdef _DEBUG
       
    32 #define _IMPS_LOGGING_ON_
       
    33 #endif
       
    34 
       
    35 
       
    36 // CONSTANTS
       
    37 #ifdef _IMPS_LOGGING_ON_
       
    38 _LIT( KDestructor,           "In destructor" );
       
    39 _LIT( KHandleMessageAsync,   "In asynchronous HandleRequestL()" );
       
    40 _LIT( KHandleMessageSync,    "In synchronous HandleRequestL()" );
       
    41 _LIT( KCancelHandleMessage,  "In CancelHandleMessage()" );
       
    42 _LIT( KDoCancel,             "In DoCancel()" );
       
    43 _LIT( KRun,                  "In RunL()" );
       
    44 _LIT( KRunError,             "In RunError()" );
       
    45 _LIT( KTransferMessage,      "In TransferMessage()" );
       
    46 _LIT( KNewL,                 "In NewL()" );
       
    47 _LIT( KMessageWasCorrupt,    "Body was corrupt" );
       
    48 #endif
       
    49 _LIT( KNotSupported, "This method is not supported!" );
       
    50 
       
    51 // FORWARD DECLARTIONS
       
    52 #ifdef _DOUNITTEST
       
    53 class CPushHandlerPluginTest;
       
    54 #endif
       
    55 
       
    56 // CLASS DECLARATION
       
    57 
       
    58 #ifdef _IMPS_LOGGING_ON_
       
    59 class CWatcherLogger : public CBase
       
    60     {
       
    61     public:
       
    62         static void Log( TRefByValue<const TDesC> aFmt, ... );
       
    63         virtual ~CWatcherLogger();
       
    64     };
       
    65 #endif
       
    66 
       
    67 /**
       
    68 *  ECOM listener plugin for WV engine.
       
    69 *  Plugin is instantiated by the wap listener in the system watcher.
       
    70 *  It delivers pushed delivery reports and message notifications to WV Engine.
       
    71 *
       
    72 *  @lib impspushhandler.lib
       
    73 *  @since 2.0
       
    74 */
       
    75 class CImpsPushHandler : public CPushHandlerBase
       
    76     {
       
    77     public:  // Constructors and destructor
       
    78 
       
    79         /**
       
    80         * Destructor
       
    81         * @since S60 2.0
       
    82         */
       
    83         ~CImpsPushHandler( );
       
    84 
       
    85     public: // New functions
       
    86 
       
    87         /**
       
    88         * Default 1st phase factory method.
       
    89         * @since 2.0
       
    90         * @return created instance of the CImpsPushHandler class
       
    91         */
       
    92         static CImpsPushHandler* NewL( );
       
    93 
       
    94     public: // Functions from base classes
       
    95 
       
    96         /**
       
    97         * Method for handling a received message asynchronously.
       
    98         * This not used in CL push
       
    99         * @since 2.0
       
   100         * @param aPushMsg object representing the received push message
       
   101         * @param aStatus Status of the asynchronous call
       
   102         */
       
   103         void HandleMessageL( CPushMessage* aPushMsg, TRequestStatus& aStatus );
       
   104 
       
   105         /**
       
   106         * Method for handling a received message synchronously.
       
   107         * @since 2.0
       
   108         * @param aPushMsg object representing the received push message
       
   109         */
       
   110         void HandleMessageL( CPushMessage* aPushMsg );
       
   111 
       
   112         /**
       
   113         * Cancels the requested asynchronous message handling.
       
   114         * This not used in CL push
       
   115         * @since 2.0
       
   116         */
       
   117         void CancelHandleMessage( );
       
   118 
       
   119 
       
   120     protected:  // Functions from base classes
       
   121 
       
   122         /**
       
   123         * Performs operations needed for cancelling the message handling.
       
   124         * Called by the Active Scheduler after user calling Cancel().
       
   125         * @since 2.0
       
   126         */
       
   127         void DoCancel( );
       
   128 
       
   129         /**
       
   130         * Performs the actual tasks related to message handling.
       
   131         * Called by the Active Scheduler.
       
   132         * @since 2.0
       
   133         */
       
   134         void RunL( );
       
   135 
       
   136         /**
       
   137         * Performs error handling tasks in case RunL() left.
       
   138         * Called by the Active Scheduler.
       
   139         * Currently does nothing.
       
   140         * @since 2.0
       
   141         * @param aError specifies the error code related to RunL()'s leave.
       
   142         * @return error value after error handling.
       
   143         */
       
   144         TInt RunError( TInt aError );
       
   145 
       
   146     private:    // New functions
       
   147 
       
   148         /**
       
   149         * Default constructor.
       
   150         * @since 2.0
       
   151         */
       
   152         CImpsPushHandler( );
       
   153 
       
   154         /**
       
   155         * 2nd phase constructor.
       
   156         * @since 2.0
       
   157         */
       
   158         void ConstructL( );
       
   159 
       
   160         /**
       
   161         * Performs basic sanity checks for the received message.
       
   162         * Only the body is checked since header is not of interest to us.
       
   163         * @since 2.0
       
   164         * @return KErrNone if ok,KErrCorrupt if the message has invalid format
       
   165         */
       
   166         TInt PerformCheck( );
       
   167 
       
   168         /**
       
   169         * Transfers a push message
       
   170         * @since 2.0
       
   171         */
       
   172         void TransferMessage( );
       
   173 
       
   174     private:    // Functions from base classes
       
   175         /**
       
   176         * Reserved for future expansion.
       
   177         * @since 2.0
       
   178         */
       
   179         void CPushHandlerBase_Reserved1( );
       
   180 
       
   181         /**
       
   182         * Reserved for future expansion.
       
   183         * @since 2.0
       
   184         */
       
   185         void CPushHandlerBase_Reserved2( );
       
   186 
       
   187     private:    // Data
       
   188 
       
   189         CPushMessage*    iPushMsg;     // Pushed message
       
   190         RImpsWatchClient iWatchClient; // Client to the WV Engine
       
   191 
       
   192 #ifdef _DOUNITTEST
       
   193         friend CPushHandlerPluginTest;
       
   194 #endif
       
   195     };
       
   196 
       
   197 #endif // CIMPSPUSHHANDLER_H
       
   198 
       
   199 // End of File