os/mm/devsound/a3fdevsound/src/mmfdevsoundproxy/mmfdevsoundcallbackhandler.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/devsound/a3fdevsound/src/mmfdevsoundproxy/mmfdevsoundcallbackhandler.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,186 @@
     1.4 +/*
     1.5 +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description:
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +
    1.23 +#ifndef MMFDEVSOUNDCALLBACKHANDLER_H
    1.24 +#define MMFDEVSOUNDCALLBACKHANDLER_H
    1.25 +
    1.26 +//  INCLUDES
    1.27 +#include <e32base.h>
    1.28 +#include <e32msgqueue.h>
    1.29 +#include "mmfaudioclientserver.h"
    1.30 +
    1.31 +// CLASS DECLARATION
    1.32 +class RMMFDevSoundProxy;
    1.33 +class MDevSoundObserver;
    1.34 +
    1.35 +/**
    1.36 +*  Utility class to handle Play Error callback from DevSound server.
    1.37 +*
    1.38 +*  @lib MMFDevSound.dll
    1.39 +*  @since 
    1.40 +*/
    1.41 +class CMsgQueueHandler : public CActive
    1.42 +	{
    1.43 +public:  // Constructors and destructor
    1.44 +
    1.45 +	/**
    1.46 +	* Constructs, and returns a pointer to, a new
    1.47 +	* CMMFPlayErrorHandler object.
    1.48 +	* Leaves on failure..
    1.49 +	* @param RMMFDevSoundProxy* aDevSoundProxy A handle to DevSoundProxy to
    1.50 +	*        subcribe for event notification from server.
    1.51 +	* @param MDevSoundObserver& aDevSoundObserver A reference to
    1.52 +	*        MDevSoundObserver to which the events will be forwarded to.
    1.53 +	* @param aDevSoundCIObserver Observer which will receive Custom Interface events
    1.54 +	* @return CMMFPlayErrorHandler* A pointer to newly created object.
    1.55 +	*/
    1.56 +	static CMsgQueueHandler* NewL(RMMFDevSoundProxy* aDevSoundProxy,
    1.57 +								MDevSoundObserver& aDevSoundObserver,
    1.58 +								RMsgQueue<TMMFDevSoundQueueItem>* aMsgQueue,
    1.59 +								MMMFDevSoundCustomInterfaceObserver& aDevSoundCIObserver);
    1.60 +	/**
    1.61 +	* Destructor.
    1.62 +	*/
    1.63 +	~CMsgQueueHandler();
    1.64 +
    1.65 +	/**
    1.66 +	* Subscribes for Play Error event from DevSound server.
    1.67 +	* @since 
    1.68 +	* @return void
    1.69 +	*/
    1.70 +	void ReceiveEvents();
    1.71 +
    1.72 +	/**
    1.73 +	* Called by DevSound server when Play Error event occurs.
    1.74 +	* Leaves on failure.
    1.75 +	* @since 
    1.76 +	* @return void
    1.77 +	*/
    1.78 +	void RunL();
    1.79 +
    1.80 +	/**
    1.81 +	* Called by CActive object framework if RunL leaves.
    1.82 +	* @since 
    1.83 +	* @param TInt aError Reason for leave
    1.84 +	* @return TInt KErrNone if error is handled succesfully, else
    1.85 +	* corresponding error codel
    1.86 +	*/
    1.87 +	TInt RunError(TInt aError);
    1.88 +
    1.89 +	/**
    1.90 +	* Called by CActive object framework when client cancels active object.
    1.91 +	* @since 
    1.92 +	* @return void
    1.93 +	*/
    1.94 +	void DoCancel();
    1.95 +	/**
    1.96 +	* Called as part of Stop() process to recover any buffers etc
    1.97 +	*/
    1.98 +	void Finish();
    1.99 +
   1.100 +private:
   1.101 +	/**
   1.102 +	* C++ default constructor.
   1.103 +	*/
   1.104 +	CMsgQueueHandler(RMMFDevSoundProxy* aDevSoundProxy,
   1.105 +					MDevSoundObserver& aDevSoundObserver,
   1.106 +					RMsgQueue<TMMFDevSoundQueueItem>* aMsgQueue,
   1.107 +					MMMFDevSoundCustomInterfaceObserver& aDevSoundCIObserver);
   1.108 +	/**
   1.109 +	* By default Symbian 2nd phase constructor is private.
   1.110 +	*/
   1.111 +	void ConstructL();
   1.112 +
   1.113 +	/*
   1.114 +	* Handles initialization completion event.
   1.115 +	*/
   1.116 +	void DoInitComplete();
   1.117 +
   1.118 +	/*
   1.119 +	* Handles play completion or cancel event.
   1.120 +	*/
   1.121 +	void DoPlayErrorComplete();
   1.122 +
   1.123 +	/*
   1.124 +	* Handles record completion or cancel event.
   1.125 +	*/
   1.126 +	void DoRecordErrorComplete();
   1.127 +
   1.128 +	/*
   1.129 +	* Handles CMMFDevSound object's data request event to supply
   1.130 +	* CMMFDevSound with the buffer that it needs to play.
   1.131 +	*/
   1.132 +	void DoBTBFCompleteL();
   1.133 +
   1.134 +	/*
   1.135 +	* Handles CMMFDevSound object's data request event to supply
   1.136 +	* CMMFDevSound with the buffer that it needs to record.
   1.137 +	*/
   1.138 +	void DoBTBECompleteL();
   1.139 +
   1.140 +	/*
   1.141 +	* Handles tone play completion event.
   1.142 +	*/
   1.143 +	void DoToneFinishedComplete();
   1.144 +
   1.145 +	/*
   1.146 +	* Sends DevSound server event completion notification to the client.
   1.147 +	*/
   1.148 +	void DoSendEventToClientComplete();
   1.149 +	
   1.150 +	/* Handles CMMFDevSound object's data request event to supply 
   1.151 +	* CMMFDevSound with the last buffer that it needs to record.
   1.152 +	*/
   1.153 +	void DoPausedRecordComplete();
   1.154 +	
   1.155 +	/*
   1.156 +	* Allocates local data buffer and links it with the global chunk.
   1.157 +	* @param aHandle Handle to a global chunk or 0 if chunk already exists.
   1.158 +	*/
   1.159 +	void AssignDataBufferToChunkL(TInt aHandle);
   1.160 +	/*
   1.161 +	* Update existing data buffer with latest buffer info from server
   1.162 +	* but using existing chunk
   1.163 +	*/
   1.164 +	void UpdateDataBufferL();
   1.165 +	
   1.166 +	static TInt AsyncQueueFinishCallback(TAny* aPtr);
   1.167 +	void DoAsyncQueueFinishCallback();
   1.168 +
   1.169 +private:
   1.170 +	
   1.171 +	RMMFDevSoundProxy* iDevSoundProxy;
   1.172 +	MDevSoundObserver& iDevSoundObserver;
   1.173 +	TMMFDevSoundProxyHwBufPckg iSetPckg;
   1.174 +
   1.175 +	TMMFEventPckg iEventPckg;
   1.176 +
   1.177 +	RMsgQueue<TMMFDevSoundQueueItem>* iMsgQueue;
   1.178 +	TMMFDevSoundQueueItem   iCurrentItem;
   1.179 +	RChunk iChunk;
   1.180 +	TPtr8 iChunkDataPtr;
   1.181 +	CMMFPtrBuffer* iDataBuffer;
   1.182 +	CMMFDataBuffer* iEmptyBuffer;
   1.183 +	MMMFDevSoundCustomInterfaceObserver& iDevSoundCIObserver;
   1.184 +	CAsyncCallBack*				iAsyncQueueFinish;
   1.185 +	};
   1.186 +
   1.187 +#endif      // MMFDEVSOUNDCALLBACKHANDLER_H
   1.188 +
   1.189 +// End of File