Update contrib.
2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
20 #ifndef MMFDEVSOUNDCALLBACKHANDLER_H
21 #define MMFDEVSOUNDCALLBACKHANDLER_H
25 #include <e32msgqueue.h>
26 #include "mmfaudioclientserver.h"
29 class RMMFDevSoundProxy;
30 class MDevSoundObserver;
33 * Utility class to handle Play Error callback from DevSound server.
35 * @lib MMFDevSound.dll
38 class CMsgQueueHandler : public CActive
40 public: // Constructors and destructor
43 * Constructs, and returns a pointer to, a new
44 * CMMFPlayErrorHandler object.
46 * @param RMMFDevSoundProxy* aDevSoundProxy A handle to DevSoundProxy to
47 * subcribe for event notification from server.
48 * @param MDevSoundObserver& aDevSoundObserver A reference to
49 * MDevSoundObserver to which the events will be forwarded to.
50 * @param aDevSoundCIObserver Observer which will receive Custom Interface events
51 * @return CMMFPlayErrorHandler* A pointer to newly created object.
53 static CMsgQueueHandler* NewL(RMMFDevSoundProxy* aDevSoundProxy,
54 MDevSoundObserver& aDevSoundObserver,
55 RMsgQueue<TMMFDevSoundQueueItem>* aMsgQueue,
56 MMMFDevSoundCustomInterfaceObserver& aDevSoundCIObserver);
63 * Subscribes for Play Error event from DevSound server.
70 * Called by DevSound server when Play Error event occurs.
78 * Called by CActive object framework if RunL leaves.
80 * @param TInt aError Reason for leave
81 * @return TInt KErrNone if error is handled succesfully, else
82 * corresponding error codel
84 TInt RunError(TInt aError);
87 * Called by CActive object framework when client cancels active object.
93 * Called as part of Stop() process to recover any buffers etc
99 * C++ default constructor.
101 CMsgQueueHandler(RMMFDevSoundProxy* aDevSoundProxy,
102 MDevSoundObserver& aDevSoundObserver,
103 RMsgQueue<TMMFDevSoundQueueItem>* aMsgQueue,
104 MMMFDevSoundCustomInterfaceObserver& aDevSoundCIObserver);
106 * By default Symbian 2nd phase constructor is private.
111 * Handles initialization completion event.
113 void DoInitComplete();
116 * Handles play completion or cancel event.
118 void DoPlayErrorComplete();
121 * Handles record completion or cancel event.
123 void DoRecordErrorComplete();
126 * Handles CMMFDevSound object's data request event to supply
127 * CMMFDevSound with the buffer that it needs to play.
129 void DoBTBFCompleteL();
132 * Handles CMMFDevSound object's data request event to supply
133 * CMMFDevSound with the buffer that it needs to record.
135 void DoBTBECompleteL();
138 * Handles tone play completion event.
140 void DoToneFinishedComplete();
143 * Sends DevSound server event completion notification to the client.
145 void DoSendEventToClientComplete();
147 /* Handles CMMFDevSound object's data request event to supply
148 * CMMFDevSound with the last buffer that it needs to record.
150 void DoPausedRecordComplete();
153 * Allocates local data buffer and links it with the global chunk.
154 * @param aHandle Handle to a global chunk or 0 if chunk already exists.
156 void AssignDataBufferToChunkL(TInt aHandle);
158 * Update existing data buffer with latest buffer info from server
159 * but using existing chunk
161 void UpdateDataBufferL();
163 static TInt AsyncQueueFinishCallback(TAny* aPtr);
164 void DoAsyncQueueFinishCallback();
168 RMMFDevSoundProxy* iDevSoundProxy;
169 MDevSoundObserver& iDevSoundObserver;
170 TMMFDevSoundProxyHwBufPckg iSetPckg;
172 TMMFEventPckg iEventPckg;
174 RMsgQueue<TMMFDevSoundQueueItem>* iMsgQueue;
175 TMMFDevSoundQueueItem iCurrentItem;
178 CMMFPtrBuffer* iDataBuffer;
179 CMMFDataBuffer* iEmptyBuffer;
180 MMMFDevSoundCustomInterfaceObserver& iDevSoundCIObserver;
181 CAsyncCallBack* iAsyncQueueFinish;
184 #endif // MMFDEVSOUNDCALLBACKHANDLER_H