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 |
#include <e32const.h>
|
sl@0
|
17 |
#include <e32btrace.h>
|
sl@0
|
18 |
#include <f32file.h>
|
sl@0
|
19 |
#include "uloggerserver.h"
|
sl@0
|
20 |
#include "uloggersession.h"
|
sl@0
|
21 |
#include "uloggerclient.h"
|
sl@0
|
22 |
#include "uloggerplugin.h"
|
sl@0
|
23 |
#include "uloggershared.h"
|
sl@0
|
24 |
#include "uloggerdatatypes.h"
|
sl@0
|
25 |
#include "inputdata.h"
|
sl@0
|
26 |
#include "uloggercommands.h"
|
sl@0
|
27 |
|
sl@0
|
28 |
#if defined(__LIGHTLOGGER_ENABLED)
|
sl@0
|
29 |
#include "lightlogger.h"
|
sl@0
|
30 |
#endif
|
sl@0
|
31 |
|
sl@0
|
32 |
|
sl@0
|
33 |
namespace Ulogger {
|
sl@0
|
34 |
|
sl@0
|
35 |
|
sl@0
|
36 |
/*Default constructor*/
|
sl@0
|
37 |
CULoggerServer::CULoggerServer(TInt aPriority)
|
sl@0
|
38 |
: CServer2( aPriority )
|
sl@0
|
39 |
|
sl@0
|
40 |
{
|
sl@0
|
41 |
iIsBooting = ETrue;
|
sl@0
|
42 |
iConfigManager = NULL;
|
sl@0
|
43 |
iDataWatcher = NULL;
|
sl@0
|
44 |
iOutputFramework = NULL;
|
sl@0
|
45 |
iInputFramework = NULL;
|
sl@0
|
46 |
iPluginAllocator = NULL;
|
sl@0
|
47 |
}
|
sl@0
|
48 |
|
sl@0
|
49 |
|
sl@0
|
50 |
/** Destructor will be called before re-starting
|
sl@0
|
51 |
*/
|
sl@0
|
52 |
CULoggerServer::~CULoggerServer()
|
sl@0
|
53 |
{
|
sl@0
|
54 |
delete iConfigManager;
|
sl@0
|
55 |
delete iOutputFramework;
|
sl@0
|
56 |
delete iInputFramework;
|
sl@0
|
57 |
delete iPluginAllocator;
|
sl@0
|
58 |
iPluginArray.ResetAndDestroy();
|
sl@0
|
59 |
iPluginArray.Close();
|
sl@0
|
60 |
if(iDataWatcher)
|
sl@0
|
61 |
{
|
sl@0
|
62 |
iDataWatcher->Cancel();
|
sl@0
|
63 |
delete iDataWatcher;
|
sl@0
|
64 |
}
|
sl@0
|
65 |
}
|
sl@0
|
66 |
|
sl@0
|
67 |
/** Static Factory Construction
|
sl@0
|
68 |
@return a pointer to the created object
|
sl@0
|
69 |
@leave KErrNoMemory if not enough memory available
|
sl@0
|
70 |
*/
|
sl@0
|
71 |
CULoggerServer* CULoggerServer::NewLC(TInt aPriority)
|
sl@0
|
72 |
{
|
sl@0
|
73 |
CULoggerServer* self = new (ELeave) CULoggerServer( aPriority );
|
sl@0
|
74 |
CleanupStack::PushL( self );
|
sl@0
|
75 |
self->ConstructL();
|
sl@0
|
76 |
|
sl@0
|
77 |
return self;
|
sl@0
|
78 |
}
|
sl@0
|
79 |
|
sl@0
|
80 |
/**
|
sl@0
|
81 |
Create and install new Framework & Active Scheduler
|
sl@0
|
82 |
*/
|
sl@0
|
83 |
void CULoggerServer::ConstructL()
|
sl@0
|
84 |
{
|
sl@0
|
85 |
iRunAsService = EFalse; // Not used yet, to be used for run-as-service functionality
|
sl@0
|
86 |
iBufferSize = KMaxBufferSize;
|
sl@0
|
87 |
iBtraceOpen = EFalse;
|
sl@0
|
88 |
iDataNotification = 0;
|
sl@0
|
89 |
|
sl@0
|
90 |
StartL( KServerName );
|
sl@0
|
91 |
iConfigManager = CConfigFileManager::NewL();
|
sl@0
|
92 |
|
sl@0
|
93 |
}
|
sl@0
|
94 |
|
sl@0
|
95 |
|
sl@0
|
96 |
/**
|
sl@0
|
97 |
Create a new server session.
|
sl@0
|
98 |
@note Called by kernel after client's thread use any of the macros for the first time.
|
sl@0
|
99 |
*/
|
sl@0
|
100 |
CSession2* CULoggerServer::NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const
|
sl@0
|
101 |
{
|
sl@0
|
102 |
TVersion v(KULoggerSrvMajorVersionNumber,KULoggerSrvMinorVersionNumber,KULoggerSrvBuildVersionNumber);
|
sl@0
|
103 |
if (!User::QueryVersionSupported(v,aVersion))
|
sl@0
|
104 |
User::Leave(KErrNotSupported);
|
sl@0
|
105 |
|
sl@0
|
106 |
RThread client;
|
sl@0
|
107 |
aMessage.Client(client);
|
sl@0
|
108 |
return CULoggerSession::NewL( client, *const_cast<CULoggerServer*>(this) );
|
sl@0
|
109 |
}
|
sl@0
|
110 |
|
sl@0
|
111 |
|
sl@0
|
112 |
/*Increment session counter*/
|
sl@0
|
113 |
void CULoggerServer::IncrementSessions()
|
sl@0
|
114 |
{
|
sl@0
|
115 |
++iSessionCounter;
|
sl@0
|
116 |
}
|
sl@0
|
117 |
|
sl@0
|
118 |
/*Decrement session counter*/
|
sl@0
|
119 |
void CULoggerServer::DecrementSessions()
|
sl@0
|
120 |
{
|
sl@0
|
121 |
if(--iSessionCounter <= 0)
|
sl@0
|
122 |
{
|
sl@0
|
123 |
if (!iBtraceOpen)
|
sl@0
|
124 |
ShutDownServer();
|
sl@0
|
125 |
|
sl@0
|
126 |
//
|
sl@0
|
127 |
// // Replace above if-statement with following to implement run-as-service functionality
|
sl@0
|
128 |
//
|
sl@0
|
129 |
// if((!iBtraceOpen) && (!iRunAsService))
|
sl@0
|
130 |
// ShutDownServer();
|
sl@0
|
131 |
//
|
sl@0
|
132 |
|
sl@0
|
133 |
}
|
sl@0
|
134 |
}
|
sl@0
|
135 |
|
sl@0
|
136 |
/*!
|
sl@0
|
137 |
Shuts down the server
|
sl@0
|
138 |
*/
|
sl@0
|
139 |
void CULoggerServer::ShutDownServer()
|
sl@0
|
140 |
{
|
sl@0
|
141 |
CActiveScheduler::Stop();
|
sl@0
|
142 |
}//</ShutDownServer>
|
sl@0
|
143 |
|
sl@0
|
144 |
|
sl@0
|
145 |
|
sl@0
|
146 |
|
sl@0
|
147 |
/*!
|
sl@0
|
148 |
Return the error value
|
sl@0
|
149 |
*/
|
sl@0
|
150 |
TInt CULoggerServer::RunError(TInt aError)
|
sl@0
|
151 |
{
|
sl@0
|
152 |
Message().Complete(aError);
|
sl@0
|
153 |
ReStart();
|
sl@0
|
154 |
|
sl@0
|
155 |
return KErrNone;
|
sl@0
|
156 |
}
|
sl@0
|
157 |
|
sl@0
|
158 |
|
sl@0
|
159 |
|
sl@0
|
160 |
|
sl@0
|
161 |
void CULoggerServer::PanicServer(TULoggerSrvPanics aPanic)
|
sl@0
|
162 |
{
|
sl@0
|
163 |
User::Panic(KServerName, aPanic);
|
sl@0
|
164 |
}//</PanicServer>
|
sl@0
|
165 |
|
sl@0
|
166 |
|
sl@0
|
167 |
|
sl@0
|
168 |
/*!
|
sl@0
|
169 |
*/
|
sl@0
|
170 |
void CULoggerServer::PanicClient(const RMessage2& aMessage, TULoggerSrvPanics aPanic)
|
sl@0
|
171 |
{
|
sl@0
|
172 |
aMessage.Panic( KServerName, aPanic );
|
sl@0
|
173 |
}//</PanicClient>
|
sl@0
|
174 |
|
sl@0
|
175 |
|
sl@0
|
176 |
|
sl@0
|
177 |
|
sl@0
|
178 |
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
179 |
/**
|
sl@0
|
180 |
ServerL
|
sl@0
|
181 |
@Installs the active scheduler
|
sl@0
|
182 |
@Opens the semaphore
|
sl@0
|
183 |
*/
|
sl@0
|
184 |
TInt CULoggerServer::StartServerL()
|
sl@0
|
185 |
{
|
sl@0
|
186 |
#if defined(__LIGHTLOGGER_ENABLED)
|
sl@0
|
187 |
__CREATE_LOG(EFalse)
|
sl@0
|
188 |
__HIRES_RESOLUTION
|
sl@0
|
189 |
#endif
|
sl@0
|
190 |
|
sl@0
|
191 |
CActiveScheduler* activeScheduler = new (ELeave) CActiveScheduler();
|
sl@0
|
192 |
CleanupStack::PushL(activeScheduler) ;
|
sl@0
|
193 |
CActiveScheduler::Install(activeScheduler);
|
sl@0
|
194 |
CULoggerServer* server = NULL;
|
sl@0
|
195 |
TInt servererr = KErrNone;
|
sl@0
|
196 |
TRAP(servererr,
|
sl@0
|
197 |
{
|
sl@0
|
198 |
server = CULoggerServer::NewLC((TProcessPriority)EPriorityHigh);
|
sl@0
|
199 |
CleanupStack::Pop();
|
sl@0
|
200 |
});
|
sl@0
|
201 |
|
sl@0
|
202 |
if(servererr==KErrNone||servererr==KErrNotFound )
|
sl@0
|
203 |
{
|
sl@0
|
204 |
RProcess::Rendezvous(KErrNone);
|
sl@0
|
205 |
servererr=KErrNone;
|
sl@0
|
206 |
CActiveScheduler::Start();
|
sl@0
|
207 |
}
|
sl@0
|
208 |
else
|
sl@0
|
209 |
{
|
sl@0
|
210 |
RProcess::Rendezvous(servererr);
|
sl@0
|
211 |
}
|
sl@0
|
212 |
delete server;
|
sl@0
|
213 |
CleanupStack::PopAndDestroy();
|
sl@0
|
214 |
return servererr;
|
sl@0
|
215 |
|
sl@0
|
216 |
}//</StartingFunctionL>
|
sl@0
|
217 |
|
sl@0
|
218 |
|
sl@0
|
219 |
/**
|
sl@0
|
220 |
Function to to start the server
|
sl@0
|
221 |
This should leave with KErrNone
|
sl@0
|
222 |
*/
|
sl@0
|
223 |
TInt CULoggerServer::StartServer()
|
sl@0
|
224 |
{
|
sl@0
|
225 |
CTrapCleanup* cleanupStack = CTrapCleanup::New();
|
sl@0
|
226 |
if (!cleanupStack)
|
sl@0
|
227 |
{
|
sl@0
|
228 |
return KErrNoMemory;
|
sl@0
|
229 |
}
|
sl@0
|
230 |
TInt err;
|
sl@0
|
231 |
TRAP(err, StartServerL());
|
sl@0
|
232 |
|
sl@0
|
233 |
delete cleanupStack;
|
sl@0
|
234 |
cleanupStack = NULL;
|
sl@0
|
235 |
|
sl@0
|
236 |
return err;
|
sl@0
|
237 |
}//</StartingFunction>
|
sl@0
|
238 |
|
sl@0
|
239 |
|
sl@0
|
240 |
/**
|
sl@0
|
241 |
Function to set the active output media
|
sl@0
|
242 |
This should leave with KErrNotFound if given plugin is not the correct one
|
sl@0
|
243 |
or the file doesn't exists in the user and public path
|
sl@0
|
244 |
*/
|
sl@0
|
245 |
|
sl@0
|
246 |
TInt CULoggerServer::SetActiveOutputPlugin(const TDesC8 &aPluginname)
|
sl@0
|
247 |
{
|
sl@0
|
248 |
RArray<TPtrC8> activePluginsArray;
|
sl@0
|
249 |
TInt error= KErrNone;
|
sl@0
|
250 |
|
sl@0
|
251 |
error = GetInstalledOutputPlugins(activePluginsArray);
|
sl@0
|
252 |
if(error==KErrNone)
|
sl@0
|
253 |
{
|
sl@0
|
254 |
for(TInt i=0;i<activePluginsArray.Count();i++)
|
sl@0
|
255 |
{
|
sl@0
|
256 |
if(aPluginname.Compare(activePluginsArray[i])==0)
|
sl@0
|
257 |
{
|
sl@0
|
258 |
error = iConfigManager->SetActiveOutputPlugin(aPluginname);
|
sl@0
|
259 |
break;
|
sl@0
|
260 |
}
|
sl@0
|
261 |
else
|
sl@0
|
262 |
error = KErrNotFound;
|
sl@0
|
263 |
}
|
sl@0
|
264 |
}
|
sl@0
|
265 |
if(error == KErrAlreadyExists)
|
sl@0
|
266 |
{
|
sl@0
|
267 |
error=KErrNone;
|
sl@0
|
268 |
}
|
sl@0
|
269 |
return error;
|
sl@0
|
270 |
}
|
sl@0
|
271 |
|
sl@0
|
272 |
|
sl@0
|
273 |
TInt CULoggerServer::SetActiveInputPlugin(const TDesC8 &aPluginname)
|
sl@0
|
274 |
{
|
sl@0
|
275 |
RArray<TPtrC8> activePluginsArray;
|
sl@0
|
276 |
TInt ret= KErrNone;
|
sl@0
|
277 |
//check configuration file in user path (\\ulogger\\uloggerconfig.ini)
|
sl@0
|
278 |
|
sl@0
|
279 |
ret = GetInstalledInputPluginsL(activePluginsArray);
|
sl@0
|
280 |
if(ret==KErrNone)
|
sl@0
|
281 |
{
|
sl@0
|
282 |
ret = KErrNotFound;
|
sl@0
|
283 |
for(TInt i=0;i<activePluginsArray.Count();i++)
|
sl@0
|
284 |
{
|
sl@0
|
285 |
if(aPluginname.Compare(activePluginsArray[i])==0)
|
sl@0
|
286 |
{
|
sl@0
|
287 |
ret = iConfigManager->SetActiveInputPlugin(aPluginname);
|
sl@0
|
288 |
break;
|
sl@0
|
289 |
}
|
sl@0
|
290 |
}
|
sl@0
|
291 |
}
|
sl@0
|
292 |
return ret;
|
sl@0
|
293 |
}
|
sl@0
|
294 |
|
sl@0
|
295 |
|
sl@0
|
296 |
/**
|
sl@0
|
297 |
Function to set the plugin settings
|
sl@0
|
298 |
This should leave with KErrNotFound if cannot file doesn't exist
|
sl@0
|
299 |
*/
|
sl@0
|
300 |
TInt CULoggerServer::SetPluginSettings(const TDesC8 &aPluginname, RArray<TPtrC8>& aListBuffer)
|
sl@0
|
301 |
{
|
sl@0
|
302 |
TInt i = 0;
|
sl@0
|
303 |
TInt ret=KErrNone;
|
sl@0
|
304 |
|
sl@0
|
305 |
//if plug-in doesn't exists
|
sl@0
|
306 |
TPtrC8 pluginName(aPluginname);
|
sl@0
|
307 |
if(!CheckPluginExists(pluginName, EOutputPluginFilter) && !CheckPluginExists(pluginName, EInputPluginFilter))
|
sl@0
|
308 |
return KErrNotFound;
|
sl@0
|
309 |
|
sl@0
|
310 |
while(i<aListBuffer.Count())
|
sl@0
|
311 |
{
|
sl@0
|
312 |
TPtrC8 key(aListBuffer[i]);
|
sl@0
|
313 |
TPtrC8 val(aListBuffer[++i]);
|
sl@0
|
314 |
ret = iConfigManager->SetPluginSetting(aPluginname, key, val);
|
sl@0
|
315 |
if(ret!=KErrNone)
|
sl@0
|
316 |
break;
|
sl@0
|
317 |
i++;
|
sl@0
|
318 |
}
|
sl@0
|
319 |
return ret;
|
sl@0
|
320 |
}
|
sl@0
|
321 |
|
sl@0
|
322 |
|
sl@0
|
323 |
|
sl@0
|
324 |
|
sl@0
|
325 |
/**
|
sl@0
|
326 |
Function to get the plugin settings
|
sl@0
|
327 |
This should leave with KErrNotFound if cannot find one
|
sl@0
|
328 |
*/
|
sl@0
|
329 |
TInt CULoggerServer::GetOptionsSettingsL(const TDesC8 &aMediaName, RArray<TPtrC8>& aListBuffer)
|
sl@0
|
330 |
{
|
sl@0
|
331 |
//if plug-in doesn't exists
|
sl@0
|
332 |
TPtrC8 pluginName(aMediaName);
|
sl@0
|
333 |
if(!CheckPluginExists(pluginName, EOutputPluginFilter) && !CheckPluginExists(pluginName, EInputPluginFilter))
|
sl@0
|
334 |
return KErrNotFound;
|
sl@0
|
335 |
else
|
sl@0
|
336 |
{
|
sl@0
|
337 |
TInt ret = GetValuesL(aMediaName,aListBuffer);
|
sl@0
|
338 |
if(ret == KErrNotFound) //this error indicate that there is no section in config file, plug-in exists
|
sl@0
|
339 |
ret = KErrNone;
|
sl@0
|
340 |
return ret;
|
sl@0
|
341 |
}
|
sl@0
|
342 |
}
|
sl@0
|
343 |
|
sl@0
|
344 |
|
sl@0
|
345 |
|
sl@0
|
346 |
/**
|
sl@0
|
347 |
Function to get values from the configuration file (i.e. for filters,plugin settings)
|
sl@0
|
348 |
This should leave with KErrNotFound if it cannot find the configuration file
|
sl@0
|
349 |
*/
|
sl@0
|
350 |
TInt CULoggerServer::GetValuesL(const TDesC8 &aSectionName, RArray<TPtrC8>& aListBuffer)
|
sl@0
|
351 |
{
|
sl@0
|
352 |
TPtrC8 key;
|
sl@0
|
353 |
TPtrC8 val;
|
sl@0
|
354 |
TInt err = KErrNotFound;
|
sl@0
|
355 |
|
sl@0
|
356 |
Ulogger::CConfigSettingsIter* iter = Ulogger::CConfigSettingsIter::NewL();
|
sl@0
|
357 |
CleanupStack::PushL(iter);
|
sl@0
|
358 |
|
sl@0
|
359 |
//check User configuration file if exists
|
sl@0
|
360 |
//check values for given section in the configuration file
|
sl@0
|
361 |
//if value exists copy it to array
|
sl@0
|
362 |
err = iConfigManager->GetSectionValues(aSectionName,*iter);
|
sl@0
|
363 |
if(err == KErrNone)
|
sl@0
|
364 |
{
|
sl@0
|
365 |
TBool found =EFalse;
|
sl@0
|
366 |
while(iter->Next(key,val))
|
sl@0
|
367 |
{
|
sl@0
|
368 |
aListBuffer.AppendL(key);
|
sl@0
|
369 |
aListBuffer.AppendL(val);
|
sl@0
|
370 |
found = ETrue;
|
sl@0
|
371 |
}
|
sl@0
|
372 |
if(!found)
|
sl@0
|
373 |
err = KErrNotFound;
|
sl@0
|
374 |
}
|
sl@0
|
375 |
CleanupStack::PopAndDestroy(); // list
|
sl@0
|
376 |
return err;
|
sl@0
|
377 |
|
sl@0
|
378 |
}
|
sl@0
|
379 |
|
sl@0
|
380 |
|
sl@0
|
381 |
/**
|
sl@0
|
382 |
Sets the Active Filter in the configuration file (primary and secondary filters)
|
sl@0
|
383 |
@aCategory filters to be set
|
sl@0
|
384 |
@aDupCategory duplicate filters which are not set
|
sl@0
|
385 |
@aFilter value that describes primary or secondary filter
|
sl@0
|
386 |
@return KErrNone, if successful, otherwise one of the other system-wide
|
sl@0
|
387 |
error codes.
|
sl@0
|
388 |
*/
|
sl@0
|
389 |
TInt CULoggerServer::SetActiveFilterL(RArray<TUint32> aCategory, TInt aFilterType)
|
sl@0
|
390 |
{
|
sl@0
|
391 |
TInt error = KErrNone;
|
sl@0
|
392 |
if(aFilterType == 1)
|
sl@0
|
393 |
{
|
sl@0
|
394 |
if(aCategory.Count()==0 || aCategory.Count()>KMaxPrimaryFiltersLimit)
|
sl@0
|
395 |
error = KErrArgument;
|
sl@0
|
396 |
else
|
sl@0
|
397 |
{
|
sl@0
|
398 |
error = iConfigManager->SetActiveFilter(aCategory,KPrimaryFilterSection);
|
sl@0
|
399 |
if(error == KErrAlreadyExists)
|
sl@0
|
400 |
error = KErrNone;
|
sl@0
|
401 |
}
|
sl@0
|
402 |
}
|
sl@0
|
403 |
if(aFilterType == 2)
|
sl@0
|
404 |
{
|
sl@0
|
405 |
//we don't want to set more secondary filters than KMaxSecondaryFiltersLimit
|
sl@0
|
406 |
RArray<TUint32> tmpArray;
|
sl@0
|
407 |
CleanupClosePushL(tmpArray);
|
sl@0
|
408 |
error = GetActiveFilters(tmpArray, ESecondaryFilter);
|
sl@0
|
409 |
if(!error || error == KErrNotFound)
|
sl@0
|
410 |
{
|
sl@0
|
411 |
error = KErrNone; //in case it was KErrNotFound as it doesn't matter we didn't have any set already
|
sl@0
|
412 |
if(aCategory.Count()==0 ||tmpArray.Count() > KMaxSecondaryFiltersLimit ||
|
sl@0
|
413 |
(tmpArray.Count()+ aCategory.Count()) > KMaxSecondaryFiltersLimit)
|
sl@0
|
414 |
error = KErrArgument;
|
sl@0
|
415 |
|
sl@0
|
416 |
}
|
sl@0
|
417 |
CleanupStack::PopAndDestroy(); //tmpArray
|
sl@0
|
418 |
if(!error)
|
sl@0
|
419 |
error = iConfigManager->SetActiveFilter(aCategory,KSecondaryFilterSection);
|
sl@0
|
420 |
}
|
sl@0
|
421 |
return error;
|
sl@0
|
422 |
}
|
sl@0
|
423 |
|
sl@0
|
424 |
|
sl@0
|
425 |
/**
|
sl@0
|
426 |
Function to remove the Filter from config file
|
sl@0
|
427 |
@aFilter Filter to be removed
|
sl@0
|
428 |
@aValue primary or secondary filter to be removed
|
sl@0
|
429 |
This should leave with KErrNotFound if cannot find one or any system wide error codes
|
sl@0
|
430 |
*/
|
sl@0
|
431 |
TInt CULoggerServer::RemoveActiveFilter(RArray<TUint32>& aValue, const TInt aFilter)
|
sl@0
|
432 |
{
|
sl@0
|
433 |
TInt ret = KErrNone;
|
sl@0
|
434 |
//remove filter (primary or secondary) from BTrace current configuration
|
sl@0
|
435 |
if(aFilter == EPrimaryFilter && (aValue.Count()==0 || aValue.Count()>KMaxPrimaryFiltersLimit))
|
sl@0
|
436 |
return KErrArgument;
|
sl@0
|
437 |
else if(aFilter == ESecondaryFilter && (aValue.Count()==0 || aValue.Count()>KMaxSecondaryFiltersLimit))
|
sl@0
|
438 |
return KErrArgument;
|
sl@0
|
439 |
|
sl@0
|
440 |
ret = iConfigManager->RemoveActiveFilter(aValue,aFilter);
|
sl@0
|
441 |
if(ret == KErrNotFound) //remove operation should succeed in this situation
|
sl@0
|
442 |
ret = KErrNone;
|
sl@0
|
443 |
|
sl@0
|
444 |
return ret;
|
sl@0
|
445 |
}
|
sl@0
|
446 |
|
sl@0
|
447 |
|
sl@0
|
448 |
/**
|
sl@0
|
449 |
Function to set Trace settings to the configuration file
|
sl@0
|
450 |
@aValue value to be set
|
sl@0
|
451 |
@aSetting setting to which value to be set
|
sl@0
|
452 |
This should leave with KErrNotFound if cannot find one or any system wide error codes
|
sl@0
|
453 |
*/
|
sl@0
|
454 |
TInt CULoggerServer::SetTraceSettings(const TDesC8& aValue, const TDesC8& aSetting)
|
sl@0
|
455 |
{
|
sl@0
|
456 |
TInt r = iConfigManager->SetTraceSettings(aValue, aSetting);
|
sl@0
|
457 |
return r;
|
sl@0
|
458 |
|
sl@0
|
459 |
}
|
sl@0
|
460 |
|
sl@0
|
461 |
/**
|
sl@0
|
462 |
Function to remove plugin settings from the configuration file
|
sl@0
|
463 |
@aPluginName Plugin name whose settings has to be removed
|
sl@0
|
464 |
@return will return KErrNone or else leave with KErrNotFound
|
sl@0
|
465 |
or any system wide error codes
|
sl@0
|
466 |
*/
|
sl@0
|
467 |
|
sl@0
|
468 |
TInt CULoggerServer::RemovePluginSettingsL(const TDesC8 &aPluginName)
|
sl@0
|
469 |
{
|
sl@0
|
470 |
if(aPluginName.Length() == 0)
|
sl@0
|
471 |
return KErrArgument;
|
sl@0
|
472 |
|
sl@0
|
473 |
TInt ret = KErrNone;
|
sl@0
|
474 |
RArray<TPtrC8> settings;
|
sl@0
|
475 |
ret = GetOptionsSettingsL(aPluginName, settings);
|
sl@0
|
476 |
if(ret != KErrNone || settings.Count()==0)
|
sl@0
|
477 |
ret = KErrNotFound;
|
sl@0
|
478 |
settings.Close();
|
sl@0
|
479 |
|
sl@0
|
480 |
if(ret == KErrNone)
|
sl@0
|
481 |
return iConfigManager->RemovePluginSettings(aPluginName);
|
sl@0
|
482 |
else
|
sl@0
|
483 |
return ret;
|
sl@0
|
484 |
}
|
sl@0
|
485 |
|
sl@0
|
486 |
/**
|
sl@0
|
487 |
Resize the BTrace buffer size
|
sl@0
|
488 |
|
sl@0
|
489 |
@aSize The size to be set for the BTrace buffer.
|
sl@0
|
490 |
@return KErrNone, if successful, otherwise one of the other system-wide
|
sl@0
|
491 |
error codes.
|
sl@0
|
492 |
*/
|
sl@0
|
493 |
TInt CULoggerServer::SetBufferSizeL(TInt aSize)
|
sl@0
|
494 |
{
|
sl@0
|
495 |
if(aSize > KMaxBufferSize || aSize < 1)
|
sl@0
|
496 |
return KErrArgument;
|
sl@0
|
497 |
|
sl@0
|
498 |
|
sl@0
|
499 |
//get dns to check
|
sl@0
|
500 |
GetBufandDataNotifyValuesL(KDataNotification,iDataNotification);
|
sl@0
|
501 |
if(aSize < iDataNotification)
|
sl@0
|
502 |
return KErrGeneral;
|
sl@0
|
503 |
|
sl@0
|
504 |
iBufferSize = aSize;
|
sl@0
|
505 |
HBufC8* Size = HBufC8::NewLC(32);
|
sl@0
|
506 |
Size->Des().Num(iBufferSize);
|
sl@0
|
507 |
CleanupStack::Pop(1);
|
sl@0
|
508 |
TPtr8 ptr(Size->Des());
|
sl@0
|
509 |
TInt r = iConfigManager->SetTraceSettings((const TDesC8&)ptr, KBuffer);
|
sl@0
|
510 |
return r;
|
sl@0
|
511 |
}
|
sl@0
|
512 |
|
sl@0
|
513 |
|
sl@0
|
514 |
/**
|
sl@0
|
515 |
Change the mode of the BTrace Buffer
|
sl@0
|
516 |
|
sl@0
|
517 |
@aValue The mode to be set for the BTrace buffer.
|
sl@0
|
518 |
@return KErrNone, if successful, otherwise one of the other system-wide
|
sl@0
|
519 |
error codes.
|
sl@0
|
520 |
*/
|
sl@0
|
521 |
TInt CULoggerServer::SetBufferMode(const TDesC8& aValue)
|
sl@0
|
522 |
{
|
sl@0
|
523 |
|
sl@0
|
524 |
TInt r = SetTraceSettings(aValue, KBufferMode);
|
sl@0
|
525 |
return r;
|
sl@0
|
526 |
}
|
sl@0
|
527 |
|
sl@0
|
528 |
/**
|
sl@0
|
529 |
Resize the Data Notification size
|
sl@0
|
530 |
|
sl@0
|
531 |
@aSize The size to be set for the Data Notification size.
|
sl@0
|
532 |
@return KErrNone, if successful, otherwise one of the other system-wide
|
sl@0
|
533 |
error codes.
|
sl@0
|
534 |
*/
|
sl@0
|
535 |
TInt CULoggerServer::SetDataNotificationSizeL(TInt aSize)
|
sl@0
|
536 |
{
|
sl@0
|
537 |
if(aSize > KMaxDnsSize || aSize < 0)
|
sl@0
|
538 |
return KErrArgument;
|
sl@0
|
539 |
TInt size, r;
|
sl@0
|
540 |
TRAP_IGNORE((r=GetBufandDataNotifyValuesL(KBuffer,size)));
|
sl@0
|
541 |
if(aSize > size)
|
sl@0
|
542 |
return KErrGeneral;
|
sl@0
|
543 |
|
sl@0
|
544 |
iDataNotification = aSize;
|
sl@0
|
545 |
HBufC8* Size = HBufC8::NewLC(32);
|
sl@0
|
546 |
Size->Des().Num(aSize);
|
sl@0
|
547 |
TPtr8 ptr(Size->Des());
|
sl@0
|
548 |
r = SetTraceSettings((const TDesC8&)ptr, KDataNotification);
|
sl@0
|
549 |
CleanupStack::PopAndDestroy();
|
sl@0
|
550 |
return r;
|
sl@0
|
551 |
}
|
sl@0
|
552 |
|
sl@0
|
553 |
/**
|
sl@0
|
554 |
Function to retrieve the Trace Section Values
|
sl@0
|
555 |
This should leave with KErrNotFound if cannot find one
|
sl@0
|
556 |
as this should be treated as a corrupt config file
|
sl@0
|
557 |
*/
|
sl@0
|
558 |
void CULoggerServer::GetOptionsSettingsL(RArray<TPtrC8>& aListBuffer,const TDesC8& aSetting)
|
sl@0
|
559 |
{
|
sl@0
|
560 |
TPtrC8 key;
|
sl@0
|
561 |
TPtrC8 val;
|
sl@0
|
562 |
TInt err=0;
|
sl@0
|
563 |
|
sl@0
|
564 |
Ulogger::CConfigSettingsIter* iter = Ulogger::CConfigSettingsIter::NewL();
|
sl@0
|
565 |
CleanupStack::PushL(iter);
|
sl@0
|
566 |
err=iConfigManager->GetPluginSettings(*iter);
|
sl@0
|
567 |
|
sl@0
|
568 |
if(err==KErrNone)
|
sl@0
|
569 |
{
|
sl@0
|
570 |
while(iter->Next(key,val))
|
sl@0
|
571 |
{
|
sl@0
|
572 |
if(key.Compare(aSetting)==0)
|
sl@0
|
573 |
{
|
sl@0
|
574 |
aListBuffer.AppendL(key);
|
sl@0
|
575 |
aListBuffer.AppendL(val);
|
sl@0
|
576 |
}
|
sl@0
|
577 |
}
|
sl@0
|
578 |
}
|
sl@0
|
579 |
CleanupStack::PopAndDestroy(); // list
|
sl@0
|
580 |
}
|
sl@0
|
581 |
|
sl@0
|
582 |
/**
|
sl@0
|
583 |
Function to retrieve the active primary filters
|
sl@0
|
584 |
This should leave with KErrNotFound if cannot find one
|
sl@0
|
585 |
as this should be treated as a corrupt config file
|
sl@0
|
586 |
*/
|
sl@0
|
587 |
TInt CULoggerServer::GetBufandDataNotifyValuesL(const TDesC8& aSetting,TInt& value)
|
sl@0
|
588 |
{
|
sl@0
|
589 |
TInt err = KErrNotFound;
|
sl@0
|
590 |
RArray<TPtrC8> traceValues;
|
sl@0
|
591 |
TFileName filepath;
|
sl@0
|
592 |
|
sl@0
|
593 |
GetOptionsSettingsL(traceValues,aSetting);
|
sl@0
|
594 |
|
sl@0
|
595 |
value =-1;
|
sl@0
|
596 |
//if values exists for the given trace settings
|
sl@0
|
597 |
if(traceValues.Count()>1)
|
sl@0
|
598 |
{// get values for buffer mode
|
sl@0
|
599 |
if(aSetting.Compare(KBufferMode)==0)
|
sl@0
|
600 |
{
|
sl@0
|
601 |
err=KErrNone;
|
sl@0
|
602 |
if(traceValues[1].Compare(KCircular) == 0)
|
sl@0
|
603 |
value = ECircularBuffer;
|
sl@0
|
604 |
else if(traceValues[1].Compare(KStraight) == 0)
|
sl@0
|
605 |
value = EStraightBuffer;
|
sl@0
|
606 |
else
|
sl@0
|
607 |
err=KErrNotFound;
|
sl@0
|
608 |
}
|
sl@0
|
609 |
else
|
sl@0
|
610 |
{// get values for data notification and buffer size
|
sl@0
|
611 |
TLex8 lex_val(traceValues[1]);
|
sl@0
|
612 |
err = lex_val.Val(value);
|
sl@0
|
613 |
}
|
sl@0
|
614 |
}
|
sl@0
|
615 |
return err;
|
sl@0
|
616 |
}
|
sl@0
|
617 |
|
sl@0
|
618 |
|
sl@0
|
619 |
|
sl@0
|
620 |
/**
|
sl@0
|
621 |
Set the enable/disable secondary filters
|
sl@0
|
622 |
|
sl@0
|
623 |
@aSize The size to be set for the BTrace buffer.
|
sl@0
|
624 |
@return KErrNone, if successful, otherwise one of the other system-wide
|
sl@0
|
625 |
error codes.
|
sl@0
|
626 |
*/
|
sl@0
|
627 |
TInt CULoggerServer::SetSecondaryFiltering(const TDesC8& aEnabled)
|
sl@0
|
628 |
{
|
sl@0
|
629 |
TInt error = iConfigManager->SetTraceSettings(aEnabled, KSecondaryGlobalFilter);
|
sl@0
|
630 |
if(error == KErrAlreadyExists)
|
sl@0
|
631 |
error = KErrNone;
|
sl@0
|
632 |
return error;
|
sl@0
|
633 |
|
sl@0
|
634 |
}
|
sl@0
|
635 |
|
sl@0
|
636 |
|
sl@0
|
637 |
/**
|
sl@0
|
638 |
Function to retrieve the active primary and secondary filters
|
sl@0
|
639 |
This should return KErrNotFound if cannot find one or return any of the system wide error codes
|
sl@0
|
640 |
*/
|
sl@0
|
641 |
TInt CULoggerServer::GetActiveFilters(RArray<TUint32>& aListBuffer,TInt aFilterType)
|
sl@0
|
642 |
{
|
sl@0
|
643 |
TInt ret = KErrNotFound;
|
sl@0
|
644 |
RArray<TPtrC8> aValues;
|
sl@0
|
645 |
if(aFilterType == 1)
|
sl@0
|
646 |
{
|
sl@0
|
647 |
TRAPD(err, ret = GetValuesL(KPrimaryFilterSection,aValues));
|
sl@0
|
648 |
if (err != KErrNone)
|
sl@0
|
649 |
{
|
sl@0
|
650 |
return err;
|
sl@0
|
651 |
}
|
sl@0
|
652 |
|
sl@0
|
653 |
if(ret==KErrNone)
|
sl@0
|
654 |
{
|
sl@0
|
655 |
TInt i =0;
|
sl@0
|
656 |
TPtrC8 val;
|
sl@0
|
657 |
TUint8 int_val;
|
sl@0
|
658 |
while(i<aValues.Count())
|
sl@0
|
659 |
{
|
sl@0
|
660 |
TLex8 lex_val(aValues[++i]);
|
sl@0
|
661 |
ret = lex_val.Val(int_val,EDecimal);
|
sl@0
|
662 |
if(ret == KErrNone)
|
sl@0
|
663 |
{
|
sl@0
|
664 |
ret = aListBuffer.Append(int_val);
|
sl@0
|
665 |
if (ret != KErrNone)
|
sl@0
|
666 |
{
|
sl@0
|
667 |
return ret;
|
sl@0
|
668 |
}
|
sl@0
|
669 |
}
|
sl@0
|
670 |
else
|
sl@0
|
671 |
{
|
sl@0
|
672 |
return KErrCorrupt;
|
sl@0
|
673 |
}
|
sl@0
|
674 |
i++;
|
sl@0
|
675 |
}
|
sl@0
|
676 |
}
|
sl@0
|
677 |
}
|
sl@0
|
678 |
else if(aFilterType == 2)
|
sl@0
|
679 |
{
|
sl@0
|
680 |
TRAPD(err, ret = GetValuesL(KSecondaryFilterSection,aValues));
|
sl@0
|
681 |
if (err != KErrNone)
|
sl@0
|
682 |
{
|
sl@0
|
683 |
return err;
|
sl@0
|
684 |
}
|
sl@0
|
685 |
if(ret==KErrNone)
|
sl@0
|
686 |
{
|
sl@0
|
687 |
TInt i =0;
|
sl@0
|
688 |
TPtrC8 val;
|
sl@0
|
689 |
TUint int_val;
|
sl@0
|
690 |
while(i<aValues.Count())
|
sl@0
|
691 |
{
|
sl@0
|
692 |
TLex8 lex_val(aValues[++i]);
|
sl@0
|
693 |
ret = lex_val.Val(int_val,EDecimal);
|
sl@0
|
694 |
if(ret == KErrNone)
|
sl@0
|
695 |
{
|
sl@0
|
696 |
ret = aListBuffer.Append(int_val);
|
sl@0
|
697 |
if (ret != KErrNone)
|
sl@0
|
698 |
{
|
sl@0
|
699 |
return ret;
|
sl@0
|
700 |
}
|
sl@0
|
701 |
}
|
sl@0
|
702 |
else
|
sl@0
|
703 |
{
|
sl@0
|
704 |
return KErrCorrupt;
|
sl@0
|
705 |
}
|
sl@0
|
706 |
i++;
|
sl@0
|
707 |
}
|
sl@0
|
708 |
}
|
sl@0
|
709 |
else
|
sl@0
|
710 |
{
|
sl@0
|
711 |
if(ret==KErrNotFound)//i.e. if there are no values in the array --> change to if(filters.Count = 0)?
|
sl@0
|
712 |
{
|
sl@0
|
713 |
ret=KErrNone;
|
sl@0
|
714 |
}
|
sl@0
|
715 |
}
|
sl@0
|
716 |
}
|
sl@0
|
717 |
return ret;
|
sl@0
|
718 |
}
|
sl@0
|
719 |
|
sl@0
|
720 |
/**
|
sl@0
|
721 |
Function to retrieve the active secondary global filter
|
sl@0
|
722 |
This should leave with KErrNotFound if cannot find one
|
sl@0
|
723 |
*/
|
sl@0
|
724 |
|
sl@0
|
725 |
TInt CULoggerServer::GetSecondaryFiltering(TBool& aEnabled)
|
sl@0
|
726 |
{
|
sl@0
|
727 |
RArray<TPtrC8> configSettings;
|
sl@0
|
728 |
TRAPD(error, GetOptionsSettingsL(configSettings,KSecondaryGlobalFilter));
|
sl@0
|
729 |
if(configSettings[1]==KEnable) //First element contains KSecondaryGlobalFilter, second the value
|
sl@0
|
730 |
aEnabled = ETrue;
|
sl@0
|
731 |
if(configSettings[1]==KDisable)
|
sl@0
|
732 |
aEnabled = EFalse;
|
sl@0
|
733 |
return error;
|
sl@0
|
734 |
}
|
sl@0
|
735 |
|
sl@0
|
736 |
/**
|
sl@0
|
737 |
Function to retrieve the plugin names from the ECOM framework
|
sl@0
|
738 |
This should leave with KErrNotFound if cannot find one
|
sl@0
|
739 |
*/
|
sl@0
|
740 |
TInt CULoggerServer::GetInstalledOutputPlugins(RArray<TPtrC8>& aListBuffer)
|
sl@0
|
741 |
{
|
sl@0
|
742 |
// Read info about all implementations into infoArray
|
sl@0
|
743 |
// Note that a special cleanup function is required to reset and destroy
|
sl@0
|
744 |
// all items in the array, and then close it.
|
sl@0
|
745 |
if(iPluginArray.Count()>0)
|
sl@0
|
746 |
{
|
sl@0
|
747 |
iPluginArray.ResetAndDestroy();
|
sl@0
|
748 |
iPluginArray.Close();
|
sl@0
|
749 |
}
|
sl@0
|
750 |
|
sl@0
|
751 |
TRAPD(error,CPluginAllocator::ListAllImplementationsL(iPluginArray));
|
sl@0
|
752 |
|
sl@0
|
753 |
if(iPluginArray.Count()>0)
|
sl@0
|
754 |
{
|
sl@0
|
755 |
for (TInt i=0; i< iPluginArray.Count(); i++)
|
sl@0
|
756 |
{
|
sl@0
|
757 |
TRAP(error,aListBuffer.AppendL(iPluginArray[i]->DataType()));
|
sl@0
|
758 |
}
|
sl@0
|
759 |
|
sl@0
|
760 |
//filter plugins and to use only output plugins
|
sl@0
|
761 |
FilterPlugins(EOutputPluginFilter, aListBuffer);
|
sl@0
|
762 |
}
|
sl@0
|
763 |
|
sl@0
|
764 |
return error;
|
sl@0
|
765 |
}
|
sl@0
|
766 |
|
sl@0
|
767 |
|
sl@0
|
768 |
|
sl@0
|
769 |
TInt CULoggerServer::GetInstalledInputPluginsL(RArray<TPtrC8>& aListBuffer)
|
sl@0
|
770 |
{
|
sl@0
|
771 |
#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
|
sl@0
|
772 |
__MARK_METHOD("CULoggerServer::GetInstalledControlPlugins")
|
sl@0
|
773 |
#endif
|
sl@0
|
774 |
|
sl@0
|
775 |
if(iPluginArray.Count()>0)
|
sl@0
|
776 |
{
|
sl@0
|
777 |
iPluginArray.ResetAndDestroy();
|
sl@0
|
778 |
iPluginArray.Close();
|
sl@0
|
779 |
}
|
sl@0
|
780 |
// Read info about all implementations into infoArray
|
sl@0
|
781 |
// Note that a special cleanup function is required to reset and destroy
|
sl@0
|
782 |
// all items in the array, and then close it.
|
sl@0
|
783 |
CPluginAllocator::ListAllImplementationsL(iPluginArray);
|
sl@0
|
784 |
|
sl@0
|
785 |
if(iPluginArray.Count() > 0)
|
sl@0
|
786 |
{
|
sl@0
|
787 |
for (TInt i=0; i< iPluginArray.Count(); i++)
|
sl@0
|
788 |
aListBuffer.AppendL(iPluginArray[i]->DataType());
|
sl@0
|
789 |
|
sl@0
|
790 |
//filter plugins and to use only output plugins
|
sl@0
|
791 |
FilterPlugins(EInputPluginFilter, aListBuffer);
|
sl@0
|
792 |
}
|
sl@0
|
793 |
return KErrNone;
|
sl@0
|
794 |
}
|
sl@0
|
795 |
|
sl@0
|
796 |
|
sl@0
|
797 |
/**
|
sl@0
|
798 |
Function to retrieve the Active plugin name
|
sl@0
|
799 |
This should leave with KErrNotFound if cannot find one or any system wide error codes
|
sl@0
|
800 |
*/
|
sl@0
|
801 |
TInt CULoggerServer::GetActiveOutputPlugin(RArray<TPtrC8>& aListBuffer)
|
sl@0
|
802 |
{
|
sl@0
|
803 |
TInt errCode = GetValuesL(KActiveSection,aListBuffer);
|
sl@0
|
804 |
//plugins are received as, e.g. '1 uloggerfileplugin' (.ini file syntax)
|
sl@0
|
805 |
//we have to remove number from array
|
sl@0
|
806 |
for(TInt i=0; i<aListBuffer.Count(); ++i)
|
sl@0
|
807 |
{
|
sl@0
|
808 |
TInt v;
|
sl@0
|
809 |
TLex8 lex(aListBuffer[i]);
|
sl@0
|
810 |
if(lex.Val(v) == KErrNone)
|
sl@0
|
811 |
{
|
sl@0
|
812 |
aListBuffer.Remove(i);
|
sl@0
|
813 |
i=-1; //start from begin, i will be incremented in loop
|
sl@0
|
814 |
}
|
sl@0
|
815 |
}
|
sl@0
|
816 |
return errCode;
|
sl@0
|
817 |
}
|
sl@0
|
818 |
|
sl@0
|
819 |
|
sl@0
|
820 |
/**
|
sl@0
|
821 |
Function to Deactivate or remove active output plugin
|
sl@0
|
822 |
This should leave with KErrNotFound if cannot find one or any system wide error codes
|
sl@0
|
823 |
*/
|
sl@0
|
824 |
|
sl@0
|
825 |
TInt CULoggerServer::DeActivateOutputPlugin(const TDesC8 &aPluginname)
|
sl@0
|
826 |
{
|
sl@0
|
827 |
if(iBtraceOpen != EFalse)
|
sl@0
|
828 |
{
|
sl@0
|
829 |
Stop();
|
sl@0
|
830 |
iBtraceOpen = EFalse;
|
sl@0
|
831 |
}
|
sl@0
|
832 |
|
sl@0
|
833 |
TInt ret = iConfigManager->DeActivateOutputPlugin(aPluginname);
|
sl@0
|
834 |
return ret;
|
sl@0
|
835 |
}
|
sl@0
|
836 |
|
sl@0
|
837 |
/**
|
sl@0
|
838 |
Function to retrieve the Active control plugin name
|
sl@0
|
839 |
This should leave with KErrNotFound if cannot find one or any system wide error codes
|
sl@0
|
840 |
*/
|
sl@0
|
841 |
TInt CULoggerServer::GetActiveInputPlugin(RArray<TPtrC8>& aListBuffer)
|
sl@0
|
842 |
{
|
sl@0
|
843 |
return GetValuesL(KActiveControlSection,aListBuffer);
|
sl@0
|
844 |
}
|
sl@0
|
845 |
|
sl@0
|
846 |
/**
|
sl@0
|
847 |
Function to Deactivate active control plugin
|
sl@0
|
848 |
This should leave with KErrNotFound if cannot find one or any system wide error codes
|
sl@0
|
849 |
*/
|
sl@0
|
850 |
TInt CULoggerServer::DeActivateInputPlugin(const TDesC8& aPluginname)
|
sl@0
|
851 |
{
|
sl@0
|
852 |
return iConfigManager->DeActivateInputPlugin(aPluginname);
|
sl@0
|
853 |
}
|
sl@0
|
854 |
|
sl@0
|
855 |
/**
|
sl@0
|
856 |
Function to run ULogger server as service, i.e. to keep it constantly running
|
sl@0
|
857 |
(but not necessarily logging) in the background, or to stop it being run as a
|
sl@0
|
858 |
service (if EFalse is passed).
|
sl@0
|
859 |
|
sl@0
|
860 |
@param aRunAsService ETrue to start, EFalse to stop running as service
|
sl@0
|
861 |
*/
|
sl@0
|
862 |
void CULoggerServer::RunAsService(TBool /*aRunAsService*/)
|
sl@0
|
863 |
{
|
sl@0
|
864 |
//
|
sl@0
|
865 |
// // Uncomment following to implement run-as-service functionality
|
sl@0
|
866 |
//
|
sl@0
|
867 |
// iRunAsService = aRunAsService;
|
sl@0
|
868 |
//
|
sl@0
|
869 |
// if (!aRunAsService)
|
sl@0
|
870 |
// {
|
sl@0
|
871 |
// //make sure server is stopped if there are no sessions
|
sl@0
|
872 |
// IncrementSessions();
|
sl@0
|
873 |
// DecrementSessions();
|
sl@0
|
874 |
// }
|
sl@0
|
875 |
}
|
sl@0
|
876 |
|
sl@0
|
877 |
/**
|
sl@0
|
878 |
Function to cd.. ulogger server
|
sl@0
|
879 |
This should leave with KErrNotFound if cannot find one or any system wide error codes
|
sl@0
|
880 |
*/
|
sl@0
|
881 |
TInt CULoggerServer::Start()
|
sl@0
|
882 |
{
|
sl@0
|
883 |
#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
|
sl@0
|
884 |
__MARK_METHOD("CULoggerServer::Start")
|
sl@0
|
885 |
#endif
|
sl@0
|
886 |
|
sl@0
|
887 |
TRAPD(error, InitializeFrameworksL());
|
sl@0
|
888 |
|
sl@0
|
889 |
//check errors
|
sl@0
|
890 |
if(error != KErrNone)
|
sl@0
|
891 |
return error;
|
sl@0
|
892 |
if(!iOutputFramework)
|
sl@0
|
893 |
return KErrNotReady;
|
sl@0
|
894 |
if(iBtraceOpen)
|
sl@0
|
895 |
return KErrInUse;
|
sl@0
|
896 |
|
sl@0
|
897 |
TPtrC8 key;
|
sl@0
|
898 |
TPtrC8 val;
|
sl@0
|
899 |
TInt buffermode=0;
|
sl@0
|
900 |
RArray<TPtrC8> settings;
|
sl@0
|
901 |
RArray<TUint32> activefilters;
|
sl@0
|
902 |
//checking if there is at least one active channel
|
sl@0
|
903 |
error = GetActiveOutputPlugin(settings);
|
sl@0
|
904 |
if(error != KErrNone)
|
sl@0
|
905 |
return error;
|
sl@0
|
906 |
if(settings.Count()==0)
|
sl@0
|
907 |
{
|
sl@0
|
908 |
return KErrNotFound; //active output plug-in not found
|
sl@0
|
909 |
}
|
sl@0
|
910 |
|
sl@0
|
911 |
if(iBtraceOpen == EFalse)
|
sl@0
|
912 |
{
|
sl@0
|
913 |
if(iIsBooting)
|
sl@0
|
914 |
error = TraceSettingsOnBootL();
|
sl@0
|
915 |
else
|
sl@0
|
916 |
error = iTrace.Open();
|
sl@0
|
917 |
|
sl@0
|
918 |
if(error == KErrNone)
|
sl@0
|
919 |
{
|
sl@0
|
920 |
//----Reset the notification size
|
sl@0
|
921 |
TRAP_IGNORE(error=GetBufandDataNotifyValuesL(KDataNotification,iDataNotification));
|
sl@0
|
922 |
if(error!=KErrNone)
|
sl@0
|
923 |
return error;
|
sl@0
|
924 |
TRAP_IGNORE(error=GetBufandDataNotifyValuesL(KBuffer,iBufferSize));
|
sl@0
|
925 |
if(error!=KErrNone)
|
sl@0
|
926 |
return error;
|
sl@0
|
927 |
|
sl@0
|
928 |
//----Reset BTrace filters
|
sl@0
|
929 |
ResetBtracePrimaryFilters(iTrace);
|
sl@0
|
930 |
|
sl@0
|
931 |
//----Resize the trace buffer
|
sl@0
|
932 |
error = iTrace.ResizeBuffer(iBufferSize*1024);
|
sl@0
|
933 |
if(error == KErrNoMemory)
|
sl@0
|
934 |
{
|
sl@0
|
935 |
error = iTrace.ResizeBuffer(KMinBufferMTPLE*1024);
|
sl@0
|
936 |
}
|
sl@0
|
937 |
if(error != KErrNone)
|
sl@0
|
938 |
return error;
|
sl@0
|
939 |
//----Reset the buffer mode
|
sl@0
|
940 |
TRAP_IGNORE(GetBufandDataNotifyValuesL(KBufferMode,buffermode));
|
sl@0
|
941 |
if(buffermode==ECircularBuffer)
|
sl@0
|
942 |
{
|
sl@0
|
943 |
iTrace.SetMode(RBTrace::EFreeRunning|RBTrace::EEnable);
|
sl@0
|
944 |
}
|
sl@0
|
945 |
else
|
sl@0
|
946 |
{
|
sl@0
|
947 |
iTrace.SetMode(RBTrace::EEnable);
|
sl@0
|
948 |
}
|
sl@0
|
949 |
|
sl@0
|
950 |
//----Enable/disable primary filter
|
sl@0
|
951 |
error = GetActiveFilters(activefilters,EPrimaryFilter);
|
sl@0
|
952 |
if(error != KErrNone)
|
sl@0
|
953 |
return error;
|
sl@0
|
954 |
for(TInt i=0; i<activefilters.Count(); ++i)
|
sl@0
|
955 |
{
|
sl@0
|
956 |
TUint filter;
|
sl@0
|
957 |
filter= (TUint8)activefilters[i];
|
sl@0
|
958 |
iTrace.SetFilter(filter,ETrue);
|
sl@0
|
959 |
}
|
sl@0
|
960 |
|
sl@0
|
961 |
//----Enable/disable secondary filter
|
sl@0
|
962 |
settings.Reset();
|
sl@0
|
963 |
TBool enabled = EFalse;
|
sl@0
|
964 |
error = GetSecondaryFiltering(enabled);
|
sl@0
|
965 |
if(!error)
|
sl@0
|
966 |
{
|
sl@0
|
967 |
if (enabled)//enable secondary filter, only traces with certain value will pass
|
sl@0
|
968 |
{
|
sl@0
|
969 |
iTrace.SetFilter2(0);
|
sl@0
|
970 |
|
sl@0
|
971 |
//enable secondary filters chosen by user
|
sl@0
|
972 |
activefilters.Reset();
|
sl@0
|
973 |
if((error = GetActiveFilters(activefilters,ESecondaryFilter)) == KErrNone)
|
sl@0
|
974 |
for(TInt i=0; i<activefilters.Count(); ++i)
|
sl@0
|
975 |
iTrace.SetFilter2(activefilters[i], ETrue);
|
sl@0
|
976 |
else
|
sl@0
|
977 |
{
|
sl@0
|
978 |
if(error == KErrNotFound)
|
sl@0
|
979 |
{
|
sl@0
|
980 |
error = KErrNone;
|
sl@0
|
981 |
}
|
sl@0
|
982 |
else
|
sl@0
|
983 |
return error;
|
sl@0
|
984 |
}
|
sl@0
|
985 |
}
|
sl@0
|
986 |
else//disable secondary filter, all traces will pass
|
sl@0
|
987 |
{
|
sl@0
|
988 |
iTrace.SetFilter2(1);
|
sl@0
|
989 |
}
|
sl@0
|
990 |
}
|
sl@0
|
991 |
|
sl@0
|
992 |
//set flag to idicate that btrace is open
|
sl@0
|
993 |
iBtraceOpen = ETrue;
|
sl@0
|
994 |
|
sl@0
|
995 |
//start input and output frameworks
|
sl@0
|
996 |
iInputFramework->StartReading(); //start waiting for remote commands
|
sl@0
|
997 |
AsynchDataRequest();
|
sl@0
|
998 |
}
|
sl@0
|
999 |
}
|
sl@0
|
1000 |
else
|
sl@0
|
1001 |
error = KErrInUse;
|
sl@0
|
1002 |
|
sl@0
|
1003 |
return error;
|
sl@0
|
1004 |
}
|
sl@0
|
1005 |
|
sl@0
|
1006 |
/**
|
sl@0
|
1007 |
Close the BTrace handle to the buffer
|
sl@0
|
1008 |
@return none
|
sl@0
|
1009 |
*/
|
sl@0
|
1010 |
TInt CULoggerServer::Stop()
|
sl@0
|
1011 |
{
|
sl@0
|
1012 |
#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
|
sl@0
|
1013 |
__MARK_METHOD("CULoggerServer::Stop")
|
sl@0
|
1014 |
#endif
|
sl@0
|
1015 |
|
sl@0
|
1016 |
if(iBtraceOpen)
|
sl@0
|
1017 |
{
|
sl@0
|
1018 |
TInt errCode = KErrNone;
|
sl@0
|
1019 |
TRAP(errCode, ReadBufferL()); //flush the BTrace buffer
|
sl@0
|
1020 |
|
sl@0
|
1021 |
ResetBtracePrimaryFilters(iTrace);//reset BTrace filters
|
sl@0
|
1022 |
|
sl@0
|
1023 |
iTrace.CancelRequestData();
|
sl@0
|
1024 |
iTrace.Empty();
|
sl@0
|
1025 |
iTrace.Close();
|
sl@0
|
1026 |
iBtraceOpen = EFalse;
|
sl@0
|
1027 |
iDataWatcher->Cancel();
|
sl@0
|
1028 |
|
sl@0
|
1029 |
//stop waiting/reading for remote commands
|
sl@0
|
1030 |
iInputFramework->StopReading();
|
sl@0
|
1031 |
iOutputFramework->ReleaseOutputResources();
|
sl@0
|
1032 |
return KErrNone;
|
sl@0
|
1033 |
}
|
sl@0
|
1034 |
else
|
sl@0
|
1035 |
{
|
sl@0
|
1036 |
return KErrNotReady;
|
sl@0
|
1037 |
}
|
sl@0
|
1038 |
|
sl@0
|
1039 |
}
|
sl@0
|
1040 |
|
sl@0
|
1041 |
/**
|
sl@0
|
1042 |
Gets the Trace settings on boot
|
sl@0
|
1043 |
@return none
|
sl@0
|
1044 |
*/
|
sl@0
|
1045 |
TInt CULoggerServer::TraceSettingsOnBootL()
|
sl@0
|
1046 |
{
|
sl@0
|
1047 |
TInt trace = FALSE;
|
sl@0
|
1048 |
|
sl@0
|
1049 |
RArray<TUint32> category;
|
sl@0
|
1050 |
TInt error = iTrace.Open();
|
sl@0
|
1051 |
if(error != KErrNone)
|
sl@0
|
1052 |
return error;
|
sl@0
|
1053 |
|
sl@0
|
1054 |
TInt bufferSize = iTrace.BufferSize(); //To get the buffer size set at boot
|
sl@0
|
1055 |
if(bufferSize <= 0 && bufferSize > KMaxBufferSize)
|
sl@0
|
1056 |
SetBufferSizeL(KMaxBufferSize); //Update config
|
sl@0
|
1057 |
else
|
sl@0
|
1058 |
SetBufferSizeL(bufferSize); //Update config
|
sl@0
|
1059 |
for(TUint i=0; i<KMaxPrimaryFiltersLimit; i++)
|
sl@0
|
1060 |
{
|
sl@0
|
1061 |
trace = iTrace.Filter(i);
|
sl@0
|
1062 |
if(trace == 1)
|
sl@0
|
1063 |
category.AppendL((TUint32)i);
|
sl@0
|
1064 |
}
|
sl@0
|
1065 |
error = iConfigManager->SetActiveFilter(category,KPrimaryFilterSection);
|
sl@0
|
1066 |
category.Close();
|
sl@0
|
1067 |
iIsBooting=0;
|
sl@0
|
1068 |
return error;
|
sl@0
|
1069 |
}
|
sl@0
|
1070 |
|
sl@0
|
1071 |
|
sl@0
|
1072 |
|
sl@0
|
1073 |
/**
|
sl@0
|
1074 |
Reads the BTrace buffer and transfers the collected logs to
|
sl@0
|
1075 |
the ACTIVE channel
|
sl@0
|
1076 |
*/
|
sl@0
|
1077 |
void CULoggerServer::ReadBufferL()
|
sl@0
|
1078 |
{
|
sl@0
|
1079 |
if(iBtraceOpen)
|
sl@0
|
1080 |
{
|
sl@0
|
1081 |
TUint8* data;
|
sl@0
|
1082 |
TInt dataSize;
|
sl@0
|
1083 |
//TUint oldMode = iTrace.Mode();
|
sl@0
|
1084 |
//iTrace.SetMode(0); // turn off trace capture while we dump
|
sl@0
|
1085 |
dataSize = iTrace.GetData(data);
|
sl@0
|
1086 |
if(dataSize > 0)
|
sl@0
|
1087 |
{
|
sl@0
|
1088 |
|
sl@0
|
1089 |
TPtrC8 dataPtr(data, dataSize);
|
sl@0
|
1090 |
|
sl@0
|
1091 |
#if defined(__LIGHTLOGGER_ENABLED) && defined(__PERFORMANCE_TEST)
|
sl@0
|
1092 |
__LOGTIMESTAMP_HIRES("Passing data to output framework - t2") //performance test
|
sl@0
|
1093 |
#endif
|
sl@0
|
1094 |
|
sl@0
|
1095 |
//send data through output channel
|
sl@0
|
1096 |
TInt error = KErrNone;
|
sl@0
|
1097 |
if((error = iOutputFramework->SendData(dataPtr)) == KErrNone)
|
sl@0
|
1098 |
iTrace.DataUsed(); //only if data was really sent via output plugin
|
sl@0
|
1099 |
else
|
sl@0
|
1100 |
User::Leave(error);
|
sl@0
|
1101 |
|
sl@0
|
1102 |
#if defined(__LIGHTLOGGER_ENABLED) && defined(__PERFORMANCE_TEST)
|
sl@0
|
1103 |
__LOGTIMESTAMP_HIRES("Data logged - t3") //performance test
|
sl@0
|
1104 |
#endif
|
sl@0
|
1105 |
}
|
sl@0
|
1106 |
//iTrace.SetMode(oldMode);
|
sl@0
|
1107 |
|
sl@0
|
1108 |
AsynchDataRequest();
|
sl@0
|
1109 |
}
|
sl@0
|
1110 |
}
|
sl@0
|
1111 |
|
sl@0
|
1112 |
|
sl@0
|
1113 |
void CULoggerServer::AsynchDataRequest()
|
sl@0
|
1114 |
{
|
sl@0
|
1115 |
if(!iDataWatcher->IsActive())
|
sl@0
|
1116 |
{
|
sl@0
|
1117 |
iTrace.RequestData(iDataWatcher->GetStatus(), iDataNotification*1024);
|
sl@0
|
1118 |
iDataWatcher->StartWatching(this);
|
sl@0
|
1119 |
}
|
sl@0
|
1120 |
}
|
sl@0
|
1121 |
|
sl@0
|
1122 |
|
sl@0
|
1123 |
void CULoggerServer::DataNotification()
|
sl@0
|
1124 |
{
|
sl@0
|
1125 |
TRAPD(e, ReadBufferL());
|
sl@0
|
1126 |
if(e != KErrNone)
|
sl@0
|
1127 |
AsynchDataRequest();
|
sl@0
|
1128 |
}
|
sl@0
|
1129 |
|
sl@0
|
1130 |
|
sl@0
|
1131 |
void CULoggerServer::GetPluginAndSettingsL(TDes8& aPluginName, RPointerArray<TPluginConfiguration>* aSettings, TPluginFilter aPluginFilter)
|
sl@0
|
1132 |
{
|
sl@0
|
1133 |
TPtrC8 key;
|
sl@0
|
1134 |
TPtrC8 val;
|
sl@0
|
1135 |
RArray<TPtrC8> activePluginsArray;
|
sl@0
|
1136 |
RArray<TPtrC8> pluginsArray;
|
sl@0
|
1137 |
RArray<TPtrC8> pluginSettings;
|
sl@0
|
1138 |
TInt i,j;
|
sl@0
|
1139 |
|
sl@0
|
1140 |
if(aPluginFilter == EOutputPluginFilter)
|
sl@0
|
1141 |
GetActiveOutputPlugin(activePluginsArray); //get output plugin
|
sl@0
|
1142 |
else
|
sl@0
|
1143 |
GetActiveInputPlugin(activePluginsArray); //get control plugin
|
sl@0
|
1144 |
|
sl@0
|
1145 |
for(i=0; i<activePluginsArray.Count(); ++i)
|
sl@0
|
1146 |
{
|
sl@0
|
1147 |
TBuf8<256> activeplugin;
|
sl@0
|
1148 |
activeplugin.Copy(activePluginsArray[i]);
|
sl@0
|
1149 |
activeplugin.LowerCase();
|
sl@0
|
1150 |
|
sl@0
|
1151 |
GetInstalledOutputPlugins(pluginsArray);
|
sl@0
|
1152 |
for(j=0;j<pluginsArray.Count();j++)
|
sl@0
|
1153 |
{
|
sl@0
|
1154 |
TBuf8<256> plugin;
|
sl@0
|
1155 |
plugin.Copy(pluginsArray[j]);
|
sl@0
|
1156 |
plugin.LowerCase();
|
sl@0
|
1157 |
|
sl@0
|
1158 |
if(activeplugin.Compare(plugin)==0)
|
sl@0
|
1159 |
{
|
sl@0
|
1160 |
break;
|
sl@0
|
1161 |
}
|
sl@0
|
1162 |
}
|
sl@0
|
1163 |
aPluginName.Copy(activePluginsArray[i]);
|
sl@0
|
1164 |
GetOptionsSettingsL(aPluginName,pluginSettings);
|
sl@0
|
1165 |
j=0;
|
sl@0
|
1166 |
while(j < pluginSettings.Count())
|
sl@0
|
1167 |
{
|
sl@0
|
1168 |
TPluginConfiguration* keyAndVal = new TPluginConfiguration();
|
sl@0
|
1169 |
keyAndVal->SetKey(pluginSettings[j]);
|
sl@0
|
1170 |
keyAndVal->SetValue(pluginSettings[j+1]);
|
sl@0
|
1171 |
aSettings->AppendL(keyAndVal);
|
sl@0
|
1172 |
j=j+2;
|
sl@0
|
1173 |
}
|
sl@0
|
1174 |
}
|
sl@0
|
1175 |
}
|
sl@0
|
1176 |
|
sl@0
|
1177 |
|
sl@0
|
1178 |
/*
|
sl@0
|
1179 |
* Cleanup RPointerArray<TPluginConfiguration>* object by calling ResetAndDestroy to delete memory
|
sl@0
|
1180 |
* allocated as TPluginConfigurations whose ownership has been passed to the RPointerArray.
|
sl@0
|
1181 |
*
|
sl@0
|
1182 |
*/
|
sl@0
|
1183 |
void CULoggerServer::CleanupTPluginConfigArray(TAny* aPtr)
|
sl@0
|
1184 |
{
|
sl@0
|
1185 |
RPointerArray<TPluginConfiguration>* ptrArray = reinterpret_cast<RPointerArray<TPluginConfiguration>*>(aPtr);
|
sl@0
|
1186 |
ptrArray->ResetAndDestroy();
|
sl@0
|
1187 |
ptrArray->Close();
|
sl@0
|
1188 |
}
|
sl@0
|
1189 |
|
sl@0
|
1190 |
|
sl@0
|
1191 |
void CULoggerServer::InitializeFrameworksL()
|
sl@0
|
1192 |
{
|
sl@0
|
1193 |
//<create plugin allocator (plugins)>
|
sl@0
|
1194 |
//output settings
|
sl@0
|
1195 |
RBuf8 outPluginName;
|
sl@0
|
1196 |
outPluginName.CreateL(KMaxPluginName);
|
sl@0
|
1197 |
CleanupClosePushL(outPluginName);
|
sl@0
|
1198 |
RPointerArray<TPluginConfiguration> outputPluginSettings;
|
sl@0
|
1199 |
CleanupStack::PushL(TCleanupItem(CleanupTPluginConfigArray, &outputPluginSettings));
|
sl@0
|
1200 |
GetPluginAndSettingsL(outPluginName, &outputPluginSettings, EOutputPluginFilter);
|
sl@0
|
1201 |
|
sl@0
|
1202 |
//control settings
|
sl@0
|
1203 |
RBuf8 inputPluginName;
|
sl@0
|
1204 |
inputPluginName.CreateL(KMaxPluginName);
|
sl@0
|
1205 |
CleanupClosePushL(inputPluginName);
|
sl@0
|
1206 |
RPointerArray<TPluginConfiguration> inputPluginSettings;
|
sl@0
|
1207 |
CleanupStack::PushL(TCleanupItem(CleanupTPluginConfigArray, &inputPluginSettings));
|
sl@0
|
1208 |
GetPluginAndSettingsL(inputPluginName, &inputPluginSettings, EInputPluginFilter);
|
sl@0
|
1209 |
|
sl@0
|
1210 |
#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
|
sl@0
|
1211 |
__LOG("before creating CPluginAllocator")
|
sl@0
|
1212 |
#endif
|
sl@0
|
1213 |
|
sl@0
|
1214 |
//create plugin allocator (plugins)
|
sl@0
|
1215 |
if(!iPluginAllocator)
|
sl@0
|
1216 |
{
|
sl@0
|
1217 |
iPluginAllocator = CPluginAllocator::NewL(outPluginName, inputPluginName);
|
sl@0
|
1218 |
}
|
sl@0
|
1219 |
|
sl@0
|
1220 |
#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
|
sl@0
|
1221 |
__LOG("before creating COutputFramework")
|
sl@0
|
1222 |
#endif
|
sl@0
|
1223 |
//Initialize output framework
|
sl@0
|
1224 |
if(!iOutputFramework)
|
sl@0
|
1225 |
{
|
sl@0
|
1226 |
iOutputFramework = COutputFramework::NewL(*(iPluginAllocator->GetOutputPlugin()), outputPluginSettings);
|
sl@0
|
1227 |
}
|
sl@0
|
1228 |
|
sl@0
|
1229 |
//Initialize Control Framework
|
sl@0
|
1230 |
if(!iInputFramework)
|
sl@0
|
1231 |
{
|
sl@0
|
1232 |
iInputFramework = CInputFramework::NewL(iPluginAllocator->GetInputPlugin(), inputPluginSettings, this);
|
sl@0
|
1233 |
}
|
sl@0
|
1234 |
|
sl@0
|
1235 |
//cleanup
|
sl@0
|
1236 |
CleanupStack::PopAndDestroy(4, &outPluginName); // and outputPluginSettings, inputPluginName and inputPluginSettings
|
sl@0
|
1237 |
|
sl@0
|
1238 |
iDataWatcher = CULoggerWatcher::NewL();
|
sl@0
|
1239 |
}
|
sl@0
|
1240 |
|
sl@0
|
1241 |
|
sl@0
|
1242 |
void CULoggerServer::PrepareControlDataPayloadL(RBuf8& aPayloadBuf, const RArray<TPtrC8>& aArray)
|
sl@0
|
1243 |
{
|
sl@0
|
1244 |
aPayloadBuf.CreateL(aArray.Count()*32);
|
sl@0
|
1245 |
for(TInt i=0; i<aArray.Count(); i++)
|
sl@0
|
1246 |
{
|
sl@0
|
1247 |
if(aPayloadBuf.MaxSize() < aPayloadBuf.Length()+aArray[i].Length())
|
sl@0
|
1248 |
{
|
sl@0
|
1249 |
aPayloadBuf.ReAllocL(aPayloadBuf.Length()+(aArray[i].Length()*10));
|
sl@0
|
1250 |
}
|
sl@0
|
1251 |
aPayloadBuf.Append(aArray[i]);
|
sl@0
|
1252 |
if(i < aArray.Count()-1) //skip last sparator as it will be added automatically
|
sl@0
|
1253 |
{
|
sl@0
|
1254 |
aPayloadBuf.Append(DATA_SEPARATOR);
|
sl@0
|
1255 |
}
|
sl@0
|
1256 |
}
|
sl@0
|
1257 |
}
|
sl@0
|
1258 |
|
sl@0
|
1259 |
|
sl@0
|
1260 |
void CULoggerServer::PrepareControlDataPayloadL(RBuf8& aPayloadBuf, const RArray<TUint32>& aArray)
|
sl@0
|
1261 |
{
|
sl@0
|
1262 |
aPayloadBuf.CreateL(aArray.Count()*4);
|
sl@0
|
1263 |
for(TInt i=0; i<aArray.Count(); i++)
|
sl@0
|
1264 |
{
|
sl@0
|
1265 |
TBuf8<64> b;
|
sl@0
|
1266 |
b.Num(aArray[i]);
|
sl@0
|
1267 |
if(aPayloadBuf.MaxSize() < aPayloadBuf.Length()+b.Length())
|
sl@0
|
1268 |
{
|
sl@0
|
1269 |
aPayloadBuf.ReAllocL(aPayloadBuf.Length()+(b.Length()*10));
|
sl@0
|
1270 |
}
|
sl@0
|
1271 |
aPayloadBuf.Append(b);
|
sl@0
|
1272 |
if(i < aArray.Count()-1) //skip last sparator as it will be added automatically
|
sl@0
|
1273 |
{
|
sl@0
|
1274 |
aPayloadBuf.Append(DATA_SEPARATOR);
|
sl@0
|
1275 |
}
|
sl@0
|
1276 |
}
|
sl@0
|
1277 |
}
|
sl@0
|
1278 |
|
sl@0
|
1279 |
|
sl@0
|
1280 |
TInt CULoggerServer::RestartOutputting()
|
sl@0
|
1281 |
{
|
sl@0
|
1282 |
TInt err=KErrNone;
|
sl@0
|
1283 |
#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
|
sl@0
|
1284 |
__MARK_METHOD("CULoggerServer::ForceRefreshSettingsL")
|
sl@0
|
1285 |
#endif
|
sl@0
|
1286 |
if(iBtraceOpen != EFalse)
|
sl@0
|
1287 |
{
|
sl@0
|
1288 |
err = Stop();
|
sl@0
|
1289 |
iBtraceOpen = EFalse;
|
sl@0
|
1290 |
}
|
sl@0
|
1291 |
|
sl@0
|
1292 |
if(iDataWatcher)
|
sl@0
|
1293 |
{
|
sl@0
|
1294 |
iDataWatcher->Cancel();
|
sl@0
|
1295 |
delete iDataWatcher;
|
sl@0
|
1296 |
iDataWatcher = NULL;
|
sl@0
|
1297 |
}
|
sl@0
|
1298 |
if(iOutputFramework)
|
sl@0
|
1299 |
{
|
sl@0
|
1300 |
delete iOutputFramework;
|
sl@0
|
1301 |
iOutputFramework = NULL;
|
sl@0
|
1302 |
}
|
sl@0
|
1303 |
if(iInputFramework)
|
sl@0
|
1304 |
{
|
sl@0
|
1305 |
delete iInputFramework;
|
sl@0
|
1306 |
iInputFramework = NULL;
|
sl@0
|
1307 |
}
|
sl@0
|
1308 |
if(iPluginAllocator)
|
sl@0
|
1309 |
{
|
sl@0
|
1310 |
delete iPluginAllocator;
|
sl@0
|
1311 |
iPluginAllocator = NULL;
|
sl@0
|
1312 |
}
|
sl@0
|
1313 |
if(iConfigManager)
|
sl@0
|
1314 |
{
|
sl@0
|
1315 |
iConfigManager->RefreshConfigFiles();
|
sl@0
|
1316 |
}
|
sl@0
|
1317 |
|
sl@0
|
1318 |
err = Start(); //always start
|
sl@0
|
1319 |
return err;
|
sl@0
|
1320 |
}
|
sl@0
|
1321 |
|
sl@0
|
1322 |
|
sl@0
|
1323 |
TInt CULoggerServer::ResetBtracePrimaryFilters(RBTrace &aBTrace)
|
sl@0
|
1324 |
{
|
sl@0
|
1325 |
for(TUint i=0; i<256; i++)
|
sl@0
|
1326 |
aBTrace.SetFilter(i, EFalse);
|
sl@0
|
1327 |
aBTrace.SetFilter2(0);
|
sl@0
|
1328 |
return KErrNone;
|
sl@0
|
1329 |
}
|
sl@0
|
1330 |
|
sl@0
|
1331 |
//This bit should be part of the input framework, or it should reuse the other methods better
|
sl@0
|
1332 |
ControlData* CULoggerServer::ProcessCommandL(TCommand aOpCode, RArray<TPtrC8> &aArguments)
|
sl@0
|
1333 |
{
|
sl@0
|
1334 |
#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
|
sl@0
|
1335 |
__MARK_METHOD("CULoggerServer::ProcessCommand")
|
sl@0
|
1336 |
#endif
|
sl@0
|
1337 |
|
sl@0
|
1338 |
TInt errCode = KErrNone;
|
sl@0
|
1339 |
TInt minSize = 8;
|
sl@0
|
1340 |
CInputData *inputData = new (ELeave) CInputData(minSize);
|
sl@0
|
1341 |
ControlData* data = NULL;
|
sl@0
|
1342 |
RBuf8 payloadBuf;
|
sl@0
|
1343 |
TBuf8<32> result;
|
sl@0
|
1344 |
|
sl@0
|
1345 |
switch(aOpCode)
|
sl@0
|
1346 |
{
|
sl@0
|
1347 |
case EStart:
|
sl@0
|
1348 |
{
|
sl@0
|
1349 |
if(!ServerState())
|
sl@0
|
1350 |
errCode = this->Start();
|
sl@0
|
1351 |
else
|
sl@0
|
1352 |
errCode = KErrInUse;
|
sl@0
|
1353 |
result.Num(errCode);
|
sl@0
|
1354 |
data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
|
sl@0
|
1355 |
}
|
sl@0
|
1356 |
break;
|
sl@0
|
1357 |
|
sl@0
|
1358 |
case EStop:
|
sl@0
|
1359 |
{
|
sl@0
|
1360 |
//ulogger shouldn't be restarted here as we must send acknowledgment back to PC
|
sl@0
|
1361 |
//Stop will be done in DoPostProcessing method after sending ack.
|
sl@0
|
1362 |
result.Num(errCode);
|
sl@0
|
1363 |
data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
|
sl@0
|
1364 |
}
|
sl@0
|
1365 |
break;
|
sl@0
|
1366 |
|
sl@0
|
1367 |
case ESetPrimaryFilter:
|
sl@0
|
1368 |
{
|
sl@0
|
1369 |
#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
|
sl@0
|
1370 |
__LOG("ESetPrimaryFilter")
|
sl@0
|
1371 |
#endif
|
sl@0
|
1372 |
|
sl@0
|
1373 |
RArray<TUint32> filterArray;
|
sl@0
|
1374 |
|
sl@0
|
1375 |
errCode = KErrNone;
|
sl@0
|
1376 |
//process parameters
|
sl@0
|
1377 |
TInt i;
|
sl@0
|
1378 |
for(i=0; i<aArguments.Count(); i++)
|
sl@0
|
1379 |
{
|
sl@0
|
1380 |
TUint8 val;
|
sl@0
|
1381 |
TLex8 lex(aArguments[i]);
|
sl@0
|
1382 |
if((errCode=lex.Val(val, EDecimal)) != KErrNone)
|
sl@0
|
1383 |
{
|
sl@0
|
1384 |
//report bad values, don't set anything
|
sl@0
|
1385 |
if(errCode == KErrGeneral)
|
sl@0
|
1386 |
errCode = KErrArgument;
|
sl@0
|
1387 |
result.Num(errCode);
|
sl@0
|
1388 |
data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
|
sl@0
|
1389 |
/*
|
sl@0
|
1390 |
payloadBuf.Create(128);
|
sl@0
|
1391 |
payloadBuf.Copy(aArguments[i]);
|
sl@0
|
1392 |
inputData->AppendNewData(ack, (const void*)payloadBuf.Ptr(), payloadBuf.Length());
|
sl@0
|
1393 |
*/
|
sl@0
|
1394 |
filterArray.Close();
|
sl@0
|
1395 |
break;
|
sl@0
|
1396 |
}
|
sl@0
|
1397 |
filterArray.AppendL(val);
|
sl@0
|
1398 |
}
|
sl@0
|
1399 |
|
sl@0
|
1400 |
if(errCode == KErrNone)
|
sl@0
|
1401 |
{
|
sl@0
|
1402 |
errCode = SetActiveFilterL(filterArray, EPrimaryFilter);
|
sl@0
|
1403 |
result.Num(errCode);
|
sl@0
|
1404 |
|
sl@0
|
1405 |
//create acknowledment
|
sl@0
|
1406 |
result.Num(errCode);
|
sl@0
|
1407 |
data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
|
sl@0
|
1408 |
|
sl@0
|
1409 |
//create string as a payload
|
sl@0
|
1410 |
/*
|
sl@0
|
1411 |
payloadBuf.CreateL(dupfilterArray.Count()*4);
|
sl@0
|
1412 |
for(i=0; i<dupfilterArray.Count(); i++)
|
sl@0
|
1413 |
{
|
sl@0
|
1414 |
TBuf8<32> b;
|
sl@0
|
1415 |
b.Num(dupfilterArray[i]);
|
sl@0
|
1416 |
if(payloadBuf.MaxSize() < payloadBuf.Length()+b.Length())
|
sl@0
|
1417 |
payloadBuf.ReAllocL(payloadBuf.Length()+(b.Length()*10));
|
sl@0
|
1418 |
payloadBuf.Append(b);
|
sl@0
|
1419 |
if(i < dupfilterArray.Count()-1) //skip last sparator as it will be added automatically
|
sl@0
|
1420 |
payloadBuf.Append(DATA_SEPARATOR);
|
sl@0
|
1421 |
}
|
sl@0
|
1422 |
if(payloadBuf.Length() > 0)
|
sl@0
|
1423 |
inputData->AppendNewData(ack, (const void*)payloadBuf.Ptr(), payloadBuf.Length());
|
sl@0
|
1424 |
*/
|
sl@0
|
1425 |
filterArray.Close();
|
sl@0
|
1426 |
}
|
sl@0
|
1427 |
}
|
sl@0
|
1428 |
break; //ESetPrimaryFilter
|
sl@0
|
1429 |
|
sl@0
|
1430 |
case ESetSecondaryFilter:
|
sl@0
|
1431 |
{
|
sl@0
|
1432 |
RArray<TUint32> filterArray;
|
sl@0
|
1433 |
//process parameters
|
sl@0
|
1434 |
TInt i;
|
sl@0
|
1435 |
for(i=0; i<aArguments.Count(); i++)
|
sl@0
|
1436 |
{
|
sl@0
|
1437 |
TUint32 val;
|
sl@0
|
1438 |
TLex8 lex(aArguments[i]);
|
sl@0
|
1439 |
if((errCode=lex.Val(val,EDecimal)) != KErrNone)
|
sl@0
|
1440 |
{
|
sl@0
|
1441 |
//report bad values, don't set anything
|
sl@0
|
1442 |
if(errCode == KErrGeneral)
|
sl@0
|
1443 |
errCode = KErrArgument;
|
sl@0
|
1444 |
result.Num(errCode);
|
sl@0
|
1445 |
data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
|
sl@0
|
1446 |
/*
|
sl@0
|
1447 |
payloadBuf.CreateL(128);
|
sl@0
|
1448 |
payloadBuf.Copy(aArguments[i]);
|
sl@0
|
1449 |
man->AppendNewData(ack, (const void*)payloadBuf.Ptr(), payloadBuf.Length());
|
sl@0
|
1450 |
*/
|
sl@0
|
1451 |
filterArray.Close();
|
sl@0
|
1452 |
break;
|
sl@0
|
1453 |
}
|
sl@0
|
1454 |
filterArray.AppendL(val);
|
sl@0
|
1455 |
}
|
sl@0
|
1456 |
if(errCode != KErrNone)
|
sl@0
|
1457 |
break;
|
sl@0
|
1458 |
|
sl@0
|
1459 |
//create ack
|
sl@0
|
1460 |
errCode = SetActiveFilterL(filterArray, ESecondaryFilter);
|
sl@0
|
1461 |
result.Num(errCode);
|
sl@0
|
1462 |
data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
|
sl@0
|
1463 |
|
sl@0
|
1464 |
filterArray.Close();
|
sl@0
|
1465 |
}
|
sl@0
|
1466 |
break; //ESetSecondaryFilter
|
sl@0
|
1467 |
|
sl@0
|
1468 |
case EEnableSecondaryFiltering:
|
sl@0
|
1469 |
{
|
sl@0
|
1470 |
errCode = SetSecondaryFiltering(KEnable);
|
sl@0
|
1471 |
result.Num(errCode);
|
sl@0
|
1472 |
data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
|
sl@0
|
1473 |
}
|
sl@0
|
1474 |
break;
|
sl@0
|
1475 |
|
sl@0
|
1476 |
case EDisableSecondaryFiltering:
|
sl@0
|
1477 |
{
|
sl@0
|
1478 |
errCode = SetSecondaryFiltering(KDisable);
|
sl@0
|
1479 |
result.Num(errCode);
|
sl@0
|
1480 |
data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
|
sl@0
|
1481 |
}
|
sl@0
|
1482 |
break;
|
sl@0
|
1483 |
|
sl@0
|
1484 |
case EResizeTraceBuffer:
|
sl@0
|
1485 |
{
|
sl@0
|
1486 |
if(aArguments.Count() > 0)
|
sl@0
|
1487 |
{
|
sl@0
|
1488 |
TInt bufSize;
|
sl@0
|
1489 |
TLex8 lex(aArguments[0]);
|
sl@0
|
1490 |
if((errCode = lex.Val(bufSize)) == KErrNone)
|
sl@0
|
1491 |
errCode = SetBufferSizeL(bufSize);
|
sl@0
|
1492 |
}
|
sl@0
|
1493 |
else
|
sl@0
|
1494 |
errCode = KErrArgument;
|
sl@0
|
1495 |
|
sl@0
|
1496 |
result.Num(errCode);
|
sl@0
|
1497 |
data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
|
sl@0
|
1498 |
}
|
sl@0
|
1499 |
break;
|
sl@0
|
1500 |
|
sl@0
|
1501 |
case ESetBufferMode:
|
sl@0
|
1502 |
{
|
sl@0
|
1503 |
#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
|
sl@0
|
1504 |
__LOG("ESetBufferMode")
|
sl@0
|
1505 |
#endif
|
sl@0
|
1506 |
|
sl@0
|
1507 |
if(aArguments.Count() > 0)
|
sl@0
|
1508 |
{
|
sl@0
|
1509 |
if(aArguments[0].Compare(KCircular)==0)
|
sl@0
|
1510 |
errCode = SetBufferMode(KCircular);
|
sl@0
|
1511 |
else if(aArguments[0].Compare(KStraight)==0)
|
sl@0
|
1512 |
errCode = SetBufferMode(KStraight);
|
sl@0
|
1513 |
else
|
sl@0
|
1514 |
errCode = KErrArgument;
|
sl@0
|
1515 |
}
|
sl@0
|
1516 |
else
|
sl@0
|
1517 |
errCode = KErrArgument;
|
sl@0
|
1518 |
|
sl@0
|
1519 |
#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
|
sl@0
|
1520 |
__LOG("errCode")
|
sl@0
|
1521 |
__LOGNUM(errCode)
|
sl@0
|
1522 |
#endif
|
sl@0
|
1523 |
|
sl@0
|
1524 |
result.Num(errCode);
|
sl@0
|
1525 |
data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
|
sl@0
|
1526 |
}
|
sl@0
|
1527 |
break;
|
sl@0
|
1528 |
|
sl@0
|
1529 |
case ESetDataNotificationSize:
|
sl@0
|
1530 |
{
|
sl@0
|
1531 |
#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
|
sl@0
|
1532 |
__LOG("ESetDataNotificationSize")
|
sl@0
|
1533 |
#endif
|
sl@0
|
1534 |
|
sl@0
|
1535 |
if(aArguments.Count() > 0)
|
sl@0
|
1536 |
{
|
sl@0
|
1537 |
TInt dns;
|
sl@0
|
1538 |
TLex8 lex(aArguments[0]);
|
sl@0
|
1539 |
if((errCode = lex.Val(dns)) == KErrNone)
|
sl@0
|
1540 |
errCode = SetDataNotificationSizeL(dns);
|
sl@0
|
1541 |
else
|
sl@0
|
1542 |
errCode = KErrArgument;
|
sl@0
|
1543 |
}
|
sl@0
|
1544 |
else
|
sl@0
|
1545 |
errCode = KErrArgument;
|
sl@0
|
1546 |
|
sl@0
|
1547 |
result.Num(errCode);
|
sl@0
|
1548 |
data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
|
sl@0
|
1549 |
}
|
sl@0
|
1550 |
break;
|
sl@0
|
1551 |
|
sl@0
|
1552 |
case ERemovePluginSettings:
|
sl@0
|
1553 |
{
|
sl@0
|
1554 |
if(aArguments.Count() > 0)
|
sl@0
|
1555 |
errCode = RemovePluginSettingsL(aArguments[0]);
|
sl@0
|
1556 |
else
|
sl@0
|
1557 |
errCode = KErrArgument;
|
sl@0
|
1558 |
result.Num(errCode);
|
sl@0
|
1559 |
data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
|
sl@0
|
1560 |
}
|
sl@0
|
1561 |
break;
|
sl@0
|
1562 |
|
sl@0
|
1563 |
case EGetInstalledPlugins:
|
sl@0
|
1564 |
{
|
sl@0
|
1565 |
#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
|
sl@0
|
1566 |
__LOG("EGetInstalledOutputPlugins")
|
sl@0
|
1567 |
#endif
|
sl@0
|
1568 |
|
sl@0
|
1569 |
RArray<TPtrC8> tmpArray;
|
sl@0
|
1570 |
errCode = GetInstalledOutputPlugins(tmpArray);
|
sl@0
|
1571 |
result.Num(errCode);
|
sl@0
|
1572 |
data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
|
sl@0
|
1573 |
|
sl@0
|
1574 |
#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
|
sl@0
|
1575 |
for(TInt p=0; p<tmpArray.Count(); p++) __LOGBUF(tmpArray[p])
|
sl@0
|
1576 |
#endif
|
sl@0
|
1577 |
|
sl@0
|
1578 |
//create payload
|
sl@0
|
1579 |
PrepareControlDataPayloadL(payloadBuf, tmpArray);
|
sl@0
|
1580 |
//add playload in control data chunk
|
sl@0
|
1581 |
if(payloadBuf.Length() > 0)
|
sl@0
|
1582 |
inputData->AppendNewData(data, (const void*)payloadBuf.Ptr(), payloadBuf.Length());
|
sl@0
|
1583 |
}
|
sl@0
|
1584 |
break; //EGetInstalledOutputPlugins
|
sl@0
|
1585 |
|
sl@0
|
1586 |
case EGetActivePlugin: //output
|
sl@0
|
1587 |
{
|
sl@0
|
1588 |
#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
|
sl@0
|
1589 |
__LOG("EGetActivePlugin")
|
sl@0
|
1590 |
#endif
|
sl@0
|
1591 |
|
sl@0
|
1592 |
RArray<TPtrC8> tmpArray;
|
sl@0
|
1593 |
errCode = GetActiveOutputPlugin(tmpArray);
|
sl@0
|
1594 |
result.Num(errCode);
|
sl@0
|
1595 |
data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
|
sl@0
|
1596 |
|
sl@0
|
1597 |
#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
|
sl@0
|
1598 |
for(TInt p=0; p<tmpArray.Count(); p++) __LOGBUF(tmpArray[p])
|
sl@0
|
1599 |
#endif
|
sl@0
|
1600 |
|
sl@0
|
1601 |
//create payload
|
sl@0
|
1602 |
PrepareControlDataPayloadL(payloadBuf, tmpArray);
|
sl@0
|
1603 |
//add playload in control data chunk
|
sl@0
|
1604 |
if(payloadBuf.Length() > 0)
|
sl@0
|
1605 |
inputData->AppendNewData(data, (const void*)payloadBuf.Ptr(), payloadBuf.Length());
|
sl@0
|
1606 |
}
|
sl@0
|
1607 |
break; //EGetActivePlugin
|
sl@0
|
1608 |
|
sl@0
|
1609 |
case EGetPluginSettings:
|
sl@0
|
1610 |
{
|
sl@0
|
1611 |
#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
|
sl@0
|
1612 |
__LOG("EGetPluginSettings")
|
sl@0
|
1613 |
#endif
|
sl@0
|
1614 |
RArray<TPtrC8> tmpArray;
|
sl@0
|
1615 |
if(aArguments.Count() > 0)
|
sl@0
|
1616 |
{
|
sl@0
|
1617 |
errCode = GetOptionsSettingsL(aArguments[0],tmpArray);
|
sl@0
|
1618 |
|
sl@0
|
1619 |
#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
|
sl@0
|
1620 |
for(TInt p=0; p<tmpArray.Count(); p++) __LOGBUF(tmpArray[p])
|
sl@0
|
1621 |
#endif
|
sl@0
|
1622 |
}
|
sl@0
|
1623 |
else
|
sl@0
|
1624 |
errCode = KErrArgument;
|
sl@0
|
1625 |
|
sl@0
|
1626 |
result.Num(errCode);
|
sl@0
|
1627 |
data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
|
sl@0
|
1628 |
//create payload
|
sl@0
|
1629 |
PrepareControlDataPayloadL(payloadBuf, tmpArray);
|
sl@0
|
1630 |
//add playload in control data chunk
|
sl@0
|
1631 |
if(payloadBuf.Length() > 0)
|
sl@0
|
1632 |
inputData->AppendNewData(data, (const void*)payloadBuf.Ptr(), payloadBuf.Length());
|
sl@0
|
1633 |
}
|
sl@0
|
1634 |
break; //EGetPluginSettings
|
sl@0
|
1635 |
|
sl@0
|
1636 |
case EGetPrimaryFilters:
|
sl@0
|
1637 |
{
|
sl@0
|
1638 |
#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
|
sl@0
|
1639 |
__LOG("EGetPluginSettings")
|
sl@0
|
1640 |
#endif
|
sl@0
|
1641 |
|
sl@0
|
1642 |
RArray<TUint32> tmpArray;
|
sl@0
|
1643 |
errCode = GetActiveFilters(tmpArray,EPrimaryFilter);
|
sl@0
|
1644 |
|
sl@0
|
1645 |
result.Num(errCode);
|
sl@0
|
1646 |
data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
|
sl@0
|
1647 |
|
sl@0
|
1648 |
#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
|
sl@0
|
1649 |
for(TInt p=0; p<tmpArray.Count(); p++) __LOGNUM(tmpArray[p])
|
sl@0
|
1650 |
#endif
|
sl@0
|
1651 |
|
sl@0
|
1652 |
//create payload
|
sl@0
|
1653 |
PrepareControlDataPayloadL(payloadBuf, tmpArray);
|
sl@0
|
1654 |
|
sl@0
|
1655 |
#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
|
sl@0
|
1656 |
__LOG("EGetPluginSettings - test 1")
|
sl@0
|
1657 |
#endif
|
sl@0
|
1658 |
|
sl@0
|
1659 |
|
sl@0
|
1660 |
if(payloadBuf.Length() > 0)
|
sl@0
|
1661 |
inputData->AppendNewData(data, (const void*)payloadBuf.Ptr(), payloadBuf.Length());
|
sl@0
|
1662 |
tmpArray.Close();
|
sl@0
|
1663 |
|
sl@0
|
1664 |
#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
|
sl@0
|
1665 |
__LOG("EGetPluginSettings - test 2")
|
sl@0
|
1666 |
#endif
|
sl@0
|
1667 |
}
|
sl@0
|
1668 |
break; //EGetPrimaryFilters
|
sl@0
|
1669 |
|
sl@0
|
1670 |
case EGetSecondaryFilters:
|
sl@0
|
1671 |
{
|
sl@0
|
1672 |
#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
|
sl@0
|
1673 |
__LOG("EGetSecondaryFilters")
|
sl@0
|
1674 |
#endif
|
sl@0
|
1675 |
|
sl@0
|
1676 |
TBool skipReadingFilters = EFalse;
|
sl@0
|
1677 |
RArray<TPtrC8> tmpArrayTxt;
|
sl@0
|
1678 |
TBool enabled = EFalse;
|
sl@0
|
1679 |
errCode = errCode = this->GetSecondaryFiltering(enabled);
|
sl@0
|
1680 |
if(errCode == KErrNone)
|
sl@0
|
1681 |
{
|
sl@0
|
1682 |
if(EFalse == enabled)
|
sl@0
|
1683 |
{
|
sl@0
|
1684 |
result.Num(errCode);
|
sl@0
|
1685 |
data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
|
sl@0
|
1686 |
skipReadingFilters = ETrue;
|
sl@0
|
1687 |
//create payload
|
sl@0
|
1688 |
PrepareControlDataPayloadL(payloadBuf, tmpArrayTxt);
|
sl@0
|
1689 |
if(payloadBuf.Length() > 0)
|
sl@0
|
1690 |
inputData->AppendNewData(data, (const void*)payloadBuf.Ptr(), payloadBuf.Length());
|
sl@0
|
1691 |
}
|
sl@0
|
1692 |
}
|
sl@0
|
1693 |
|
sl@0
|
1694 |
RArray<TUint32> tmpArray;
|
sl@0
|
1695 |
if(!skipReadingFilters)
|
sl@0
|
1696 |
{
|
sl@0
|
1697 |
errCode = this->GetActiveFilters(tmpArray,ESecondaryFilter);
|
sl@0
|
1698 |
result.Num(errCode);
|
sl@0
|
1699 |
data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
|
sl@0
|
1700 |
//create payload
|
sl@0
|
1701 |
PrepareControlDataPayloadL(payloadBuf, tmpArray);
|
sl@0
|
1702 |
if(payloadBuf.Length() > 0)
|
sl@0
|
1703 |
inputData->AppendNewData(data, (const void*)payloadBuf.Ptr(), payloadBuf.Length());
|
sl@0
|
1704 |
}
|
sl@0
|
1705 |
|
sl@0
|
1706 |
tmpArrayTxt.Close();
|
sl@0
|
1707 |
tmpArray.Close();
|
sl@0
|
1708 |
}
|
sl@0
|
1709 |
break; //EGetSecondaryFilters
|
sl@0
|
1710 |
|
sl@0
|
1711 |
case EGetSecondaryFiltering:
|
sl@0
|
1712 |
{
|
sl@0
|
1713 |
#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
|
sl@0
|
1714 |
__LOG("EGetSecondaryFiltering")
|
sl@0
|
1715 |
#endif
|
sl@0
|
1716 |
|
sl@0
|
1717 |
TBool enabled = EFalse;
|
sl@0
|
1718 |
errCode = GetSecondaryFiltering(enabled);
|
sl@0
|
1719 |
if(errCode == KErrNone)
|
sl@0
|
1720 |
{
|
sl@0
|
1721 |
result.Num(errCode);
|
sl@0
|
1722 |
data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
|
sl@0
|
1723 |
|
sl@0
|
1724 |
//create payload
|
sl@0
|
1725 |
TBuf8<32> b;
|
sl@0
|
1726 |
b.Num(enabled);
|
sl@0
|
1727 |
inputData->AppendNewData(data, (const void*)b.Ptr(), b.Length());
|
sl@0
|
1728 |
}
|
sl@0
|
1729 |
else
|
sl@0
|
1730 |
{
|
sl@0
|
1731 |
result.Num(errCode);
|
sl@0
|
1732 |
data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
|
sl@0
|
1733 |
}
|
sl@0
|
1734 |
}
|
sl@0
|
1735 |
break; //EGetSecondaryFiltering
|
sl@0
|
1736 |
|
sl@0
|
1737 |
//this functionality is removed now
|
sl@0
|
1738 |
/*
|
sl@0
|
1739 |
case ESetSecondaryFilterCurrent:
|
sl@0
|
1740 |
{
|
sl@0
|
1741 |
#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
|
sl@0
|
1742 |
__LOG("ESetSecondaryFilterCurrent")
|
sl@0
|
1743 |
#endif
|
sl@0
|
1744 |
|
sl@0
|
1745 |
errCode = this->SetSecondaryFiltering(KCurrent);
|
sl@0
|
1746 |
result.Num(errCode);
|
sl@0
|
1747 |
ack = man->CreatePackage((void*)result.Ptr(), result.Length());
|
sl@0
|
1748 |
}
|
sl@0
|
1749 |
break; //ESetSecondaryFilterCurrent
|
sl@0
|
1750 |
*/
|
sl@0
|
1751 |
case EGetTraceBufferSize:
|
sl@0
|
1752 |
{
|
sl@0
|
1753 |
#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
|
sl@0
|
1754 |
__LOG("EGetTraceBufferSize")
|
sl@0
|
1755 |
#endif
|
sl@0
|
1756 |
|
sl@0
|
1757 |
TInt bufferSize = 0;
|
sl@0
|
1758 |
errCode = GetBufandDataNotifyValuesL(KBuffer,bufferSize);
|
sl@0
|
1759 |
if(errCode == KErrNone)
|
sl@0
|
1760 |
{
|
sl@0
|
1761 |
result.Num(errCode);
|
sl@0
|
1762 |
data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
|
sl@0
|
1763 |
TBuf8<32> b;
|
sl@0
|
1764 |
b.Num(bufferSize);
|
sl@0
|
1765 |
inputData->AppendNewData(data, (const void*)b.Ptr(), b.Length());
|
sl@0
|
1766 |
}
|
sl@0
|
1767 |
else
|
sl@0
|
1768 |
{
|
sl@0
|
1769 |
result.Num(errCode);
|
sl@0
|
1770 |
data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
|
sl@0
|
1771 |
}
|
sl@0
|
1772 |
}
|
sl@0
|
1773 |
break; //EGetTraceBufferSize
|
sl@0
|
1774 |
|
sl@0
|
1775 |
case EGetBufferMode:
|
sl@0
|
1776 |
{
|
sl@0
|
1777 |
#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
|
sl@0
|
1778 |
__LOG("EGetBufferMode")
|
sl@0
|
1779 |
#endif
|
sl@0
|
1780 |
|
sl@0
|
1781 |
TInt bufferMode = 3;
|
sl@0
|
1782 |
errCode = GetBufandDataNotifyValuesL(KBufferMode,bufferMode);
|
sl@0
|
1783 |
if(errCode == KErrNone)
|
sl@0
|
1784 |
{
|
sl@0
|
1785 |
result.Num(errCode);
|
sl@0
|
1786 |
data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
|
sl@0
|
1787 |
|
sl@0
|
1788 |
result.Zero();
|
sl@0
|
1789 |
if(bufferMode == 0)
|
sl@0
|
1790 |
result.Append(KCircular);
|
sl@0
|
1791 |
else if(bufferMode == 1)
|
sl@0
|
1792 |
result.Append(KStraight);
|
sl@0
|
1793 |
else
|
sl@0
|
1794 |
result.Append(_L8("Invalid mode"));
|
sl@0
|
1795 |
|
sl@0
|
1796 |
inputData->AppendNewData(data, (const void*)result.Ptr(), result.Length());
|
sl@0
|
1797 |
}
|
sl@0
|
1798 |
else
|
sl@0
|
1799 |
{
|
sl@0
|
1800 |
result.Num(errCode);
|
sl@0
|
1801 |
data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
|
sl@0
|
1802 |
}
|
sl@0
|
1803 |
}
|
sl@0
|
1804 |
break; //EGetBufferMode
|
sl@0
|
1805 |
|
sl@0
|
1806 |
case EGetDataNotificationSize:
|
sl@0
|
1807 |
{
|
sl@0
|
1808 |
#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
|
sl@0
|
1809 |
__LOG("EGetDataNotificationSize")
|
sl@0
|
1810 |
#endif
|
sl@0
|
1811 |
|
sl@0
|
1812 |
TInt dataNotification = 0;
|
sl@0
|
1813 |
errCode = GetBufandDataNotifyValuesL(KDataNotification,dataNotification);
|
sl@0
|
1814 |
if(errCode == KErrNone)
|
sl@0
|
1815 |
{
|
sl@0
|
1816 |
result.Num(errCode);
|
sl@0
|
1817 |
data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
|
sl@0
|
1818 |
TBuf8<32> b;
|
sl@0
|
1819 |
b.Num(dataNotification);
|
sl@0
|
1820 |
inputData->AppendNewData(data, (const void*)b.Ptr(), b.Length());
|
sl@0
|
1821 |
}
|
sl@0
|
1822 |
else
|
sl@0
|
1823 |
{
|
sl@0
|
1824 |
result.Num(errCode);
|
sl@0
|
1825 |
data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
|
sl@0
|
1826 |
}
|
sl@0
|
1827 |
}
|
sl@0
|
1828 |
break; //EGetDataNotificationSize
|
sl@0
|
1829 |
|
sl@0
|
1830 |
case ERemovePrimaryFilter:
|
sl@0
|
1831 |
{
|
sl@0
|
1832 |
#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
|
sl@0
|
1833 |
__LOG("ERemovePrimaryFilter")
|
sl@0
|
1834 |
for(TInt k=0; k<aArguments.Count(); k++)
|
sl@0
|
1835 |
{
|
sl@0
|
1836 |
__LOGBUF(aArguments[k])
|
sl@0
|
1837 |
}
|
sl@0
|
1838 |
#endif
|
sl@0
|
1839 |
|
sl@0
|
1840 |
if(aArguments.Count() > 0)
|
sl@0
|
1841 |
{
|
sl@0
|
1842 |
RArray<TUint32> filterArray;
|
sl@0
|
1843 |
for(TInt i=0; i<aArguments.Count(); i++)
|
sl@0
|
1844 |
{
|
sl@0
|
1845 |
TUint32 val;
|
sl@0
|
1846 |
TLex8 lex(aArguments[i]);
|
sl@0
|
1847 |
if(lex.Val(val, EDecimal) == KErrNone)
|
sl@0
|
1848 |
filterArray.AppendL(val);
|
sl@0
|
1849 |
}
|
sl@0
|
1850 |
errCode = RemoveActiveFilter(filterArray,EPrimaryFilter);
|
sl@0
|
1851 |
filterArray.Close();
|
sl@0
|
1852 |
}
|
sl@0
|
1853 |
else
|
sl@0
|
1854 |
errCode = KErrArgument;
|
sl@0
|
1855 |
|
sl@0
|
1856 |
result.Num(errCode);
|
sl@0
|
1857 |
data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
|
sl@0
|
1858 |
}
|
sl@0
|
1859 |
break; //ERemovePrimaryFilter
|
sl@0
|
1860 |
|
sl@0
|
1861 |
case ERemoveSecondaryFilter:
|
sl@0
|
1862 |
{
|
sl@0
|
1863 |
#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
|
sl@0
|
1864 |
__LOG("EDisableMultipleModuleUids")
|
sl@0
|
1865 |
for(TInt k=0; k<aArguments.Count(); k++)
|
sl@0
|
1866 |
{
|
sl@0
|
1867 |
__LOGBUF(aArguments[k])
|
sl@0
|
1868 |
}
|
sl@0
|
1869 |
#endif
|
sl@0
|
1870 |
|
sl@0
|
1871 |
if(aArguments.Count() > 0)
|
sl@0
|
1872 |
{
|
sl@0
|
1873 |
RArray<TUint32> filterArray;
|
sl@0
|
1874 |
for(TInt i=0; i<aArguments.Count(); i++)
|
sl@0
|
1875 |
{
|
sl@0
|
1876 |
TUint32 val;
|
sl@0
|
1877 |
TLex8 lex(aArguments[i]);
|
sl@0
|
1878 |
if(lex.Val(val, EDecimal) == KErrNone)
|
sl@0
|
1879 |
filterArray.AppendL(val);
|
sl@0
|
1880 |
}
|
sl@0
|
1881 |
errCode = RemoveActiveFilter(filterArray,ESecondaryFilter);
|
sl@0
|
1882 |
filterArray.Close();
|
sl@0
|
1883 |
}
|
sl@0
|
1884 |
else
|
sl@0
|
1885 |
errCode = KErrArgument;
|
sl@0
|
1886 |
|
sl@0
|
1887 |
#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
|
sl@0
|
1888 |
__LOG("errCode:")
|
sl@0
|
1889 |
__LOGNUM(errCode)
|
sl@0
|
1890 |
#endif
|
sl@0
|
1891 |
|
sl@0
|
1892 |
result.Num(errCode);
|
sl@0
|
1893 |
data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
|
sl@0
|
1894 |
}
|
sl@0
|
1895 |
break; //ERemoveSecondaryFilter
|
sl@0
|
1896 |
|
sl@0
|
1897 |
case ESetPluginSettings:
|
sl@0
|
1898 |
{
|
sl@0
|
1899 |
#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
|
sl@0
|
1900 |
__LOG("ESetPluginSettings")
|
sl@0
|
1901 |
#endif
|
sl@0
|
1902 |
|
sl@0
|
1903 |
if(aArguments.Count() > 2)
|
sl@0
|
1904 |
{
|
sl@0
|
1905 |
TBuf8<128> plugin;
|
sl@0
|
1906 |
plugin.Copy(aArguments[0]);
|
sl@0
|
1907 |
aArguments.Remove(0);
|
sl@0
|
1908 |
errCode = SetPluginSettings(plugin, aArguments);
|
sl@0
|
1909 |
}
|
sl@0
|
1910 |
else
|
sl@0
|
1911 |
errCode = KErrArgument;
|
sl@0
|
1912 |
|
sl@0
|
1913 |
result.Num(errCode);
|
sl@0
|
1914 |
data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
|
sl@0
|
1915 |
}
|
sl@0
|
1916 |
break; //ESetChannelSettings
|
sl@0
|
1917 |
|
sl@0
|
1918 |
case ESetActivePlugin:
|
sl@0
|
1919 |
{
|
sl@0
|
1920 |
#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
|
sl@0
|
1921 |
__LOG("ESetActiveOutputPlugin")
|
sl@0
|
1922 |
#endif
|
sl@0
|
1923 |
|
sl@0
|
1924 |
if(aArguments.Count() > 0)
|
sl@0
|
1925 |
errCode = SetActiveOutputPlugin(aArguments[0]);
|
sl@0
|
1926 |
else
|
sl@0
|
1927 |
errCode = KErrArgument;
|
sl@0
|
1928 |
|
sl@0
|
1929 |
result.Num(errCode);
|
sl@0
|
1930 |
data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
|
sl@0
|
1931 |
}
|
sl@0
|
1932 |
break; //ESetActiveOutputPlugin
|
sl@0
|
1933 |
|
sl@0
|
1934 |
case ESetActiveInputPlugin:
|
sl@0
|
1935 |
{
|
sl@0
|
1936 |
if(aArguments.Count() > 0)
|
sl@0
|
1937 |
errCode = SetActiveInputPlugin(aArguments[0]);
|
sl@0
|
1938 |
else
|
sl@0
|
1939 |
errCode = KErrArgument;
|
sl@0
|
1940 |
|
sl@0
|
1941 |
result.Num(errCode);
|
sl@0
|
1942 |
data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
|
sl@0
|
1943 |
}
|
sl@0
|
1944 |
break;
|
sl@0
|
1945 |
|
sl@0
|
1946 |
case EDeactivateInputPlugin:
|
sl@0
|
1947 |
{
|
sl@0
|
1948 |
if(aArguments.Count() > 0)
|
sl@0
|
1949 |
errCode = DeActivateInputPlugin(aArguments[0]);
|
sl@0
|
1950 |
else
|
sl@0
|
1951 |
errCode = KErrArgument;
|
sl@0
|
1952 |
|
sl@0
|
1953 |
result.Num(errCode);
|
sl@0
|
1954 |
data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
|
sl@0
|
1955 |
}
|
sl@0
|
1956 |
break;
|
sl@0
|
1957 |
|
sl@0
|
1958 |
case EGetActiveInputPlugin:
|
sl@0
|
1959 |
{
|
sl@0
|
1960 |
RArray<TPtrC8> tmpArray;
|
sl@0
|
1961 |
errCode = GetActiveInputPlugin(tmpArray);
|
sl@0
|
1962 |
result.Num(errCode);
|
sl@0
|
1963 |
|
sl@0
|
1964 |
//remove ini specific data (number)
|
sl@0
|
1965 |
//example (1 uloggerusbplugin) must look like (uloggerusbplugin)
|
sl@0
|
1966 |
TInt i=0;
|
sl@0
|
1967 |
while(i<tmpArray.Count())
|
sl@0
|
1968 |
{
|
sl@0
|
1969 |
TInt v = 0;
|
sl@0
|
1970 |
TLex8 l(tmpArray[i]);
|
sl@0
|
1971 |
if(l.Val(v) == KErrNone)
|
sl@0
|
1972 |
tmpArray.Remove(i);
|
sl@0
|
1973 |
else
|
sl@0
|
1974 |
++i;
|
sl@0
|
1975 |
}
|
sl@0
|
1976 |
|
sl@0
|
1977 |
data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
|
sl@0
|
1978 |
PrepareControlDataPayloadL(payloadBuf, tmpArray);
|
sl@0
|
1979 |
if(payloadBuf.Length() > 0)
|
sl@0
|
1980 |
inputData->AppendNewData(data, (const void*)payloadBuf.Ptr(), payloadBuf.Length());
|
sl@0
|
1981 |
tmpArray.Close();
|
sl@0
|
1982 |
}
|
sl@0
|
1983 |
break;
|
sl@0
|
1984 |
|
sl@0
|
1985 |
case EGetInputPlugins:
|
sl@0
|
1986 |
{
|
sl@0
|
1987 |
#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
|
sl@0
|
1988 |
__LOG("EGetControlPlugins")
|
sl@0
|
1989 |
#endif
|
sl@0
|
1990 |
|
sl@0
|
1991 |
RArray<TPtrC8> tmpArray;
|
sl@0
|
1992 |
errCode = GetInstalledInputPluginsL(tmpArray);
|
sl@0
|
1993 |
|
sl@0
|
1994 |
result.Num(errCode);
|
sl@0
|
1995 |
data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
|
sl@0
|
1996 |
|
sl@0
|
1997 |
//create payload
|
sl@0
|
1998 |
PrepareControlDataPayloadL(payloadBuf, tmpArray);
|
sl@0
|
1999 |
//add playload to control data chunk
|
sl@0
|
2000 |
if(payloadBuf.Length() > 0)
|
sl@0
|
2001 |
inputData->AppendNewData(data, (const void*)payloadBuf.Ptr(), payloadBuf.Length());
|
sl@0
|
2002 |
tmpArray.Close();
|
sl@0
|
2003 |
}
|
sl@0
|
2004 |
break;
|
sl@0
|
2005 |
|
sl@0
|
2006 |
case ERestart:
|
sl@0
|
2007 |
{
|
sl@0
|
2008 |
#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
|
sl@0
|
2009 |
__LOG("ERestartOutputting")
|
sl@0
|
2010 |
#endif
|
sl@0
|
2011 |
|
sl@0
|
2012 |
//ulogger shouldn't be restarted here as we must send acknowledgment back to PC
|
sl@0
|
2013 |
//restart will be done in DoPostProcessing method after sending ack.
|
sl@0
|
2014 |
result.Num(errCode);
|
sl@0
|
2015 |
data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
|
sl@0
|
2016 |
}
|
sl@0
|
2017 |
break;
|
sl@0
|
2018 |
|
sl@0
|
2019 |
default:
|
sl@0
|
2020 |
#if defined(__LIGHTLOGGER_ENABLED) && defined(__VERBOSE_MODE)
|
sl@0
|
2021 |
__LOG("input command not supported")
|
sl@0
|
2022 |
#endif
|
sl@0
|
2023 |
|
sl@0
|
2024 |
result.Num(KErrNotSupported);
|
sl@0
|
2025 |
data = inputData->CreatePackage((void*)result.Ptr(), result.Length());
|
sl@0
|
2026 |
break;
|
sl@0
|
2027 |
}//end of switch
|
sl@0
|
2028 |
|
sl@0
|
2029 |
|
sl@0
|
2030 |
//cleanup
|
sl@0
|
2031 |
if(inputData)
|
sl@0
|
2032 |
{
|
sl@0
|
2033 |
delete inputData;
|
sl@0
|
2034 |
inputData = NULL;
|
sl@0
|
2035 |
}
|
sl@0
|
2036 |
payloadBuf.Close();
|
sl@0
|
2037 |
|
sl@0
|
2038 |
return data;
|
sl@0
|
2039 |
}
|
sl@0
|
2040 |
|
sl@0
|
2041 |
|
sl@0
|
2042 |
|
sl@0
|
2043 |
void CULoggerServer::DoPostProcessing(TCommand aCmd)
|
sl@0
|
2044 |
{
|
sl@0
|
2045 |
switch(aCmd)
|
sl@0
|
2046 |
{
|
sl@0
|
2047 |
case EStop:
|
sl@0
|
2048 |
Stop();
|
sl@0
|
2049 |
break;
|
sl@0
|
2050 |
case ERestart:
|
sl@0
|
2051 |
RestartOutputting();
|
sl@0
|
2052 |
break;
|
sl@0
|
2053 |
default:
|
sl@0
|
2054 |
break;
|
sl@0
|
2055 |
}
|
sl@0
|
2056 |
}
|
sl@0
|
2057 |
|
sl@0
|
2058 |
/**
|
sl@0
|
2059 |
This function checks if array of given names contains any of real plugin names (either output of input).
|
sl@0
|
2060 |
After call aPluginList will be filtered to contain only proper plugin names (strings that really could be used
|
sl@0
|
2061 |
to refer to a real plugin.
|
sl@0
|
2062 |
@param aFilter Either EOutputPluginFilter or EInputPluginFilter.
|
sl@0
|
2063 |
@param aPluginList Reference to an array which contain list of names that function has to check.
|
sl@0
|
2064 |
*/
|
sl@0
|
2065 |
void CULoggerServer::FilterPlugins(TPluginFilter aFilter, RArray<TPtrC8>& aPluginList)
|
sl@0
|
2066 |
{
|
sl@0
|
2067 |
TInt errCode = 0;
|
sl@0
|
2068 |
CPlugin::TPluginInterface interfaceId;
|
sl@0
|
2069 |
//assign filter value
|
sl@0
|
2070 |
interfaceId = (aFilter == EOutputPluginFilter ? MOutputPlugin::iInterfaceId : MInputPlugin::iInterfaceId);
|
sl@0
|
2071 |
|
sl@0
|
2072 |
//filter plugins
|
sl@0
|
2073 |
TInt i=0;
|
sl@0
|
2074 |
while(i<aPluginList.Count())
|
sl@0
|
2075 |
{
|
sl@0
|
2076 |
CPlugin *plugin = NULL;
|
sl@0
|
2077 |
TRAP(errCode, plugin=CPlugin::NewL(aPluginList[i]));
|
sl@0
|
2078 |
if(plugin && errCode==KErrNone)
|
sl@0
|
2079 |
{
|
sl@0
|
2080 |
TAny *ptr = NULL;
|
sl@0
|
2081 |
TRAP(errCode, ptr=plugin->GetInterfaceL(interfaceId));
|
sl@0
|
2082 |
if(!ptr || errCode!=KErrNone)
|
sl@0
|
2083 |
{
|
sl@0
|
2084 |
aPluginList.Remove(i--);
|
sl@0
|
2085 |
}
|
sl@0
|
2086 |
//cleanup
|
sl@0
|
2087 |
if(plugin)
|
sl@0
|
2088 |
{
|
sl@0
|
2089 |
delete plugin;
|
sl@0
|
2090 |
plugin = NULL;
|
sl@0
|
2091 |
}
|
sl@0
|
2092 |
}
|
sl@0
|
2093 |
++i;
|
sl@0
|
2094 |
}
|
sl@0
|
2095 |
}
|
sl@0
|
2096 |
|
sl@0
|
2097 |
|
sl@0
|
2098 |
|
sl@0
|
2099 |
TBool CULoggerServer::ServerState()
|
sl@0
|
2100 |
{
|
sl@0
|
2101 |
return iBtraceOpen;
|
sl@0
|
2102 |
}
|
sl@0
|
2103 |
|
sl@0
|
2104 |
|
sl@0
|
2105 |
TBool CULoggerServer::CheckPluginExists(TPtrC8& aPluginName, TPluginFilter aPluginFilter)
|
sl@0
|
2106 |
{
|
sl@0
|
2107 |
RArray<TPtrC8> pluginsArray;
|
sl@0
|
2108 |
if(aPluginFilter == EOutputPluginFilter)
|
sl@0
|
2109 |
GetInstalledOutputPlugins(pluginsArray);
|
sl@0
|
2110 |
else if(aPluginFilter == EInputPluginFilter)
|
sl@0
|
2111 |
GetInstalledInputPluginsL(pluginsArray);
|
sl@0
|
2112 |
|
sl@0
|
2113 |
for(TInt i=0; i<pluginsArray.Count(); ++i)
|
sl@0
|
2114 |
if(aPluginName.Compare(pluginsArray[i])==0)
|
sl@0
|
2115 |
{
|
sl@0
|
2116 |
pluginsArray.Close();
|
sl@0
|
2117 |
return ETrue;
|
sl@0
|
2118 |
}
|
sl@0
|
2119 |
|
sl@0
|
2120 |
pluginsArray.Close();
|
sl@0
|
2121 |
return EFalse;
|
sl@0
|
2122 |
}
|
sl@0
|
2123 |
|
sl@0
|
2124 |
|
sl@0
|
2125 |
}//end of namespace
|
sl@0
|
2126 |
|
sl@0
|
2127 |
#ifndef __ULOGGER_SERVER_UNIT_TEST
|
sl@0
|
2128 |
//Main Entry
|
sl@0
|
2129 |
TInt E32Main()
|
sl@0
|
2130 |
{
|
sl@0
|
2131 |
return Ulogger::CULoggerServer::StartServer();
|
sl@0
|
2132 |
}
|
sl@0
|
2133 |
#endif //__ULOGGER_SERVER_UNIT_TEST
|