mmappfw_plat/mpx_common_api/inc/mpxmessagequeue.h
changeset 0 a2952bb97e68
child 9 bee149131e4b
equal deleted inserted replaced
-1:000000000000 0:a2952bb97e68
       
     1 /*
       
     2 * Copyright (c) 2007 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:  Queue the message
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CMPXMESSAGEQUEUE_H
       
    20 #define CMPXMESSAGEQUEUE_H
       
    21 
       
    22 #include <e32base.h>    // For CActive, link against: euser.lib
       
    23 #include <e32msgqueue.h>
       
    24 #include <mpxmessage2.h>
       
    25 
       
    26 class CMPXMessageItem;
       
    27 
       
    28 /**
       
    29 *  Message queue.
       
    30 *
       
    31 *  @lib mpxcommon.lib
       
    32 */
       
    33 class CMPXMessageQueue : public CBase
       
    34     {
       
    35 public:
       
    36     /**
       
    37      * Two-phased constructor.
       
    38      *
       
    39      * @since S60 3.2.3
       
    40      * @return new object of the CMPXMessageQueue
       
    41      */
       
    42     IMPORT_C static CMPXMessageQueue* NewL();
       
    43 
       
    44     /**
       
    45      * Destructor.
       
    46      *
       
    47      * @since S60 3.2.3
       
    48      */
       
    49     IMPORT_C ~CMPXMessageQueue();
       
    50 
       
    51 public: // New functions
       
    52     /**
       
    53      * Request to send next message.
       
    54      *
       
    55      * @since S60 3.2.3
       
    56      * @param aMsgRequest message request
       
    57      */
       
    58     IMPORT_C void SendNext(const RMessage2& aMsgRequest);
       
    59     
       
    60     /**
       
    61      * Adds a message into the queue and sends the message if slot is available.
       
    62      *
       
    63      * @since S60 3.2.3
       
    64      * @param aMessage message object, ownership not transferred.
       
    65      * @param aError error code
       
    66      */
       
    67     IMPORT_C void Add(const CMPXMessage* aMessage, TInt aError);
       
    68     
       
    69     /**
       
    70      * Reset the message queue.
       
    71      *
       
    72      * @since S60 3.2.3
       
    73      */
       
    74     IMPORT_C void Reset();
       
    75 
       
    76 private:
       
    77     /**
       
    78      * C++ constructor.
       
    79      *
       
    80      * @since S60 3.2.3
       
    81      */
       
    82     CMPXMessageQueue();
       
    83     
       
    84     /**
       
    85      * Second-phase constructor.
       
    86      *
       
    87      * @since S60 3.2.3
       
    88      */
       
    89     void ConstructL();
       
    90 
       
    91     /**
       
    92      * Send a message to client.
       
    93      *
       
    94      * @since S60 3.2.3
       
    95      */
       
    96     void Send();
       
    97 
       
    98 private:
       
    99     RMessage2 iMsgRequest;
       
   100     TSglQue<CMPXMessageItem> iMsgs; // Queue for the messages
       
   101     CMPXMessageItem* iMsgSent; // Sent message
       
   102     TInt iFailure; // Failed to add message to the queue
       
   103 #ifdef _DEBUG
       
   104     TInt iCount; // message count
       
   105 #endif
       
   106     };
       
   107 
       
   108 #endif // CMPXMESSAGEQUEUE_H
       
   109 
       
   110 // End of file