mmappfw_plat/mpx_common_api/inc/mpxmessagemonitor.h
changeset 0 a2952bb97e68
equal deleted inserted replaced
-1:000000000000 0:a2952bb97e68
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Message monitor
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CMPXMESSAGEMONITOR_H
       
    21 #define CMPXMESSAGEMONITOR_H
       
    22 
       
    23 #include <e32base.h>
       
    24 #include <e32msgqueue.h>
       
    25 #include "mpxmessageobserver.h"
       
    26 
       
    27 class RMPXSession;
       
    28 
       
    29 /**
       
    30 *  Monitor messages in the message queue.
       
    31 *  The class is always derived from and is never instantiated explicitly.
       
    32 *
       
    33 *  @lib mpxcommon.lib
       
    34 */
       
    35 class CMPXMessageMonitor : public CActive
       
    36     {
       
    37 public:
       
    38     /**
       
    39      * Two-phased constructor.
       
    40      * 
       
    41      * @since S60 3.2.3
       
    42      * @param aSession refrence to session object
       
    43      * @param aObserver observer
       
    44      */
       
    45     IMPORT_C static CMPXMessageMonitor* NewL(const RMPXSession& aSession,
       
    46                                              MMPXMessageObserver& aObserver);
       
    47 
       
    48     /**
       
    49     * Destructor.
       
    50     *
       
    51     * @since S60 3.2.3
       
    52     */
       
    53     IMPORT_C virtual ~CMPXMessageMonitor();
       
    54     
       
    55     /**
       
    56     * Get next message.
       
    57     *
       
    58     * @since S60 3.2.3
       
    59     */
       
    60     IMPORT_C void GetNextMessage();
       
    61     
       
    62 protected: // From base class
       
    63     
       
    64     /**
       
    65     * From CActive.
       
    66     * Handles request completion event.
       
    67     *
       
    68     * @since S60 3.2.3
       
    69     */
       
    70     IMPORT_C void RunL();
       
    71     
       
    72     /**
       
    73     * From CActive.
       
    74     * Implements cancellation of an outstanding request.
       
    75     *
       
    76     * @since S60 3.2.3
       
    77     */
       
    78     IMPORT_C void DoCancel();
       
    79     
       
    80     /**
       
    81     * From CActive.
       
    82     * Handles a leave occurring in the request completion event handler RunL().
       
    83     *
       
    84     * @since S60 3.2.3
       
    85     * @param aError error code
       
    86     */
       
    87     IMPORT_C TInt RunError(TInt aError);
       
    88 
       
    89     
       
    90 protected: // New function
       
    91     
       
    92     /**
       
    93     * Wait for next message.
       
    94     *
       
    95     * @since S60 3.2.3
       
    96     */
       
    97     void WaitForNextMessage();
       
    98 
       
    99 
       
   100 private:
       
   101 
       
   102      /**
       
   103      * C++ constructor.
       
   104      *
       
   105      * @since S60 3.2.3
       
   106      * @param aSession refrence to session object
       
   107      * @param aObserver observer
       
   108      */
       
   109     CMPXMessageMonitor(const RMPXSession& aSession,
       
   110                        MMPXMessageObserver& aObserver);
       
   111 
       
   112     /**
       
   113      * Second phase constructor.
       
   114      *
       
   115      * @since S60 3.2.3
       
   116      */
       
   117     void ConstructL();
       
   118     
       
   119 private:
       
   120     const RMPXSession& iSession;
       
   121     MMPXMessageObserver& iObserver;
       
   122     TPckgBuf<TInt> iMsgDataPkg; // Message data package
       
   123     TPckgBuf<TInt> iErrorPkg; // Error code package
       
   124     };
       
   125 
       
   126 #endif // CMPXMESSAGEMONITOR_H
       
   127 
       
   128 // End of file