|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // ULogger Server header file |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalTechnology |
|
21 @prototype |
|
22 */ |
|
23 |
|
24 #ifndef ULOGGERSERVER_H |
|
25 #define ULOGGERSERVER_H |
|
26 |
|
27 #include "outputframework.h" // COutputFramework |
|
28 #include "uloggerconfigmanager.h" // CConfig, CConfigSettingsIter, MConfigObserver |
|
29 #include "uloggershared.h" |
|
30 #include "uloggerwatcher.h" |
|
31 #include "pluginallocator.h" |
|
32 #include "inputframework.h" |
|
33 #include <d32btrace.h> // RBTrace |
|
34 |
|
35 namespace Ulogger { |
|
36 |
|
37 |
|
38 enum TFilter |
|
39 { |
|
40 EPrimaryFilter = 1, |
|
41 ESecondaryFilter |
|
42 }; |
|
43 |
|
44 |
|
45 enum TULoggerSrvPanics |
|
46 { |
|
47 EUnknownPanic = 1 |
|
48 }; |
|
49 |
|
50 |
|
51 /** CULoggerServer server class. |
|
52 This class is responsible for maintaining the server state. |
|
53 */ |
|
54 class CULoggerServer : public CServer2, |
|
55 public MDataWatcherObserver, |
|
56 public MInputFrameworkObserver |
|
57 { |
|
58 public: |
|
59 |
|
60 static CULoggerServer* NewLC(TInt aPriority); |
|
61 ~CULoggerServer(); |
|
62 |
|
63 //own methods |
|
64 static TInt StartServer(); |
|
65 void IncrementSessions(); |
|
66 void DecrementSessions(); |
|
67 |
|
68 //from CActive |
|
69 TInt RunError(TInt aError); |
|
70 |
|
71 //from MInputFrameworkObserver |
|
72 ControlData* ProcessCommandL(TCommand aOpCode, RArray<TPtrC8>& aArguments); |
|
73 void DoPostProcessing(TCommand aCmd); |
|
74 |
|
75 //From MDataWatcher |
|
76 void DataNotification(); |
|
77 |
|
78 //server stuff |
|
79 TBool ServerState(); |
|
80 |
|
81 //actions |
|
82 void RunAsService(TBool aRunAsService); // Not implemented yet |
|
83 TInt Start(); //this is actually only called from inside the server, or by the test framework. |
|
84 TInt Stop(); |
|
85 TInt RestartOutputting(); |
|
86 void ReadBufferL(); //this is actually only called from inside the server, or by the test framework. |
|
87 |
|
88 |
|
89 //filters |
|
90 TInt GetActiveFilters(RArray<TUint32>& aListBuffer,TInt aFilterType); |
|
91 TInt SetActiveFilter(RArray<TUint32> aCategory, TInt aFilterType); |
|
92 TInt RemoveActiveFilter(RArray<TUint32>& aValue, const TInt aFilterType); |
|
93 TInt SetSecondaryFiltering(const TDesC8& aEnabled); |
|
94 TInt GetSecondaryFiltering(TBool& aEnabled); |
|
95 |
|
96 //plugins |
|
97 TInt SetPluginSettings(const TDesC8& aPluginname, RArray<TPtrC8>& aListBuffer); |
|
98 TInt RemovePluginSettingsL(const TDesC8& aPluginName); |
|
99 TInt GetActiveOutputPlugin(RArray<TPtrC8>& aListBuffer); |
|
100 TInt SetActiveOutputPlugin(const TDesC8& aPluginname); |
|
101 TInt GetInstalledOutputPlugins(RArray<TPtrC8>& aListBuffer); |
|
102 TInt DeActivateInputPlugin(const TDesC8& aPluginname); |
|
103 TInt GetActiveInputPlugin(RArray<TPtrC8>& aListBuffer); |
|
104 TInt SetActiveInputPlugin(const TDesC8& aPluginname); |
|
105 TInt GetInstalledInputPlugins(RArray<TPtrC8>& aListBuffer); |
|
106 |
|
107 //buffers |
|
108 TInt GetOptionsSettingsL(const TDesC8& aMedianame, RArray<TPtrC8>& aListBuffer); |
|
109 TInt GetBufandDataNotifyValuesL(const TDesC8& aSetting,TInt& value); |
|
110 TInt SetBufferMode(const TDesC8& aValue); |
|
111 TInt SetBufferSize(TInt aSize); |
|
112 TInt SetDataNotificationSize(TInt aSize); |
|
113 |
|
114 private: |
|
115 //server related stuff |
|
116 CULoggerServer(TInt aPriority); |
|
117 void ConstructL(); |
|
118 static TInt StartServerL(); |
|
119 static void PanicServer(TULoggerSrvPanics aPanic); |
|
120 static void PanicClient(const RMessage2& aMessage, TULoggerSrvPanics aPanic); |
|
121 void ShutDownServer(); |
|
122 void RequestCancel(); |
|
123 //from CServer2 |
|
124 CSession2* NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const; |
|
125 |
|
126 //on boot things |
|
127 TInt TraceSettingsOnBoot(); |
|
128 TInt ResetBtracePrimaryFilters(RBTrace& aBTrace); |
|
129 |
|
130 //action related things |
|
131 |
|
132 //other configs |
|
133 void GetOptionsSettingsL(RArray<TPtrC8>& aListBuffer,const TDesC8& aSetting); |
|
134 TInt SetTraceSettings(const TDesC8& aValue, const TDesC8& aSetting); |
|
135 |
|
136 //framework stuff |
|
137 void InitializeFrameworksL(); |
|
138 void PrepareControlDataPayloadL(RBuf8& aPayloadBuf, const RArray<TPtrC8>& aArray); |
|
139 void PrepareControlDataPayloadL(RBuf8& aPayloadBuf, const RArray<TUint32>& aArray); |
|
140 |
|
141 //config file stuff |
|
142 // CConfig* CreateConfig(TFileName aFilePath); |
|
143 // void InitializeConfigFileL(); |
|
144 // TInt CheckConfigFile(const TDesC& aFileName,const TDesC& aDirPath,TFileName& aFilePath); |
|
145 // void CopyFileToSystemDrive(TFileName& aFilePath); |
|
146 |
|
147 //plugin stuff |
|
148 TInt DeActivateOutputPlugin(const TDesC8& aPluginname); |
|
149 void FilterPlugins(TPluginFilter aFilter, RArray<TPtrC8>& aPluginList); |
|
150 TBool CheckPluginExists(TPtrC8& aPluginName, TPluginFilter aPluginFilter); |
|
151 void GetPluginAndSettingsL(TDes8& aPluginName, RPointerArray<TPluginConfiguration>* aSettings, TPluginFilter aPluginFilter); |
|
152 void AsynchDataRequest(); |
|
153 |
|
154 //filter related stuff |
|
155 ControlData* SetPrimaryFilters(RArray<TPtrC8> &aArguments); |
|
156 TInt GetValues(const TDesC8& aSectionName, RArray<TPtrC8>& aListBuffer); |
|
157 private: |
|
158 //data |
|
159 TInt iRunAsService; |
|
160 TInt iSessionCounter; |
|
161 |
|
162 /** config API */ |
|
163 //CConfig* iConfig; |
|
164 CConfigFileManager* iConfigManager; |
|
165 /** Output Framework */ |
|
166 COutputFramework* iOutputFramework; |
|
167 /** Input Framework main object. */ |
|
168 CInputFramework* iInputFramework; |
|
169 /** Data Watcher */ |
|
170 CULoggerWatcher* iDataWatcher; |
|
171 /** Plugin Allocator */ |
|
172 CPluginAllocator* iPluginAllocator; |
|
173 |
|
174 RImplInfoPtrArray iPluginArray; |
|
175 |
|
176 //BTrace |
|
177 RBTrace iTrace; |
|
178 TInt iBufferSize; |
|
179 TBool iBtraceOpen; |
|
180 TInt iDataNotification; |
|
181 TFileName iUserFilePath; |
|
182 TFileName iConfigFilePath; |
|
183 TBool iUserFile; |
|
184 TBool iConfigFile; |
|
185 TBool iIsBooting; |
|
186 }; |
|
187 |
|
188 }//namespace |
|
189 |
|
190 #endif // ULOGGERSERVER_H |