mmserv/voipaudioservices/inc/VoIPQueueHandler.h
changeset 53 eabc8c503852
parent 0 71ca22bcf22a
equal deleted inserted replaced
48:a493a607b5bf 53:eabc8c503852
     1 /*
     1 /*
     2 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). 
     2  * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3  * All rights reserved.
     4 * This component and the accompanying materials are made available
     4  * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5  * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6  * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     8  *
     9 * Initial Contributors:
     9  * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10  * Nokia Corporation - initial contribution.
    11 *
    11  *
    12 * Contributors:
    12  * Contributors:
    13 *
    13  *
    14 * Description:  Declares CQueueHandler class which handles VoIP client/server
    14  * Description:  Declares CQueueHandler class which handles VoIP client/server
    15 *                messaging.
    15  *               messaging.
    16 *
    16  *
    17 */
    17  */
    18 
    18 
    19 
    19 #ifndef VOIPQUEUEHANDLER_H
    20 #ifndef __VOIPQUEUEHANDLER_H
    20 #define VOIPQUEUEHANDLER_H
    21 #define __VOIPQUEUEHANDLER_H
       
    22 
       
    23 
    21 
    24 // INCLUDES
    22 // INCLUDES
    25 #include <e32base.h>
    23 #include <e32base.h>
    26 #include <e32msgqueue.h>
    24 #include <e32msgqueue.h>
    27 #include "VoIPAudioClientServer.h"   // for TVoIPMsgBuf
    25 #include "VoIPAudioClientServer.h"   // for TVoIPMsgBuf
    28 
       
    29 // FORWARD DECLARATIONS
    26 // FORWARD DECLARATIONS
    30 class CVoIPDataBuffer;
    27 class CVoIPDataBuffer;
    31 
    28 
    32 
       
    33 /**
    29 /**
    34 *  MQueueHandlerObserver
    30  *  MQueueHandlerObserver
    35 *  Responsible for sending callbacks to the VoIP client app
    31  *  Responsible for sending callbacks to the VoIP client app
    36 */
    32  */
    37 class MQueueHandlerObserver
    33 class MQueueHandlerObserver
    38     {
    34     {
    39 public:
    35 public:
    40     virtual void FillBuffer(CVoIPDataBuffer* aBuffer) = 0;
    36     virtual void FillBuffer(CVoIPDataBuffer* aBuffer) = 0;
    41     virtual void EmptyBuffer(CVoIPDataBuffer* aBuffer) = 0;
    37     virtual void EmptyBuffer(CVoIPDataBuffer* aBuffer) = 0;
    42     virtual void Event(TInt aEventType, TInt aError) = 0;
    38     virtual void Event(TInt aEventType, TInt aError) = 0;
    43     };
    39     };
    44 
    40 
    45 
       
    46 /**
    41 /**
    47 *  CQueueHandler
    42  *  CQueueHandler
    48 *
    43  *
    49 */
    44  */
    50 NONSHARABLE_CLASS(CQueueHandler) : public CActive
    45 NONSHARABLE_CLASS(CQueueHandler) : public CActive
    51     {
    46     {
    52 public:
    47 public:
    53 
    48 
    54     /**
    49     /**
    55     * NewL()
    50      * NewL()
    56     * Contructor
    51      * Contructor
    57     *
    52      *
    58     */
    53      */
    59     static CQueueHandler* NewL(MQueueHandlerObserver* aObserver,
    54     static CQueueHandler* NewL(MQueueHandlerObserver* aObserver,
    60                                RMsgQueue<TVoIPMsgBuf>* aMsgQueue,
    55             RMsgQueue<TVoIPMsgBuf>* aMsgQueue, TInt aBufferLen = 0);
    61                                TInt aBufferLen = 0);
       
    62 
    56 
    63     /**
    57     /**
    64     * destructor
    58      * destructor
    65     */
    59      */
    66     virtual ~CQueueHandler();
    60     virtual ~CQueueHandler();
    67 
    61 
    68     /**
    62     /**
    69     * Start
    63      * Start
    70     * Starts listening for events.
    64      * Starts listening for events.
    71     *
    65      *
    72     */
    66      */
    73     void Start();
    67     void Start();
    74 
    68 
    75     /**
    69     /**
    76     * Returns request status.
    70      * Returns request status.
    77     */
    71      */
    78     TRequestStatus* Status();
    72     TRequestStatus* Status();
    79 
    73 
    80 private:
    74 private:
    81 
    75 
    82     /**
    76     /**
    83     * constructor
    77      * constructor
    84     */
    78      */
    85     CQueueHandler(RMsgQueue<TVoIPMsgBuf>* aMsgQueue);
    79     CQueueHandler(RMsgQueue<TVoIPMsgBuf>* aMsgQueue);
    86 
    80 
    87     void ConstructL(MQueueHandlerObserver* aObserver, TInt aBufferLen);
    81     void ConstructL(MQueueHandlerObserver* aObserver, TInt aBufferLen);
    88 
    82 
    89     // from CActive
    83     // from CActive
    91     void RunL();
    85     void RunL();
    92     TInt RunError(TInt aError);
    86     TInt RunError(TInt aError);
    93     void DoFillBuffer(TInt aBufLen, TInt aStatus);
    87     void DoFillBuffer(TInt aBufLen, TInt aStatus);
    94     void DoEmptyBuffer(TInt aBufLen, TInt aStatus);
    88     void DoEmptyBuffer(TInt aBufLen, TInt aStatus);
    95 
    89 
    96 private: // data
    90 private:
       
    91     // data
    97 
    92 
    98     MQueueHandlerObserver*   iObserver; // (not owned)
    93     MQueueHandlerObserver* iObserver; // (not owned)
    99     RMsgQueue<TVoIPMsgBuf>*  iMsgQueue;
    94     RMsgQueue<TVoIPMsgBuf>* iMsgQueue;
   100 
    95 
   101     RChunk                   iChunk;
    96     RChunk iChunk;
   102     TPtr8                    iChunkDataPtr;
    97     TPtr8 iChunkDataPtr;
   103     CVoIPDataBuffer*         iBuffer;
    98     CVoIPDataBuffer* iBuffer;
   104 
       
   105     };
    99     };
   106 
   100 
   107 
   101 #endif //VOIPQUEUEHANDLER_H
   108 #endif      // __VOIPQUEUEHANDLER_H
       
   109 
       
   110 
   102 
   111 // End of File
   103 // End of File