sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
|
sl@0
|
20 |
#ifndef MMFDEVSOUNDCALLBACKHANDLER_H
|
sl@0
|
21 |
#define MMFDEVSOUNDCALLBACKHANDLER_H
|
sl@0
|
22 |
|
sl@0
|
23 |
// INCLUDES
|
sl@0
|
24 |
#include <e32base.h>
|
sl@0
|
25 |
#include <e32msgqueue.h>
|
sl@0
|
26 |
#include "mmfaudioclientserver.h"
|
sl@0
|
27 |
|
sl@0
|
28 |
// CLASS DECLARATION
|
sl@0
|
29 |
class RMMFDevSoundProxy;
|
sl@0
|
30 |
class MDevSoundObserver;
|
sl@0
|
31 |
|
sl@0
|
32 |
/**
|
sl@0
|
33 |
* Utility class to handle Play Error callback from DevSound server.
|
sl@0
|
34 |
*
|
sl@0
|
35 |
* @lib MMFDevSound.dll
|
sl@0
|
36 |
* @since
|
sl@0
|
37 |
*/
|
sl@0
|
38 |
class CMsgQueueHandler : public CActive
|
sl@0
|
39 |
{
|
sl@0
|
40 |
public: // Constructors and destructor
|
sl@0
|
41 |
|
sl@0
|
42 |
/**
|
sl@0
|
43 |
* Constructs, and returns a pointer to, a new
|
sl@0
|
44 |
* CMMFPlayErrorHandler object.
|
sl@0
|
45 |
* Leaves on failure..
|
sl@0
|
46 |
* @param RMMFDevSoundProxy* aDevSoundProxy A handle to DevSoundProxy to
|
sl@0
|
47 |
* subcribe for event notification from server.
|
sl@0
|
48 |
* @param MDevSoundObserver& aDevSoundObserver A reference to
|
sl@0
|
49 |
* MDevSoundObserver to which the events will be forwarded to.
|
sl@0
|
50 |
* @param aDevSoundCIObserver Observer which will receive Custom Interface events
|
sl@0
|
51 |
* @return CMMFPlayErrorHandler* A pointer to newly created object.
|
sl@0
|
52 |
*/
|
sl@0
|
53 |
static CMsgQueueHandler* NewL(RMMFDevSoundProxy* aDevSoundProxy,
|
sl@0
|
54 |
MDevSoundObserver& aDevSoundObserver,
|
sl@0
|
55 |
RMsgQueue<TMMFDevSoundQueueItem>* aMsgQueue,
|
sl@0
|
56 |
MMMFDevSoundCustomInterfaceObserver& aDevSoundCIObserver);
|
sl@0
|
57 |
/**
|
sl@0
|
58 |
* Destructor.
|
sl@0
|
59 |
*/
|
sl@0
|
60 |
~CMsgQueueHandler();
|
sl@0
|
61 |
|
sl@0
|
62 |
/**
|
sl@0
|
63 |
* Subscribes for Play Error event from DevSound server.
|
sl@0
|
64 |
* @since
|
sl@0
|
65 |
* @return void
|
sl@0
|
66 |
*/
|
sl@0
|
67 |
void ReceiveEvents();
|
sl@0
|
68 |
|
sl@0
|
69 |
/**
|
sl@0
|
70 |
* Called by DevSound server when Play Error event occurs.
|
sl@0
|
71 |
* Leaves on failure.
|
sl@0
|
72 |
* @since
|
sl@0
|
73 |
* @return void
|
sl@0
|
74 |
*/
|
sl@0
|
75 |
void RunL();
|
sl@0
|
76 |
|
sl@0
|
77 |
/**
|
sl@0
|
78 |
* Called by CActive object framework if RunL leaves.
|
sl@0
|
79 |
* @since
|
sl@0
|
80 |
* @param TInt aError Reason for leave
|
sl@0
|
81 |
* @return TInt KErrNone if error is handled succesfully, else
|
sl@0
|
82 |
* corresponding error codel
|
sl@0
|
83 |
*/
|
sl@0
|
84 |
TInt RunError(TInt aError);
|
sl@0
|
85 |
|
sl@0
|
86 |
/**
|
sl@0
|
87 |
* Called by CActive object framework when client cancels active object.
|
sl@0
|
88 |
* @since
|
sl@0
|
89 |
* @return void
|
sl@0
|
90 |
*/
|
sl@0
|
91 |
void DoCancel();
|
sl@0
|
92 |
/**
|
sl@0
|
93 |
* Called as part of Stop() process to recover any buffers etc
|
sl@0
|
94 |
*/
|
sl@0
|
95 |
void Finish();
|
sl@0
|
96 |
|
sl@0
|
97 |
private:
|
sl@0
|
98 |
/**
|
sl@0
|
99 |
* C++ default constructor.
|
sl@0
|
100 |
*/
|
sl@0
|
101 |
CMsgQueueHandler(RMMFDevSoundProxy* aDevSoundProxy,
|
sl@0
|
102 |
MDevSoundObserver& aDevSoundObserver,
|
sl@0
|
103 |
RMsgQueue<TMMFDevSoundQueueItem>* aMsgQueue,
|
sl@0
|
104 |
MMMFDevSoundCustomInterfaceObserver& aDevSoundCIObserver);
|
sl@0
|
105 |
/**
|
sl@0
|
106 |
* By default Symbian 2nd phase constructor is private.
|
sl@0
|
107 |
*/
|
sl@0
|
108 |
void ConstructL();
|
sl@0
|
109 |
|
sl@0
|
110 |
/*
|
sl@0
|
111 |
* Handles initialization completion event.
|
sl@0
|
112 |
*/
|
sl@0
|
113 |
void DoInitComplete();
|
sl@0
|
114 |
|
sl@0
|
115 |
/*
|
sl@0
|
116 |
* Handles play completion or cancel event.
|
sl@0
|
117 |
*/
|
sl@0
|
118 |
void DoPlayErrorComplete();
|
sl@0
|
119 |
|
sl@0
|
120 |
/*
|
sl@0
|
121 |
* Handles record completion or cancel event.
|
sl@0
|
122 |
*/
|
sl@0
|
123 |
void DoRecordErrorComplete();
|
sl@0
|
124 |
|
sl@0
|
125 |
/*
|
sl@0
|
126 |
* Handles CMMFDevSound object's data request event to supply
|
sl@0
|
127 |
* CMMFDevSound with the buffer that it needs to play.
|
sl@0
|
128 |
*/
|
sl@0
|
129 |
void DoBTBFCompleteL();
|
sl@0
|
130 |
|
sl@0
|
131 |
/*
|
sl@0
|
132 |
* Handles CMMFDevSound object's data request event to supply
|
sl@0
|
133 |
* CMMFDevSound with the buffer that it needs to record.
|
sl@0
|
134 |
*/
|
sl@0
|
135 |
void DoBTBECompleteL();
|
sl@0
|
136 |
|
sl@0
|
137 |
/*
|
sl@0
|
138 |
* Handles tone play completion event.
|
sl@0
|
139 |
*/
|
sl@0
|
140 |
void DoToneFinishedComplete();
|
sl@0
|
141 |
|
sl@0
|
142 |
/*
|
sl@0
|
143 |
* Sends DevSound server event completion notification to the client.
|
sl@0
|
144 |
*/
|
sl@0
|
145 |
void DoSendEventToClientComplete();
|
sl@0
|
146 |
|
sl@0
|
147 |
/* Handles CMMFDevSound object's data request event to supply
|
sl@0
|
148 |
* CMMFDevSound with the last buffer that it needs to record.
|
sl@0
|
149 |
*/
|
sl@0
|
150 |
void DoPausedRecordComplete();
|
sl@0
|
151 |
|
sl@0
|
152 |
/*
|
sl@0
|
153 |
* Allocates local data buffer and links it with the global chunk.
|
sl@0
|
154 |
* @param aHandle Handle to a global chunk or 0 if chunk already exists.
|
sl@0
|
155 |
*/
|
sl@0
|
156 |
void AssignDataBufferToChunkL(TInt aHandle);
|
sl@0
|
157 |
/*
|
sl@0
|
158 |
* Update existing data buffer with latest buffer info from server
|
sl@0
|
159 |
* but using existing chunk
|
sl@0
|
160 |
*/
|
sl@0
|
161 |
void UpdateDataBufferL();
|
sl@0
|
162 |
|
sl@0
|
163 |
static TInt AsyncQueueFinishCallback(TAny* aPtr);
|
sl@0
|
164 |
void DoAsyncQueueFinishCallback();
|
sl@0
|
165 |
|
sl@0
|
166 |
private:
|
sl@0
|
167 |
|
sl@0
|
168 |
RMMFDevSoundProxy* iDevSoundProxy;
|
sl@0
|
169 |
MDevSoundObserver& iDevSoundObserver;
|
sl@0
|
170 |
TMMFDevSoundProxyHwBufPckg iSetPckg;
|
sl@0
|
171 |
|
sl@0
|
172 |
TMMFEventPckg iEventPckg;
|
sl@0
|
173 |
|
sl@0
|
174 |
RMsgQueue<TMMFDevSoundQueueItem>* iMsgQueue;
|
sl@0
|
175 |
TMMFDevSoundQueueItem iCurrentItem;
|
sl@0
|
176 |
RChunk iChunk;
|
sl@0
|
177 |
TPtr8 iChunkDataPtr;
|
sl@0
|
178 |
CMMFPtrBuffer* iDataBuffer;
|
sl@0
|
179 |
CMMFDataBuffer* iEmptyBuffer;
|
sl@0
|
180 |
MMMFDevSoundCustomInterfaceObserver& iDevSoundCIObserver;
|
sl@0
|
181 |
CAsyncCallBack* iAsyncQueueFinish;
|
sl@0
|
182 |
};
|
sl@0
|
183 |
|
sl@0
|
184 |
#endif // MMFDEVSOUNDCALLBACKHANDLER_H
|
sl@0
|
185 |
|
sl@0
|
186 |
// End of File
|