sl@0
|
1 |
// Copyright (c) 2007-2010 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 |
|
sl@0
|
17 |
#include <s32mem.h>
|
sl@0
|
18 |
#include "uloggersession.h"
|
sl@0
|
19 |
#include "uloggershared.h"
|
sl@0
|
20 |
#include "uloggerclient.h"
|
sl@0
|
21 |
#include "uloggershared.h"
|
sl@0
|
22 |
#include "uloggertools.h"
|
sl@0
|
23 |
|
sl@0
|
24 |
namespace Ulogger {
|
sl@0
|
25 |
|
sl@0
|
26 |
|
sl@0
|
27 |
CULoggerSession* CULoggerSession::NewL(RThread& aClient, CULoggerServer& aServer)
|
sl@0
|
28 |
{
|
sl@0
|
29 |
CULoggerSession* self = CULoggerSession::NewLC(aClient, aServer);
|
sl@0
|
30 |
CleanupStack::Pop(); //self
|
sl@0
|
31 |
return self;
|
sl@0
|
32 |
}//</NewL>
|
sl@0
|
33 |
|
sl@0
|
34 |
|
sl@0
|
35 |
|
sl@0
|
36 |
|
sl@0
|
37 |
CULoggerSession* CULoggerSession::NewLC(RThread& aClient, CULoggerServer& aServer)
|
sl@0
|
38 |
{
|
sl@0
|
39 |
CULoggerSession* self = new(ELeave) CULoggerSession( aClient, aServer );
|
sl@0
|
40 |
CleanupStack::PushL( self );
|
sl@0
|
41 |
self->ConstructL();
|
sl@0
|
42 |
return self;
|
sl@0
|
43 |
}//</NewLC>
|
sl@0
|
44 |
|
sl@0
|
45 |
|
sl@0
|
46 |
|
sl@0
|
47 |
|
sl@0
|
48 |
void CULoggerSession::ConstructL()
|
sl@0
|
49 |
{
|
sl@0
|
50 |
iServer.IncrementSessions();
|
sl@0
|
51 |
}//</ConstructL>
|
sl@0
|
52 |
|
sl@0
|
53 |
|
sl@0
|
54 |
|
sl@0
|
55 |
CULoggerSession::CULoggerSession(RThread& aClient, CULoggerServer& aServer)
|
sl@0
|
56 |
: CSession2(),
|
sl@0
|
57 |
iServer( aServer ),
|
sl@0
|
58 |
iClient( aClient )
|
sl@0
|
59 |
{
|
sl@0
|
60 |
|
sl@0
|
61 |
}//</constructor>
|
sl@0
|
62 |
|
sl@0
|
63 |
|
sl@0
|
64 |
|
sl@0
|
65 |
CULoggerSession::~CULoggerSession()
|
sl@0
|
66 |
{
|
sl@0
|
67 |
iServer.DecrementSessions();
|
sl@0
|
68 |
}//</destructor>
|
sl@0
|
69 |
|
sl@0
|
70 |
|
sl@0
|
71 |
|
sl@0
|
72 |
|
sl@0
|
73 |
|
sl@0
|
74 |
|
sl@0
|
75 |
/** Process message from 'client' (actually another instance of ourselves)
|
sl@0
|
76 |
*/
|
sl@0
|
77 |
void CULoggerSession::ServiceL(const RMessage2& aMessage)
|
sl@0
|
78 |
{
|
sl@0
|
79 |
TInt error = KErrNone;
|
sl@0
|
80 |
switch(aMessage.Function())
|
sl@0
|
81 |
{
|
sl@0
|
82 |
case ERunAsService:
|
sl@0
|
83 |
{
|
sl@0
|
84 |
iServer.RunAsService(ETrue);
|
sl@0
|
85 |
error = KErrNone;
|
sl@0
|
86 |
}
|
sl@0
|
87 |
break;
|
sl@0
|
88 |
|
sl@0
|
89 |
case EDontRunAsService:
|
sl@0
|
90 |
{
|
sl@0
|
91 |
iServer.RunAsService(EFalse);
|
sl@0
|
92 |
error = KErrNone;
|
sl@0
|
93 |
}
|
sl@0
|
94 |
break;
|
sl@0
|
95 |
|
sl@0
|
96 |
case EStart:
|
sl@0
|
97 |
{
|
sl@0
|
98 |
//Starts the BTrace
|
sl@0
|
99 |
//r= iServer.Start();
|
sl@0
|
100 |
if(!iServer.ServerState())
|
sl@0
|
101 |
error = iServer.RestartOutputting();
|
sl@0
|
102 |
else
|
sl@0
|
103 |
error = KErrInUse;
|
sl@0
|
104 |
}
|
sl@0
|
105 |
break;
|
sl@0
|
106 |
|
sl@0
|
107 |
case EStop:
|
sl@0
|
108 |
{
|
sl@0
|
109 |
//Stops the BTrace
|
sl@0
|
110 |
error = iServer.Stop();
|
sl@0
|
111 |
//iServer.UnconfigureCurrentChannel();
|
sl@0
|
112 |
}
|
sl@0
|
113 |
break;
|
sl@0
|
114 |
|
sl@0
|
115 |
case ERestart:
|
sl@0
|
116 |
{
|
sl@0
|
117 |
error = iServer.RestartOutputting();
|
sl@0
|
118 |
}
|
sl@0
|
119 |
break;
|
sl@0
|
120 |
|
sl@0
|
121 |
case ESetPrimaryFilter:
|
sl@0
|
122 |
{
|
sl@0
|
123 |
//Set filter 1
|
sl@0
|
124 |
RArray<TUint32> filterArray;
|
sl@0
|
125 |
CleanupClosePushL(filterArray);
|
sl@0
|
126 |
|
sl@0
|
127 |
TInt elementsCount = aMessage.Int1();
|
sl@0
|
128 |
if(elementsCount > 0)
|
sl@0
|
129 |
{
|
sl@0
|
130 |
HBufC8* desData = HBufC8::NewLC(elementsCount);
|
sl@0
|
131 |
TPtr8 readPtr(desData->Des());
|
sl@0
|
132 |
aMessage.ReadL(0, readPtr);
|
sl@0
|
133 |
|
sl@0
|
134 |
CArrayFixFlat<TUint8> *array = new (ELeave) CArrayFixFlat<TUint8>(1);
|
sl@0
|
135 |
CleanupStack::PushL(array);
|
sl@0
|
136 |
|
sl@0
|
137 |
TUint8 tmp(1);
|
sl@0
|
138 |
InternalizeFromBufL(readPtr, *array, tmp);
|
sl@0
|
139 |
|
sl@0
|
140 |
for(TInt i(0); i < array->Count(); ++i)
|
sl@0
|
141 |
{
|
sl@0
|
142 |
filterArray.AppendL((TUint32)array->At(i));
|
sl@0
|
143 |
}
|
sl@0
|
144 |
|
sl@0
|
145 |
error = iServer.SetActiveFilterL(filterArray, EPrimaryFilter);
|
sl@0
|
146 |
|
sl@0
|
147 |
CleanupStack::PopAndDestroy(3, &filterArray); // and array, desData
|
sl@0
|
148 |
}
|
sl@0
|
149 |
else
|
sl@0
|
150 |
{
|
sl@0
|
151 |
error = KErrArgument;
|
sl@0
|
152 |
}
|
sl@0
|
153 |
}
|
sl@0
|
154 |
break;
|
sl@0
|
155 |
|
sl@0
|
156 |
case ERemovePrimaryFilter:
|
sl@0
|
157 |
{
|
sl@0
|
158 |
//remove primaryfilters
|
sl@0
|
159 |
TInt elementsCount = aMessage.Int1();
|
sl@0
|
160 |
if(elementsCount > 0)
|
sl@0
|
161 |
{
|
sl@0
|
162 |
RArray<TUint32> filterArray;
|
sl@0
|
163 |
CleanupClosePushL(filterArray);
|
sl@0
|
164 |
HBufC8* desData = HBufC8::NewLC(elementsCount);
|
sl@0
|
165 |
TPtr8 readPtr(desData->Des());
|
sl@0
|
166 |
aMessage.ReadL(0, readPtr);
|
sl@0
|
167 |
|
sl@0
|
168 |
CArrayFixFlat<TUint8> *array = new (ELeave) CArrayFixFlat<TUint8>(1);
|
sl@0
|
169 |
CleanupStack::PushL(array);
|
sl@0
|
170 |
|
sl@0
|
171 |
TUint8 tmp(1);
|
sl@0
|
172 |
InternalizeFromBufL(readPtr, *array, tmp);
|
sl@0
|
173 |
|
sl@0
|
174 |
for(TInt i(0); i < array->Count(); ++i)
|
sl@0
|
175 |
{
|
sl@0
|
176 |
filterArray.AppendL((TUint32)array->At(i));
|
sl@0
|
177 |
}
|
sl@0
|
178 |
|
sl@0
|
179 |
error = iServer.RemoveActiveFilter(filterArray,EPrimaryFilter);
|
sl@0
|
180 |
|
sl@0
|
181 |
CleanupStack::PopAndDestroy(3, &filterArray); // and array, desData
|
sl@0
|
182 |
}
|
sl@0
|
183 |
else
|
sl@0
|
184 |
{
|
sl@0
|
185 |
error = KErrArgument;
|
sl@0
|
186 |
}
|
sl@0
|
187 |
}
|
sl@0
|
188 |
break;
|
sl@0
|
189 |
|
sl@0
|
190 |
case EGetPrimaryFilters:
|
sl@0
|
191 |
{
|
sl@0
|
192 |
//Get primaryfilters
|
sl@0
|
193 |
RArray<TUint32> listBuffer;
|
sl@0
|
194 |
error = iServer.GetActiveFilters(listBuffer,EPrimaryFilter);
|
sl@0
|
195 |
|
sl@0
|
196 |
CArrayFixFlat<TUint8> *fixArray = new (ELeave)CArrayFixFlat<TUint8>(1);
|
sl@0
|
197 |
CleanupStack::PushL(fixArray);
|
sl@0
|
198 |
|
sl@0
|
199 |
for(TInt i=0; i<listBuffer.Count(); ++i)
|
sl@0
|
200 |
fixArray->AppendL((TUint8)listBuffer[i]);
|
sl@0
|
201 |
HBufC8* desData = ExternalizeToBufL((const CArrayFix<TUint8>&) *fixArray, sizeof(TUint8));
|
sl@0
|
202 |
CleanupStack::PopAndDestroy(); //fixArray
|
sl@0
|
203 |
|
sl@0
|
204 |
aMessage.Write(0,*desData);
|
sl@0
|
205 |
|
sl@0
|
206 |
delete desData;
|
sl@0
|
207 |
desData = NULL;
|
sl@0
|
208 |
listBuffer.Close();
|
sl@0
|
209 |
}
|
sl@0
|
210 |
break;
|
sl@0
|
211 |
case ESetSecondaryFilter:
|
sl@0
|
212 |
{
|
sl@0
|
213 |
//Set filter 2
|
sl@0
|
214 |
TInt elementsCount = aMessage.Int1();
|
sl@0
|
215 |
if(elementsCount > 0)
|
sl@0
|
216 |
{
|
sl@0
|
217 |
HBufC8* desData = HBufC8::NewLC(elementsCount*sizeof(TUint32));
|
sl@0
|
218 |
TPtr8 readPtr(desData->Des());
|
sl@0
|
219 |
aMessage.ReadL(0, readPtr);
|
sl@0
|
220 |
|
sl@0
|
221 |
RArray<TUint32> filterArray;
|
sl@0
|
222 |
TUint32 tmp=1;
|
sl@0
|
223 |
InternalizeFromBufL(readPtr, filterArray, tmp);
|
sl@0
|
224 |
|
sl@0
|
225 |
error = iServer.SetActiveFilterL(filterArray,ESecondaryFilter);
|
sl@0
|
226 |
|
sl@0
|
227 |
CleanupStack::PopAndDestroy(); //desData
|
sl@0
|
228 |
filterArray.Close();
|
sl@0
|
229 |
}
|
sl@0
|
230 |
else
|
sl@0
|
231 |
error = KErrArgument;
|
sl@0
|
232 |
}
|
sl@0
|
233 |
break;
|
sl@0
|
234 |
|
sl@0
|
235 |
case ERemoveSecondaryFilter:
|
sl@0
|
236 |
{
|
sl@0
|
237 |
//remove secondaryfilters
|
sl@0
|
238 |
TInt elementsCount = aMessage.Int1();
|
sl@0
|
239 |
if(elementsCount > 0)
|
sl@0
|
240 |
{
|
sl@0
|
241 |
HBufC8* desData = HBufC8::NewLC(elementsCount*sizeof(TUint32));
|
sl@0
|
242 |
TPtr8 readPtr(desData->Des());
|
sl@0
|
243 |
aMessage.ReadL(0, readPtr);
|
sl@0
|
244 |
|
sl@0
|
245 |
RArray<TUint32> filterArray;
|
sl@0
|
246 |
|
sl@0
|
247 |
TUint32 tmp=1;
|
sl@0
|
248 |
InternalizeFromBufL(readPtr, filterArray, tmp);
|
sl@0
|
249 |
|
sl@0
|
250 |
error = iServer.RemoveActiveFilter(filterArray,ESecondaryFilter);
|
sl@0
|
251 |
|
sl@0
|
252 |
CleanupStack::PopAndDestroy(); //desData
|
sl@0
|
253 |
filterArray.Close();
|
sl@0
|
254 |
}
|
sl@0
|
255 |
else
|
sl@0
|
256 |
error = KErrArgument;
|
sl@0
|
257 |
}
|
sl@0
|
258 |
break;
|
sl@0
|
259 |
|
sl@0
|
260 |
case EGetSecondaryFilters:
|
sl@0
|
261 |
{
|
sl@0
|
262 |
//Get secondary filters
|
sl@0
|
263 |
RArray<TUint32> listBuffer;
|
sl@0
|
264 |
error=iServer.GetActiveFilters(listBuffer,ESecondaryFilter);
|
sl@0
|
265 |
|
sl@0
|
266 |
HBufC8* desData = ExternalizeToBufL(listBuffer, sizeof(TUint32));
|
sl@0
|
267 |
TPtr8 readPtr2(desData->Des());
|
sl@0
|
268 |
aMessage.Write(0,readPtr2);
|
sl@0
|
269 |
|
sl@0
|
270 |
delete desData;
|
sl@0
|
271 |
desData = NULL;
|
sl@0
|
272 |
listBuffer.Close();
|
sl@0
|
273 |
}
|
sl@0
|
274 |
break;
|
sl@0
|
275 |
|
sl@0
|
276 |
case EEnableSecondaryFiltering:
|
sl@0
|
277 |
{
|
sl@0
|
278 |
error = iServer.SetSecondaryFiltering(KEnable);
|
sl@0
|
279 |
}
|
sl@0
|
280 |
break;
|
sl@0
|
281 |
|
sl@0
|
282 |
case EDisableSecondaryFiltering:
|
sl@0
|
283 |
{
|
sl@0
|
284 |
error = iServer.SetSecondaryFiltering(KDisable);
|
sl@0
|
285 |
}
|
sl@0
|
286 |
break;
|
sl@0
|
287 |
|
sl@0
|
288 |
case EGetSecondaryFiltering:
|
sl@0
|
289 |
{
|
sl@0
|
290 |
TBool enabled = EFalse;
|
sl@0
|
291 |
iServer.GetSecondaryFiltering(enabled);
|
sl@0
|
292 |
SendIntegerL(aMessage, (TInt)enabled);
|
sl@0
|
293 |
}
|
sl@0
|
294 |
break;
|
sl@0
|
295 |
|
sl@0
|
296 |
case ESetActivePlugin:
|
sl@0
|
297 |
{
|
sl@0
|
298 |
//Set the active plugin
|
sl@0
|
299 |
HBufC8* pluginName = NULL;
|
sl@0
|
300 |
TInt dataSize1 = aMessage.GetDesLength(0);
|
sl@0
|
301 |
if(dataSize1 > 0)
|
sl@0
|
302 |
{
|
sl@0
|
303 |
pluginName = HBufC8::NewLC( dataSize1 );
|
sl@0
|
304 |
TPtr8 namePtr(pluginName->Des());
|
sl@0
|
305 |
aMessage.ReadL(0,namePtr);
|
sl@0
|
306 |
error = iServer.SetActiveOutputPlugin(pluginName->Des());
|
sl@0
|
307 |
CleanupStack::PopAndDestroy(1);
|
sl@0
|
308 |
}
|
sl@0
|
309 |
else
|
sl@0
|
310 |
error = KErrArgument;
|
sl@0
|
311 |
}
|
sl@0
|
312 |
break;
|
sl@0
|
313 |
|
sl@0
|
314 |
case ESetActiveInputPlugin:
|
sl@0
|
315 |
{
|
sl@0
|
316 |
//Set the active control plugin
|
sl@0
|
317 |
HBufC8* pluginName = NULL;
|
sl@0
|
318 |
TInt dataSize1 = aMessage.GetDesLength(0);
|
sl@0
|
319 |
if(dataSize1 > 0)
|
sl@0
|
320 |
{
|
sl@0
|
321 |
pluginName = HBufC8::NewLC( dataSize1 );
|
sl@0
|
322 |
TPtr8 namePtr(pluginName->Des());
|
sl@0
|
323 |
aMessage.ReadL(0,namePtr);
|
sl@0
|
324 |
error = iServer.SetActiveInputPlugin(pluginName->Des());
|
sl@0
|
325 |
CleanupStack::PopAndDestroy(1); //pluginName
|
sl@0
|
326 |
}
|
sl@0
|
327 |
else
|
sl@0
|
328 |
error = KErrArgument;
|
sl@0
|
329 |
}
|
sl@0
|
330 |
break;
|
sl@0
|
331 |
|
sl@0
|
332 |
case ESetPluginSettings:
|
sl@0
|
333 |
{
|
sl@0
|
334 |
//Set the channel settings
|
sl@0
|
335 |
HBufC8* pluginName = NULL;
|
sl@0
|
336 |
HBufC8* setting = NULL;
|
sl@0
|
337 |
|
sl@0
|
338 |
RArray<TPtrC8> value;
|
sl@0
|
339 |
TInt dataSize1 = aMessage.GetDesLength(0);
|
sl@0
|
340 |
TInt dataSize2 = aMessage.GetDesLength(1);
|
sl@0
|
341 |
CArrayPtrFlat<HBufC8> *ptrArray = new (ELeave) CArrayPtrFlat<HBufC8>(1);
|
sl@0
|
342 |
CleanupStack::PushL(ptrArray);
|
sl@0
|
343 |
|
sl@0
|
344 |
if(dataSize1>0 && dataSize2>0)
|
sl@0
|
345 |
{
|
sl@0
|
346 |
pluginName = HBufC8::NewLC( dataSize1 );
|
sl@0
|
347 |
setting = HBufC8::NewLC( dataSize2 );
|
sl@0
|
348 |
TPtr8 data1Ptr(pluginName->Des());
|
sl@0
|
349 |
TPtr8 data2Ptr(setting->Des());
|
sl@0
|
350 |
|
sl@0
|
351 |
aMessage.ReadL(0,data1Ptr);
|
sl@0
|
352 |
aMessage.ReadL(1,data2Ptr);
|
sl@0
|
353 |
|
sl@0
|
354 |
_LIT8(KSeparator,";");
|
sl@0
|
355 |
TInt pos = KErrNone;
|
sl@0
|
356 |
|
sl@0
|
357 |
while(pos != KErrNotFound)
|
sl@0
|
358 |
{
|
sl@0
|
359 |
pos = setting->Des().Find(KSeparator);
|
sl@0
|
360 |
if(pos > 0)
|
sl@0
|
361 |
{
|
sl@0
|
362 |
TPtrC8 ptrVal(setting->Des().Left(pos));
|
sl@0
|
363 |
HBufC8 *bufDes = HBufC8::NewLC(ptrVal.Length()+8);
|
sl@0
|
364 |
bufDes->Des().Copy(ptrVal);
|
sl@0
|
365 |
CleanupStack::Pop(bufDes);
|
sl@0
|
366 |
ptrArray->AppendL(bufDes);
|
sl@0
|
367 |
setting->Des().Delete(0,pos+1);
|
sl@0
|
368 |
}
|
sl@0
|
369 |
}
|
sl@0
|
370 |
|
sl@0
|
371 |
for(TInt i=0; i<ptrArray->Count(); ++i)
|
sl@0
|
372 |
value.AppendL(*(ptrArray->At(i)));
|
sl@0
|
373 |
error = iServer.SetPluginSettings(pluginName->Des(), value);
|
sl@0
|
374 |
CleanupStack::PopAndDestroy(2);
|
sl@0
|
375 |
}
|
sl@0
|
376 |
else
|
sl@0
|
377 |
error = KErrArgument;
|
sl@0
|
378 |
|
sl@0
|
379 |
CleanupStack::PopAndDestroy(ptrArray);
|
sl@0
|
380 |
}
|
sl@0
|
381 |
break;
|
sl@0
|
382 |
|
sl@0
|
383 |
case ERemovePluginSettings:
|
sl@0
|
384 |
{
|
sl@0
|
385 |
TInt dataSize = aMessage.GetDesLength(0);
|
sl@0
|
386 |
TBuf8<KMaxPluginName> pluginName;
|
sl@0
|
387 |
if (dataSize > 0)
|
sl@0
|
388 |
{
|
sl@0
|
389 |
aMessage.ReadL(0, pluginName);
|
sl@0
|
390 |
error = iServer.RemovePluginSettingsL(pluginName);
|
sl@0
|
391 |
}
|
sl@0
|
392 |
else
|
sl@0
|
393 |
error = KErrArgument;
|
sl@0
|
394 |
}
|
sl@0
|
395 |
break;
|
sl@0
|
396 |
|
sl@0
|
397 |
case EGetPluginSettings:
|
sl@0
|
398 |
{
|
sl@0
|
399 |
TInt dataSize1 = aMessage.GetDesLength(0);
|
sl@0
|
400 |
TBuf8<128> mediaName;
|
sl@0
|
401 |
|
sl@0
|
402 |
if(dataSize1 > 0)
|
sl@0
|
403 |
{
|
sl@0
|
404 |
aMessage.ReadL(0, mediaName);
|
sl@0
|
405 |
RArray<TPtrC8> tmpArray;
|
sl@0
|
406 |
error = iServer.GetOptionsSettingsL(mediaName,tmpArray);
|
sl@0
|
407 |
|
sl@0
|
408 |
//<rewrite array and add separator to each record>
|
sl@0
|
409 |
_LIT8(KFormatString,"%S;");//';' is a separator
|
sl@0
|
410 |
RArray<TPtrC8> tmpArray2;
|
sl@0
|
411 |
//count total_length + separators
|
sl@0
|
412 |
TInt length = 1;
|
sl@0
|
413 |
TInt i=0;
|
sl@0
|
414 |
for(i=0; i<tmpArray.Count(); ++i)
|
sl@0
|
415 |
length+=tmpArray[i].Length()+1;
|
sl@0
|
416 |
|
sl@0
|
417 |
HBufC8* b = HBufC8::NewLC(length);
|
sl@0
|
418 |
for(i=0; i<tmpArray.Count(); ++i)
|
sl@0
|
419 |
b->Des().AppendFormat(KFormatString, &tmpArray[i]);
|
sl@0
|
420 |
//</rewrite array and add separator to each record>
|
sl@0
|
421 |
|
sl@0
|
422 |
aMessage.Write(1,*b);
|
sl@0
|
423 |
CleanupStack::PopAndDestroy(); // b
|
sl@0
|
424 |
}
|
sl@0
|
425 |
else
|
sl@0
|
426 |
error = KErrArgument;
|
sl@0
|
427 |
}
|
sl@0
|
428 |
break;
|
sl@0
|
429 |
|
sl@0
|
430 |
case EGetInstalledPlugins:
|
sl@0
|
431 |
{
|
sl@0
|
432 |
//Get the installed plugins
|
sl@0
|
433 |
RArray<TPtrC8> tmpArray;
|
sl@0
|
434 |
iServer.GetInstalledOutputPlugins(tmpArray);
|
sl@0
|
435 |
|
sl@0
|
436 |
//<rewrite array and add separator to each record>
|
sl@0
|
437 |
_LIT8(KFormatString,"%S;");//';' is a separator
|
sl@0
|
438 |
RArray<TPtrC8> tmpArray2;
|
sl@0
|
439 |
//count total_length + separators
|
sl@0
|
440 |
TInt length = 1;
|
sl@0
|
441 |
TInt i=0;
|
sl@0
|
442 |
for(i=0; i<tmpArray.Count(); ++i)
|
sl@0
|
443 |
length+=tmpArray[i].Length()+1;
|
sl@0
|
444 |
|
sl@0
|
445 |
HBufC8* b = HBufC8::NewLC(length);
|
sl@0
|
446 |
for(i=0; i<tmpArray.Count(); ++i)
|
sl@0
|
447 |
b->Des().AppendFormat(KFormatString, &tmpArray[i]);
|
sl@0
|
448 |
//</rewrite array and add separator to each record>
|
sl@0
|
449 |
|
sl@0
|
450 |
aMessage.Write(0,*b);
|
sl@0
|
451 |
CleanupStack::PopAndDestroy(); // b
|
sl@0
|
452 |
}
|
sl@0
|
453 |
break;
|
sl@0
|
454 |
|
sl@0
|
455 |
case EGetInputPlugins:
|
sl@0
|
456 |
{
|
sl@0
|
457 |
//Get the installed plugins
|
sl@0
|
458 |
RArray<TPtrC8> tmpArray;
|
sl@0
|
459 |
error = iServer.GetInstalledInputPluginsL(tmpArray);
|
sl@0
|
460 |
if(!error)
|
sl@0
|
461 |
{
|
sl@0
|
462 |
//<rewrite array and add separator to each record>
|
sl@0
|
463 |
_LIT8(KFormatString,"%S;");//';' is a separator
|
sl@0
|
464 |
//count total_length + separators
|
sl@0
|
465 |
TInt length = 1;
|
sl@0
|
466 |
TInt i=0;
|
sl@0
|
467 |
for(i=0; i<tmpArray.Count(); ++i)
|
sl@0
|
468 |
length+=tmpArray[i].Length()+1;
|
sl@0
|
469 |
|
sl@0
|
470 |
HBufC8* b = HBufC8::NewLC(length);
|
sl@0
|
471 |
for(i=0; i<tmpArray.Count(); ++i)
|
sl@0
|
472 |
b->Des().AppendFormat(KFormatString, &tmpArray[i]);
|
sl@0
|
473 |
//</rewrite array and add separator to each record>
|
sl@0
|
474 |
|
sl@0
|
475 |
aMessage.Write(0,*b);
|
sl@0
|
476 |
CleanupStack::PopAndDestroy(); // b
|
sl@0
|
477 |
}
|
sl@0
|
478 |
}
|
sl@0
|
479 |
break;
|
sl@0
|
480 |
|
sl@0
|
481 |
case EGetActivePlugin:
|
sl@0
|
482 |
{
|
sl@0
|
483 |
//Reads the active plugin
|
sl@0
|
484 |
RArray<TPtrC8> tmpArray;
|
sl@0
|
485 |
error = iServer.GetActiveOutputPlugin(tmpArray);
|
sl@0
|
486 |
if(!error)
|
sl@0
|
487 |
{
|
sl@0
|
488 |
//<rewrite array and add separator to each record>
|
sl@0
|
489 |
_LIT8(KFormatString,"%S;");//';' is a separator
|
sl@0
|
490 |
RArray<TPtrC8> tmpArray2;
|
sl@0
|
491 |
//count total_length + separators
|
sl@0
|
492 |
TInt length = 1;
|
sl@0
|
493 |
TInt i=0;
|
sl@0
|
494 |
for(i=0; i<tmpArray.Count(); ++i)
|
sl@0
|
495 |
length+=tmpArray[i].Length()+1;
|
sl@0
|
496 |
|
sl@0
|
497 |
HBufC8* b = HBufC8::NewLC(length);
|
sl@0
|
498 |
for(i=0; i<tmpArray.Count(); ++i)
|
sl@0
|
499 |
b->Des().AppendFormat(KFormatString, &tmpArray[i]);
|
sl@0
|
500 |
//</rewrite array and add separator to each record>
|
sl@0
|
501 |
|
sl@0
|
502 |
aMessage.Write(0,*b);
|
sl@0
|
503 |
CleanupStack::PopAndDestroy(); // b
|
sl@0
|
504 |
}
|
sl@0
|
505 |
}
|
sl@0
|
506 |
break;
|
sl@0
|
507 |
|
sl@0
|
508 |
case EGetActiveInputPlugin:
|
sl@0
|
509 |
{
|
sl@0
|
510 |
RArray<TPtrC8> tmpArray;
|
sl@0
|
511 |
error = iServer.GetActiveInputPlugin(tmpArray);
|
sl@0
|
512 |
if(!error)
|
sl@0
|
513 |
{
|
sl@0
|
514 |
if(tmpArray.Count() == 0)
|
sl@0
|
515 |
error = KErrNotFound;
|
sl@0
|
516 |
//<rewrite array and add separator to each record>
|
sl@0
|
517 |
_LIT8(KFormatString,"%S;");//';' is a separator
|
sl@0
|
518 |
RArray<TPtrC8> tmpArray2;
|
sl@0
|
519 |
//count total_length + separators
|
sl@0
|
520 |
TInt length = 1;
|
sl@0
|
521 |
TInt i=0;
|
sl@0
|
522 |
for(i=0; i<tmpArray.Count(); ++i)
|
sl@0
|
523 |
length+=tmpArray[i].Length()+1;
|
sl@0
|
524 |
|
sl@0
|
525 |
HBufC8* b = HBufC8::NewLC(length);
|
sl@0
|
526 |
for(i=0; i<tmpArray.Count(); ++i)
|
sl@0
|
527 |
b->Des().AppendFormat(KFormatString, &tmpArray[i]);
|
sl@0
|
528 |
//</rewrite array and add separator to each record>
|
sl@0
|
529 |
|
sl@0
|
530 |
aMessage.Write(0,*b);
|
sl@0
|
531 |
CleanupStack::PopAndDestroy(); // b
|
sl@0
|
532 |
}
|
sl@0
|
533 |
}
|
sl@0
|
534 |
break;
|
sl@0
|
535 |
|
sl@0
|
536 |
case EDeactivateInputPlugin:
|
sl@0
|
537 |
{
|
sl@0
|
538 |
HBufC8* pluginName = NULL;
|
sl@0
|
539 |
TInt dataSize1 = aMessage.GetDesLength(0);
|
sl@0
|
540 |
if(dataSize1 > 0)
|
sl@0
|
541 |
{
|
sl@0
|
542 |
pluginName = HBufC8::NewLC( dataSize1 );
|
sl@0
|
543 |
TPtr8 namePtr(pluginName->Des());
|
sl@0
|
544 |
aMessage.ReadL(0,namePtr);
|
sl@0
|
545 |
error = iServer.DeActivateInputPlugin(pluginName->Des());
|
sl@0
|
546 |
CleanupStack::PopAndDestroy(); //pluginName
|
sl@0
|
547 |
}
|
sl@0
|
548 |
}
|
sl@0
|
549 |
break;
|
sl@0
|
550 |
case EResizeTraceBuffer:
|
sl@0
|
551 |
{
|
sl@0
|
552 |
//Resize buffer size
|
sl@0
|
553 |
TInt bufferSize = aMessage.Int0();
|
sl@0
|
554 |
error = iServer.SetBufferSizeL(bufferSize);
|
sl@0
|
555 |
}
|
sl@0
|
556 |
break;
|
sl@0
|
557 |
|
sl@0
|
558 |
case EGetTraceBufferSize:
|
sl@0
|
559 |
{
|
sl@0
|
560 |
//Get buffer size
|
sl@0
|
561 |
TInt bufferSize = 0;
|
sl@0
|
562 |
error = iServer.GetBufandDataNotifyValuesL(KBuffer,bufferSize);
|
sl@0
|
563 |
SendIntegerL(aMessage, bufferSize);
|
sl@0
|
564 |
}
|
sl@0
|
565 |
break;
|
sl@0
|
566 |
|
sl@0
|
567 |
case ESetBufferMode:
|
sl@0
|
568 |
{
|
sl@0
|
569 |
TInt bufferMode = aMessage.Int0();
|
sl@0
|
570 |
if(bufferMode == ECircularBuffer)
|
sl@0
|
571 |
error = iServer.SetBufferMode(KCircular);
|
sl@0
|
572 |
else if(bufferMode == EStraightBuffer)
|
sl@0
|
573 |
error = iServer.SetBufferMode(KStraight);
|
sl@0
|
574 |
else
|
sl@0
|
575 |
error = KErrArgument;
|
sl@0
|
576 |
}
|
sl@0
|
577 |
break;
|
sl@0
|
578 |
|
sl@0
|
579 |
case EGetBufferMode:
|
sl@0
|
580 |
{
|
sl@0
|
581 |
//Get buffer size
|
sl@0
|
582 |
TInt bufferMode = 3;
|
sl@0
|
583 |
error = iServer.GetBufandDataNotifyValuesL(KBufferMode,bufferMode);
|
sl@0
|
584 |
SendIntegerL(aMessage, bufferMode);
|
sl@0
|
585 |
}
|
sl@0
|
586 |
break;
|
sl@0
|
587 |
|
sl@0
|
588 |
case ESetDataNotificationSize:
|
sl@0
|
589 |
{
|
sl@0
|
590 |
//Set data notification size
|
sl@0
|
591 |
TInt dataNotification = aMessage.Int0();
|
sl@0
|
592 |
error = iServer.SetDataNotificationSizeL(dataNotification);
|
sl@0
|
593 |
}
|
sl@0
|
594 |
break;
|
sl@0
|
595 |
|
sl@0
|
596 |
case EGetDataNotificationSize:
|
sl@0
|
597 |
{
|
sl@0
|
598 |
//Get Data Notification size
|
sl@0
|
599 |
TInt dataNotification = 0;
|
sl@0
|
600 |
error = iServer.GetBufandDataNotifyValuesL(KDataNotification,dataNotification);
|
sl@0
|
601 |
SendIntegerL(aMessage, dataNotification);
|
sl@0
|
602 |
}
|
sl@0
|
603 |
break;
|
sl@0
|
604 |
|
sl@0
|
605 |
default:
|
sl@0
|
606 |
{
|
sl@0
|
607 |
error = KErrArgument;
|
sl@0
|
608 |
}
|
sl@0
|
609 |
break;
|
sl@0
|
610 |
}
|
sl@0
|
611 |
aMessage.Complete(error);
|
sl@0
|
612 |
}
|
sl@0
|
613 |
|
sl@0
|
614 |
void CULoggerSession::SendIntegerL(const RMessage2& aMessage, TUint32 aInt)
|
sl@0
|
615 |
{
|
sl@0
|
616 |
HBufC8* size = HBufC8::NewLC(32);
|
sl@0
|
617 |
size->Des().Num(aInt);
|
sl@0
|
618 |
TPtr8 ptr(size->Des());
|
sl@0
|
619 |
aMessage.Write(0,ptr);
|
sl@0
|
620 |
CleanupStack::PopAndDestroy();
|
sl@0
|
621 |
}
|
sl@0
|
622 |
}//namespace
|