javauis/mmapi_qt/audiostreaming/inc.emc/cmmastreamrequest.h
branchRCL_3
changeset 24 0fd27995241b
equal deleted inserted replaced
20:f9bb0fca356a 24:0fd27995241b
       
     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:  Request used to write or read data
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CMMASTREAMREQUEST_H
       
    19 #define CMMASTREAMREQUEST_H
       
    20 
       
    21 //  INCLUDES
       
    22 #include <e32base.h>
       
    23 #include "mmmastreamrequestlistener.h"
       
    24 
       
    25 // CONSTANTS
       
    26 const TInt KMMAStreamRequestBufferSize = 5120;
       
    27 
       
    28 /**
       
    29  * - If IsActive returns ETrue, data is procedded in the server.
       
    30  * - If IsActive returns EFalse and DataPtr is empty request is
       
    31  *   ready for reuse
       
    32  * - If IsActive returns EFalse and DataPtr is not empty request
       
    33  *   is waiting to be written.
       
    34  */
       
    35 class CMMAStreamRequest: public CBase
       
    36 {
       
    37 public:// Constructor and destructor
       
    38     /**
       
    39      * @param aListener will be informed when request completes
       
    40      */
       
    41     static CMMAStreamRequest* NewLC(MMMAStreamRequestListener* aListener);
       
    42 
       
    43     /**
       
    44      * Destructor
       
    45      */
       
    46     ~CMMAStreamRequest();
       
    47 
       
    48 public: // new methods
       
    49     /**
       
    50      * @return TPtr to request's data
       
    51      */
       
    52     TPtr8& DataPtr();
       
    53 
       
    54     /**
       
    55      * Completes read request.
       
    56      * @param aError system error code
       
    57      */
       
    58     void CompleteRead(TInt aError);
       
    59 
       
    60     /**
       
    61      * MMMAStreamRequestListener will be informed when request is ready.
       
    62      */
       
    63     void SetActive(TBool iActive);
       
    64     TBool IsActive();
       
    65 
       
    66     /**
       
    67      * 1 if this is stream's last buffer
       
    68      * @return reference to request buffer
       
    69      */
       
    70     TPckgBuf< TInt >& RequestBuffer();
       
    71 public:
       
    72     void WriteRequestComplete(TInt Err);
       
    73 
       
    74 private: // Constructor
       
    75     CMMAStreamRequest(MMMAStreamRequestListener* aListener);
       
    76     void ConstructL();
       
    77 private: // Data
       
    78     // will be informed when request is complete
       
    79     MMMAStreamRequestListener* iListener;
       
    80 
       
    81     // owned data
       
    82     HBufC8* iData;
       
    83 
       
    84     // ptr to iData or NULL if data is processed.
       
    85     TPtr8 iDataPtr;
       
    86 
       
    87     // Request buffer
       
    88     TPckgBuf< TInt > iRequestBuffer;
       
    89 
       
    90     // Status of the buffer
       
    91     TBool iActive;
       
    92 };
       
    93 
       
    94 #endif // CMMASTREAMREQUEST_H