sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2006 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: Interface proxy for BT SBC Encoder configuration CI.
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
|
sl@0
|
20 |
// INCLUDE FILES
|
sl@0
|
21 |
#include <CustomCommandUtility.h>
|
sl@0
|
22 |
#include <CustomInterfaceUtility.h>
|
sl@0
|
23 |
#include "SbcEncoderIntfcMsgs.h"
|
sl@0
|
24 |
#include "SbcEncoderIntfcProxy.h"
|
sl@0
|
25 |
|
sl@0
|
26 |
// EXTERNAL DATA STRUCTURES
|
sl@0
|
27 |
|
sl@0
|
28 |
// EXTERNAL FUNCTION PROTOTYPES
|
sl@0
|
29 |
|
sl@0
|
30 |
// CONSTANTS
|
sl@0
|
31 |
|
sl@0
|
32 |
// MACROS
|
sl@0
|
33 |
|
sl@0
|
34 |
// LOCAL CONSTANTS AND MACROS
|
sl@0
|
35 |
|
sl@0
|
36 |
// MODULE DATA STRUCTURES
|
sl@0
|
37 |
|
sl@0
|
38 |
// LOCAL FUNCTION PROTOTYPES
|
sl@0
|
39 |
|
sl@0
|
40 |
// FORWARD DECLARATIONS
|
sl@0
|
41 |
|
sl@0
|
42 |
// ============================= LOCAL FUNCTIONS ===============================
|
sl@0
|
43 |
|
sl@0
|
44 |
// ============================= MEMBER FUNCTIONS ==============================
|
sl@0
|
45 |
|
sl@0
|
46 |
/**
|
sl@0
|
47 |
* CSbcEncoderIntfcProxy::CSbcEncoderIntfcProxy
|
sl@0
|
48 |
* C++ default constructor can NOT contain any code, that might leave.
|
sl@0
|
49 |
*/
|
sl@0
|
50 |
CSbcEncoderIntfcProxy::CSbcEncoderIntfcProxy(
|
sl@0
|
51 |
TMMFMessageDestinationPckg aMessageHandler,
|
sl@0
|
52 |
MCustomCommand& aCustomCommand,
|
sl@0
|
53 |
CCustomInterfaceUtility* aCustomInterfaceUtility) :
|
sl@0
|
54 |
iCustomCommand(aCustomCommand),
|
sl@0
|
55 |
iMessageHandler(aMessageHandler),
|
sl@0
|
56 |
iCustomInterfaceUtility(aCustomInterfaceUtility)
|
sl@0
|
57 |
{
|
sl@0
|
58 |
}
|
sl@0
|
59 |
|
sl@0
|
60 |
/**
|
sl@0
|
61 |
* CSbcEncoderIntfcProxy::ConstructL
|
sl@0
|
62 |
* Symbian 2nd phase constructor can leave.
|
sl@0
|
63 |
*/
|
sl@0
|
64 |
void CSbcEncoderIntfcProxy::ConstructL()
|
sl@0
|
65 |
{
|
sl@0
|
66 |
iHasBeenApplied = EFalse;
|
sl@0
|
67 |
}
|
sl@0
|
68 |
|
sl@0
|
69 |
/**
|
sl@0
|
70 |
* CSbcEncoderIntfcProxy::NewL
|
sl@0
|
71 |
* Two-phased constructor.
|
sl@0
|
72 |
*/
|
sl@0
|
73 |
EXPORT_C CSbcEncoderIntfcProxy* CSbcEncoderIntfcProxy::NewL(
|
sl@0
|
74 |
TMMFMessageDestinationPckg aMessageHandler,
|
sl@0
|
75 |
MCustomCommand& aCustomCommand,
|
sl@0
|
76 |
CCustomInterfaceUtility* aCustomInterfaceUtility)
|
sl@0
|
77 |
{
|
sl@0
|
78 |
CSbcEncoderIntfcProxy* self = new(ELeave) CSbcEncoderIntfcProxy(
|
sl@0
|
79 |
aMessageHandler,
|
sl@0
|
80 |
aCustomCommand,
|
sl@0
|
81 |
aCustomInterfaceUtility);
|
sl@0
|
82 |
CleanupStack::PushL( self );
|
sl@0
|
83 |
self->ConstructL();
|
sl@0
|
84 |
CleanupStack::Pop( self );
|
sl@0
|
85 |
return self;
|
sl@0
|
86 |
}
|
sl@0
|
87 |
|
sl@0
|
88 |
/**
|
sl@0
|
89 |
* Destructor
|
sl@0
|
90 |
*/
|
sl@0
|
91 |
EXPORT_C CSbcEncoderIntfcProxy::~CSbcEncoderIntfcProxy()
|
sl@0
|
92 |
{
|
sl@0
|
93 |
iCustomInterfaceUtility->RemoveCustomInterface(iMessageHandler);
|
sl@0
|
94 |
delete iCustomInterfaceUtility;
|
sl@0
|
95 |
}
|
sl@0
|
96 |
|
sl@0
|
97 |
/**
|
sl@0
|
98 |
* CSbcEncoderIntfcProxy::GetSupportedSamplingFrequencies
|
sl@0
|
99 |
* Returns an array of supported sampling frequencies.
|
sl@0
|
100 |
* Calls a subfunction, which sends the appropriate custom command
|
sl@0
|
101 |
* to its message handler. A subfunction is used to contain multiple
|
sl@0
|
102 |
* leaving functions in a single trap.
|
sl@0
|
103 |
* (other items were commented in a header).
|
sl@0
|
104 |
*/
|
sl@0
|
105 |
EXPORT_C TInt CSbcEncoderIntfcProxy::GetSupportedSamplingFrequencies(
|
sl@0
|
106 |
RArray<TUint>&
|
sl@0
|
107 |
aSupportedSamplingFrequencies)
|
sl@0
|
108 |
{
|
sl@0
|
109 |
TRAPD(status,
|
sl@0
|
110 |
GetSupportedSamplingFrequenciesL(aSupportedSamplingFrequencies));
|
sl@0
|
111 |
return status;
|
sl@0
|
112 |
}
|
sl@0
|
113 |
|
sl@0
|
114 |
/**
|
sl@0
|
115 |
* CSbcEncoderIntfcProxy::GetSupportedSamplingFrequenciesL
|
sl@0
|
116 |
* Returns an array of supported sampling frequencies.
|
sl@0
|
117 |
* Sends the custom command for this function to its message handler. This
|
sl@0
|
118 |
* requires two commands. The first is a request for the number of supported
|
sl@0
|
119 |
* sampling frequencies. A buffer is allocated locally to hold this number of
|
sl@0
|
120 |
* frequencies that will be returned. A pointer to this buffer is sent with the
|
sl@0
|
121 |
* next command, which is a request for the frequencies. This buffer will be
|
sl@0
|
122 |
* filled with the frequency values. These values are then copied into the
|
sl@0
|
123 |
* array provided to this function and the local buffer is deleted.
|
sl@0
|
124 |
* (other items were commented in a header).
|
sl@0
|
125 |
*/
|
sl@0
|
126 |
void CSbcEncoderIntfcProxy::GetSupportedSamplingFrequenciesL(
|
sl@0
|
127 |
RArray<TUint>& aSupportedSamplingFrequencies)
|
sl@0
|
128 |
{
|
sl@0
|
129 |
aSupportedSamplingFrequencies.Reset();
|
sl@0
|
130 |
|
sl@0
|
131 |
TPckgBuf<TUint> pckgBuf;
|
sl@0
|
132 |
User::LeaveIfError(iCustomCommand.CustomCommandSync(
|
sl@0
|
133 |
iMessageHandler,
|
sl@0
|
134 |
ESbceimGetNumOfSupportedSamplingFrequencies,
|
sl@0
|
135 |
KNullDesC8,
|
sl@0
|
136 |
KNullDesC8,
|
sl@0
|
137 |
pckgBuf));
|
sl@0
|
138 |
|
sl@0
|
139 |
HBufC8* buf = HBufC8::NewLC(pckgBuf() * sizeof(TUint));
|
sl@0
|
140 |
TPtr8 ptr = buf->Des();
|
sl@0
|
141 |
|
sl@0
|
142 |
User::LeaveIfError(iCustomCommand.CustomCommandSync(
|
sl@0
|
143 |
iMessageHandler,
|
sl@0
|
144 |
ESbceimGetSupportedSamplingFrequencies,
|
sl@0
|
145 |
KNullDesC8,
|
sl@0
|
146 |
KNullDesC8,
|
sl@0
|
147 |
ptr));
|
sl@0
|
148 |
|
sl@0
|
149 |
PopulateArrayL(aSupportedSamplingFrequencies, ptr, pckgBuf());
|
sl@0
|
150 |
CleanupStack::PopAndDestroy(buf);
|
sl@0
|
151 |
}
|
sl@0
|
152 |
|
sl@0
|
153 |
/**
|
sl@0
|
154 |
* CSbcEncoderIntfcProxy::GetSupportedChannelModes
|
sl@0
|
155 |
* Returns an array of supported channel modes.
|
sl@0
|
156 |
* Calls a subfunction which sends the appropriate custom command to its
|
sl@0
|
157 |
* message handler. A subfunction is used to contain multiple leaving
|
sl@0
|
158 |
* functions for a single trap.
|
sl@0
|
159 |
* (other items were commented in a header).
|
sl@0
|
160 |
*/
|
sl@0
|
161 |
EXPORT_C TInt CSbcEncoderIntfcProxy::GetSupportedChannelModes(
|
sl@0
|
162 |
RArray<TSbcChannelMode>&
|
sl@0
|
163 |
aSupportedChannelModes)
|
sl@0
|
164 |
{
|
sl@0
|
165 |
TRAPD(status, GetSupportedChannelModesL(aSupportedChannelModes));
|
sl@0
|
166 |
return status;
|
sl@0
|
167 |
}
|
sl@0
|
168 |
|
sl@0
|
169 |
/**
|
sl@0
|
170 |
* CSbcEncoderIntfcProxy::GetSupportedChannelModesL
|
sl@0
|
171 |
* Returns an array of supported channel modes.
|
sl@0
|
172 |
* Sends the custom command for this function to its message handler. This
|
sl@0
|
173 |
* requires two commands. The first is a request for the number of supported
|
sl@0
|
174 |
* channel modes. A buffer is allocated locally to hold this number of channel
|
sl@0
|
175 |
* modes that will be returned. A pointer to this buffer is sent with the next
|
sl@0
|
176 |
* command, which is a request for the channel modes. This buffer will be
|
sl@0
|
177 |
* filled with the frequency values. These values are then copied into the array
|
sl@0
|
178 |
* provided to this function and the local buffer is deleted.
|
sl@0
|
179 |
* (other items were commented in a header).
|
sl@0
|
180 |
*/
|
sl@0
|
181 |
void CSbcEncoderIntfcProxy::GetSupportedChannelModesL(
|
sl@0
|
182 |
RArray<TSbcChannelMode>& aSupportedChannelModes)
|
sl@0
|
183 |
{
|
sl@0
|
184 |
aSupportedChannelModes.Reset();
|
sl@0
|
185 |
|
sl@0
|
186 |
TPckgBuf<TSbcChannelMode> pckgBuf;
|
sl@0
|
187 |
User::LeaveIfError(iCustomCommand.CustomCommandSync(
|
sl@0
|
188 |
iMessageHandler,
|
sl@0
|
189 |
ESbceimGetNumOfSupportedChannelModes,
|
sl@0
|
190 |
KNullDesC8,
|
sl@0
|
191 |
KNullDesC8,
|
sl@0
|
192 |
pckgBuf));
|
sl@0
|
193 |
|
sl@0
|
194 |
HBufC8* buf = HBufC8::NewLC(pckgBuf() * sizeof(TUint));
|
sl@0
|
195 |
TPtr8 ptr = buf->Des();
|
sl@0
|
196 |
User::LeaveIfError(iCustomCommand.CustomCommandSync(
|
sl@0
|
197 |
iMessageHandler,
|
sl@0
|
198 |
ESbceimGetSupportedChannelModes,
|
sl@0
|
199 |
KNullDesC8,
|
sl@0
|
200 |
KNullDesC8,
|
sl@0
|
201 |
ptr));
|
sl@0
|
202 |
|
sl@0
|
203 |
RDesReadStream stream(ptr);
|
sl@0
|
204 |
CleanupClosePushL(stream);
|
sl@0
|
205 |
|
sl@0
|
206 |
for (TInt i = 0; i < pckgBuf(); i++)
|
sl@0
|
207 |
{
|
sl@0
|
208 |
aSupportedChannelModes.AppendL(
|
sl@0
|
209 |
static_cast<TSbcChannelMode>(stream.ReadUint32L()));
|
sl@0
|
210 |
}
|
sl@0
|
211 |
|
sl@0
|
212 |
CleanupStack::PopAndDestroy(&stream);
|
sl@0
|
213 |
CleanupStack::PopAndDestroy(buf);
|
sl@0
|
214 |
}
|
sl@0
|
215 |
|
sl@0
|
216 |
/**
|
sl@0
|
217 |
* CSbcEncoderIntfcProxy::GetSupportedNumOfBlocks
|
sl@0
|
218 |
* Returns an array of supported blocks.
|
sl@0
|
219 |
* Calls a subfunction, which sends the appropriate custom command to its
|
sl@0
|
220 |
* message handler. A subfunction is used to contain multiple leaving functions
|
sl@0
|
221 |
* for a single trap.
|
sl@0
|
222 |
* (other items were commented in a header).
|
sl@0
|
223 |
*/
|
sl@0
|
224 |
EXPORT_C TInt CSbcEncoderIntfcProxy::GetSupportedNumOfBlocks(
|
sl@0
|
225 |
RArray<TUint>& aSupportedNumOfBlocks)
|
sl@0
|
226 |
{
|
sl@0
|
227 |
TRAPD(status, GetSupportedNumOfBlocksL(aSupportedNumOfBlocks));
|
sl@0
|
228 |
return status;
|
sl@0
|
229 |
}
|
sl@0
|
230 |
|
sl@0
|
231 |
/**
|
sl@0
|
232 |
* CSbcEncoderIntfcProxy::GetSupportedNumOfBlocks
|
sl@0
|
233 |
* Returns an array of supported blocks.
|
sl@0
|
234 |
* Sends the custom command for this function to its message handler. This
|
sl@0
|
235 |
* requires two commands. The first is a request for the number of supported
|
sl@0
|
236 |
* blocks. A buffer is allocated locally to hold this number of blocks that
|
sl@0
|
237 |
* will be returned. A pointer to this buffer is then sent with the next
|
sl@0
|
238 |
* command, which is a request for the blocks. This buffer will be filled
|
sl@0
|
239 |
* with the block values. These values are then copied into the array provided
|
sl@0
|
240 |
* to this function and the local buffer is deleted.
|
sl@0
|
241 |
* (other items were commented in a header).
|
sl@0
|
242 |
*/
|
sl@0
|
243 |
void CSbcEncoderIntfcProxy::GetSupportedNumOfBlocksL(
|
sl@0
|
244 |
RArray<TUint>& aSupportedNumOfBlocks)
|
sl@0
|
245 |
{
|
sl@0
|
246 |
aSupportedNumOfBlocks.Reset();
|
sl@0
|
247 |
|
sl@0
|
248 |
TPckgBuf<TUint> pckgBuf;
|
sl@0
|
249 |
User::LeaveIfError(iCustomCommand.CustomCommandSync(
|
sl@0
|
250 |
iMessageHandler,
|
sl@0
|
251 |
ESbceimGetNumOfSupportedBlocks,
|
sl@0
|
252 |
KNullDesC8,
|
sl@0
|
253 |
KNullDesC8,
|
sl@0
|
254 |
pckgBuf));
|
sl@0
|
255 |
|
sl@0
|
256 |
HBufC8* buf = HBufC8::NewLC(pckgBuf() * sizeof(TUint));
|
sl@0
|
257 |
TPtr8 ptr = buf->Des();
|
sl@0
|
258 |
User::LeaveIfError(iCustomCommand.CustomCommandSync(
|
sl@0
|
259 |
iMessageHandler,
|
sl@0
|
260 |
ESbceimGetSupportedBlocks,
|
sl@0
|
261 |
KNullDesC8,
|
sl@0
|
262 |
KNullDesC8,
|
sl@0
|
263 |
ptr));
|
sl@0
|
264 |
|
sl@0
|
265 |
PopulateArrayL(aSupportedNumOfBlocks, ptr, pckgBuf());
|
sl@0
|
266 |
CleanupStack::PopAndDestroy(buf);
|
sl@0
|
267 |
}
|
sl@0
|
268 |
|
sl@0
|
269 |
/**
|
sl@0
|
270 |
* CSbcEncoderIntfcProxy::GetSupportedNumOfSubbands
|
sl@0
|
271 |
* Returns an array of supported subbands.
|
sl@0
|
272 |
* Calls a subfunction which sends the appropriate custom command to its
|
sl@0
|
273 |
* message handler. A subfunction is used to contain multiple leaving functions
|
sl@0
|
274 |
* for a single trap.
|
sl@0
|
275 |
* (other items were commented in a header).
|
sl@0
|
276 |
*/
|
sl@0
|
277 |
EXPORT_C TInt CSbcEncoderIntfcProxy::GetSupportedNumOfSubbands(
|
sl@0
|
278 |
RArray<TUint>& aSupportedNumOfSubbands)
|
sl@0
|
279 |
{
|
sl@0
|
280 |
TRAPD(status, GetSupportedNumOfSubbandsL(aSupportedNumOfSubbands));
|
sl@0
|
281 |
return status;
|
sl@0
|
282 |
}
|
sl@0
|
283 |
|
sl@0
|
284 |
/**
|
sl@0
|
285 |
* CSbcEncoderIntfcProxy::GetSupportedNumOfSubbandsL
|
sl@0
|
286 |
* Returns an array of supported subbands.
|
sl@0
|
287 |
* Sends the custom command for this function to its message handler. This
|
sl@0
|
288 |
* requires two commands. The first is a request for the number of supported
|
sl@0
|
289 |
* subbands. A buffer is allocated locally to hold this number of subbands that
|
sl@0
|
290 |
* will be returned. A pointer to this buffer is sent with the next command,
|
sl@0
|
291 |
* which is a request for the subbands. This buffer will be filled with the
|
sl@0
|
292 |
* subband values. These values are then copied into the array provided to this
|
sl@0
|
293 |
* function and the local buffer is deleted.
|
sl@0
|
294 |
* (other items were commented in a header).
|
sl@0
|
295 |
*/
|
sl@0
|
296 |
void CSbcEncoderIntfcProxy::GetSupportedNumOfSubbandsL(
|
sl@0
|
297 |
RArray<TUint>& aSupportedNumOfSubbands)
|
sl@0
|
298 |
{
|
sl@0
|
299 |
aSupportedNumOfSubbands.Reset();
|
sl@0
|
300 |
|
sl@0
|
301 |
TPckgBuf<TUint> pckgBuf;
|
sl@0
|
302 |
User::LeaveIfError(iCustomCommand.CustomCommandSync(
|
sl@0
|
303 |
iMessageHandler,
|
sl@0
|
304 |
ESbceimGetNumOfSupportedNumOfSubbands,
|
sl@0
|
305 |
KNullDesC8,
|
sl@0
|
306 |
KNullDesC8,
|
sl@0
|
307 |
pckgBuf));
|
sl@0
|
308 |
|
sl@0
|
309 |
HBufC8* buf = HBufC8::NewLC(pckgBuf() * sizeof(TUint));
|
sl@0
|
310 |
TPtr8 ptr = buf->Des();
|
sl@0
|
311 |
User::LeaveIfError(iCustomCommand.CustomCommandSync(
|
sl@0
|
312 |
iMessageHandler,
|
sl@0
|
313 |
ESbceimGetSupportedNumOfSubbands,
|
sl@0
|
314 |
KNullDesC8,
|
sl@0
|
315 |
KNullDesC8,
|
sl@0
|
316 |
ptr));
|
sl@0
|
317 |
|
sl@0
|
318 |
PopulateArrayL(aSupportedNumOfSubbands, ptr, pckgBuf());
|
sl@0
|
319 |
CleanupStack::PopAndDestroy(buf);
|
sl@0
|
320 |
}
|
sl@0
|
321 |
|
sl@0
|
322 |
/**
|
sl@0
|
323 |
* CSbcEncoderIntfcProxy::GetSupportedAllocationMethods
|
sl@0
|
324 |
* Returns an array of supported allocation methods.
|
sl@0
|
325 |
* Calls a subfunction which sends the appropriate custom command to its
|
sl@0
|
326 |
* message handler. A subfunction is used to contain multiple leaving
|
sl@0
|
327 |
* functions for a single trap.
|
sl@0
|
328 |
* (other items were commented in a header).
|
sl@0
|
329 |
*/
|
sl@0
|
330 |
EXPORT_C TInt CSbcEncoderIntfcProxy::GetSupportedAllocationMethods(
|
sl@0
|
331 |
RArray<TSbcAllocationMethod>&
|
sl@0
|
332 |
aSupportedAllocationMethods)
|
sl@0
|
333 |
{
|
sl@0
|
334 |
TRAPD(status, GetSupportedAllocationMethodsL(aSupportedAllocationMethods));
|
sl@0
|
335 |
return status;
|
sl@0
|
336 |
}
|
sl@0
|
337 |
|
sl@0
|
338 |
/**
|
sl@0
|
339 |
* CSbcEncoderIntfcProxy::GetSupportedAllocationMethodsL
|
sl@0
|
340 |
* Returns an array of supported allocation methods.
|
sl@0
|
341 |
* Sends the custom command for this function to its message handler. This
|
sl@0
|
342 |
* requires two commands. The first is a request for the number of supported
|
sl@0
|
343 |
* allocation methods. A buffer is allocated locally to hold this number of
|
sl@0
|
344 |
* allocation methods that will be returned. A pointer to this buffer is sent
|
sl@0
|
345 |
* with the next command which is a request for the allocation methods. This
|
sl@0
|
346 |
* buffer will be filled with the allocation method values. These values are
|
sl@0
|
347 |
* then copied into the array provided to this function and the local buffer
|
sl@0
|
348 |
* is deleted.
|
sl@0
|
349 |
* (other items were commented in a header).
|
sl@0
|
350 |
*/
|
sl@0
|
351 |
void CSbcEncoderIntfcProxy::GetSupportedAllocationMethodsL(
|
sl@0
|
352 |
RArray<TSbcAllocationMethod>&
|
sl@0
|
353 |
aSupportedAllocationMethods)
|
sl@0
|
354 |
{
|
sl@0
|
355 |
aSupportedAllocationMethods.Reset();
|
sl@0
|
356 |
|
sl@0
|
357 |
TPckgBuf<TSbcAllocationMethod> pckgBuf;
|
sl@0
|
358 |
User::LeaveIfError(iCustomCommand.CustomCommandSync(
|
sl@0
|
359 |
iMessageHandler,
|
sl@0
|
360 |
ESbceimGetNumOfSupportedAllocationMethods,
|
sl@0
|
361 |
KNullDesC8,
|
sl@0
|
362 |
KNullDesC8,
|
sl@0
|
363 |
pckgBuf));
|
sl@0
|
364 |
|
sl@0
|
365 |
HBufC8* buf = HBufC8::NewLC(pckgBuf() * sizeof(TUint));
|
sl@0
|
366 |
TPtr8 ptr = buf->Des();
|
sl@0
|
367 |
User::LeaveIfError(iCustomCommand.CustomCommandSync(
|
sl@0
|
368 |
iMessageHandler,
|
sl@0
|
369 |
ESbceimGetSupportedAllocationMethods,
|
sl@0
|
370 |
KNullDesC8,
|
sl@0
|
371 |
KNullDesC8,
|
sl@0
|
372 |
ptr));
|
sl@0
|
373 |
|
sl@0
|
374 |
RDesReadStream stream(ptr);
|
sl@0
|
375 |
CleanupClosePushL(stream);
|
sl@0
|
376 |
|
sl@0
|
377 |
for (TInt i = 0; i < pckgBuf(); i++)
|
sl@0
|
378 |
{
|
sl@0
|
379 |
aSupportedAllocationMethods.AppendL(
|
sl@0
|
380 |
static_cast<TSbcAllocationMethod>(stream.ReadUint32L()));
|
sl@0
|
381 |
}
|
sl@0
|
382 |
|
sl@0
|
383 |
CleanupStack::PopAndDestroy(&stream);
|
sl@0
|
384 |
CleanupStack::PopAndDestroy(buf);
|
sl@0
|
385 |
}
|
sl@0
|
386 |
|
sl@0
|
387 |
/**
|
sl@0
|
388 |
* CSbcEncoderIntfcProxy::GetSupportedBitpoolRange
|
sl@0
|
389 |
* Returns supported bitpool range.
|
sl@0
|
390 |
* Calls a subfunction which sends the appropriate custom command to its
|
sl@0
|
391 |
* message handler. A subfunction is used to contain multiple leaving
|
sl@0
|
392 |
* functions for a single trap.
|
sl@0
|
393 |
* (other items were commented in a header).
|
sl@0
|
394 |
*/
|
sl@0
|
395 |
EXPORT_C TInt CSbcEncoderIntfcProxy::GetSupportedBitpoolRange(
|
sl@0
|
396 |
TUint& aMinSupportedBitpoolSize,
|
sl@0
|
397 |
TUint& aMaxSupportedBitpoolSize)
|
sl@0
|
398 |
{
|
sl@0
|
399 |
TRAPD(status, GetSupportedBitpoolRangeL(aMinSupportedBitpoolSize,
|
sl@0
|
400 |
aMaxSupportedBitpoolSize));
|
sl@0
|
401 |
return status;
|
sl@0
|
402 |
}
|
sl@0
|
403 |
|
sl@0
|
404 |
/**
|
sl@0
|
405 |
* CSbcEncoderIntfcProxy::GetSupportedBitpoolRangeL
|
sl@0
|
406 |
* Returns an array of supported bitpool range.
|
sl@0
|
407 |
* Sends the custom command for this function to its message handler with TUint
|
sl@0
|
408 |
* type arguments that will be filled with the bitpool min and max values.
|
sl@0
|
409 |
* (other items were commented in a header).
|
sl@0
|
410 |
*/
|
sl@0
|
411 |
void CSbcEncoderIntfcProxy::GetSupportedBitpoolRangeL(
|
sl@0
|
412 |
TUint& aMinSupportedBitpoolSize,
|
sl@0
|
413 |
TUint& aMaxSupportedBitpoolSize)
|
sl@0
|
414 |
{
|
sl@0
|
415 |
TSbcEncoderBitpoolRange bitPoolRange;
|
sl@0
|
416 |
bitPoolRange.iMinSupportedBitpoolSize = 0;
|
sl@0
|
417 |
bitPoolRange.iMaxSupportedBitpoolSize = 0;
|
sl@0
|
418 |
|
sl@0
|
419 |
TPckgBuf<TSbcEncoderBitpoolRange> pckgBuf(bitPoolRange);
|
sl@0
|
420 |
User::LeaveIfError(iCustomCommand.CustomCommandSync(
|
sl@0
|
421 |
iMessageHandler,
|
sl@0
|
422 |
ESbceimGetSupportedBitpoolRange,
|
sl@0
|
423 |
KNullDesC8,
|
sl@0
|
424 |
KNullDesC8,
|
sl@0
|
425 |
pckgBuf));
|
sl@0
|
426 |
|
sl@0
|
427 |
aMinSupportedBitpoolSize = pckgBuf().iMinSupportedBitpoolSize;
|
sl@0
|
428 |
aMaxSupportedBitpoolSize = pckgBuf().iMaxSupportedBitpoolSize;
|
sl@0
|
429 |
}
|
sl@0
|
430 |
|
sl@0
|
431 |
/*
|
sl@0
|
432 |
* CSbcEncoderIntfcProxy::ApplyConfig
|
sl@0
|
433 |
* Commits encoder configuration settings configured by callas to Set() APIs.
|
sl@0
|
434 |
* Sends the custom command for this function to its message handler.
|
sl@0
|
435 |
* New settings will not take effect until ApplyConfig() is called.
|
sl@0
|
436 |
* (other items were commented in a header).
|
sl@0
|
437 |
*/
|
sl@0
|
438 |
EXPORT_C TInt CSbcEncoderIntfcProxy::ApplyConfig()
|
sl@0
|
439 |
{
|
sl@0
|
440 |
TInt status = KErrNone;
|
sl@0
|
441 |
|
sl@0
|
442 |
if (!iHasBeenApplied)
|
sl@0
|
443 |
{
|
sl@0
|
444 |
if (!iSbcEncConf.iSamplingFrequencySet ||
|
sl@0
|
445 |
!iSbcEncConf.iChannelModeSet ||
|
sl@0
|
446 |
!iSbcEncConf.iNumOfSubbandsSet ||
|
sl@0
|
447 |
!iSbcEncConf.iNumOfBlocksSet ||
|
sl@0
|
448 |
!iSbcEncConf.iAllocationMethodSet ||
|
sl@0
|
449 |
!iSbcEncConf.iBitpoolSizeSet)
|
sl@0
|
450 |
{
|
sl@0
|
451 |
status = KErrArgument;
|
sl@0
|
452 |
}
|
sl@0
|
453 |
}
|
sl@0
|
454 |
|
sl@0
|
455 |
if (status == KErrNone)
|
sl@0
|
456 |
{
|
sl@0
|
457 |
TSbcEncoderConfig sbcEncoderConfig;
|
sl@0
|
458 |
|
sl@0
|
459 |
sbcEncoderConfig.iSamplingFrequency = iSbcEncConf.iSamplingFrequency;
|
sl@0
|
460 |
sbcEncoderConfig.iChannelMode = iSbcEncConf.iChannelMode;
|
sl@0
|
461 |
sbcEncoderConfig.iNumOfSubbands = iSbcEncConf.iNumOfSubbands;
|
sl@0
|
462 |
sbcEncoderConfig.iNumOfBlocks = iSbcEncConf.iNumOfBlocks;
|
sl@0
|
463 |
sbcEncoderConfig.iAllocationMethod = iSbcEncConf.iAllocationMethod;
|
sl@0
|
464 |
sbcEncoderConfig.iBitpoolSize = iSbcEncConf.iBitpoolSize;
|
sl@0
|
465 |
|
sl@0
|
466 |
TPckgBuf<TSbcEncoderConfig> pckgBuf(sbcEncoderConfig);
|
sl@0
|
467 |
status = iCustomCommand.CustomCommandSync(iMessageHandler,
|
sl@0
|
468 |
ESbceimApplyConfig,
|
sl@0
|
469 |
pckgBuf,
|
sl@0
|
470 |
KNullDesC8);
|
sl@0
|
471 |
if (status == KErrNone)
|
sl@0
|
472 |
{
|
sl@0
|
473 |
iSbcEncConfCurrent = iSbcEncConf;
|
sl@0
|
474 |
iHasBeenApplied = ETrue;
|
sl@0
|
475 |
}
|
sl@0
|
476 |
}
|
sl@0
|
477 |
|
sl@0
|
478 |
return status;
|
sl@0
|
479 |
}
|
sl@0
|
480 |
|
sl@0
|
481 |
/**
|
sl@0
|
482 |
* CSbcEncoderIntfcProxy::SetSamplingFrequency
|
sl@0
|
483 |
* Saves locally requested sampling frequency.
|
sl@0
|
484 |
* Change does not apply to the encoder until ApplyConfig() is called.
|
sl@0
|
485 |
* (other items were commented in a header).
|
sl@0
|
486 |
*/
|
sl@0
|
487 |
EXPORT_C void CSbcEncoderIntfcProxy::SetSamplingFrequency(
|
sl@0
|
488 |
TUint aSamplingFrequency)
|
sl@0
|
489 |
{
|
sl@0
|
490 |
iSbcEncConf.iSamplingFrequency = aSamplingFrequency;
|
sl@0
|
491 |
iSbcEncConf.iSamplingFrequencySet = ETrue;
|
sl@0
|
492 |
}
|
sl@0
|
493 |
|
sl@0
|
494 |
/**
|
sl@0
|
495 |
* CSbcEncoderIntfcProxy::GetSamplingFrequency
|
sl@0
|
496 |
* Returns current sampling frequency commited by call to ApplyConfig().
|
sl@0
|
497 |
* (other items were commented in a header).
|
sl@0
|
498 |
*/
|
sl@0
|
499 |
EXPORT_C TInt CSbcEncoderIntfcProxy::GetSamplingFrequency(
|
sl@0
|
500 |
TUint& aSamplingFrequency)
|
sl@0
|
501 |
{
|
sl@0
|
502 |
TInt status = KErrNone;
|
sl@0
|
503 |
|
sl@0
|
504 |
if (iHasBeenApplied)
|
sl@0
|
505 |
{
|
sl@0
|
506 |
aSamplingFrequency = iSbcEncConfCurrent.iSamplingFrequency;
|
sl@0
|
507 |
}
|
sl@0
|
508 |
else
|
sl@0
|
509 |
{
|
sl@0
|
510 |
status = KErrArgument;
|
sl@0
|
511 |
}
|
sl@0
|
512 |
|
sl@0
|
513 |
return status;
|
sl@0
|
514 |
}
|
sl@0
|
515 |
|
sl@0
|
516 |
/**
|
sl@0
|
517 |
* CSbcEncoderIntfcProxy::SetChannelMode
|
sl@0
|
518 |
* Saves locally requested channel mode.
|
sl@0
|
519 |
* Change does not apply to the encoder until ApplyConfig() is called.
|
sl@0
|
520 |
* (other items were commented in a header).
|
sl@0
|
521 |
*/
|
sl@0
|
522 |
EXPORT_C void CSbcEncoderIntfcProxy::SetChannelMode(
|
sl@0
|
523 |
TSbcChannelMode aChannelMode)
|
sl@0
|
524 |
{
|
sl@0
|
525 |
iSbcEncConf.iChannelMode = aChannelMode;
|
sl@0
|
526 |
iSbcEncConf.iChannelModeSet = ETrue;
|
sl@0
|
527 |
}
|
sl@0
|
528 |
|
sl@0
|
529 |
/**
|
sl@0
|
530 |
* CSbcEncoderIntfcProxy::GetChannelMode
|
sl@0
|
531 |
* Returns current channel mode commited by call to ApplyConfig().
|
sl@0
|
532 |
* (other items were commented in a header).
|
sl@0
|
533 |
*/
|
sl@0
|
534 |
EXPORT_C TInt CSbcEncoderIntfcProxy::GetChannelMode(
|
sl@0
|
535 |
TSbcChannelMode& aChannelMode)
|
sl@0
|
536 |
{
|
sl@0
|
537 |
TInt status = KErrNone;
|
sl@0
|
538 |
|
sl@0
|
539 |
if (iHasBeenApplied)
|
sl@0
|
540 |
{
|
sl@0
|
541 |
aChannelMode = iSbcEncConfCurrent.iChannelMode;
|
sl@0
|
542 |
}
|
sl@0
|
543 |
else
|
sl@0
|
544 |
{
|
sl@0
|
545 |
status = KErrArgument;
|
sl@0
|
546 |
}
|
sl@0
|
547 |
|
sl@0
|
548 |
return status;
|
sl@0
|
549 |
}
|
sl@0
|
550 |
|
sl@0
|
551 |
/**
|
sl@0
|
552 |
* CSbcEncoderIntfcProxy::SetNumOfSubbands
|
sl@0
|
553 |
* Saves locally requested number of subbands.
|
sl@0
|
554 |
* Change does not apply to the encoder until ApplyConfig() is called.
|
sl@0
|
555 |
* (other items were commented in a header).
|
sl@0
|
556 |
*/
|
sl@0
|
557 |
EXPORT_C void CSbcEncoderIntfcProxy::SetNumOfSubbands(TUint aNumOfSubbands)
|
sl@0
|
558 |
{
|
sl@0
|
559 |
iSbcEncConf.iNumOfSubbands = aNumOfSubbands;
|
sl@0
|
560 |
iSbcEncConf.iNumOfSubbandsSet = ETrue;
|
sl@0
|
561 |
}
|
sl@0
|
562 |
|
sl@0
|
563 |
/**
|
sl@0
|
564 |
* CSbcEncoderIntfcProxy::GetNumOfSubbands
|
sl@0
|
565 |
* Returns current number of subbands commited by call to ApplyConfig().
|
sl@0
|
566 |
* (other items were commented in a header).
|
sl@0
|
567 |
*/
|
sl@0
|
568 |
EXPORT_C TInt CSbcEncoderIntfcProxy::GetNumOfSubbands(TUint& aNumOfSubbands)
|
sl@0
|
569 |
{
|
sl@0
|
570 |
TInt status = KErrNone;
|
sl@0
|
571 |
|
sl@0
|
572 |
if (iHasBeenApplied)
|
sl@0
|
573 |
{
|
sl@0
|
574 |
aNumOfSubbands = iSbcEncConfCurrent.iNumOfSubbands;
|
sl@0
|
575 |
}
|
sl@0
|
576 |
else
|
sl@0
|
577 |
{
|
sl@0
|
578 |
status = KErrArgument;
|
sl@0
|
579 |
}
|
sl@0
|
580 |
|
sl@0
|
581 |
return status;
|
sl@0
|
582 |
}
|
sl@0
|
583 |
|
sl@0
|
584 |
/**
|
sl@0
|
585 |
* CSbcEncoderIntfcProxy::SetNumOfBlocks
|
sl@0
|
586 |
* Saves locally requested number of blocks.
|
sl@0
|
587 |
* Change does not apply to the encoder until ApplyConfig() is called.
|
sl@0
|
588 |
* (other items were commented in a header).
|
sl@0
|
589 |
*/
|
sl@0
|
590 |
EXPORT_C void CSbcEncoderIntfcProxy::SetNumOfBlocks(TUint aNumOfBlocks)
|
sl@0
|
591 |
{
|
sl@0
|
592 |
iSbcEncConf.iNumOfBlocks = aNumOfBlocks;
|
sl@0
|
593 |
iSbcEncConf.iNumOfBlocksSet = ETrue;
|
sl@0
|
594 |
}
|
sl@0
|
595 |
|
sl@0
|
596 |
/**
|
sl@0
|
597 |
* CSbcEncoderIntfcProxy::GetNumOfBlocks
|
sl@0
|
598 |
* Returns current number of blocks commited by call to ApplyConfig().
|
sl@0
|
599 |
* (other items were commented in a header).
|
sl@0
|
600 |
*/
|
sl@0
|
601 |
EXPORT_C TInt CSbcEncoderIntfcProxy::GetNumOfBlocks(TUint& aNumOfBlocks)
|
sl@0
|
602 |
{
|
sl@0
|
603 |
TInt status = KErrNone;
|
sl@0
|
604 |
|
sl@0
|
605 |
if (iHasBeenApplied)
|
sl@0
|
606 |
{
|
sl@0
|
607 |
aNumOfBlocks = iSbcEncConfCurrent.iNumOfBlocks;
|
sl@0
|
608 |
}
|
sl@0
|
609 |
else
|
sl@0
|
610 |
{
|
sl@0
|
611 |
status = KErrArgument;
|
sl@0
|
612 |
}
|
sl@0
|
613 |
|
sl@0
|
614 |
return status;
|
sl@0
|
615 |
}
|
sl@0
|
616 |
|
sl@0
|
617 |
/**
|
sl@0
|
618 |
* CSbcEncoderIntfcProxy::SetAllocationMethod
|
sl@0
|
619 |
* Saves locally requested allocation method.
|
sl@0
|
620 |
* Change does not apply to the encoder until ApplyConfig() is called.
|
sl@0
|
621 |
* (other items were commented in a header).
|
sl@0
|
622 |
*/
|
sl@0
|
623 |
EXPORT_C void CSbcEncoderIntfcProxy::SetAllocationMethod(
|
sl@0
|
624 |
TSbcAllocationMethod aAllocationMethod)
|
sl@0
|
625 |
{
|
sl@0
|
626 |
iSbcEncConf.iAllocationMethod = aAllocationMethod;
|
sl@0
|
627 |
iSbcEncConf.iAllocationMethodSet = ETrue;
|
sl@0
|
628 |
}
|
sl@0
|
629 |
|
sl@0
|
630 |
/**
|
sl@0
|
631 |
* CSbcEncoderIntfcProxy::GetAllocationMethod
|
sl@0
|
632 |
* Returns current allocation method commited by call to ApplyConfig().
|
sl@0
|
633 |
* (other items were commented in a header).
|
sl@0
|
634 |
*/
|
sl@0
|
635 |
EXPORT_C TInt CSbcEncoderIntfcProxy::GetAllocationMethod(
|
sl@0
|
636 |
TSbcAllocationMethod& aAllocationMethod)
|
sl@0
|
637 |
{
|
sl@0
|
638 |
TInt status = KErrNone;
|
sl@0
|
639 |
|
sl@0
|
640 |
if (iHasBeenApplied)
|
sl@0
|
641 |
{
|
sl@0
|
642 |
aAllocationMethod = iSbcEncConfCurrent.iAllocationMethod;
|
sl@0
|
643 |
}
|
sl@0
|
644 |
else
|
sl@0
|
645 |
{
|
sl@0
|
646 |
status = KErrArgument;
|
sl@0
|
647 |
}
|
sl@0
|
648 |
|
sl@0
|
649 |
return status;
|
sl@0
|
650 |
}
|
sl@0
|
651 |
|
sl@0
|
652 |
/**
|
sl@0
|
653 |
* CSbcEncoderIntfcProxy::SetBitpoolSize
|
sl@0
|
654 |
* Saves locally requested bitpool range.
|
sl@0
|
655 |
* Change does not apply to the encoder until ApplyConfig() is called.
|
sl@0
|
656 |
* (other items were commented in a header).
|
sl@0
|
657 |
*/
|
sl@0
|
658 |
EXPORT_C void CSbcEncoderIntfcProxy::SetBitpoolSize(TUint aBitpoolSize)
|
sl@0
|
659 |
{
|
sl@0
|
660 |
iSbcEncConf.iBitpoolSize = aBitpoolSize;
|
sl@0
|
661 |
iSbcEncConf.iBitpoolSizeSet = ETrue;
|
sl@0
|
662 |
}
|
sl@0
|
663 |
|
sl@0
|
664 |
/**
|
sl@0
|
665 |
* CSbcEncoderIntfcProxy::GetBitpoolSize
|
sl@0
|
666 |
* Returns current bitpool range commited by call to ApplyConfig().
|
sl@0
|
667 |
* (other items were commented in a header).
|
sl@0
|
668 |
*/
|
sl@0
|
669 |
EXPORT_C TInt CSbcEncoderIntfcProxy::GetBitpoolSize(TUint& aBitpoolSize)
|
sl@0
|
670 |
{
|
sl@0
|
671 |
TInt status = KErrNone;
|
sl@0
|
672 |
|
sl@0
|
673 |
if (iHasBeenApplied)
|
sl@0
|
674 |
{
|
sl@0
|
675 |
aBitpoolSize = iSbcEncConfCurrent.iBitpoolSize;
|
sl@0
|
676 |
}
|
sl@0
|
677 |
else
|
sl@0
|
678 |
{
|
sl@0
|
679 |
status = KErrArgument;
|
sl@0
|
680 |
}
|
sl@0
|
681 |
|
sl@0
|
682 |
return status;
|
sl@0
|
683 |
}
|
sl@0
|
684 |
|
sl@0
|
685 |
/**
|
sl@0
|
686 |
* CSbcEncoderIntfcProxy::PopulateArrayL
|
sl@0
|
687 |
* Utility method that reads stream from 8-bit descriptor, converts it
|
sl@0
|
688 |
* to TUint data items and then copies them to the aArray.
|
sl@0
|
689 |
* (other items were commented in a header).
|
sl@0
|
690 |
*/
|
sl@0
|
691 |
void CSbcEncoderIntfcProxy::PopulateArrayL(RArray<TUint>& aArray,
|
sl@0
|
692 |
TPtr8 aPtr,
|
sl@0
|
693 |
TUint aCount)
|
sl@0
|
694 |
{
|
sl@0
|
695 |
RDesReadStream stream(aPtr);
|
sl@0
|
696 |
CleanupClosePushL(stream);
|
sl@0
|
697 |
|
sl@0
|
698 |
for (TInt i = 0; i < aCount; i++)
|
sl@0
|
699 |
{
|
sl@0
|
700 |
aArray.AppendL(stream.ReadUint32L());
|
sl@0
|
701 |
}
|
sl@0
|
702 |
|
sl@0
|
703 |
CleanupStack::PopAndDestroy(&stream);
|
sl@0
|
704 |
}
|
sl@0
|
705 |
|
sl@0
|
706 |
// ========================== OTHER EXPORTED FUNCTIONS =========================
|
sl@0
|
707 |
|
sl@0
|
708 |
// End of File
|