sl@0
|
1 |
// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#include <s32mem.h>
|
sl@0
|
17 |
#include "MmfDevSoundSession.h"
|
sl@0
|
18 |
#include "MmfDevSoundSessionXtnd.h"
|
sl@0
|
19 |
#include "MmfDevSoundSessionBody.h"
|
sl@0
|
20 |
|
sl@0
|
21 |
#include "MmfAudioClientServer.h"
|
sl@0
|
22 |
#include "MmfAudioServer.h"
|
sl@0
|
23 |
#include "MmfDevSoundServer.h"
|
sl@0
|
24 |
|
sl@0
|
25 |
void CMMFDevSoundSession::CreateL(const CMmfIpcServer& aServer)
|
sl@0
|
26 |
{
|
sl@0
|
27 |
CMmfIpcSession::CreateL(aServer);
|
sl@0
|
28 |
CMMFDevSoundServer& server =
|
sl@0
|
29 |
const_cast<CMMFDevSoundServer&>(static_cast<const CMMFDevSoundServer&>(aServer));
|
sl@0
|
30 |
server.IncrementSessionId();
|
sl@0
|
31 |
iDevSoundSessionId = server.DevSoundSessionId();
|
sl@0
|
32 |
iClientHasCaps = server.CheckClientCapabilities();
|
sl@0
|
33 |
}
|
sl@0
|
34 |
|
sl@0
|
35 |
TBool CMMFDevSoundSession::CheckClientCapabilities()
|
sl@0
|
36 |
{
|
sl@0
|
37 |
return iClientHasCaps;
|
sl@0
|
38 |
}
|
sl@0
|
39 |
|
sl@0
|
40 |
void CMMFDevSoundSession::ServiceL(const RMmfIpcMessage& aMessage)
|
sl@0
|
41 |
{
|
sl@0
|
42 |
TBool complete = EFalse;
|
sl@0
|
43 |
switch(aMessage.Function())
|
sl@0
|
44 |
{
|
sl@0
|
45 |
case EMMFDevSoundProxyInitialize1:
|
sl@0
|
46 |
complete = DoInitialize1L(aMessage);
|
sl@0
|
47 |
break;
|
sl@0
|
48 |
case EMMFDevSoundProxyInitialize2:
|
sl@0
|
49 |
complete = DoInitialize2L(aMessage);
|
sl@0
|
50 |
break;
|
sl@0
|
51 |
case EMMFDevSoundProxyInitialize3:
|
sl@0
|
52 |
complete = DoInitialize3L(aMessage);
|
sl@0
|
53 |
break;
|
sl@0
|
54 |
case EMMFDevSoundProxyInitialize4:
|
sl@0
|
55 |
complete = DoInitialize4L(aMessage);
|
sl@0
|
56 |
break;
|
sl@0
|
57 |
case EMMFDevSoundProxyCapabilities:
|
sl@0
|
58 |
complete = DoCapabilitiesL(aMessage);
|
sl@0
|
59 |
break;
|
sl@0
|
60 |
case EMMFDevSoundProxyConfig:
|
sl@0
|
61 |
complete = DoConfigL(aMessage);
|
sl@0
|
62 |
break;
|
sl@0
|
63 |
case EMMFDevSoundProxySetConfig:
|
sl@0
|
64 |
complete = DoSetConfigL(aMessage);
|
sl@0
|
65 |
break;
|
sl@0
|
66 |
case EMMFDevSoundProxyMaxVolume:
|
sl@0
|
67 |
complete = DoMaxVolumeL(aMessage);
|
sl@0
|
68 |
break;
|
sl@0
|
69 |
case EMMFDevSoundProxyVolume:
|
sl@0
|
70 |
complete = DoVolumeL(aMessage);
|
sl@0
|
71 |
break;
|
sl@0
|
72 |
case EMMFDevSoundProxySetVolume:
|
sl@0
|
73 |
complete = DoSetVolumeL(aMessage);
|
sl@0
|
74 |
break;
|
sl@0
|
75 |
case EMMFDevSoundProxyMaxGain:
|
sl@0
|
76 |
complete = DoMaxGainL(aMessage);
|
sl@0
|
77 |
break;
|
sl@0
|
78 |
case EMMFDevSoundProxyGain:
|
sl@0
|
79 |
complete = DoGainL(aMessage);
|
sl@0
|
80 |
break;
|
sl@0
|
81 |
case EMMFDevSoundProxySetGain:
|
sl@0
|
82 |
complete = DoSetGainL(aMessage);
|
sl@0
|
83 |
break;
|
sl@0
|
84 |
case EMMFDevSoundProxyPlayBalance:
|
sl@0
|
85 |
complete = DoGetPlayBalanceL(aMessage);
|
sl@0
|
86 |
break;
|
sl@0
|
87 |
case EMMFDevSoundProxySetPlayBalance:
|
sl@0
|
88 |
complete = DoSetPlayBalanceL(aMessage);
|
sl@0
|
89 |
break;
|
sl@0
|
90 |
case EMMFDevSoundProxyRecordBalance:
|
sl@0
|
91 |
complete = DoGetRecordBalanceL(aMessage);
|
sl@0
|
92 |
break;
|
sl@0
|
93 |
case EMMFDevSoundProxySetRecordBalance:
|
sl@0
|
94 |
complete = DoSetRecordBalanceL(aMessage);
|
sl@0
|
95 |
break;
|
sl@0
|
96 |
case EMMFDevSoundProxyBTBFData:
|
sl@0
|
97 |
complete = DoBufferToBeFilledDataL(aMessage);
|
sl@0
|
98 |
break;
|
sl@0
|
99 |
case EMMFDevSoundProxyBTBEData:
|
sl@0
|
100 |
complete = DoBufferToBeEmptiedDataL(aMessage);
|
sl@0
|
101 |
break;
|
sl@0
|
102 |
case EMMFDevSoundProxyPlayInit:
|
sl@0
|
103 |
complete = DoPlayInitL(aMessage);
|
sl@0
|
104 |
break;
|
sl@0
|
105 |
case EMMFDevSoundProxyRecordInit:
|
sl@0
|
106 |
complete = DoRecordInitL(aMessage);
|
sl@0
|
107 |
break;
|
sl@0
|
108 |
case EMMFDevSoundProxyPlayData:
|
sl@0
|
109 |
complete = DoPlayDataL(aMessage);
|
sl@0
|
110 |
break;
|
sl@0
|
111 |
case EMMFDevSoundProxyRecordData:
|
sl@0
|
112 |
complete = DoRecordDataL(aMessage);
|
sl@0
|
113 |
break;
|
sl@0
|
114 |
case EMMFDevSoundProxyStop:
|
sl@0
|
115 |
complete = DoStopL(aMessage);
|
sl@0
|
116 |
break;
|
sl@0
|
117 |
case EMMFDevSoundProxyPause:
|
sl@0
|
118 |
complete = DoPauseL(aMessage);
|
sl@0
|
119 |
break;
|
sl@0
|
120 |
case EMMFDevSoundProxyPlayTone:
|
sl@0
|
121 |
complete = DoPlayToneL(aMessage);
|
sl@0
|
122 |
break;
|
sl@0
|
123 |
case EMMFDevSoundProxyPlayDualTone:
|
sl@0
|
124 |
complete = DoPlayDualToneL(aMessage);
|
sl@0
|
125 |
break;
|
sl@0
|
126 |
case EMMFDevSoundProxyPlayDTMFString:
|
sl@0
|
127 |
complete = DoPlayDTMFStringL(aMessage);
|
sl@0
|
128 |
break;
|
sl@0
|
129 |
case EMMFDevSoundProxyPlayToneSequence:
|
sl@0
|
130 |
complete = DoPlayToneSequenceL(aMessage);
|
sl@0
|
131 |
break;
|
sl@0
|
132 |
case EMMFDevSoundProxyPlayFixedSequence:
|
sl@0
|
133 |
complete = DoPlayFixedSequenceL(aMessage);
|
sl@0
|
134 |
break;
|
sl@0
|
135 |
case EMMFDevSoundProxySetDTMFLengths:
|
sl@0
|
136 |
complete = DoSetDTMFLengthsL(aMessage);
|
sl@0
|
137 |
break;
|
sl@0
|
138 |
case EMMFDevSoundProxySetVolumeRamp:
|
sl@0
|
139 |
complete = DoSetVolumeRampL(aMessage);
|
sl@0
|
140 |
break;
|
sl@0
|
141 |
case EMMFDevSoundProxyGetSupportedInputDataTypes:
|
sl@0
|
142 |
complete = DoGetSupportedInputDataTypesL(aMessage);
|
sl@0
|
143 |
break;
|
sl@0
|
144 |
case EMMFDevSoundProxyGetSupportedOutputDataTypes:
|
sl@0
|
145 |
complete = DoGetSupportedOutputDataTypesL(aMessage);
|
sl@0
|
146 |
break;
|
sl@0
|
147 |
case EMMFDevSoundProxyCopyFourCCArrayData:
|
sl@0
|
148 |
complete = DoCopyFourCCArrayDataL(aMessage);
|
sl@0
|
149 |
break;
|
sl@0
|
150 |
case EMMFDevSoundProxyGetRecordedBuffer:
|
sl@0
|
151 |
complete = DoGetRecordedBufferL(aMessage);
|
sl@0
|
152 |
break;
|
sl@0
|
153 |
case EMMFDevSoundProxySamplesRecorded:
|
sl@0
|
154 |
complete = DoSamplesRecordedL(aMessage);
|
sl@0
|
155 |
break;
|
sl@0
|
156 |
case EMMFDevSoundProxySamplesPlayed:
|
sl@0
|
157 |
complete = DoSamplesPlayedL(aMessage);
|
sl@0
|
158 |
break;
|
sl@0
|
159 |
case EMMFDevSoundProxySetToneRepeats:
|
sl@0
|
160 |
complete = DoSetToneRepeatsL(aMessage);
|
sl@0
|
161 |
break;
|
sl@0
|
162 |
case EMMFDevSoundProxySetPrioritySettings:
|
sl@0
|
163 |
complete = DoSetPrioritySettingsL(aMessage);
|
sl@0
|
164 |
break;
|
sl@0
|
165 |
case EMMFDevSoundProxyFixedSequenceName:
|
sl@0
|
166 |
complete = DoFixedSequenceNameL(aMessage);
|
sl@0
|
167 |
break;
|
sl@0
|
168 |
case EMMFDevSoundProxyFixedSequenceCount:
|
sl@0
|
169 |
complete = DoFixedSequenceCountL(aMessage);
|
sl@0
|
170 |
break;
|
sl@0
|
171 |
case EMMFDevSoundProxyRequestResourceNotification:
|
sl@0
|
172 |
complete = DoRegisterAsClientL(aMessage);
|
sl@0
|
173 |
break;
|
sl@0
|
174 |
case EMMFDevSoundProxyCancelRequestResourceNotification:
|
sl@0
|
175 |
complete = DoCancelRegisterAsClientL(aMessage);
|
sl@0
|
176 |
break;
|
sl@0
|
177 |
case EMMFDevSoundProxyGetResourceNotificationData:
|
sl@0
|
178 |
complete = DoGetResourceNotificationDataL(aMessage);
|
sl@0
|
179 |
break;
|
sl@0
|
180 |
case EMMFDevSoundProxyWillResumePlay:
|
sl@0
|
181 |
complete = DoWillResumePlayL(aMessage);
|
sl@0
|
182 |
break;
|
sl@0
|
183 |
case EMMFDevSoundProxySetClientThreadInfo:
|
sl@0
|
184 |
complete = DoSetClientThreadInfoL(aMessage);
|
sl@0
|
185 |
break;
|
sl@0
|
186 |
case EMMFDevSoundProxyGetTimePlayed:
|
sl@0
|
187 |
complete = DoGetTimePlayedL(aMessage);
|
sl@0
|
188 |
break;
|
sl@0
|
189 |
|
sl@0
|
190 |
// custom command support
|
sl@0
|
191 |
case EMMFDevSoundProxySyncCustomCommand:
|
sl@0
|
192 |
complete = DoSyncCustomCommandL(aMessage);
|
sl@0
|
193 |
break;
|
sl@0
|
194 |
case EMMFDevSoundProxySyncCustomCommandResult:
|
sl@0
|
195 |
complete = DoSyncCustomCommandResultL(aMessage);
|
sl@0
|
196 |
break;
|
sl@0
|
197 |
case EMMFDevSoundProxyAsyncCustomCommand:
|
sl@0
|
198 |
complete = DoAsyncCustomCommandL(aMessage);
|
sl@0
|
199 |
break;
|
sl@0
|
200 |
case EMMFDevSoundProxyAsyncCustomCommandResult:
|
sl@0
|
201 |
complete = DoAsyncCustomCommandResultL(aMessage);
|
sl@0
|
202 |
break;
|
sl@0
|
203 |
case EMMFDevSoundProxyEmptyBuffers:
|
sl@0
|
204 |
complete = DoEmptyBuffersL(aMessage);
|
sl@0
|
205 |
break;
|
sl@0
|
206 |
default:
|
sl@0
|
207 |
User::Leave(KErrNotSupported);
|
sl@0
|
208 |
break;
|
sl@0
|
209 |
}
|
sl@0
|
210 |
if (complete)
|
sl@0
|
211 |
aMessage.Complete(KErrNone);
|
sl@0
|
212 |
}
|
sl@0
|
213 |
|
sl@0
|
214 |
TBool CMMFDevSoundSession::DoInitialize1L(const RMmfIpcMessage& aMessage)
|
sl@0
|
215 |
{
|
sl@0
|
216 |
if(iMsgQueue.Handle() == 0)
|
sl@0
|
217 |
{
|
sl@0
|
218 |
TInt err = iMsgQueue.Open(aMessage, 1); // a global queue.
|
sl@0
|
219 |
User::LeaveIfError(err);
|
sl@0
|
220 |
}
|
sl@0
|
221 |
TMMFDevSoundProxySettingsPckg buf;
|
sl@0
|
222 |
MmfMessageUtil::ReadL(aMessage,0,buf);
|
sl@0
|
223 |
TMMFState mode = buf().iMode;
|
sl@0
|
224 |
iBody->InitializeL(*this, mode);
|
sl@0
|
225 |
iBufferPlay = NULL;
|
sl@0
|
226 |
return ETrue;
|
sl@0
|
227 |
}
|
sl@0
|
228 |
|
sl@0
|
229 |
TBool CMMFDevSoundSession::DoInitialize2L(const RMmfIpcMessage& aMessage)
|
sl@0
|
230 |
{
|
sl@0
|
231 |
if(iMsgQueue.Handle() == 0)
|
sl@0
|
232 |
{
|
sl@0
|
233 |
TInt err = iMsgQueue.Open(aMessage, 1); // a global queue.
|
sl@0
|
234 |
User::LeaveIfError(err);
|
sl@0
|
235 |
}
|
sl@0
|
236 |
TMMFDevSoundProxySettingsPckg buf;
|
sl@0
|
237 |
MmfMessageUtil::ReadL(aMessage,0,buf);
|
sl@0
|
238 |
TUid HWDev = buf().iHWDev;
|
sl@0
|
239 |
TMMFState mode = buf().iMode;
|
sl@0
|
240 |
iBody->InitializeL(*this, HWDev, mode);
|
sl@0
|
241 |
iBufferPlay = NULL;
|
sl@0
|
242 |
return ETrue;
|
sl@0
|
243 |
}
|
sl@0
|
244 |
|
sl@0
|
245 |
TBool CMMFDevSoundSession::DoInitialize3L(const RMmfIpcMessage& /*aMessage*/)
|
sl@0
|
246 |
{
|
sl@0
|
247 |
User::Leave(KErrNotSupported);
|
sl@0
|
248 |
return ETrue;
|
sl@0
|
249 |
}
|
sl@0
|
250 |
|
sl@0
|
251 |
TBool CMMFDevSoundSession::DoInitialize4L(const RMmfIpcMessage& aMessage)
|
sl@0
|
252 |
{
|
sl@0
|
253 |
if(iMsgQueue.Handle() == 0)
|
sl@0
|
254 |
{
|
sl@0
|
255 |
TInt err = iMsgQueue.Open(aMessage, 1); // a global queue.
|
sl@0
|
256 |
User::LeaveIfError(err);
|
sl@0
|
257 |
}
|
sl@0
|
258 |
TMMFDevSoundProxySettingsPckg buf;
|
sl@0
|
259 |
aMessage.ReadL(TInt(0),buf);
|
sl@0
|
260 |
TFourCC desiredFourCC = buf().iDesiredFourCC;
|
sl@0
|
261 |
TMMFState mode = buf().iMode;
|
sl@0
|
262 |
iBody->InitializeL(*this, desiredFourCC, mode);
|
sl@0
|
263 |
iBufferPlay = NULL;
|
sl@0
|
264 |
return ETrue;
|
sl@0
|
265 |
}
|
sl@0
|
266 |
|
sl@0
|
267 |
TBool CMMFDevSoundSession::DoCapabilitiesL(const RMmfIpcMessage& aMessage)
|
sl@0
|
268 |
{
|
sl@0
|
269 |
TMMFDevSoundProxySettings set;
|
sl@0
|
270 |
set.iCaps = iBody->Capabilities();
|
sl@0
|
271 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
272 |
aMessage.WriteL(TInt(2),pckg);
|
sl@0
|
273 |
return ETrue;
|
sl@0
|
274 |
}
|
sl@0
|
275 |
|
sl@0
|
276 |
TBool CMMFDevSoundSession::DoConfigL(const RMmfIpcMessage& aMessage)
|
sl@0
|
277 |
{
|
sl@0
|
278 |
TMMFDevSoundProxySettings set;
|
sl@0
|
279 |
set.iConfig = iBody->Config();
|
sl@0
|
280 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
281 |
aMessage.WriteL(TInt(2),pckg);
|
sl@0
|
282 |
return ETrue;
|
sl@0
|
283 |
}
|
sl@0
|
284 |
|
sl@0
|
285 |
TBool CMMFDevSoundSession::DoSetConfigL(const RMmfIpcMessage& aMessage)
|
sl@0
|
286 |
{
|
sl@0
|
287 |
TMMFDevSoundProxySettingsPckg buf;
|
sl@0
|
288 |
aMessage.ReadL(TInt(0),buf);
|
sl@0
|
289 |
TMMFCapabilities config = buf().iConfig;
|
sl@0
|
290 |
iBody->SetConfigL(config);
|
sl@0
|
291 |
return ETrue;
|
sl@0
|
292 |
}
|
sl@0
|
293 |
|
sl@0
|
294 |
TBool CMMFDevSoundSession::DoMaxVolumeL(const RMmfIpcMessage& aMessage)
|
sl@0
|
295 |
{
|
sl@0
|
296 |
TMMFDevSoundProxySettings set;
|
sl@0
|
297 |
set.iMaxVolume = iBody->MaxVolume();
|
sl@0
|
298 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
299 |
aMessage.WriteL(TInt(2),pckg);
|
sl@0
|
300 |
return ETrue;
|
sl@0
|
301 |
}
|
sl@0
|
302 |
|
sl@0
|
303 |
TBool CMMFDevSoundSession::DoVolumeL(const RMmfIpcMessage& aMessage)
|
sl@0
|
304 |
{
|
sl@0
|
305 |
TMMFDevSoundProxySettings set;
|
sl@0
|
306 |
set.iVolume = iBody->Volume();
|
sl@0
|
307 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
308 |
aMessage.WriteL(TInt(2),pckg);
|
sl@0
|
309 |
return ETrue;
|
sl@0
|
310 |
}
|
sl@0
|
311 |
|
sl@0
|
312 |
TBool CMMFDevSoundSession::DoSetVolumeL(const RMmfIpcMessage& aMessage)
|
sl@0
|
313 |
{
|
sl@0
|
314 |
TMMFDevSoundProxySettingsPckg buf;
|
sl@0
|
315 |
aMessage.ReadL(TInt(0),buf);
|
sl@0
|
316 |
TInt volume = buf().iVolume;
|
sl@0
|
317 |
iBody->SetVolume(volume);
|
sl@0
|
318 |
return ETrue;
|
sl@0
|
319 |
}
|
sl@0
|
320 |
|
sl@0
|
321 |
TBool CMMFDevSoundSession::DoMaxGainL(const RMmfIpcMessage& aMessage)
|
sl@0
|
322 |
{
|
sl@0
|
323 |
TMMFDevSoundProxySettings set;
|
sl@0
|
324 |
set.iMaxGain = iBody->MaxGain();
|
sl@0
|
325 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
326 |
aMessage.WriteL(TInt(2),pckg);
|
sl@0
|
327 |
return ETrue;
|
sl@0
|
328 |
}
|
sl@0
|
329 |
|
sl@0
|
330 |
TBool CMMFDevSoundSession::DoGainL(const RMmfIpcMessage& aMessage)
|
sl@0
|
331 |
{
|
sl@0
|
332 |
TMMFDevSoundProxySettings set;
|
sl@0
|
333 |
set.iGain = iBody->Gain();
|
sl@0
|
334 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
335 |
aMessage.WriteL(TInt(2),pckg);
|
sl@0
|
336 |
return ETrue;
|
sl@0
|
337 |
}
|
sl@0
|
338 |
|
sl@0
|
339 |
TBool CMMFDevSoundSession::DoSetGainL(const RMmfIpcMessage& aMessage)
|
sl@0
|
340 |
{
|
sl@0
|
341 |
TMMFDevSoundProxySettingsPckg buf;
|
sl@0
|
342 |
aMessage.ReadL(TInt(0),buf);
|
sl@0
|
343 |
TInt gain = buf().iGain;
|
sl@0
|
344 |
iBody->SetGain(gain);
|
sl@0
|
345 |
return ETrue;
|
sl@0
|
346 |
}
|
sl@0
|
347 |
|
sl@0
|
348 |
TBool CMMFDevSoundSession::DoGetPlayBalanceL(const RMmfIpcMessage& aMessage)
|
sl@0
|
349 |
{
|
sl@0
|
350 |
TMMFDevSoundProxySettings set;
|
sl@0
|
351 |
iBody->GetPlayBalanceL(set.iLeftPercentage, set.iRightPercentage);
|
sl@0
|
352 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
353 |
aMessage.WriteL(TInt(2),pckg);
|
sl@0
|
354 |
return ETrue;
|
sl@0
|
355 |
}
|
sl@0
|
356 |
|
sl@0
|
357 |
TBool CMMFDevSoundSession::DoSetPlayBalanceL(const RMmfIpcMessage& aMessage)
|
sl@0
|
358 |
{
|
sl@0
|
359 |
TMMFDevSoundProxySettingsPckg buf;
|
sl@0
|
360 |
aMessage.ReadL(TInt(0),buf);
|
sl@0
|
361 |
TInt leftPercentage = buf().iLeftPercentage;
|
sl@0
|
362 |
TInt rightPercentage = buf().iRightPercentage;
|
sl@0
|
363 |
iBody->SetPlayBalanceL(leftPercentage, rightPercentage);
|
sl@0
|
364 |
return ETrue;
|
sl@0
|
365 |
}
|
sl@0
|
366 |
|
sl@0
|
367 |
TBool CMMFDevSoundSession::DoGetRecordBalanceL(const RMmfIpcMessage& aMessage)
|
sl@0
|
368 |
{
|
sl@0
|
369 |
TMMFDevSoundProxySettings set;
|
sl@0
|
370 |
iBody->GetRecordBalanceL(set.iLeftPercentage, set.iRightPercentage);
|
sl@0
|
371 |
TMMFDevSoundProxySettingsPckg pckg(set);
|
sl@0
|
372 |
aMessage.WriteL(TInt(2),pckg);
|
sl@0
|
373 |
return ETrue;
|
sl@0
|
374 |
}
|
sl@0
|
375 |
|
sl@0
|
376 |
TBool CMMFDevSoundSession::DoSetRecordBalanceL(const RMmfIpcMessage& aMessage)
|
sl@0
|
377 |
{
|
sl@0
|
378 |
TMMFDevSoundProxySettingsPckg buf;
|
sl@0
|
379 |
aMessage.ReadL(TInt(0),buf);
|
sl@0
|
380 |
TInt leftPercentage = buf().iLeftPercentage;
|
sl@0
|
381 |
TInt rightPercentage = buf().iRightPercentage;
|
sl@0
|
382 |
iBody->SetRecordBalanceL(leftPercentage, rightPercentage);
|
sl@0
|
383 |
return ETrue;
|
sl@0
|
384 |
}
|
sl@0
|
385 |
|
sl@0
|
386 |
TBool CMMFDevSoundSession::DoPlayInitL(const RMmfIpcMessage& /*aMessage*/)
|
sl@0
|
387 |
{
|
sl@0
|
388 |
iBody->PlayInitL();
|
sl@0
|
389 |
return ETrue;
|
sl@0
|
390 |
}
|
sl@0
|
391 |
|
sl@0
|
392 |
TBool CMMFDevSoundSession::DoRecordInitL(const RMmfIpcMessage& aMessage)
|
sl@0
|
393 |
{
|
sl@0
|
394 |
iBody->RecordInitL(aMessage);
|
sl@0
|
395 |
return ETrue;
|
sl@0
|
396 |
}
|
sl@0
|
397 |
|
sl@0
|
398 |
TBool CMMFDevSoundSession::DoPlayDataL(const RMmfIpcMessage& aMessage)
|
sl@0
|
399 |
{
|
sl@0
|
400 |
TMMFDevSoundProxyHwBufPckg buf;
|
sl@0
|
401 |
aMessage.ReadL(TInt(0),buf);
|
sl@0
|
402 |
iBufferPlay->SetLastBuffer(buf().iLastBuffer);
|
sl@0
|
403 |
|
sl@0
|
404 |
aMessage.ReadL(TInt(1),iBufferPlay->Data());
|
sl@0
|
405 |
return iBody->PlayData(aMessage);
|
sl@0
|
406 |
}
|
sl@0
|
407 |
|
sl@0
|
408 |
TBool CMMFDevSoundSession::DoRecordDataL(const RMmfIpcMessage& aMessage)
|
sl@0
|
409 |
{
|
sl@0
|
410 |
return iBody->RecordData(aMessage);
|
sl@0
|
411 |
}
|
sl@0
|
412 |
|
sl@0
|
413 |
TBool CMMFDevSoundSession::DoStopL(const RMmfIpcMessage& /*aMessage*/)
|
sl@0
|
414 |
{
|
sl@0
|
415 |
if(iMsgQueue.Handle() != 0)
|
sl@0
|
416 |
{
|
sl@0
|
417 |
TMMFDevSoundQueueItem queueItem;
|
sl@0
|
418 |
TInt err = KErrNone;
|
sl@0
|
419 |
while(err != KErrUnderflow)
|
sl@0
|
420 |
{
|
sl@0
|
421 |
err = iMsgQueue.Receive(queueItem);
|
sl@0
|
422 |
}
|
sl@0
|
423 |
}
|
sl@0
|
424 |
iBody->Stop();
|
sl@0
|
425 |
return ETrue;
|
sl@0
|
426 |
}
|
sl@0
|
427 |
|
sl@0
|
428 |
TBool CMMFDevSoundSession::DoPauseL(const RMmfIpcMessage& /*aMessage*/)
|
sl@0
|
429 |
{
|
sl@0
|
430 |
iBody->Pause();
|
sl@0
|
431 |
return ETrue;
|
sl@0
|
432 |
}
|
sl@0
|
433 |
|
sl@0
|
434 |
TBool CMMFDevSoundSession::DoPlayToneL(const RMmfIpcMessage& aMessage)
|
sl@0
|
435 |
{
|
sl@0
|
436 |
TMMFDevSoundProxySettingsPckg buf;
|
sl@0
|
437 |
aMessage.ReadL(TInt(0),buf);
|
sl@0
|
438 |
TInt frequency = buf().iFrequencyOne;
|
sl@0
|
439 |
TTimeIntervalMicroSeconds duration(buf().iDuration);
|
sl@0
|
440 |
iBody->PlayToneL(frequency, duration);
|
sl@0
|
441 |
return ETrue;
|
sl@0
|
442 |
}
|
sl@0
|
443 |
|
sl@0
|
444 |
TBool CMMFDevSoundSession::DoPlayDualToneL(const RMmfIpcMessage& aMessage)
|
sl@0
|
445 |
{
|
sl@0
|
446 |
TMMFDevSoundProxySettingsPckg buf;
|
sl@0
|
447 |
aMessage.ReadL(TInt(0),buf);
|
sl@0
|
448 |
TInt frequencyOne = buf().iFrequencyOne;
|
sl@0
|
449 |
TInt frequencyTwo = buf().iFrequencyTwo;
|
sl@0
|
450 |
TTimeIntervalMicroSeconds duration(buf().iDuration);
|
sl@0
|
451 |
iBody->PlayDualToneL(frequencyOne, frequencyTwo, duration);
|
sl@0
|
452 |
return ETrue;
|
sl@0
|
453 |
}
|
sl@0
|
454 |
|
sl@0
|
455 |
TBool CMMFDevSoundSession::DoPlayDTMFStringL(const RMmfIpcMessage& aMessage)
|
sl@0
|
456 |
{
|
sl@0
|
457 |
TInt DTMFLength = User::LeaveIfError(aMessage.GetDesLength(0));
|
sl@0
|
458 |
|
sl@0
|
459 |
if(iDTMFString)
|
sl@0
|
460 |
{
|
sl@0
|
461 |
delete iDTMFString;
|
sl@0
|
462 |
iDTMFString = NULL;
|
sl@0
|
463 |
}
|
sl@0
|
464 |
|
sl@0
|
465 |
iDTMFString = HBufC::NewL(DTMFLength);
|
sl@0
|
466 |
TPtr DTMFPtr = iDTMFString->Des();
|
sl@0
|
467 |
aMessage.ReadL(TInt(0), DTMFPtr);
|
sl@0
|
468 |
|
sl@0
|
469 |
iBody->PlayDTMFStringL(*iDTMFString);
|
sl@0
|
470 |
return ETrue;
|
sl@0
|
471 |
}
|
sl@0
|
472 |
|
sl@0
|
473 |
TBool CMMFDevSoundSession::DoPlayToneSequenceL(const RMmfIpcMessage& aMessage)
|
sl@0
|
474 |
{
|
sl@0
|
475 |
TInt toneLength = User::LeaveIfError(aMessage.GetDesLength(0));
|
sl@0
|
476 |
|
sl@0
|
477 |
if(iToneSeqBuf)
|
sl@0
|
478 |
{
|
sl@0
|
479 |
delete iToneSeqBuf;
|
sl@0
|
480 |
iToneSeqBuf = NULL;
|
sl@0
|
481 |
}
|
sl@0
|
482 |
|
sl@0
|
483 |
iToneSeqBuf = HBufC8::NewL(toneLength);
|
sl@0
|
484 |
TPtr8 toneSeqPtr = iToneSeqBuf->Des();
|
sl@0
|
485 |
aMessage.ReadL(TInt(0), toneSeqPtr);
|
sl@0
|
486 |
|
sl@0
|
487 |
iBody->PlayToneSequenceL(*iToneSeqBuf);
|
sl@0
|
488 |
return ETrue;
|
sl@0
|
489 |
}
|
sl@0
|
490 |
|
sl@0
|
491 |
TBool CMMFDevSoundSession::DoPlayFixedSequenceL(const RMmfIpcMessage& aMessage)
|
sl@0
|
492 |
{
|
sl@0
|
493 |
TPckgBuf<TInt> buf;
|
sl@0
|
494 |
aMessage.ReadL(TInt(0),buf);
|
sl@0
|
495 |
TInt seqNum = buf();
|
sl@0
|
496 |
|
sl@0
|
497 |
iBody->PlayFixedSequenceL(seqNum);
|
sl@0
|
498 |
return ETrue;
|
sl@0
|
499 |
}
|
sl@0
|
500 |
|
sl@0
|
501 |
TBool CMMFDevSoundSession::DoSetDTMFLengthsL(const RMmfIpcMessage& aMessage)
|
sl@0
|
502 |
{
|
sl@0
|
503 |
TMMFDevSoundProxySettingsPckg buf;
|
sl@0
|
504 |
aMessage.ReadL(TInt(0),buf);
|
sl@0
|
505 |
TTimeIntervalMicroSeconds32 toneOnLength = buf().iToneOnLength;
|
sl@0
|
506 |
TTimeIntervalMicroSeconds32 toneOffLength = buf().iToneOffLength;
|
sl@0
|
507 |
TTimeIntervalMicroSeconds32 pauseLength = buf().iPauseLength;
|
sl@0
|
508 |
iBody->SetDTMFLengths(toneOnLength, toneOffLength, pauseLength);
|
sl@0
|
509 |
return ETrue;
|
sl@0
|
510 |
}
|
sl@0
|
511 |
|
sl@0
|
512 |
TBool CMMFDevSoundSession::DoSetVolumeRampL(const RMmfIpcMessage& aMessage)
|
sl@0
|
513 |
{
|
sl@0
|
514 |
TMMFDevSoundProxySettingsPckg buf;
|
sl@0
|
515 |
aMessage.ReadL(TInt(0),buf);
|
sl@0
|
516 |
TTimeIntervalMicroSeconds duration = buf().iDuration;
|
sl@0
|
517 |
iBody->SetVolumeRamp(duration);
|
sl@0
|
518 |
return ETrue;
|
sl@0
|
519 |
}
|
sl@0
|
520 |
|
sl@0
|
521 |
TBool CMMFDevSoundSession::DoGetSupportedInputDataTypesL(const RMmfIpcMessage& aMessage)
|
sl@0
|
522 |
{
|
sl@0
|
523 |
iArray.Reset();
|
sl@0
|
524 |
|
sl@0
|
525 |
TMMFPrioritySettingsPckg buf;
|
sl@0
|
526 |
aMessage.ReadL(TInt(0),buf);
|
sl@0
|
527 |
TMMFPrioritySettings prioritySet = buf();
|
sl@0
|
528 |
|
sl@0
|
529 |
iBody->GetSupportedInputDataTypesL(iArray, prioritySet);
|
sl@0
|
530 |
|
sl@0
|
531 |
TPckgBuf<TInt> pckg;
|
sl@0
|
532 |
pckg() = iArray.Count();
|
sl@0
|
533 |
aMessage.WriteL(TInt(2),pckg);
|
sl@0
|
534 |
|
sl@0
|
535 |
return ETrue;
|
sl@0
|
536 |
}
|
sl@0
|
537 |
|
sl@0
|
538 |
TBool CMMFDevSoundSession::DoGetSupportedOutputDataTypesL(const RMmfIpcMessage& aMessage)
|
sl@0
|
539 |
{
|
sl@0
|
540 |
iArray.Reset();
|
sl@0
|
541 |
|
sl@0
|
542 |
TMMFPrioritySettingsPckg buf;
|
sl@0
|
543 |
aMessage.ReadL(TInt(0),buf);
|
sl@0
|
544 |
TMMFPrioritySettings prioritySet = buf();
|
sl@0
|
545 |
|
sl@0
|
546 |
iBody->GetSupportedOutputDataTypesL(iArray, prioritySet);
|
sl@0
|
547 |
|
sl@0
|
548 |
TPckgBuf<TInt> pckg;
|
sl@0
|
549 |
pckg() = iArray.Count();
|
sl@0
|
550 |
aMessage.WriteL(TInt(2),pckg);
|
sl@0
|
551 |
|
sl@0
|
552 |
return ETrue;
|
sl@0
|
553 |
}
|
sl@0
|
554 |
|
sl@0
|
555 |
TBool CMMFDevSoundSession::DoSamplesRecordedL(const RMmfIpcMessage& aMessage)
|
sl@0
|
556 |
{
|
sl@0
|
557 |
TPckgBuf<TInt> pckg;
|
sl@0
|
558 |
pckg() = iBody->SamplesRecorded();
|
sl@0
|
559 |
aMessage.WriteL(TInt(2),pckg);
|
sl@0
|
560 |
return ETrue;
|
sl@0
|
561 |
}
|
sl@0
|
562 |
|
sl@0
|
563 |
TBool CMMFDevSoundSession::DoSamplesPlayedL(const RMmfIpcMessage& aMessage)
|
sl@0
|
564 |
{
|
sl@0
|
565 |
TPckgBuf<TInt> pckg;
|
sl@0
|
566 |
pckg() = iBody->SamplesPlayed();
|
sl@0
|
567 |
aMessage.WriteL(TInt(2),pckg);
|
sl@0
|
568 |
return ETrue;
|
sl@0
|
569 |
}
|
sl@0
|
570 |
|
sl@0
|
571 |
TBool CMMFDevSoundSession::DoSetToneRepeatsL(const RMmfIpcMessage& aMessage)
|
sl@0
|
572 |
{
|
sl@0
|
573 |
TPckgBuf<TInt> countRepeat;
|
sl@0
|
574 |
aMessage.ReadL(TInt(0),countRepeat);
|
sl@0
|
575 |
|
sl@0
|
576 |
TPckgBuf<TTimeIntervalMicroSeconds> repeatTS;
|
sl@0
|
577 |
aMessage.ReadL(TInt(1),repeatTS);
|
sl@0
|
578 |
|
sl@0
|
579 |
iBody->SetToneRepeats(countRepeat(), repeatTS());
|
sl@0
|
580 |
return ETrue;
|
sl@0
|
581 |
}
|
sl@0
|
582 |
|
sl@0
|
583 |
TBool CMMFDevSoundSession::DoSetPrioritySettingsL(const RMmfIpcMessage& aMessage)
|
sl@0
|
584 |
{
|
sl@0
|
585 |
TPckgBuf<TMMFPrioritySettings> prioritySet;
|
sl@0
|
586 |
aMessage.ReadL(TInt(0),prioritySet);
|
sl@0
|
587 |
|
sl@0
|
588 |
iBody->SetPrioritySettings(prioritySet());
|
sl@0
|
589 |
return ETrue;
|
sl@0
|
590 |
}
|
sl@0
|
591 |
|
sl@0
|
592 |
TBool CMMFDevSoundSession::DoFixedSequenceNameL(const RMmfIpcMessage& aMessage)
|
sl@0
|
593 |
{
|
sl@0
|
594 |
TPckgBuf<TInt> seqNum;
|
sl@0
|
595 |
aMessage.ReadL(0, seqNum);
|
sl@0
|
596 |
aMessage.WriteL(2, iBody->FixedSequenceName(seqNum()).Left(KMaxFixedSequenceNameLength));
|
sl@0
|
597 |
return ETrue;
|
sl@0
|
598 |
}
|
sl@0
|
599 |
|
sl@0
|
600 |
TBool CMMFDevSoundSession::DoFixedSequenceCountL(const RMmfIpcMessage& aMessage)
|
sl@0
|
601 |
{
|
sl@0
|
602 |
TPckgBuf<TInt> fixSeqCountPckg;
|
sl@0
|
603 |
TInt fixSeqCount = iBody->FixedSequenceCount();
|
sl@0
|
604 |
fixSeqCountPckg = fixSeqCount;
|
sl@0
|
605 |
|
sl@0
|
606 |
aMessage.WriteL(TInt(0),fixSeqCountPckg);
|
sl@0
|
607 |
return ETrue;
|
sl@0
|
608 |
}
|
sl@0
|
609 |
|
sl@0
|
610 |
|
sl@0
|
611 |
TBool CMMFDevSoundSession::DoCopyFourCCArrayDataL(const RMmfIpcMessage& aMessage)
|
sl@0
|
612 |
{
|
sl@0
|
613 |
const TInt KBufExpandSize8 = 8;//two TInts
|
sl@0
|
614 |
CBufFlat* dataCopyBuffer = CBufFlat::NewL(KBufExpandSize8);
|
sl@0
|
615 |
CleanupStack::PushL(dataCopyBuffer);
|
sl@0
|
616 |
RBufWriteStream stream;
|
sl@0
|
617 |
stream.Open(*dataCopyBuffer);
|
sl@0
|
618 |
CleanupClosePushL(stream);
|
sl@0
|
619 |
for (TInt i=0;i<iArray.Count();i++)
|
sl@0
|
620 |
{
|
sl@0
|
621 |
stream.WriteInt32L(iArray[i].FourCC());
|
sl@0
|
622 |
}
|
sl@0
|
623 |
aMessage.WriteL(TInt(2), dataCopyBuffer->Ptr(0));
|
sl@0
|
624 |
CleanupStack::PopAndDestroy(2);//iDataCopyBuffer, stream
|
sl@0
|
625 |
return ETrue;
|
sl@0
|
626 |
}
|
sl@0
|
627 |
|
sl@0
|
628 |
|
sl@0
|
629 |
TBool CMMFDevSoundSession::DoGetRecordedBufferL(const RMmfIpcMessage& aMessage)
|
sl@0
|
630 |
{
|
sl@0
|
631 |
MmfMessageUtil::Write(aMessage, TInt(0), iBufferRecord->Data());
|
sl@0
|
632 |
return ETrue;
|
sl@0
|
633 |
}
|
sl@0
|
634 |
|
sl@0
|
635 |
TBool CMMFDevSoundSession::DoBufferToBeFilledDataL(const RMmfIpcMessage& aMessage)
|
sl@0
|
636 |
{
|
sl@0
|
637 |
TInt err = MmfMessageUtil::Write(aMessage, 0, iHwBufPckgFill);
|
sl@0
|
638 |
aMessage.Complete(err);
|
sl@0
|
639 |
return EFalse;
|
sl@0
|
640 |
}
|
sl@0
|
641 |
|
sl@0
|
642 |
TBool CMMFDevSoundSession::DoBufferToBeEmptiedDataL(const RMmfIpcMessage& aMessage)
|
sl@0
|
643 |
{
|
sl@0
|
644 |
TInt err = MmfMessageUtil::Write(aMessage, 0, iHwBufPckgEmpty);
|
sl@0
|
645 |
aMessage.Complete(err);
|
sl@0
|
646 |
return EFalse;
|
sl@0
|
647 |
}
|
sl@0
|
648 |
|
sl@0
|
649 |
TBool CMMFDevSoundSession::DoRegisterAsClientL(const RMmfIpcMessage& aMessage)
|
sl@0
|
650 |
{
|
sl@0
|
651 |
TMMFDevSoundProxySettingsPckg buf;
|
sl@0
|
652 |
aMessage.ReadL(0,buf);
|
sl@0
|
653 |
HBufC8* notificationRegistrationData = NULL;
|
sl@0
|
654 |
notificationRegistrationData = HBufC8::NewLC(User::LeaveIfError(aMessage.GetDesLengthL(1)));
|
sl@0
|
655 |
TPtr8 dataPtr(notificationRegistrationData->Des());
|
sl@0
|
656 |
aMessage.ReadL(1,dataPtr);
|
sl@0
|
657 |
TInt err = KErrNone;
|
sl@0
|
658 |
err = iBody->RegisterAsClient(buf().iNotificationEventUid,dataPtr);
|
sl@0
|
659 |
CleanupStack::PopAndDestroy(1); // Notification Registeration data
|
sl@0
|
660 |
if (err != KErrNone)
|
sl@0
|
661 |
{
|
sl@0
|
662 |
aMessage.Complete(err);
|
sl@0
|
663 |
return EFalse;
|
sl@0
|
664 |
}
|
sl@0
|
665 |
return ETrue;
|
sl@0
|
666 |
}
|
sl@0
|
667 |
|
sl@0
|
668 |
TBool CMMFDevSoundSession::DoCancelRegisterAsClientL(const RMmfIpcMessage& aMessage)
|
sl@0
|
669 |
{
|
sl@0
|
670 |
TMMFDevSoundProxySettingsPckg buf;
|
sl@0
|
671 |
aMessage.ReadL(0,buf);
|
sl@0
|
672 |
TInt err = KErrNone;
|
sl@0
|
673 |
err = iBody->CancelRegisterAsClient(buf().iNotificationEventUid);
|
sl@0
|
674 |
if (err != KErrNone)
|
sl@0
|
675 |
{
|
sl@0
|
676 |
aMessage.Complete(err);
|
sl@0
|
677 |
return EFalse;
|
sl@0
|
678 |
}
|
sl@0
|
679 |
return ETrue;
|
sl@0
|
680 |
}
|
sl@0
|
681 |
|
sl@0
|
682 |
TBool CMMFDevSoundSession::DoGetResourceNotificationDataL(const RMmfIpcMessage& aMessage)
|
sl@0
|
683 |
{
|
sl@0
|
684 |
TMMFDevSoundProxySettingsPckg buf;
|
sl@0
|
685 |
aMessage.ReadL(0,buf);
|
sl@0
|
686 |
HBufC8* notificationData = NULL;
|
sl@0
|
687 |
notificationData = HBufC8::NewLC(User::LeaveIfError(aMessage.GetDesMaxLengthL(2)));
|
sl@0
|
688 |
TPtr8 dataPtr(notificationData->Des());
|
sl@0
|
689 |
aMessage.ReadL(2,dataPtr);
|
sl@0
|
690 |
TInt err = KErrNone;
|
sl@0
|
691 |
err = iBody->GetResourceNotificationData(buf().iNotificationEventUid,dataPtr);
|
sl@0
|
692 |
aMessage.WriteL(2,*notificationData);
|
sl@0
|
693 |
CleanupStack::PopAndDestroy(1); // Notification data
|
sl@0
|
694 |
if (err != KErrNone)
|
sl@0
|
695 |
{
|
sl@0
|
696 |
aMessage.Complete(err);
|
sl@0
|
697 |
return EFalse;
|
sl@0
|
698 |
}
|
sl@0
|
699 |
return ETrue;
|
sl@0
|
700 |
}
|
sl@0
|
701 |
|
sl@0
|
702 |
TBool CMMFDevSoundSession::DoWillResumePlayL(const RMmfIpcMessage& aMessage)
|
sl@0
|
703 |
{
|
sl@0
|
704 |
TInt err = KErrNone;
|
sl@0
|
705 |
if(CheckClientCapabilities())
|
sl@0
|
706 |
{
|
sl@0
|
707 |
err = iBody->WillResumePlay();
|
sl@0
|
708 |
}
|
sl@0
|
709 |
else
|
sl@0
|
710 |
{
|
sl@0
|
711 |
err = KErrPermissionDenied;
|
sl@0
|
712 |
}
|
sl@0
|
713 |
|
sl@0
|
714 |
if (err != KErrNone)
|
sl@0
|
715 |
{
|
sl@0
|
716 |
aMessage.Complete(err);
|
sl@0
|
717 |
return EFalse;
|
sl@0
|
718 |
}
|
sl@0
|
719 |
return ETrue;
|
sl@0
|
720 |
}
|
sl@0
|
721 |
|
sl@0
|
722 |
TBool CMMFDevSoundSession::DoEmptyBuffersL(const RMmfIpcMessage& aMessage)
|
sl@0
|
723 |
{
|
sl@0
|
724 |
TInt err = KErrNone;
|
sl@0
|
725 |
err = iBody->EmptyBuffers();
|
sl@0
|
726 |
if (err != KErrNone)
|
sl@0
|
727 |
{
|
sl@0
|
728 |
aMessage.Complete(err);
|
sl@0
|
729 |
return EFalse;
|
sl@0
|
730 |
}
|
sl@0
|
731 |
return ETrue;
|
sl@0
|
732 |
}
|
sl@0
|
733 |
|
sl@0
|
734 |
TBool CMMFDevSoundSession::DoSetClientThreadInfoL(const RMmfIpcMessage& aMessage)
|
sl@0
|
735 |
{
|
sl@0
|
736 |
if (aMessage.HasCapability(ECapabilityMultimediaDD))
|
sl@0
|
737 |
{
|
sl@0
|
738 |
TPckgBuf<TThreadId> threadId;
|
sl@0
|
739 |
aMessage.ReadL(0, threadId);
|
sl@0
|
740 |
|
sl@0
|
741 |
CMMFDevSoundServer* server =
|
sl@0
|
742 |
const_cast<CMMFDevSoundServer*>(static_cast<const CMMFDevSoundServer*>(Server()));
|
sl@0
|
743 |
server->SetClientCapabilitiesL(threadId());
|
sl@0
|
744 |
iClientHasCaps = server->CheckClientCapabilities();
|
sl@0
|
745 |
}
|
sl@0
|
746 |
else
|
sl@0
|
747 |
{
|
sl@0
|
748 |
User::Leave(KErrPermissionDenied);
|
sl@0
|
749 |
}
|
sl@0
|
750 |
return ETrue;
|
sl@0
|
751 |
}
|
sl@0
|
752 |
|
sl@0
|
753 |
TBool CMMFDevSoundSession::DoGetTimePlayedL(const RMmfIpcMessage& aMessage)
|
sl@0
|
754 |
{
|
sl@0
|
755 |
TInt err = KErrNone;
|
sl@0
|
756 |
TPckgBuf<TTimeIntervalMicroSeconds> timePckg;
|
sl@0
|
757 |
err = iBody->GetTimePlayed(timePckg());
|
sl@0
|
758 |
if (err != KErrNone)
|
sl@0
|
759 |
{
|
sl@0
|
760 |
aMessage.Complete(err);
|
sl@0
|
761 |
return EFalse;
|
sl@0
|
762 |
}
|
sl@0
|
763 |
aMessage.WriteL(TInt(2),timePckg);
|
sl@0
|
764 |
return ETrue;
|
sl@0
|
765 |
}
|
sl@0
|
766 |
|
sl@0
|
767 |
TBool CMMFDevSoundSession::DoSyncCustomCommandL(const RMmfIpcMessage& aMessage)
|
sl@0
|
768 |
{
|
sl@0
|
769 |
// check whether these are custom interface commands
|
sl@0
|
770 |
// if so then send them into the demux pipeline
|
sl@0
|
771 |
TInt retVal = KErrNone;
|
sl@0
|
772 |
|
sl@0
|
773 |
// try and process this as a custom interface
|
sl@0
|
774 |
TRAPD(err, retVal = iDeMuxUtility->ProcessCustomInterfaceCommandL(aMessage));
|
sl@0
|
775 |
if (err == KErrNone)
|
sl@0
|
776 |
{
|
sl@0
|
777 |
// we can pass back valid values here since command
|
sl@0
|
778 |
// has been handled by the DeMux framework
|
sl@0
|
779 |
aMessage.Complete(retVal);
|
sl@0
|
780 |
}
|
sl@0
|
781 |
else if (err != KErrNotFound)
|
sl@0
|
782 |
{
|
sl@0
|
783 |
// the framework left with an error condition
|
sl@0
|
784 |
// so we complete the message with this error
|
sl@0
|
785 |
aMessage.Complete(err);
|
sl@0
|
786 |
}
|
sl@0
|
787 |
else
|
sl@0
|
788 |
{
|
sl@0
|
789 |
// commmand was not found inside the Custom Interface framework
|
sl@0
|
790 |
// so we can pass onto the DevSound server implementation
|
sl@0
|
791 |
// assume that this will either leave or complete the message
|
sl@0
|
792 |
iBody->DoSyncCustomCommandL(aMessage);
|
sl@0
|
793 |
}
|
sl@0
|
794 |
|
sl@0
|
795 |
// we complete our own message so don't need the framework to do so
|
sl@0
|
796 |
return EFalse;
|
sl@0
|
797 |
}
|
sl@0
|
798 |
|
sl@0
|
799 |
TBool CMMFDevSoundSession::DoSyncCustomCommandResultL(const RMmfIpcMessage& aMessage)
|
sl@0
|
800 |
{
|
sl@0
|
801 |
// check whether these are custom interface commands
|
sl@0
|
802 |
TInt retVal = KErrNone;
|
sl@0
|
803 |
TRAPD(err, retVal = iDeMuxUtility->ProcessCustomInterfaceCommandL(aMessage));
|
sl@0
|
804 |
if (err == KErrNone)
|
sl@0
|
805 |
{
|
sl@0
|
806 |
// we can pass back valid values here since command
|
sl@0
|
807 |
// has been handled by the DeMux framework
|
sl@0
|
808 |
aMessage.Complete(retVal);
|
sl@0
|
809 |
}
|
sl@0
|
810 |
else if (err != KErrNotFound)
|
sl@0
|
811 |
{
|
sl@0
|
812 |
// the framework left with an error condition
|
sl@0
|
813 |
// so we complete the message with this error
|
sl@0
|
814 |
aMessage.Complete(err);
|
sl@0
|
815 |
}
|
sl@0
|
816 |
else
|
sl@0
|
817 |
{
|
sl@0
|
818 |
// commmand was not found inside the Custom Interface framework
|
sl@0
|
819 |
// so we can pass onto the DevSound server implementation
|
sl@0
|
820 |
// assume that this will either leave or complete the message
|
sl@0
|
821 |
iBody->DoSyncCustomCommandResultL(aMessage);
|
sl@0
|
822 |
}
|
sl@0
|
823 |
// we complete our own message so don't need the framework to do so
|
sl@0
|
824 |
return EFalse;
|
sl@0
|
825 |
}
|
sl@0
|
826 |
|
sl@0
|
827 |
TBool CMMFDevSoundSession::DoAsyncCustomCommandL(const RMmfIpcMessage& aMessage)
|
sl@0
|
828 |
{
|
sl@0
|
829 |
// check whether these are custom interface commands
|
sl@0
|
830 |
// async message will complete later
|
sl@0
|
831 |
TRAPD(err, iDeMuxUtility->ProcessCustomInterfaceCommandL(aMessage));
|
sl@0
|
832 |
if ((err != KErrNotFound) && (err != KErrNone))
|
sl@0
|
833 |
{
|
sl@0
|
834 |
// the framework left with an error condition
|
sl@0
|
835 |
// so we complete the message with this error
|
sl@0
|
836 |
aMessage.Complete(err);
|
sl@0
|
837 |
}
|
sl@0
|
838 |
else if (err == KErrNotFound)
|
sl@0
|
839 |
{
|
sl@0
|
840 |
// commmand was not found inside the Custom Interface framework
|
sl@0
|
841 |
// so we can pass onto the DevSound server implementation
|
sl@0
|
842 |
// assume that this will either leave or complete the message
|
sl@0
|
843 |
iBody->DoAsyncCustomCommandL(aMessage);
|
sl@0
|
844 |
}
|
sl@0
|
845 |
return EFalse;
|
sl@0
|
846 |
}
|
sl@0
|
847 |
|
sl@0
|
848 |
TBool CMMFDevSoundSession::DoAsyncCustomCommandResultL(const RMmfIpcMessage& aMessage)
|
sl@0
|
849 |
{
|
sl@0
|
850 |
// check whether these are custom interface commands
|
sl@0
|
851 |
// async message will complete later
|
sl@0
|
852 |
TRAPD(err, iDeMuxUtility->ProcessCustomInterfaceCommandL(aMessage));
|
sl@0
|
853 |
if ((err != KErrNotFound) && (err != KErrNone))
|
sl@0
|
854 |
{
|
sl@0
|
855 |
// the framework left with an error condition
|
sl@0
|
856 |
// so we complete the message with this error
|
sl@0
|
857 |
aMessage.Complete(err);
|
sl@0
|
858 |
}
|
sl@0
|
859 |
else if (err == KErrNotFound)
|
sl@0
|
860 |
{
|
sl@0
|
861 |
// commmand was not found inside the Custom Interface framework
|
sl@0
|
862 |
// so we can pass onto the DevSound server implementation
|
sl@0
|
863 |
// assume that this will either leave or complete the message
|
sl@0
|
864 |
iBody->DoAsyncCustomCommandL(aMessage);
|
sl@0
|
865 |
}
|
sl@0
|
866 |
return EFalse;
|
sl@0
|
867 |
}
|
sl@0
|
868 |
|
sl@0
|
869 |
|
sl@0
|
870 |
|
sl@0
|
871 |
void CMMFDevSoundSession::SendEventToClient(/*TMMFAudioPolicyEvent& aEvent*/)
|
sl@0
|
872 |
{
|
sl@0
|
873 |
}
|
sl@0
|
874 |
|
sl@0
|
875 |
|
sl@0
|
876 |
/*
|
sl@0
|
877 |
*
|
sl@0
|
878 |
* Default Constructor.
|
sl@0
|
879 |
*
|
sl@0
|
880 |
*
|
sl@0
|
881 |
*/
|
sl@0
|
882 |
CMMFDevSoundSession::CMMFDevSoundSession()
|
sl@0
|
883 |
{
|
sl@0
|
884 |
}
|
sl@0
|
885 |
|
sl@0
|
886 |
CMMFDevSoundSession::~CMMFDevSoundSession()
|
sl@0
|
887 |
{
|
sl@0
|
888 |
// clear the array of custom interfaces
|
sl@0
|
889 |
for (TInt i = 0; i < iCustomInterfaceArray.Count(); i++)
|
sl@0
|
890 |
{
|
sl@0
|
891 |
// we could have already deleted interfaces without
|
sl@0
|
892 |
// removing them from the array so check for this
|
sl@0
|
893 |
// and only delete release plugin if non-null
|
sl@0
|
894 |
MMMFDevSoundCustomInterfaceDeMuxPlugin* ptr = iCustomInterfaceArray[i].iInterface;
|
sl@0
|
895 |
if (ptr)
|
sl@0
|
896 |
{
|
sl@0
|
897 |
iCustomInterfaceArray[i].iInterface->Release();
|
sl@0
|
898 |
}
|
sl@0
|
899 |
}
|
sl@0
|
900 |
iCustomInterfaceArray.Reset();
|
sl@0
|
901 |
iCustomInterfaceArray.Close();
|
sl@0
|
902 |
|
sl@0
|
903 |
delete iDeMuxUtility;
|
sl@0
|
904 |
|
sl@0
|
905 |
iMsgQueue.Close();
|
sl@0
|
906 |
iArray.Close();
|
sl@0
|
907 |
delete iDTMFString;
|
sl@0
|
908 |
delete iToneSeqBuf;
|
sl@0
|
909 |
delete iBody;
|
sl@0
|
910 |
|
sl@0
|
911 |
CMMFDevSoundServer* server =
|
sl@0
|
912 |
const_cast<CMMFDevSoundServer*>(static_cast<const CMMFDevSoundServer*>(Server()));
|
sl@0
|
913 |
if (server)
|
sl@0
|
914 |
{
|
sl@0
|
915 |
server->DecrementSessionId();
|
sl@0
|
916 |
}
|
sl@0
|
917 |
}
|
sl@0
|
918 |
|
sl@0
|
919 |
/*
|
sl@0
|
920 |
* -doxygen comments moved to header-
|
sl@0
|
921 |
*
|
sl@0
|
922 |
* Constructs, and returns a pointer to, a new CMMFDevSoundProxy object.
|
sl@0
|
923 |
*
|
sl@0
|
924 |
* Leaves on failure.
|
sl@0
|
925 |
*
|
sl@0
|
926 |
*/
|
sl@0
|
927 |
CMMFDevSoundSession* CMMFDevSoundSession::NewL(RServer2& aPolicyServerHandle)
|
sl@0
|
928 |
{
|
sl@0
|
929 |
CMMFDevSoundSession* self = new (ELeave) CMMFDevSoundSessionXtnd;
|
sl@0
|
930 |
CleanupStack::PushL(self);
|
sl@0
|
931 |
self->ConstructL(aPolicyServerHandle);
|
sl@0
|
932 |
CleanupStack::Pop();
|
sl@0
|
933 |
return self;
|
sl@0
|
934 |
}
|
sl@0
|
935 |
|
sl@0
|
936 |
/*
|
sl@0
|
937 |
* -doxygen comments moved to header-
|
sl@0
|
938 |
*
|
sl@0
|
939 |
* Second phase constructor.
|
sl@0
|
940 |
*
|
sl@0
|
941 |
*/
|
sl@0
|
942 |
void CMMFDevSoundSession::ConstructL(RServer2& aPolicyServerHandle)
|
sl@0
|
943 |
{
|
sl@0
|
944 |
iBody = CMMFDevSoundSvrImp::NewL(static_cast<CMMFDevSoundSessionXtnd*>(this));
|
sl@0
|
945 |
iBody->Construct3L(aPolicyServerHandle);
|
sl@0
|
946 |
|
sl@0
|
947 |
iDeMuxUtility = CMMFDevSoundCIDeMuxUtility::NewL(this);
|
sl@0
|
948 |
}
|
sl@0
|
949 |
|
sl@0
|
950 |
//callbacks
|
sl@0
|
951 |
void CMMFDevSoundSession::InitializeComplete(TInt aError)
|
sl@0
|
952 |
{
|
sl@0
|
953 |
// this may be a re-initialization and so we need to
|
sl@0
|
954 |
// re-get our custom interfaces on the DeMux plugins
|
sl@0
|
955 |
for (TInt i = 0; i < iCustomInterfaceArray.Count(); i++)
|
sl@0
|
956 |
{
|
sl@0
|
957 |
// we could have already deleted interfaces without
|
sl@0
|
958 |
// removing them from the array so check for this
|
sl@0
|
959 |
// and only delete release plugin if non-null
|
sl@0
|
960 |
MMMFDevSoundCustomInterfaceDeMuxPlugin* ptr = iCustomInterfaceArray[i].iInterface;
|
sl@0
|
961 |
if (ptr)
|
sl@0
|
962 |
{
|
sl@0
|
963 |
// we can't keep track of..
|
sl@0
|
964 |
// 1. where a custom interface is implemented
|
sl@0
|
965 |
// 2. the uid of the custom interface to be refreshed
|
sl@0
|
966 |
// so assume all have to be refreshed
|
sl@0
|
967 |
TRAPD(err, iCustomInterfaceArray[i].iInterface->RefreshL());
|
sl@0
|
968 |
|
sl@0
|
969 |
// if there is an error then this is no longer a
|
sl@0
|
970 |
// valid interface so could be deleted this from the array
|
sl@0
|
971 |
// but this would involve notifying the client side
|
sl@0
|
972 |
//
|
sl@0
|
973 |
// since we have no way of notifying the client in this
|
sl@0
|
974 |
// implementation and the fact that this is a prototype
|
sl@0
|
975 |
// implementation and we will leave this up to the licensee
|
sl@0
|
976 |
// to implement as required
|
sl@0
|
977 |
if (err != KErrNone)
|
sl@0
|
978 |
{
|
sl@0
|
979 |
TMMFEvent event;
|
sl@0
|
980 |
TMMFDevSoundQueueItem item;
|
sl@0
|
981 |
item.iRequest = EMMFDevSoundCustomCommandCloseMuxDemuxPair;
|
sl@0
|
982 |
item.iErrorCode = err;
|
sl@0
|
983 |
event.iEventType.iUid = i+1;
|
sl@0
|
984 |
item.iEventPckg() = event;
|
sl@0
|
985 |
iMsgQueue.Send(item);
|
sl@0
|
986 |
}
|
sl@0
|
987 |
}
|
sl@0
|
988 |
}
|
sl@0
|
989 |
|
sl@0
|
990 |
// The previous implementation was commented out,
|
sl@0
|
991 |
// so add a new commented out implementation :)
|
sl@0
|
992 |
TMMFDevSoundQueueItem item;
|
sl@0
|
993 |
item.iRequest = EMMFDevSoundProxyICEvent;
|
sl@0
|
994 |
item.iErrorCode = aError;
|
sl@0
|
995 |
iMsgQueue.Send(item); // assumes sufficient space in the queue so ignores the return value
|
sl@0
|
996 |
}
|
sl@0
|
997 |
|
sl@0
|
998 |
void CMMFDevSoundSession::ToneFinished(TInt aError)
|
sl@0
|
999 |
{
|
sl@0
|
1000 |
TMMFDevSoundQueueItem item;
|
sl@0
|
1001 |
item.iRequest = EMMFDevSoundProxyTFEvent;
|
sl@0
|
1002 |
item.iErrorCode = aError;
|
sl@0
|
1003 |
iMsgQueue.Send(item); // assumes sufficient space in the queue so ignores the return value
|
sl@0
|
1004 |
}
|
sl@0
|
1005 |
|
sl@0
|
1006 |
void CMMFDevSoundSession::BufferToBeFilled(CMMFBuffer* aBuffer)
|
sl@0
|
1007 |
{
|
sl@0
|
1008 |
// Package up the data for retrieval later (using a two stage process
|
sl@0
|
1009 |
// as this payload is too large to be sent via the queue in one message)
|
sl@0
|
1010 |
iBufferPlay = reinterpret_cast<CMMFDataBuffer*>(aBuffer);
|
sl@0
|
1011 |
iHwBufPckgFill().iBufferType = iBufferPlay->Type();
|
sl@0
|
1012 |
iHwBufPckgFill().iRequestSize = iBufferPlay->RequestSize();
|
sl@0
|
1013 |
iHwBufPckgFill().iBufferSize = iBufferPlay->Data().MaxLength();
|
sl@0
|
1014 |
iHwBufPckgFill().iLastBuffer = iBufferPlay->LastBuffer();
|
sl@0
|
1015 |
|
sl@0
|
1016 |
TMMFDevSoundQueueItem item;
|
sl@0
|
1017 |
item.iRequest = EMMFDevSoundProxyBTBFEvent;
|
sl@0
|
1018 |
iMsgQueue.Send(item); // assumes sufficient space in the queue so ignores the return value
|
sl@0
|
1019 |
}
|
sl@0
|
1020 |
|
sl@0
|
1021 |
void CMMFDevSoundSession::PlayError(TInt aError)
|
sl@0
|
1022 |
{
|
sl@0
|
1023 |
TMMFDevSoundQueueItem item;
|
sl@0
|
1024 |
item.iRequest = EMMFDevSoundProxyPEEvent;
|
sl@0
|
1025 |
item.iErrorCode = aError;
|
sl@0
|
1026 |
iMsgQueue.Send(item); // assumes sufficient space in the queue so ignores the return value
|
sl@0
|
1027 |
}
|
sl@0
|
1028 |
|
sl@0
|
1029 |
void CMMFDevSoundSession::BufferToBeEmptied(CMMFBuffer* aBuffer)
|
sl@0
|
1030 |
{
|
sl@0
|
1031 |
iBufferRecord = reinterpret_cast<CMMFDataBuffer*>(aBuffer);
|
sl@0
|
1032 |
|
sl@0
|
1033 |
iHwBufPckgEmpty().iBufferType = iBufferRecord->Type();
|
sl@0
|
1034 |
iHwBufPckgEmpty().iRequestSize = iBufferRecord->RequestSize();
|
sl@0
|
1035 |
iHwBufPckgEmpty().iBufferSize = iBufferRecord->Data().MaxLength();
|
sl@0
|
1036 |
iHwBufPckgEmpty().iLastBuffer = iBufferRecord->LastBuffer();
|
sl@0
|
1037 |
|
sl@0
|
1038 |
TMMFDevSoundQueueItem item;
|
sl@0
|
1039 |
item.iRequest = EMMFDevSoundProxyBTBEEvent;
|
sl@0
|
1040 |
iMsgQueue.Send(item); // assumes sufficient space in the queue so ignores the return value
|
sl@0
|
1041 |
}
|
sl@0
|
1042 |
|
sl@0
|
1043 |
void CMMFDevSoundSession::RecordError(TInt aError)
|
sl@0
|
1044 |
{
|
sl@0
|
1045 |
TMMFDevSoundQueueItem item;
|
sl@0
|
1046 |
item.iRequest = EMMFDevSoundProxyREEvent;
|
sl@0
|
1047 |
item.iErrorCode = aError;
|
sl@0
|
1048 |
iMsgQueue.Send(item); // assumes sufficient space in the queue so ignores the return value
|
sl@0
|
1049 |
}
|
sl@0
|
1050 |
|
sl@0
|
1051 |
void CMMFDevSoundSession::ConvertError(TInt /*aError*/)
|
sl@0
|
1052 |
{
|
sl@0
|
1053 |
}
|
sl@0
|
1054 |
|
sl@0
|
1055 |
void CMMFDevSoundSession::DeviceMessage(TUid /*aMessageType*/, const TDesC8& /*aMsg*/)
|
sl@0
|
1056 |
{
|
sl@0
|
1057 |
}
|
sl@0
|
1058 |
|
sl@0
|
1059 |
void CMMFDevSoundSession::SendEventToClient(const TMMFEvent& aEvent)
|
sl@0
|
1060 |
{
|
sl@0
|
1061 |
TMMFDevSoundQueueItem item;
|
sl@0
|
1062 |
item.iRequest = EMMFDevSoundProxySETCEvent;
|
sl@0
|
1063 |
item.iEventPckg() = aEvent;
|
sl@0
|
1064 |
iMsgQueue.Send(item); // assumes sufficient space in the queue so ignores the return value
|
sl@0
|
1065 |
}
|
sl@0
|
1066 |
|
sl@0
|
1067 |
/********************************************************************************
|
sl@0
|
1068 |
* Non Exported public functions begins here *
|
sl@0
|
1069 |
********************************************************************************/
|
sl@0
|
1070 |
|
sl@0
|
1071 |
//
|
sl@0
|
1072 |
// Audio Policy specific implementation begins here //
|
sl@0
|
1073 |
//
|
sl@0
|
1074 |
|
sl@0
|
1075 |
/**
|
sl@0
|
1076 |
*
|
sl@0
|
1077 |
* Sets Id for this instance of DevSound
|
sl@0
|
1078 |
*
|
sl@0
|
1079 |
* @param "TInt aDevSoundId"
|
sl@0
|
1080 |
* Integer value assigned by Audio Policy Server
|
sl@0
|
1081 |
*
|
sl@0
|
1082 |
*/
|
sl@0
|
1083 |
void CMMFDevSoundSessionXtnd::SetDevSoundId(TInt aDevSoundId)
|
sl@0
|
1084 |
{
|
sl@0
|
1085 |
iBody->SetDevSoundId(aDevSoundId);
|
sl@0
|
1086 |
}
|
sl@0
|
1087 |
|
sl@0
|
1088 |
/**
|
sl@0
|
1089 |
*
|
sl@0
|
1090 |
* Returns information about this DevSound instance.
|
sl@0
|
1091 |
*
|
sl@0
|
1092 |
* This method is used by Audio Policy Server to make audio policy decisions.
|
sl@0
|
1093 |
*
|
sl@0
|
1094 |
* @return "TMMFDevSoundinfo"
|
sl@0
|
1095 |
* A reference to TMMFDevSoundinfo object holding the current settings
|
sl@0
|
1096 |
* of this DevSound instance.
|
sl@0
|
1097 |
*
|
sl@0
|
1098 |
*/
|
sl@0
|
1099 |
TMMFDevSoundInfo CMMFDevSoundSessionXtnd::DevSoundInfo()
|
sl@0
|
1100 |
{
|
sl@0
|
1101 |
return iBody->DevSoundInfo();
|
sl@0
|
1102 |
}
|
sl@0
|
1103 |
|
sl@0
|
1104 |
/**
|
sl@0
|
1105 |
*
|
sl@0
|
1106 |
* Called by Audio Policy Server when a request to play is approved by the
|
sl@0
|
1107 |
* Audio Policy Server.
|
sl@0
|
1108 |
*
|
sl@0
|
1109 |
* Leaves on failure.
|
sl@0
|
1110 |
*
|
sl@0
|
1111 |
*/
|
sl@0
|
1112 |
void CMMFDevSoundSessionXtnd::StartPlayDataL()
|
sl@0
|
1113 |
{
|
sl@0
|
1114 |
iBody->StartPlayDataL();
|
sl@0
|
1115 |
}
|
sl@0
|
1116 |
|
sl@0
|
1117 |
/**
|
sl@0
|
1118 |
*
|
sl@0
|
1119 |
* Called by Audio Policy Server when a request to record is approved by the
|
sl@0
|
1120 |
* Audio Policy Server.
|
sl@0
|
1121 |
*
|
sl@0
|
1122 |
* Leaves on failure.
|
sl@0
|
1123 |
*
|
sl@0
|
1124 |
*/
|
sl@0
|
1125 |
void CMMFDevSoundSessionXtnd::StartRecordDataL()
|
sl@0
|
1126 |
{
|
sl@0
|
1127 |
iBody->StartRecordDataL();
|
sl@0
|
1128 |
}
|
sl@0
|
1129 |
|
sl@0
|
1130 |
/**
|
sl@0
|
1131 |
*
|
sl@0
|
1132 |
* Called by Audio Policy Server when a request to play tone is approved by
|
sl@0
|
1133 |
* the Audio Policy Server.
|
sl@0
|
1134 |
*
|
sl@0
|
1135 |
* Leaves on failure.
|
sl@0
|
1136 |
*
|
sl@0
|
1137 |
*/
|
sl@0
|
1138 |
void CMMFDevSoundSessionXtnd::StartPlayToneL()
|
sl@0
|
1139 |
{
|
sl@0
|
1140 |
iBody->StartPlayToneL();
|
sl@0
|
1141 |
}
|
sl@0
|
1142 |
|
sl@0
|
1143 |
/**
|
sl@0
|
1144 |
*
|
sl@0
|
1145 |
* Called by Audio Policy Server when a request to play a dual tone is approved by
|
sl@0
|
1146 |
* the Audio Policy Server.
|
sl@0
|
1147 |
*
|
sl@0
|
1148 |
*/
|
sl@0
|
1149 |
void CMMFDevSoundSessionXtnd::StartPlayDualToneL()
|
sl@0
|
1150 |
{
|
sl@0
|
1151 |
iBody->StartPlayDualToneL();
|
sl@0
|
1152 |
}
|
sl@0
|
1153 |
|
sl@0
|
1154 |
/**
|
sl@0
|
1155 |
*
|
sl@0
|
1156 |
* Called by Audio Policy Server when a request to play DTMF String is approved
|
sl@0
|
1157 |
* by the Audio Policy Server.
|
sl@0
|
1158 |
*
|
sl@0
|
1159 |
* Leaves on failure.
|
sl@0
|
1160 |
*
|
sl@0
|
1161 |
*/
|
sl@0
|
1162 |
void CMMFDevSoundSessionXtnd::StartPlayDTMFStringL()
|
sl@0
|
1163 |
{
|
sl@0
|
1164 |
iBody->StartPlayDTMFStringL();
|
sl@0
|
1165 |
}
|
sl@0
|
1166 |
|
sl@0
|
1167 |
/**
|
sl@0
|
1168 |
*
|
sl@0
|
1169 |
* Called by Audio Policy Server when a request to play tone sequence is
|
sl@0
|
1170 |
* approved by the Audio Policy Server.
|
sl@0
|
1171 |
*
|
sl@0
|
1172 |
* Leaves on failure.
|
sl@0
|
1173 |
*
|
sl@0
|
1174 |
*/
|
sl@0
|
1175 |
void CMMFDevSoundSessionXtnd::StartPlayToneSequenceL()
|
sl@0
|
1176 |
{
|
sl@0
|
1177 |
iBody->StartPlayToneSequenceL();
|
sl@0
|
1178 |
}
|
sl@0
|
1179 |
|
sl@0
|
1180 |
/**
|
sl@0
|
1181 |
*
|
sl@0
|
1182 |
* Called by Audio Policy Server when the current DevSound instance looses the
|
sl@0
|
1183 |
* policy because of another instance with a higher priority wants the device.
|
sl@0
|
1184 |
*
|
sl@0
|
1185 |
*/
|
sl@0
|
1186 |
void CMMFDevSoundSessionXtnd::SendEvent(const TMMFEvent& aEvent)
|
sl@0
|
1187 |
{
|
sl@0
|
1188 |
iBody->SendEventToClient(aEvent);
|
sl@0
|
1189 |
}
|
sl@0
|
1190 |
|
sl@0
|
1191 |
|
sl@0
|
1192 |
//
|
sl@0
|
1193 |
// Audio Policy specific implementation begins here //
|
sl@0
|
1194 |
//
|
sl@0
|
1195 |
|
sl@0
|
1196 |
/**
|
sl@0
|
1197 |
*
|
sl@0
|
1198 |
* Updates the total bytes played.
|
sl@0
|
1199 |
*
|
sl@0
|
1200 |
*/
|
sl@0
|
1201 |
void CMMFDevSoundSessionXtnd::UpdateBytesPlayed()
|
sl@0
|
1202 |
{
|
sl@0
|
1203 |
iBody->UpdateBytesPlayed();
|
sl@0
|
1204 |
}
|
sl@0
|
1205 |
|
sl@0
|
1206 |
|
sl@0
|
1207 |
// Custom Interface //
|
sl@0
|
1208 |
TInt CMMFDevSoundSession::DoOpenSlaveL(TUid aInterface, const TDesC8& aPackageBuf)
|
sl@0
|
1209 |
{
|
sl@0
|
1210 |
// it shouldn't be necessary to check if we have already instantiated this
|
sl@0
|
1211 |
// interface since the client would already know - however this is something
|
sl@0
|
1212 |
// that a licensee could implement if they required additional functionality
|
sl@0
|
1213 |
// e.g. many : 1 mappings between client and DevSound.
|
sl@0
|
1214 |
|
sl@0
|
1215 |
MMMFDevSoundCustomInterfaceDeMuxPlugin* ptr = NULL;
|
sl@0
|
1216 |
|
sl@0
|
1217 |
// try and instantiate a plugin tunnelling
|
sl@0
|
1218 |
// pair to support this Custom Interface
|
sl@0
|
1219 |
ptr = iDeMuxUtility->CreateCustomInterfaceDeMuxL(aInterface);
|
sl@0
|
1220 |
|
sl@0
|
1221 |
TInt handle = KNullHandle;
|
sl@0
|
1222 |
|
sl@0
|
1223 |
if (ptr)
|
sl@0
|
1224 |
{
|
sl@0
|
1225 |
TMMFDevSoundCustomInterfaceDeMuxData data;
|
sl@0
|
1226 |
data.iInterface = ptr;
|
sl@0
|
1227 |
data.iId = aInterface;
|
sl@0
|
1228 |
|
sl@0
|
1229 |
CleanupReleasePushL(*ptr);
|
sl@0
|
1230 |
|
sl@0
|
1231 |
// setup demux plugin
|
sl@0
|
1232 |
ptr->SetInterfaceTarget(iBody);
|
sl@0
|
1233 |
|
sl@0
|
1234 |
// try and open interface
|
sl@0
|
1235 |
// this will fetch the interface from the svr implementation
|
sl@0
|
1236 |
ptr->DoOpenSlaveL(aInterface, aPackageBuf);
|
sl@0
|
1237 |
User::LeaveIfError(iCustomInterfaceArray.Append(data));
|
sl@0
|
1238 |
|
sl@0
|
1239 |
CleanupStack::Pop(); // ptr
|
sl@0
|
1240 |
|
sl@0
|
1241 |
handle = iCustomInterfaceArray.Count();
|
sl@0
|
1242 |
return handle;
|
sl@0
|
1243 |
}
|
sl@0
|
1244 |
|
sl@0
|
1245 |
// we couldn't set up the interface correctly so return a NULL
|
sl@0
|
1246 |
// handle to the client
|
sl@0
|
1247 |
return KNullHandle;
|
sl@0
|
1248 |
}
|
sl@0
|
1249 |
|
sl@0
|
1250 |
void CMMFDevSoundSession::DoCloseSlaveL(TInt aHandle)
|
sl@0
|
1251 |
{
|
sl@0
|
1252 |
if (aHandle==KNullHandle)
|
sl@0
|
1253 |
{
|
sl@0
|
1254 |
// null-handle -> NOP
|
sl@0
|
1255 |
return;
|
sl@0
|
1256 |
}
|
sl@0
|
1257 |
|
sl@0
|
1258 |
if (aHandle<KNullHandle || aHandle > iCustomInterfaceArray.Count())
|
sl@0
|
1259 |
{
|
sl@0
|
1260 |
// handle out of range - should not happen, but leave to show error
|
sl@0
|
1261 |
User::Leave(KErrBadHandle);
|
sl@0
|
1262 |
}
|
sl@0
|
1263 |
|
sl@0
|
1264 |
// set the current handle location to NULL
|
sl@0
|
1265 |
// can't re-compress array because this will alter handles
|
sl@0
|
1266 |
// we could change this to a list type structure but this
|
sl@0
|
1267 |
// seems overkill for the current prototype
|
sl@0
|
1268 |
TMMFDevSoundCustomInterfaceDeMuxData& data = iCustomInterfaceArray[aHandle-1];
|
sl@0
|
1269 |
|
sl@0
|
1270 |
// close and delete the plugin
|
sl@0
|
1271 |
MMMFDevSoundCustomInterfaceDeMuxPlugin* ptr = data.iInterface;
|
sl@0
|
1272 |
ptr->DoCloseSlaveL(aHandle);
|
sl@0
|
1273 |
ptr->Release();
|
sl@0
|
1274 |
|
sl@0
|
1275 |
// clear the entry
|
sl@0
|
1276 |
data.iInterface = NULL;
|
sl@0
|
1277 |
data.iId.iUid = 0;
|
sl@0
|
1278 |
}
|
sl@0
|
1279 |
|
sl@0
|
1280 |
TInt CMMFDevSoundSession::DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage)
|
sl@0
|
1281 |
{
|
sl@0
|
1282 |
// use the demux utility to get the handle
|
sl@0
|
1283 |
TMMFDevSoundCIMessageData data;
|
sl@0
|
1284 |
iDeMuxUtility->GetSyncMessageDataL(aMessage, data);
|
sl@0
|
1285 |
|
sl@0
|
1286 |
TInt handle = data.iHandle;
|
sl@0
|
1287 |
|
sl@0
|
1288 |
if ((handle <= 0) || (handle > (iCustomInterfaceArray.Count())))
|
sl@0
|
1289 |
{
|
sl@0
|
1290 |
|
sl@0
|
1291 |
User::Leave(KErrBadHandle);
|
sl@0
|
1292 |
}
|
sl@0
|
1293 |
|
sl@0
|
1294 |
// call on demux plugin
|
sl@0
|
1295 |
return iCustomInterfaceArray[handle-1].iInterface->DoSendSlaveSyncCommandL(aMessage);
|
sl@0
|
1296 |
}
|
sl@0
|
1297 |
|
sl@0
|
1298 |
TInt CMMFDevSoundSession::DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage)
|
sl@0
|
1299 |
{
|
sl@0
|
1300 |
// use the demux utility to get the handle
|
sl@0
|
1301 |
TMMFDevSoundCIMessageData data;
|
sl@0
|
1302 |
iDeMuxUtility->GetSyncMessageDataL(aMessage, data);
|
sl@0
|
1303 |
|
sl@0
|
1304 |
TInt handle = data.iHandle;
|
sl@0
|
1305 |
|
sl@0
|
1306 |
if ((handle <= 0) || (handle > (iCustomInterfaceArray.Count())))
|
sl@0
|
1307 |
{
|
sl@0
|
1308 |
|
sl@0
|
1309 |
User::Leave(KErrBadHandle);
|
sl@0
|
1310 |
}
|
sl@0
|
1311 |
|
sl@0
|
1312 |
// call on demux plugin
|
sl@0
|
1313 |
return iCustomInterfaceArray[handle-1].iInterface->DoSendSlaveSyncCommandResultL(aMessage);
|
sl@0
|
1314 |
}
|
sl@0
|
1315 |
|
sl@0
|
1316 |
void CMMFDevSoundSession::DoSendSlaveAsyncCommandL(const RMmfIpcMessage& aMessage)
|
sl@0
|
1317 |
{
|
sl@0
|
1318 |
// use the demux utility to get the handle
|
sl@0
|
1319 |
TMMFDevSoundCIMessageData data;
|
sl@0
|
1320 |
iDeMuxUtility->GetAsyncMessageDataL(aMessage, data);
|
sl@0
|
1321 |
|
sl@0
|
1322 |
TInt handle = data.iHandle;
|
sl@0
|
1323 |
|
sl@0
|
1324 |
if ((handle <= 0) || (handle > (iCustomInterfaceArray.Count())))
|
sl@0
|
1325 |
{
|
sl@0
|
1326 |
User::Leave(KErrBadHandle);
|
sl@0
|
1327 |
}
|
sl@0
|
1328 |
|
sl@0
|
1329 |
// call on demux plugin
|
sl@0
|
1330 |
iCustomInterfaceArray[handle-1].iInterface->DoSendSlaveAsyncCommandL(aMessage);
|
sl@0
|
1331 |
}
|
sl@0
|
1332 |
|
sl@0
|
1333 |
void CMMFDevSoundSession::DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& aMessage)
|
sl@0
|
1334 |
{
|
sl@0
|
1335 |
// use the demux utility to get the handle
|
sl@0
|
1336 |
TMMFDevSoundCIMessageData data;
|
sl@0
|
1337 |
iDeMuxUtility->GetAsyncMessageDataL(aMessage, data);
|
sl@0
|
1338 |
|
sl@0
|
1339 |
TInt handle = data.iHandle;
|
sl@0
|
1340 |
|
sl@0
|
1341 |
if ((handle <= 0) || (handle > (iCustomInterfaceArray.Count())))
|
sl@0
|
1342 |
{
|
sl@0
|
1343 |
User::Leave(KErrBadHandle);
|
sl@0
|
1344 |
}
|
sl@0
|
1345 |
|
sl@0
|
1346 |
// call on demux plugin
|
sl@0
|
1347 |
iCustomInterfaceArray[handle-1].iInterface->DoSendSlaveAsyncCommandResultL(aMessage);
|
sl@0
|
1348 |
}
|
sl@0
|
1349 |
|
sl@0
|
1350 |
|
sl@0
|
1351 |
|