|
1 // Utils.cpp |
|
2 // |
|
3 // Copyright (c) 2010 Accenture. All rights reserved. |
|
4 // This component and the accompanying materials are made available |
|
5 // under the terms of the "Eclipse Public License v1.0" |
|
6 // which accompanies this distribution, and is available |
|
7 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 // |
|
9 // Initial Contributors: |
|
10 // Accenture - Initial contribution |
|
11 // |
|
12 #define __INCLUDE_ALL_SUPPORTED_CAPABILITIES__ |
|
13 #define __INCLUDE_CAPABILITY_NAMES__ |
|
14 |
|
15 #include <e32base.h> |
|
16 #include "Utils.h" |
|
17 #include <HAL.h> |
|
18 #include <eikenv.h> |
|
19 |
|
20 #ifdef INCLUDE_UIQ_DEFINITIONS |
|
21 #include <DeviceKeys.h> |
|
22 #endif |
|
23 |
|
24 #include <fshell/memoryaccess.h> |
|
25 #include <fshell/ltkutils.h> |
|
26 |
|
27 /* TomS: These don't seem to be used any more |
|
28 //#include <featureUIDs.h> |
|
29 namespace NFeature |
|
30 { |
|
31 // default present |
|
32 const TUid KFax = {0x10279806}; |
|
33 const TUid KPrint = {0x10279807}; |
|
34 const TUid KBluetooth = {0x10279808}; |
|
35 const TUid KInfrared = {0x10279809}; |
|
36 const TUid KMmc = {0x1027980a}; |
|
37 const TUid KUsb = {0x1027980b}; |
|
38 const TUid KObex = {0x1027980c}; |
|
39 const TUid KRtpRtcp = {0x1027980d}; |
|
40 const TUid KSip = {0x1027980f}; |
|
41 const TUid KOmaDataSync = {0x10279810}; |
|
42 const TUid KOmaDeviceManagement = {0x10279811}; |
|
43 const TUid KIPQoS = {0x10279812}; |
|
44 const TUid KNetworkQoS = {0x10279813}; |
|
45 const TUid KIPSec = {0x10279814}; |
|
46 const TUid KDhcp = {0x10279815}; |
|
47 const TUid KConnectivity = {0x10279816}; // PC Connectivity |
|
48 |
|
49 // default not-present |
|
50 const TUid KLocation = {0x10281818}; |
|
51 const TUid KMobileIP = {0x10281819}; |
|
52 const TUid KOfflineMode = {0x1028181A}; |
|
53 const TUid KDRM = {0x1028181B}; |
|
54 const TUid KOmaDsHostServers = {0x10282663}; |
|
55 } |
|
56 */ |
|
57 |
|
58 #ifdef __DLL__ |
|
59 #define gPlugin ((CDefaultProductPlugin*)Dll::Tls()) |
|
60 #else |
|
61 CDefaultProductPlugin* gPlugin = NULL; |
|
62 #endif |
|
63 |
|
64 // GCC has issues with the CASE_LIT definition that ran along the same lines as CASE_LIT2 below - more than 8 CASE_LITs in one switch made the compiler blow up |
|
65 #define CASE_LIT(name) case name: { const TText16* KName = (const TText16*) L ## #name; return TPtrC(KName); } |
|
66 #define CASE_LIT2(val, name) case val: { _LIT(KName, name); return TPtrC(KName); } |
|
67 |
|
68 |
|
69 void HR(TDes& aDes, TInt64 aSize) |
|
70 { |
|
71 // This functionality has been moved into ltkutils |
|
72 LtkUtils::FormatSize(aDes, aSize); |
|
73 } |
|
74 |
|
75 void HR(TDes8& aDes, TInt64 aSize) |
|
76 { |
|
77 LtkUtils::FormatSize(aDes, aSize); |
|
78 } |
|
79 |
|
80 TPtrC ToString(TProcessPriority aPriority) |
|
81 { |
|
82 switch(aPriority) |
|
83 { |
|
84 CASE_LIT(EPriorityLow); |
|
85 CASE_LIT(EPriorityBackground); |
|
86 CASE_LIT(EPriorityForeground); |
|
87 CASE_LIT(EPriorityHigh); |
|
88 CASE_LIT(EPriorityWindowServer); |
|
89 CASE_LIT(EPriorityFileServer); |
|
90 CASE_LIT(EPriorityRealTimeServer); |
|
91 CASE_LIT(EPrioritySupervisor); |
|
92 default: |
|
93 return TPtrC(); |
|
94 } |
|
95 } |
|
96 |
|
97 TPtrC ToString(TThreadPriority aPriority) |
|
98 { |
|
99 // Redefine these here - easiest way of making sure this builds and works on all 9.x baselines |
|
100 enum TPrioritiesThatArentIn91 |
|
101 { |
|
102 EPriorityAbsoluteLowNormal=150, |
|
103 EPriorityAbsoluteBackgroundNormal=250, |
|
104 EPriorityAbsoluteForegroundNormal=350, |
|
105 EPriorityAbsoluteHighNormal=450, |
|
106 EPriorityAbsoluteHigh=500, |
|
107 EPriorityAbsoluteRealTime1=810, |
|
108 EPriorityAbsoluteRealTime2=820, |
|
109 EPriorityAbsoluteRealTime3=830, |
|
110 EPriorityAbsoluteRealTime4=840, |
|
111 EPriorityAbsoluteRealTime5=850, |
|
112 EPriorityAbsoluteRealTime6=860, |
|
113 EPriorityAbsoluteRealTime7=870, |
|
114 EPriorityAbsoluteRealTime8=880 |
|
115 }; |
|
116 |
|
117 switch((TInt)aPriority) |
|
118 { |
|
119 CASE_LIT(EPriorityNull); |
|
120 CASE_LIT(EPriorityMuchLess); |
|
121 CASE_LIT(EPriorityLess); |
|
122 CASE_LIT(EPriorityNormal); |
|
123 CASE_LIT(EPriorityMore); |
|
124 CASE_LIT(EPriorityMuchMore); |
|
125 CASE_LIT(EPriorityAbsoluteVeryLow); |
|
126 CASE_LIT(EPriorityAbsoluteLow); |
|
127 CASE_LIT(EPriorityAbsoluteBackground); |
|
128 CASE_LIT(EPriorityAbsoluteForeground); |
|
129 CASE_LIT(EPriorityAbsoluteHigh); |
|
130 CASE_LIT(EPriorityRealTime); |
|
131 CASE_LIT(EPriorityAbsoluteLowNormal); |
|
132 CASE_LIT(EPriorityAbsoluteBackgroundNormal); |
|
133 CASE_LIT(EPriorityAbsoluteForegroundNormal); |
|
134 CASE_LIT(EPriorityAbsoluteHighNormal); |
|
135 CASE_LIT(EPriorityAbsoluteRealTime1); |
|
136 CASE_LIT(EPriorityAbsoluteRealTime2); |
|
137 CASE_LIT(EPriorityAbsoluteRealTime3); |
|
138 CASE_LIT(EPriorityAbsoluteRealTime4); |
|
139 CASE_LIT(EPriorityAbsoluteRealTime5); |
|
140 CASE_LIT(EPriorityAbsoluteRealTime6); |
|
141 CASE_LIT(EPriorityAbsoluteRealTime7); |
|
142 CASE_LIT(EPriorityAbsoluteRealTime8); |
|
143 default: |
|
144 return TPtrC(); |
|
145 } |
|
146 } |
|
147 |
|
148 HBufC* ToStringL(SCapabilitySet& aCaps) |
|
149 { |
|
150 //TODO |
|
151 //_LIT8(KUnknown, "Unknown"); |
|
152 //return KUnknown().AllocL(); |
|
153 |
|
154 __ASSERT_COMPILE(ECapability_Limit < 32); |
|
155 _LIT(KAll, "All"); |
|
156 _LIT(KAllMinusTCB, "All -Tcb"); |
|
157 _LIT(KNone, "None"); |
|
158 if (aCaps[0] == AllSupportedCapabilities[0]) |
|
159 { |
|
160 return KAll().AllocL(); |
|
161 } |
|
162 else if (aCaps[0] == (AllSupportedCapabilities[0] & ~(1 << ECapabilityTCB))) |
|
163 { |
|
164 return KAllMinusTCB().AllocL(); |
|
165 } |
|
166 else if (aCaps[0] == 0) |
|
167 { |
|
168 return KNone().AllocL(); |
|
169 } |
|
170 else |
|
171 { |
|
172 HBufC8* res = HBufC8::NewLC(512); // Easily enough room for all the capability names |
|
173 TPtr8 ptr = res->Des(); |
|
174 for (TInt bit = 0; bit < ECapability_Limit; bit++) |
|
175 { |
|
176 if (aCaps[0] & (1 << bit)) |
|
177 { |
|
178 ptr.Append(TPtrC8((TUint8*)CapabilityNames[bit])); |
|
179 ptr.Append(' '); |
|
180 } |
|
181 } |
|
182 ptr.SetLength(ptr.Length()-1); // Remove trailing space |
|
183 HBufC* res16 = HBufC::NewL(ptr.Length()); |
|
184 res16->Des().Copy(ptr); |
|
185 CleanupStack::PopAndDestroy(res); |
|
186 return res16; |
|
187 } |
|
188 } |
|
189 |
|
190 TPtrC ToString(TExitType aType) |
|
191 { |
|
192 switch (aType) |
|
193 { |
|
194 CASE_LIT2(EExitKill, "Kill"); |
|
195 CASE_LIT2(EExitTerminate, "Terminate"); |
|
196 CASE_LIT2(EExitPanic, "Panic"); |
|
197 CASE_LIT2(EExitPending, "Pending"); |
|
198 default: |
|
199 return TPtrC(); |
|
200 } |
|
201 } |
|
202 |
|
203 TPtrC ToString(User::TCritical aCritical) |
|
204 { |
|
205 switch (aCritical) |
|
206 { |
|
207 CASE_LIT2(User::ENotCritical, "Not critical"); |
|
208 CASE_LIT2(User::EProcessCritical, "Process critical"); |
|
209 CASE_LIT2(User::EProcessPermanent, "Process permanent"); |
|
210 CASE_LIT2(User::ESystemCritical, "System critical"); |
|
211 CASE_LIT2(User::ESystemPermanent, "System permanent"); |
|
212 default: |
|
213 return TPtrC(); |
|
214 } |
|
215 } |
|
216 |
|
217 // These lines must all be terminated by a blank string, "" |
|
218 // First item must be the description of the word, and must be <= 16 characters |
|
219 static char const *const w0[] = /* kernel debugging */ { "Word 0", "khardware", "kboot", "kserver", "kmmu", "ksemaphore", "ksched", "kproc", "kexec", "kdebugger", "kthread", "kdll", "kipc", "kpbus1", "kpbus", "kpbusdrv", "kpower", "ktiming", "kevent", "kobject", "kdfc", "kextension", "ksched2", "klocdrv", "kfail", "kthread2", "kdevice", "kmemtrace", "kdma", "kmmu2", "knkern", "kscratch", "kpanic", "" }; |
|
220 static char const *const w1[] = /* kernel debugging */ { "Word 1", "kusb", "kusbpsl", "knetwork1", "knetwork2", "ksound1", "kusbhost", "kusbotg", "kusbjournal", "kusbho", "kresmanager", "kiic", "khcr", "" }; |
|
221 static char const *const w2[] = /* kernel behaviour */ { "Word 2", "kallthreadssystem", "ktestfast", "ktestlatency", "kdebugmonitordisable", "kcrashmonitordisable", "" }; |
|
222 static char const *const w3[] = /* kernel behaviour */ { "Word 3", "kuserheaptrace", "" }; |
|
223 static char const *const w4[] = /* file server debug*/ { "" }; |
|
224 static char const *const w5[] = /* file server debug*/ { "" }; |
|
225 static char const *const w6[] = /* licensee specific*/ { "Word 6", "Bit 0", "Bit 1", "Bit 2", "Bit 3", "Bit 4", "Bit 5", "Bit 6", "Bit 7", "Bit 8", "Bit 9", "Bit 10", "Bit 11", "Bit 12", "Bit 13", "Bit 14", "Bit 15", "Bit 16", "Bit 17", "Bit 18", "Bit 19", "Bit 20", "Bit 21", "Bit 22", "Bit 23", "Bit 24", "Bit 25", "Bit 26", "Bit 27", "Bit 28", "Bit 29", "Bit 30", "Bit 31", "" }; |
|
226 static char const *const w7[] = /* licensee specific*/ { "Word 7", "Bit 0", "Bit 1", "Bit 2", "Bit 3", "Bit 4", "Bit 5", "Bit 6", "Bit 7", "Bit 8", "Bit 9", "Bit 10", "Bit 11", "Bit 12", "Bit 13", "Bit 14", "Bit 15", "Bit 16", "Bit 17", "Bit 18", "Bit 19", "Bit 20", "Bit 21", "Bit 22", "Bit 23", "Bit 24", "Bit 25", "Bit 26", "Bit 27", "Bit 28", "Bit 29", "Bit 30", "Bit 31", "" }; |
|
227 static char const *const fs[] = /* file server debug*/ { "File server", "kfsys", "kfserv", "kfldr", "kalloc", "klffs", "kiso9660", "kntfs", "krofs", "kthrd", "kcache", "kcompfs", ""}; |
|
228 |
|
229 static char const*const*const KKTraceFlags[] = { w0, w1, w2, w3, w4, w5, w6, w7, fs }; |
|
230 |
|
231 TPtrC8 TraceFlagName(TInt aWord, TInt aBit) |
|
232 { |
|
233 return gPlugin->TraceFlagName(aWord, aBit); |
|
234 } |
|
235 |
|
236 TPtrC8 CDefaultProductPlugin::TraceFlagName(TInt aWord, TInt aBit) |
|
237 { |
|
238 if (iPluginForThisDevice) |
|
239 { |
|
240 return iPluginForThisDevice->TraceFlagName(aWord, aBit); |
|
241 } |
|
242 |
|
243 if (aBit == 0 && *KKTraceFlags[aWord][aBit] == 0) |
|
244 { |
|
245 // Special-case this because the caller expects to be able to test whether the first bit name is empty to decide whether the word is empty, and our data structure doesn't let you do that any more |
|
246 return TPtrC8(); |
|
247 } |
|
248 |
|
249 aBit++; // Because we use -1 to mean the word title, and the bits go from 0-32, whereas in the array the title is at index 0 and the bits go from 1 to 33 |
|
250 return TPtrC8((const TUint8*)KKTraceFlags[aWord][aBit]); |
|
251 } |
|
252 |
|
253 // Format is tag name, followed by the names of the bits, starting from bit 0. Terminate with a "" and remember you only have 32 bits to play with! |
|
254 //const char* qres[] = { "QResources3", "Bit0", "Bit1", "Bit2", "" }; |
|
255 //const char* sentinel[] = {"Sentinel", "MemoryEvent", "AppSwitch", "QMemoryManager", "" }; |
|
256 static char const *const clogger[] = {"Clogger", "Log SetEnabled", "Log new tags", "Log disks", "Log new rdebuggers", ""}; |
|
257 static char const *const kernel[] = {"Kern::Printf", "<unused>", "Kern::Printf", "Platsec diagnostics", ""}; |
|
258 static char const *const wserv[] = {"Wserv", "Important", "Intermediate", "Everything else", ""}; |
|
259 static char const *const fallback[] = {"", "Bit 0", "Bit 1", "Bit 2", "Bit 3", "Bit 4", "Bit 5", "Bit 6", "Bit 7", "Bit 8", "Bit 9", "Bit 10", "Bit 11", "Bit 12", "Bit 13", "Bit 14", "Bit 15", "Bit 16", "Bit 17", "Bit 18", "Bit 19", "Bit 20", "Bit 21", "Bit 22", "Bit 23", "Bit 24", "Bit 25", "Bit 26", "Bit 27", "Bit 28", "Bit 29", "Bit 30", "Bit 31", "" }; |
|
260 |
|
261 extern char const* const* const KCloggerTags[] = {clogger, kernel, wserv, /*fallback must be the last in the list!*/fallback}; |
|
262 |
|
263 #ifdef __WINS__ |
|
264 #define WCHAR_TYPE TUint16 |
|
265 #else |
|
266 #define WCHAR_TYPE wchar_t |
|
267 #endif |
|
268 |
|
269 WCHAR_TYPE const*const KHalAtrributes[] = { |
|
270 L"EManufacturer", |
|
271 L"EManufacturerHardwareRev", |
|
272 L"EManufacturerSoftwareRev", |
|
273 L"EManufacturerSoftwareBuild", |
|
274 L"EModel", |
|
275 L"EMachineUid", |
|
276 L"EDeviceFamily", |
|
277 L"EDeviceFamilyRev", |
|
278 L"ECPU", |
|
279 L"ECPUArch", |
|
280 L"ECPUABI", |
|
281 L"ECPUSpeed", |
|
282 L"ESystemStartupReason", |
|
283 L"ESystemException", |
|
284 L"ESystemTickPeriod", |
|
285 L"EMemoryRAM", |
|
286 L"EMemoryRAMFree", |
|
287 L"EMemoryROM", |
|
288 L"EMemoryPageSize", |
|
289 L"EPowerGood", |
|
290 L"EPowerBatteryStatus", |
|
291 L"EPowerBackup", |
|
292 L"EPowerBackupStatus", |
|
293 L"EPowerExternal", |
|
294 L"EKeyboard", |
|
295 L"EKeyboardDeviceKeys", |
|
296 L"EKeyboardAppKeys", |
|
297 L"EKeyboardClick", |
|
298 L"EKeyboardClickState", |
|
299 L"EKeyboardClickVolume", |
|
300 L"EKeyboardClickVolumeMax", |
|
301 L"EDisplayXPixels", |
|
302 L"EDisplayYPixels", |
|
303 L"EDisplayXTwips", |
|
304 L"EDisplayYTwips", |
|
305 L"EDisplayColors", |
|
306 L"EDisplayState", |
|
307 L"EDisplayContrast", |
|
308 L"EDisplayContrastMax", |
|
309 L"EBacklight", |
|
310 L"EBacklightState", |
|
311 L"EPen", |
|
312 L"EPenX", |
|
313 L"EPenY", |
|
314 L"EPenDisplayOn", |
|
315 L"EPenClick", |
|
316 L"EPenClickState", |
|
317 L"EPenClickVolume", |
|
318 L"EPenClickVolumeMax", |
|
319 L"EMouse", |
|
320 L"EMouseX", |
|
321 L"EMouseY", |
|
322 L"EMouseState", |
|
323 L"EMouseSpeed", |
|
324 L"EMouseAcceleration", |
|
325 L"EMouseButtons", |
|
326 L"EMouseButtonState", |
|
327 L"ECaseState", |
|
328 L"ECaseSwitch", |
|
329 L"ECaseSwitchDisplayOn", |
|
330 L"ECaseSwitchDisplayOff", |
|
331 L"ELEDs", |
|
332 L"ELEDmask", |
|
333 L"EIntegratedPhone", |
|
334 L"EDisplayBrightness", |
|
335 L"EDisplayBrightnessMax", |
|
336 L"EKeyboardBacklightState", |
|
337 L"EAccessoryPower", |
|
338 L"ELanguageIndex", |
|
339 L"EKeyboardIndex", |
|
340 L"EMaxRAMDriveSize", |
|
341 L"EKeyboardState", |
|
342 L"ESystemDrive", |
|
343 L"EPenState", |
|
344 L"EDisplayIsMono", |
|
345 L"EDisplayIsPalettized", |
|
346 L"EDisplayBitsPerPixel", |
|
347 L"EDisplayNumModes", |
|
348 L"EDisplayMemoryAddress", |
|
349 L"EDisplayOffsetToFirstPixel", |
|
350 L"EDisplayOffsetBetweenLines", |
|
351 L"EDisplayPaletteEntry", |
|
352 L"EDisplayIsPixelOrderRGB", |
|
353 L"EDisplayIsPixelOrderLandscape", |
|
354 L"EDisplayMode", |
|
355 L"ESwitches", |
|
356 L"EDebugPort", |
|
357 L"ELocaleLoaded", |
|
358 L"EClipboardDrive", |
|
359 L"ECustomRestart", |
|
360 L"ECustomRestartReason", |
|
361 L"EDisplayNumberOfScreens", |
|
362 L"ENanoTickPeriod", |
|
363 L"EFastCounterFrequency", |
|
364 L"EFastCounterCountsUp", |
|
365 L"EPointer3D", |
|
366 L"EPointer3DZ", |
|
367 L"EPointer3DThetaSupported", |
|
368 L"EPointer3DPhiSupported", |
|
369 L"EPointer3DRotationSupported", |
|
370 L"EPointer3DPressureSupported", |
|
371 L"EHardwareFloatingPoint", |
|
372 L"ECustomResourceDrive", |
|
373 }; |
|
374 const TInt KNumHalAttributes = sizeof(KHalAtrributes) / sizeof(TUint16*); |
|
375 |
|
376 TPtrC ToStringHal(TInt aHalAttribute) |
|
377 { |
|
378 if (aHalAttribute >= KNumHalAttributes) |
|
379 { |
|
380 return TPtrC(); |
|
381 } |
|
382 else |
|
383 { |
|
384 return TPtrC((TUint16*)KHalAtrributes[aHalAttribute]); |
|
385 } |
|
386 } |
|
387 |
|
388 void ToStringHalVal(TDes& aDes, TInt aHalAttribute, TInt aHalValue) |
|
389 { |
|
390 gPlugin->FormatValue(aDes, MProductPlugin::EHal, aHalAttribute, aHalValue); |
|
391 } |
|
392 |
|
393 const TPtrC ToStringUid(TInt aVal) |
|
394 { |
|
395 switch(aVal) |
|
396 { |
|
397 CASE_LIT2(0x10279806, "KFax"); |
|
398 CASE_LIT2(0x10279807, "KPrint"); |
|
399 CASE_LIT2(0x10279808, "KBluetooth"); |
|
400 CASE_LIT2(0x10279809, "KInfrared"); |
|
401 CASE_LIT2(0x1027980a, "KMmc"); |
|
402 CASE_LIT2(0x1027980b, "KUsb"); |
|
403 CASE_LIT2(0x1027980c, "KObex"); |
|
404 CASE_LIT2(0x1027980d, "KRtpRtcp"); |
|
405 CASE_LIT2(0x1027980f, "KSip"); |
|
406 CASE_LIT2(0x10279810, "KOmaDataSync"); |
|
407 CASE_LIT2(0x10279811, "KOmaDeviceManagement"); |
|
408 CASE_LIT2(0x10279812, "KIPQoS"); |
|
409 CASE_LIT2(0x10279813, "KNetworkQoS"); |
|
410 CASE_LIT2(0x10279814, "KIPSec"); |
|
411 CASE_LIT2(0x10279815, "KDhcp"); |
|
412 CASE_LIT2(0x10279816, "KConnectivity"); |
|
413 CASE_LIT2(0x10281818, "KLocation"); |
|
414 CASE_LIT2(0x10281819, "KMobileIP"); |
|
415 CASE_LIT2(0x1028181A, "KOfflineMode"); |
|
416 CASE_LIT2(0x1028181B, "KDRM"); |
|
417 CASE_LIT2(0x10282663, "KOmaDsHostServers"); |
|
418 default: return TPtrC(); |
|
419 } |
|
420 } |
|
421 |
|
422 TPtrC KeyName(TInt aKeyCode); |
|
423 |
|
424 void CDefaultProductPlugin::FormatValue(TDes& aDes, TValueType aType, TInt aAttrib, TInt aVal) |
|
425 { |
|
426 aDes.SetLength(0); |
|
427 // Give product a chance to handle it |
|
428 if (iPluginForThisDevice) |
|
429 { |
|
430 iPluginForThisDevice->FormatValue(aDes, aType, aAttrib, aVal); |
|
431 if (aDes.Length()) return; |
|
432 } |
|
433 |
|
434 if (aType == MProductPlugin::EHal) |
|
435 { |
|
436 const TInt aHalAttribute = aAttrib; |
|
437 const TInt aHalValue = aVal; |
|
438 TBool hex = EFalse; |
|
439 switch (aHalAttribute) |
|
440 { |
|
441 case HAL::EManufacturer: |
|
442 { |
|
443 switch (aHalValue) |
|
444 { |
|
445 case HAL::EManufacturer_Ericsson: |
|
446 aDes = _L("Ericsson"); return; |
|
447 case HAL::EManufacturer_Motorola: |
|
448 aDes = _L("Motorola"); return; |
|
449 case HAL::EManufacturer_Nokia: |
|
450 aDes = _L("Nokia"); return; |
|
451 case HAL::EManufacturer_Panasonic: |
|
452 aDes = _L("Panasonic"); return; |
|
453 case HAL::EManufacturer_Psion: |
|
454 aDes = _L("Psion"); return; |
|
455 case HAL::EManufacturer_Intel: |
|
456 aDes = _L("Intel"); return; |
|
457 case HAL::EManufacturer_Cogent: |
|
458 aDes = _L("Cogent"); return; |
|
459 case HAL::EManufacturer_Cirrus: |
|
460 aDes = _L("Cirrus"); return; |
|
461 case HAL::EManufacturer_Linkup: |
|
462 aDes = _L("Linkup"); return; |
|
463 case HAL::EManufacturer_TexasInstruments: |
|
464 aDes = _L("TI"); return; |
|
465 default: |
|
466 hex = ETrue; |
|
467 break; |
|
468 } |
|
469 break; |
|
470 } |
|
471 case HAL::EMemoryRAM: |
|
472 case HAL::EMemoryRAMFree: |
|
473 case HAL::EMemoryROM: |
|
474 case HAL::EMemoryPageSize: |
|
475 case HAL::EMaxRAMDriveSize: |
|
476 HR(aDes, aHalValue); |
|
477 return; |
|
478 case HAL::ECPU: |
|
479 switch (aHalValue) |
|
480 { |
|
481 case HAL::ECPU_ARM: |
|
482 aDes = _L("ARM"); return; |
|
483 case HAL::ECPU_MCORE: |
|
484 aDes = _L("MCORE"); return; |
|
485 case HAL::ECPU_X86: |
|
486 aDes = _L("x86"); return; |
|
487 default: |
|
488 break; |
|
489 } |
|
490 break; |
|
491 case HAL::EModel: |
|
492 case HAL::EMachineUid: |
|
493 case HAL::ELEDmask: |
|
494 case HAL::EDisplayMemoryAddress: |
|
495 hex = ETrue; |
|
496 break; |
|
497 case HAL::EDeviceFamily: |
|
498 hex = ETrue; |
|
499 break; |
|
500 case HAL::ESystemDrive: |
|
501 case HAL::EClipboardDrive: |
|
502 if (aHalValue == -1) |
|
503 { |
|
504 // Emulator returns -1 for system drive... |
|
505 aDes = _L("Unknown"); |
|
506 return; |
|
507 } |
|
508 aDes.SetLength(1); |
|
509 aDes[0] = 'A' + aHalValue; |
|
510 return; |
|
511 default: |
|
512 break; |
|
513 } |
|
514 |
|
515 // Fall back if nothing recognised it |
|
516 if (hex) |
|
517 { |
|
518 aDes.Format(_L("0x%x"), aHalValue); |
|
519 } |
|
520 else |
|
521 { |
|
522 aDes.Format(_L("%i"), aHalValue); |
|
523 } |
|
524 } |
|
525 else if (aType == MProductPlugin::EKey) |
|
526 { |
|
527 const TInt aKeyCode = aVal; |
|
528 TPtrC name = KeyName(aKeyCode); |
|
529 if (name.Length()) |
|
530 { |
|
531 aDes = name; |
|
532 } |
|
533 else |
|
534 { |
|
535 if ((aKeyCode >= 'a' && aKeyCode <= 'z') || (aKeyCode >= '0' && aKeyCode <= '9') || aKeyCode == '*' || aKeyCode == '#') |
|
536 { |
|
537 aDes.Append((TChar)aKeyCode); |
|
538 } |
|
539 else |
|
540 { |
|
541 aDes.AppendFormat(_L("Keycode 0x%x"), aKeyCode); |
|
542 } |
|
543 } |
|
544 } |
|
545 else if (aType == MProductPlugin::EFeature) |
|
546 { |
|
547 aDes = ToStringUid(aAttrib); |
|
548 } |
|
549 } |
|
550 |
|
551 void PrettyName(TInt aType, TDes& aName) |
|
552 { |
|
553 switch (aType) |
|
554 { |
|
555 case EListProcess: |
|
556 { |
|
557 // name is too long, lose the uid |
|
558 TInt open = aName.LocateReverse('['); |
|
559 TInt close = aName.LocateReverse(']'); |
|
560 if (open != KErrNotFound && close > open) |
|
561 { |
|
562 aName.Delete(open, close-open+1); |
|
563 } |
|
564 // Lose the nonce if its 0001 |
|
565 _LIT(KOne, "0001"); |
|
566 if (aName.Right(4) == KOne) |
|
567 { |
|
568 aName.SetLength(aName.Length() - 4); |
|
569 } |
|
570 else |
|
571 { |
|
572 _LIT(KSeparator, " "); |
|
573 aName.Insert(aName.Length() - 4, KSeparator); |
|
574 } |
|
575 break; |
|
576 } |
|
577 case EListChunk: |
|
578 { |
|
579 // name is too long, as it can be based on thread fullname, ie procname[uid]nonce::threadname::$STK |
|
580 // lose the uid and the nonce |
|
581 TInt open = aName.Locate('['); |
|
582 TInt colon = aName.Locate(':'); |
|
583 if (open != KErrNotFound && colon > open) |
|
584 { |
|
585 aName.Delete(open, colon-open); |
|
586 } |
|
587 break; |
|
588 } |
|
589 case EListThread: |
|
590 { |
|
591 // Algorithm is: |
|
592 // Given a aName xxx(.exe)?\[uid\]nonce::(!)?yyy |
|
593 // if yyy == xxx (case insensitive compare) then just display yyy (with exclamation mark if present) |
|
594 // else display xxx::yyy |
|
595 |
|
596 // Find the :: that splits thread and process name |
|
597 _LIT(KDoubleColon, "::"); |
|
598 TInt colon = aName.Find(KDoubleColon); |
|
599 if (colon == KErrNotFound) |
|
600 { |
|
601 // It's not a thread name |
|
602 return; |
|
603 } |
|
604 |
|
605 // Remove .exe if present immediately before [uid] |
|
606 TInt brak = aName.Left(colon).LocateReverse('['); |
|
607 _LIT(KExe, ".exe"); |
|
608 if (brak >= 5 && aName.Mid(brak-4, 4).CompareF(KExe) == 0) |
|
609 { |
|
610 aName.Delete(brak-4, 4); |
|
611 brak -= 4; |
|
612 colon -= 4; |
|
613 } |
|
614 |
|
615 TPtrC procaName = brak >=0 ? aName.Left(brak) : aName.Left(colon); |
|
616 TPtrC threadaName = aName.Mid(colon+2); |
|
617 TPtrC realThreadaName = threadaName.Length() && threadaName[0] == '!' ? threadaName.Mid(1) : threadaName; |
|
618 if (procaName.CompareF(realThreadaName) == 0) |
|
619 { |
|
620 aName.Delete(0, colon+2); |
|
621 } |
|
622 else if (brak >= 0) |
|
623 { |
|
624 aName.Delete(brak, colon-brak); |
|
625 } |
|
626 break; |
|
627 } |
|
628 case EListWindowGroups: |
|
629 { |
|
630 // Window group names aren't supposed to be proper strings, so make them friendlier |
|
631 TInt nullPos = aName.Locate(TChar(0)); |
|
632 while (nullPos >= 0) |
|
633 { |
|
634 aName[nullPos] = '.'; |
|
635 nullPos = aName.Locate(TChar(0)); |
|
636 } |
|
637 break; |
|
638 } |
|
639 default: |
|
640 break; |
|
641 } |
|
642 } |
|
643 |
|
644 #ifdef FSHELL_SAMPLINGPROFILER_SUPPORT |
|
645 #include <profiler.h> |
|
646 |
|
647 void StartProfilerL() |
|
648 { |
|
649 _LIT(KProfiler,"Profiler.exe"); |
|
650 _LIT(KStartnoui,"start -noui"); |
|
651 TInt err = Profiler::Start(); |
|
652 if (err == KErrNotFound) |
|
653 { |
|
654 RProcess p; |
|
655 err = p.Create(KProfiler, KStartnoui); |
|
656 User::LeaveIfError(err); |
|
657 p.Resume(); |
|
658 p.Close(); |
|
659 } |
|
660 User::LeaveIfError(err); |
|
661 } |
|
662 |
|
663 TBool IsProfilerRunning() |
|
664 { |
|
665 _LIT(KProfiler,"Profiler.exe*"); |
|
666 |
|
667 TBool running = EFalse; |
|
668 TFindProcess f(KProfiler); |
|
669 TFullName n; |
|
670 while (f.Next(n) == KErrNone) |
|
671 { |
|
672 // Have to iterate all the Profiler RProcesses to see if any of em are still running |
|
673 RProcess p; |
|
674 if (p.Open(f) == KErrNone) |
|
675 { |
|
676 TExitType exitType = p.ExitType(); |
|
677 p.Close(); |
|
678 if (exitType == EExitPending) |
|
679 { |
|
680 running = ETrue; |
|
681 break; |
|
682 } |
|
683 } |
|
684 } |
|
685 return running; |
|
686 } |
|
687 |
|
688 void StopProfiler() |
|
689 { |
|
690 Profiler::Unload(); |
|
691 } |
|
692 |
|
693 #else |
|
694 void StartProfilerL() |
|
695 { |
|
696 User::Leave(KErrNotSupported); |
|
697 } |
|
698 |
|
699 TBool IsProfilerRunning() |
|
700 { |
|
701 return EFalse; |
|
702 } |
|
703 |
|
704 void StopProfiler() |
|
705 { |
|
706 } |
|
707 #endif |
|
708 |
|
709 TUint CriticalToFlags(User::TCritical aCrit) |
|
710 { |
|
711 switch (aCrit) |
|
712 { |
|
713 case User::ESystemPermanent: |
|
714 return KThreadFlagSystemPermanent; |
|
715 case User::ESystemCritical: |
|
716 return KThreadFlagSystemCritical; |
|
717 case User::EProcessPermanent: |
|
718 return KThreadFlagProcessPermanent; |
|
719 case User::EProcessCritical: |
|
720 return KThreadFlagProcessCritical; |
|
721 default: |
|
722 return 0; |
|
723 } |
|
724 } |
|
725 |
|
726 User::TCritical FlagsToCritical(TUint aFlags) |
|
727 { |
|
728 aFlags = aFlags & (KThreadFlagSystemPermanent | KThreadFlagSystemCritical | KThreadFlagProcessPermanent | KThreadFlagProcessCritical); |
|
729 switch (aFlags) |
|
730 { |
|
731 case KThreadFlagSystemPermanent: |
|
732 return User::ESystemPermanent; |
|
733 case KThreadFlagSystemCritical: |
|
734 return User::ESystemCritical; |
|
735 case KThreadFlagProcessPermanent: |
|
736 return User::EProcessPermanent; |
|
737 case KThreadFlagProcessCritical: |
|
738 return User::EProcessCritical; |
|
739 default: |
|
740 return User::ENotCritical; |
|
741 } |
|
742 } |
|
743 |
|
744 TUint32 CDefaultProductPlugin::GetDeviceType() |
|
745 { |
|
746 TUint32 res = 0; // EUnknownDevice; |
|
747 if (iPluginForThisDevice) |
|
748 { |
|
749 res = iPluginForThisDevice->GetDeviceType(); |
|
750 } |
|
751 return res; |
|
752 } |
|
753 |
|
754 TBool CDefaultProductPlugin::HandleErrorL(MProductPlugin::TError aType, TInt aErr) |
|
755 { |
|
756 TBool handled = EFalse; |
|
757 if (iPluginForThisDevice) |
|
758 { |
|
759 handled = iPluginForThisDevice->HandleErrorL(aType, aErr); |
|
760 } |
|
761 return handled; |
|
762 } |
|
763 |
|
764 TKeyResponse CDefaultProductPlugin::OfferKeyEventL(TKeyEvent& aEvent, TEventCode aType) |
|
765 { |
|
766 if (iPluginForThisDevice) |
|
767 { |
|
768 return iPluginForThisDevice->OfferKeyEventL(aEvent, aType); |
|
769 } |
|
770 return EKeyWasNotConsumed; |
|
771 } |
|
772 |
|
773 TBool CDefaultProductPlugin::DoDynInitOrDeleteCommandL(CQikCommand*& aCommand, const CCoeControl& aControlAddingCommands) |
|
774 { |
|
775 if (iPluginForThisDevice) |
|
776 { |
|
777 return iPluginForThisDevice->DoDynInitOrDeleteCommandL(aCommand, aControlAddingCommands); |
|
778 } |
|
779 return EFalse; |
|
780 } |
|
781 |
|
782 void CDefaultProductPlugin::RefreshTabL(TInt aTab) |
|
783 { |
|
784 if (iPluginForThisDevice) |
|
785 { |
|
786 iPluginForThisDevice->RefreshTabL(aTab); |
|
787 } |
|
788 } |
|
789 |
|
790 void CDefaultProductPlugin::LoadProductPluginL() |
|
791 { |
|
792 ASSERT(!gPlugin); |
|
793 |
|
794 CDefaultProductPlugin* plugin = new(ELeave) CDefaultProductPlugin; |
|
795 plugin->ConstructL(); |
|
796 |
|
797 #ifdef __DLL__ |
|
798 Dll::SetTls(plugin); |
|
799 #else |
|
800 gPlugin = plugin; |
|
801 #endif |
|
802 } |
|
803 |
|
804 void CDefaultProductPlugin::EnablePanicChecking(TBool aEnable) |
|
805 { |
|
806 if (iPluginForThisDeviceVersion > 1) |
|
807 { |
|
808 static_cast<MProductPluginV2*>(iPluginForThisDevice)->EnablePanicChecking(aEnable); |
|
809 } |
|
810 } |
|
811 |
|
812 TBool CDefaultProductPlugin::PanicCheckingIsEnabled() |
|
813 { |
|
814 if (iPluginForThisDeviceVersion > 1) |
|
815 { |
|
816 return static_cast<MProductPluginV2*>(iPluginForThisDevice)->PanicCheckingIsEnabled(); |
|
817 } |
|
818 return EFalse; |
|
819 } |
|
820 |
|
821 void CDefaultProductPlugin::DisablePanicCheckPushL() |
|
822 { |
|
823 if (PanicCheckingIsEnabled()) |
|
824 { |
|
825 CleanupStack::PushL(TCleanupItem(&EnablePanicCheck, this)); |
|
826 EnablePanicChecking(EFalse); |
|
827 } |
|
828 else |
|
829 { |
|
830 // This is a no-op cleanup item, since nothing needs doing if panic checks aren't on in the first place |
|
831 CBase* nullItem = NULL; |
|
832 CleanupStack::PushL(nullItem); |
|
833 } |
|
834 } |
|
835 |
|
836 void CDefaultProductPlugin::EnablePanicCheck(TAny* aSelf) |
|
837 { |
|
838 static_cast<CDefaultProductPlugin*>(aSelf)->EnablePanicChecking(ETrue); |
|
839 } |
|
840 |
|
841 NONSHARABLE_CLASS(CEcomWatcher) : public CActive |
|
842 { |
|
843 public: |
|
844 CEcomWatcher(REComSession& aSession, CDefaultProductPlugin& aSomething) |
|
845 : CActive(EPriorityStandard), iSession(aSession), iSomething(aSomething) |
|
846 { |
|
847 CActiveScheduler::Add(this); |
|
848 iSession.NotifyOnChange(iStatus); |
|
849 SetActive(); |
|
850 } |
|
851 |
|
852 ~CEcomWatcher() { Cancel(); } |
|
853 |
|
854 private: |
|
855 void RunL() |
|
856 { |
|
857 if (iStatus == KErrNone) |
|
858 { |
|
859 iSession.NotifyOnChange(iStatus); |
|
860 SetActive(); |
|
861 } |
|
862 iSomething.EcomChangedL(); |
|
863 } |
|
864 |
|
865 void DoCancel() { iSession.CancelNotifyOnChange(iStatus); } |
|
866 |
|
867 private: |
|
868 REComSession& iSession; |
|
869 CDefaultProductPlugin& iSomething; |
|
870 }; |
|
871 |
|
872 void CDefaultProductPlugin::ConstructL() |
|
873 { |
|
874 //gPlugin->iPluginForThisDevice = CZebraPlugin::NewL(); |
|
875 //gPlugin->iPlugins.AppendL(gPlugin->iPluginForThisDevice); |
|
876 |
|
877 #ifndef __DLL__ |
|
878 // When running as a DLL, we don't want to mess about loading plugins |
|
879 iEcom = REComSession::OpenL(); |
|
880 iEcomChangeWatcher = new(ELeave) CEcomWatcher(iEcom, *this); |
|
881 RescanPluginsL(); |
|
882 #endif |
|
883 } |
|
884 |
|
885 void CDefaultProductPlugin::DestroyPlugins() |
|
886 { |
|
887 for (TInt i = 0; i < iPlugins.Count(); i++) |
|
888 { |
|
889 iPlugins[i]->Release(iShuttingDown); |
|
890 } |
|
891 iPlugins.Reset(); |
|
892 |
|
893 for (TInt i = 0; i < iPluginDestructors.Count(); i++) |
|
894 { |
|
895 REComSession::DestroyedImplementation(iPluginDestructors[i]); |
|
896 } |
|
897 iPluginDestructors.Reset(); |
|
898 iEcomPluginList.ResetAndDestroy(); |
|
899 iPluginForThisDevice = NULL; |
|
900 iPluginForThisDeviceVersion = 0; |
|
901 } |
|
902 |
|
903 void CDefaultProductPlugin::RescanPluginsL() |
|
904 { |
|
905 DestroyPlugins(); |
|
906 TUid KUid = {KQr3ProductPluginEcomUid}; |
|
907 REComSession::ListImplementationsL(KUid, iEcomPluginList); |
|
908 for (TInt i = 0; i < iEcomPluginList.Count(); i++) |
|
909 { |
|
910 TRAP_IGNORE(LoadPluginL(iEcomPluginList[i]->ImplementationUid(), iEcomPluginList[i]->Version())); |
|
911 // One dodgy plugin shouldn't prevent everything else loading |
|
912 } |
|
913 } |
|
914 |
|
915 void CDefaultProductPlugin::LoadPluginL(TUid aImplUid, TInt aVersion) |
|
916 { |
|
917 //__DEBUGGER(); |
|
918 TUid uid; |
|
919 MProductPlugin* plugin = reinterpret_cast<MProductPlugin*>(REComSession::CreateImplementationL(aImplUid, uid)); |
|
920 // OK so yes it would be easier to keep the destructor key with the plugin... |
|
921 TInt err = iPlugins.Append(plugin); |
|
922 if (!err) |
|
923 { |
|
924 err = iPluginDestructors.Append(uid); |
|
925 if (err) |
|
926 { |
|
927 // need to remove from iPlugins so that iPlugins and iPluginDestructors are in sync |
|
928 iPlugins.Remove(iPlugins.Count()-1); |
|
929 } |
|
930 } |
|
931 if (err) |
|
932 { |
|
933 plugin->Release(EFalse); |
|
934 REComSession::DestroyedImplementation(uid); |
|
935 User::Leave(err); |
|
936 } |
|
937 |
|
938 TUint32 devType = plugin->GetDeviceType(); |
|
939 TUint32 currentDevType = iPluginForThisDevice ? iPluginForThisDevice->GetDeviceType() : 0; |
|
940 if (devType > currentDevType) |
|
941 { |
|
942 iPluginForThisDevice = plugin; |
|
943 iPluginForThisDeviceVersion = aVersion; |
|
944 if (iParentView) |
|
945 { |
|
946 plugin->DoViewConstructL(iParentView); |
|
947 } |
|
948 } |
|
949 } |
|
950 |
|
951 void CDefaultProductPlugin::EcomChangedL() |
|
952 { |
|
953 // Remove and reread all plugins |
|
954 RescanPluginsL(); |
|
955 //PluginsChangedL(ETrue); |
|
956 } |
|
957 |
|
958 CDefaultProductPlugin::~CDefaultProductPlugin() |
|
959 { |
|
960 //__DEBUGGER(); |
|
961 DestroyPlugins(); |
|
962 delete iEcomChangeWatcher; |
|
963 iEcom.Close(); |
|
964 } |
|
965 |
|
966 void CDefaultProductPlugin::DoViewConstructL(CQikMultiPageViewBase* aParentView) |
|
967 { |
|
968 iParentView = aParentView; |
|
969 if (iPluginForThisDevice) |
|
970 { |
|
971 iPluginForThisDevice->DoViewConstructL(aParentView); |
|
972 } |
|
973 } |
|
974 |
|
975 void CDefaultProductPlugin::DoHandleControlEventL(CCoeControl *aControl, MCoeControlObserver::TCoeEvent aEventType) |
|
976 { |
|
977 if (iPluginForThisDevice) |
|
978 { |
|
979 iPluginForThisDevice->DoHandleControlEventL(aControl, aEventType); |
|
980 } |
|
981 } |
|
982 |
|
983 TBool CDefaultProductPlugin::ConsumeMemoryKeys(TBool aDisk, TDes& aCheckboxName, TInt& aUpKeyCode, TInt& aDownKeyCode, TInt& aLogKeyCode) |
|
984 { |
|
985 TInt upscan, downscan, logscan; |
|
986 return ConsumeMemoryKeys(aDisk, aCheckboxName, aUpKeyCode, upscan, aDownKeyCode, downscan, aLogKeyCode, logscan); |
|
987 } |
|
988 |
|
989 TBool CDefaultProductPlugin::ConsumeMemoryKeys(TBool aDisk, TDes& aCheckboxName, TInt& aUpKeyCode, TInt& aUpScanCode, TInt& aDownKeyCode, TInt& aDownScanCode, TInt& aLogKeyCode, TInt& aLogScanCode) |
|
990 { |
|
991 // Set up defaults here. Device plugins are welcome to modify them |
|
992 TBool display = ETrue; |
|
993 if (aDisk) |
|
994 { |
|
995 aCheckboxName = _L("Use 2-way nav to consume disk"); |
|
996 } |
|
997 else |
|
998 { |
|
999 aCheckboxName = _L("Use 2-way nav to consume RAM"); |
|
1000 } |
|
1001 #ifdef INCLUDE_UIQ_DEFINITIONS |
|
1002 aUpKeyCode = EDeviceKeyTwoWayUp; |
|
1003 aUpScanCode = EStdDeviceKeyTwoWayUp; |
|
1004 aDownKeyCode = EDeviceKeyTwoWayDown; |
|
1005 aDownScanCode = EStdDeviceKeyTwoWayDown; |
|
1006 aLogKeyCode = EDeviceKeyAction; |
|
1007 aLogScanCode = EStdDeviceKeyAction; |
|
1008 #else |
|
1009 aUpKeyCode = EKeyUpArrow; |
|
1010 aUpScanCode = EStdKeyUpArrow; |
|
1011 aDownKeyCode = EKeyDownArrow; |
|
1012 aDownScanCode = EStdKeyDownArrow; |
|
1013 aLogKeyCode = EKeyEnter; |
|
1014 aLogScanCode = EStdKeyEnter; |
|
1015 #endif |
|
1016 |
|
1017 if (iPluginForThisDevice && iPluginForThisDeviceVersion > 3) |
|
1018 { |
|
1019 // Supports the scancode-aware interface |
|
1020 display = static_cast<MProductPluginV4*>(iPluginForThisDevice)->ConsumeMemoryKeys(aDisk, aCheckboxName, aUpKeyCode, aUpScanCode, aDownKeyCode, aDownScanCode, aLogKeyCode, aLogScanCode); |
|
1021 } |
|
1022 else if (iPluginForThisDevice) |
|
1023 { |
|
1024 aUpScanCode = 0; |
|
1025 aDownScanCode = 0; |
|
1026 aLogScanCode = 0; |
|
1027 display = iPluginForThisDevice->ConsumeMemoryKeys(aDisk, aCheckboxName, aUpKeyCode, aDownKeyCode, aLogKeyCode); |
|
1028 } |
|
1029 return display; |
|
1030 } |
|
1031 |
|
1032 void CDefaultProductPlugin::Release(TBool aAppIsShuttingDown) |
|
1033 { |
|
1034 iShuttingDown = aAppIsShuttingDown; |
|
1035 delete this; |
|
1036 } |
|
1037 |
|
1038 void CDefaultProductPlugin::GetFeatureUidsL(RArray<TUid>& aUids) |
|
1039 { |
|
1040 const TUid KDefaultFeatures[] = |
|
1041 { |
|
1042 /* KFax */ {0x10279806}, |
|
1043 /* KPrint */ {0x10279807}, |
|
1044 /* KBluetooth */ {0x10279808}, |
|
1045 /* KInfrared */ {0x10279809}, |
|
1046 /* KMmc */ {0x1027980a}, |
|
1047 /* KUsb */ {0x1027980b}, |
|
1048 /* KObex */ {0x1027980c}, |
|
1049 /* KRtpRtcp */ {0x1027980d}, |
|
1050 /* KSip */ {0x1027980f}, |
|
1051 /* KOmaDataSync */ {0x10279810}, |
|
1052 /* KOmaDeviceManagement */ {0x10279811}, |
|
1053 /* KIPQoS */ {0x10279812}, |
|
1054 /* KNetworkQoS */ {0x10279813}, |
|
1055 /* KIPSec */ {0x10279814}, |
|
1056 /* KDhcp */ {0x10279815}, |
|
1057 /* KConnectivity */ {0x10279816}, |
|
1058 /* KLocation */ {0x10281818}, |
|
1059 /* KMobileIP */ {0x10281819}, |
|
1060 /* KOfflineMode */ {0x1028181A}, |
|
1061 /* KDRM */ {0x1028181B}, |
|
1062 /* KOmaDsHostServers */ {0x10282663}, |
|
1063 }; |
|
1064 const TInt KNumFeatures = sizeof(KDefaultFeatures) / sizeof(TUid); |
|
1065 for (TInt i = 0; i < KNumFeatures; i++) |
|
1066 { |
|
1067 aUids.AppendL(KDefaultFeatures[i]); |
|
1068 } |
|
1069 |
|
1070 if (iPluginForThisDeviceVersion > 2) |
|
1071 { |
|
1072 static_cast<MProductPluginV3*>(iPluginForThisDevice)->GetFeatureUidsL(aUids); |
|
1073 } |
|
1074 } |
|
1075 |
|
1076 TPtrC KeyName(TInt aKeyCode) |
|
1077 { |
|
1078 enum TStuffNotDefinedInAllReleases |
|
1079 { |
|
1080 EKeyDevice20 = EKeyApplication1F + 1, |
|
1081 EKeyDevice21, |
|
1082 EKeyDevice22, |
|
1083 EKeyDevice23, |
|
1084 EKeyDevice24, |
|
1085 EKeyDevice25, |
|
1086 EKeyDevice26, |
|
1087 EKeyDevice27, |
|
1088 EKeyApplication20, |
|
1089 EKeyApplication21, |
|
1090 EKeyApplication22, |
|
1091 EKeyApplication23, |
|
1092 EKeyApplication24, |
|
1093 EKeyApplication25, |
|
1094 EKeyApplication26, |
|
1095 EKeyApplication27, |
|
1096 }; |
|
1097 |
|
1098 switch(aKeyCode) |
|
1099 { |
|
1100 #ifdef INCLUDE_UIQ_DEFINITIONS |
|
1101 CASE_LIT2(EDeviceKeyTwoWayUp, "2-way up"); |
|
1102 CASE_LIT2(EDeviceKeyTwoWayDown, "2-way down"); |
|
1103 CASE_LIT2(EDeviceKeyFourWayUp, "4-way up"); |
|
1104 CASE_LIT2(EDeviceKeyFourWayDown, "4-way down"); |
|
1105 CASE_LIT2(EDeviceKeyFourWayLeft, "4-way left"); |
|
1106 CASE_LIT2(EDeviceKeyFourWayRight, "4-way right"); |
|
1107 CASE_LIT2(EDeviceKeyAction, "Confirm"); |
|
1108 CASE_LIT2(EDeviceKeyHomeScreen, "Home key"); |
|
1109 CASE_LIT2(EDeviceKeyCameraFocusLock, "Camera focus"); |
|
1110 CASE_LIT2(EDeviceKeyCameraShutter, "Camer shutter"); |
|
1111 CASE_LIT2(EDeviceKeyLock, "Key lock"); |
|
1112 CASE_LIT2(EDeviceKeyMultimedia, "Multimedia key"); |
|
1113 CASE_LIT2(EDeviceKeyIncVolume, "Volume up"); |
|
1114 CASE_LIT2(EDeviceKeyDecVolume, "Volume down"); |
|
1115 CASE_LIT2(EDeviceKeyPower, "Power"); |
|
1116 CASE_LIT2(EDeviceKeyVideoCall, "Video Call"); |
|
1117 #else |
|
1118 // These are things that have the same value as UIQ definitions above, thus we can't include them twice in the switch |
|
1119 CASE_LIT(EKeyDevice1); |
|
1120 CASE_LIT(EKeyDevice2); |
|
1121 CASE_LIT(EKeyDevice4); |
|
1122 CASE_LIT(EKeyDevice5); |
|
1123 CASE_LIT(EKeyDevice6); |
|
1124 CASE_LIT(EKeyDevice7); |
|
1125 CASE_LIT(EKeyDevice8); |
|
1126 CASE_LIT(EKeyDeviceD); |
|
1127 CASE_LIT(EKeyApplication1); |
|
1128 CASE_LIT(EKeyApplication3); |
|
1129 CASE_LIT(EKeyApplication5); |
|
1130 #endif |
|
1131 CASE_LIT2(EKeyBackspace, "Backspace"); |
|
1132 CASE_LIT2(EKeyEnter, "Return"); |
|
1133 CASE_LIT2(EKeySpace, "Space"); |
|
1134 CASE_LIT2(EKeyLeftArrow, "Left arrow"); |
|
1135 CASE_LIT2(EKeyRightArrow, "Right arrow"); |
|
1136 CASE_LIT2(EKeyUpArrow, "Up arrow"); |
|
1137 CASE_LIT2(EKeyDownArrow, "Down arrow"); |
|
1138 CASE_LIT2(EKeyYes, "GREEN key"); |
|
1139 CASE_LIT2(EKeyNo, "RED key"); |
|
1140 CASE_LIT(EKeyDevice0); |
|
1141 CASE_LIT(EKeyDevice3); |
|
1142 CASE_LIT(EKeyDevice9); |
|
1143 CASE_LIT(EKeyDeviceA); |
|
1144 CASE_LIT(EKeyDeviceB); |
|
1145 CASE_LIT(EKeyDeviceC); |
|
1146 CASE_LIT(EKeyDeviceE); |
|
1147 CASE_LIT(EKeyDeviceF); |
|
1148 #ifdef FSHELL_PLATFORM_S60 |
|
1149 CASE_LIT2(EKeyApplication0, "Menu"); |
|
1150 #else |
|
1151 CASE_LIT(EKeyApplication0); |
|
1152 #endif |
|
1153 CASE_LIT(EKeyApplication2); |
|
1154 CASE_LIT(EKeyApplication4); |
|
1155 CASE_LIT(EKeyApplication6); |
|
1156 CASE_LIT(EKeyApplication7); |
|
1157 CASE_LIT(EKeyApplication8); |
|
1158 CASE_LIT(EKeyApplication9); |
|
1159 CASE_LIT(EKeyApplicationA); |
|
1160 CASE_LIT(EKeyApplicationB); |
|
1161 CASE_LIT(EKeyApplicationC); |
|
1162 CASE_LIT(EKeyApplicationD); |
|
1163 CASE_LIT(EKeyApplicationE); |
|
1164 CASE_LIT(EKeyApplicationF); |
|
1165 CASE_LIT(EKeyDevice10); |
|
1166 CASE_LIT(EKeyDevice11); |
|
1167 CASE_LIT(EKeyDevice12); |
|
1168 CASE_LIT(EKeyDevice13); |
|
1169 CASE_LIT(EKeyDevice14); |
|
1170 CASE_LIT(EKeyDevice15); |
|
1171 CASE_LIT(EKeyDevice16); |
|
1172 CASE_LIT(EKeyDevice17); |
|
1173 CASE_LIT(EKeyDevice18); |
|
1174 CASE_LIT(EKeyDevice19); |
|
1175 CASE_LIT(EKeyDevice1A); |
|
1176 CASE_LIT(EKeyDevice1B); |
|
1177 CASE_LIT(EKeyDevice1C); |
|
1178 CASE_LIT(EKeyDevice1D); |
|
1179 CASE_LIT(EKeyDevice1E); |
|
1180 CASE_LIT(EKeyDevice1F); |
|
1181 CASE_LIT(EKeyApplication10); |
|
1182 CASE_LIT(EKeyApplication11); |
|
1183 CASE_LIT(EKeyApplication12); |
|
1184 CASE_LIT(EKeyApplication13); |
|
1185 CASE_LIT(EKeyApplication14); |
|
1186 CASE_LIT(EKeyApplication15); |
|
1187 CASE_LIT(EKeyApplication16); |
|
1188 CASE_LIT(EKeyApplication17); |
|
1189 CASE_LIT(EKeyApplication18); |
|
1190 CASE_LIT(EKeyApplication19); |
|
1191 CASE_LIT(EKeyApplication1A); |
|
1192 CASE_LIT(EKeyApplication1B); |
|
1193 CASE_LIT(EKeyApplication1C); |
|
1194 CASE_LIT(EKeyApplication1D); |
|
1195 CASE_LIT(EKeyApplication1E); |
|
1196 CASE_LIT(EKeyApplication1F); |
|
1197 CASE_LIT(EKeyDevice20); |
|
1198 CASE_LIT(EKeyDevice21); |
|
1199 CASE_LIT(EKeyDevice22); |
|
1200 CASE_LIT(EKeyDevice23); |
|
1201 CASE_LIT(EKeyDevice24); |
|
1202 CASE_LIT(EKeyDevice25); |
|
1203 CASE_LIT(EKeyDevice26); |
|
1204 CASE_LIT(EKeyDevice27); |
|
1205 CASE_LIT(EKeyApplication20); |
|
1206 CASE_LIT(EKeyApplication21); |
|
1207 CASE_LIT(EKeyApplication22); |
|
1208 CASE_LIT(EKeyApplication23); |
|
1209 CASE_LIT(EKeyApplication24); |
|
1210 CASE_LIT(EKeyApplication25); |
|
1211 CASE_LIT(EKeyApplication26); |
|
1212 CASE_LIT(EKeyApplication27); |
|
1213 default: |
|
1214 return TPtrC(); |
|
1215 } |
|
1216 } |