javauis/mmapi_qt/audiostreaming/inc/cmmadatasourcestream.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 11 May 2010 16:07:20 +0300
branchRCL_3
changeset 24 0fd27995241b
permissions -rw-r--r--
Revision: v2.1.24 Kit: 201019

/*
* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  Class for reading data from Java SourceStream to native side
*
*/


#ifndef CMMADATASOURCESTREAM_H
#define CMMADATASOURCESTREAM_H

#include "cmmasourcestream.h"

class CMMADataSourceStreamEvent;
class MMMASourceStreamListener;
class MMMAEventPoster;
class CMMAStreamRequest;

// CONSTANTS

//  CLASS DECLARATION
/**
*   Class for reading data from Java SourceStream to native side
*
*/
NONSHARABLE_CLASS(CMMADataSourceStream): public CMMASourceStream
{
public:     // Constructors and destructors
    /**
     * Object creation. Static method.
     *
     * @param aJNIEnv           handle to used jni environment
     * @param aEventPoster      handle to event poster
     * @param aJavaSourceStream handle to java SourceStream object
     * @param aListener         Handle to source stream listener
     *
     * @return CMMADataSourceStream object
     */
    static CMMADataSourceStream* NewLC(JNIEnv* aJNIEnv,
    MMMAEventPoster* aEventPoster,
    jobject aJavaSourceStream,
    MMMASourceStreamListener* aListener,
    MMAFunctionServer* aEventSource);

    /**
     * Deletes owned objects
     */
    ~CMMADataSourceStream(); // Destructor

public: // New methods
    /**
     * Reads data from Java
     */
    void Read(CMMAStreamRequest* aRequest);

    /**
     * @return readed request
     */
    CMMAStreamRequest* Request();

public: // From CMMASourceStream

    /**
     * Overwrites CMMASourceStream's ResetData
     * so iData will not be NULL, does nothing
     */
    void ResetData();

protected:  // Constructors and destructors

    /**
     * Set variables
     * @param aEventPoster handle to event poster
     * @param aListener    handle to source stream listener
     */
    CMMADataSourceStream(MMMAEventPoster* aEventPoster,
                         MMMASourceStreamListener* aListener);

    /**
     * 2nd phase constructor
     *
     * @param aJNIEnv           used jni environment
     * @param aJavaSourceStream handle to java source stream object
     */
    void ConstructL(JNIEnv* aJNIEnv, MMAFunctionServer* aEventSource,jobject aJavaSourceStream);


protected:  // From CMMASourceStream

    void WriteL(const TUint8* aData,
                TInt aLength, TInt aState);

protected:
    // not owned request
    CMMAStreamRequest* iRequest;
};

#endif // CMMADATASOURCESTREAM_H