|
1 // Utils.h |
|
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 #ifndef UTILS_H |
|
13 #define UTILS_H |
|
14 |
|
15 #include <fshell/QR3ProductPlugin.h> |
|
16 #include <fshell/qr3dll.h> |
|
17 |
|
18 void HR(TDes& aDes, TInt64 aSize); // Human readable formatting of aSize as a memory size (eg 1500 -> "1.46 KB") |
|
19 void HR(TDes8& aDes, TInt64 aSize); |
|
20 |
|
21 TPtrC ToString(TProcessPriority aPriority); |
|
22 TPtrC ToString(TThreadPriority aPriority); |
|
23 TPtrC ToString(TExitType aType); |
|
24 HBufC* ToStringL(SCapabilitySet& aCaps); |
|
25 TPtrC ToString(User::TCritical aCritical); |
|
26 TPtrC ToStringHal(TInt aHalAttribute); |
|
27 void ToStringHalVal(TDes& aDes, TInt aHalAttribute, TInt aHalValue); |
|
28 |
|
29 void PrettyName(TInt aType, TDes& aName); // aType is a TKernelObjectType |
|
30 |
|
31 //extern const char*const* KKTraceFlags[]; |
|
32 TPtrC8 TraceFlagName(TInt aWord, TInt aBit); |
|
33 |
|
34 extern char const* const* const KCloggerTags[]; |
|
35 |
|
36 //extern const char* KFileServerTraceFlags[]; |
|
37 |
|
38 class CEcomWatcher; |
|
39 |
|
40 NONSHARABLE_CLASS(CDefaultProductPlugin) : public CBase, public MProductPlugin |
|
41 { |
|
42 public: |
|
43 static void LoadProductPluginL(); |
|
44 ~CDefaultProductPlugin(); |
|
45 |
|
46 // From MProductPluginV1 |
|
47 TPtrC8 TraceFlagName(TInt aWord, TInt aBit); |
|
48 void FormatValue(TDes& aDes, TValueType aType, TInt aAttrib, TInt aVal); |
|
49 TUint32 GetDeviceType(); |
|
50 TBool HandleErrorL(TError aType, TInt aErr); |
|
51 TKeyResponse OfferKeyEventL(TKeyEvent& aEvent, TEventCode aType); |
|
52 void RefreshTabL(TInt aTab); |
|
53 TBool DoDynInitOrDeleteCommandL(CQikCommand*& aCommand, const CCoeControl& aControlAddingCommands); |
|
54 void DoViewConstructL(CQikMultiPageViewBase* aParentView); |
|
55 void DoHandleControlEventL(CCoeControl *aControl, MCoeControlObserver::TCoeEvent aEventType); |
|
56 TBool ConsumeMemoryKeys(TBool aDisk, TDes& aCheckboxName, TInt& aUpKeyCode, TInt& aDownKeyCode, TInt& aLogKeyCode); |
|
57 void Release(TBool aAppIsShuttingDown); |
|
58 |
|
59 // From MProductPluginV2 |
|
60 void EnablePanicChecking(TBool aEnable); |
|
61 TBool PanicCheckingIsEnabled(); |
|
62 |
|
63 // From MProductPluginV3 |
|
64 void GetFeatureUidsL(RArray<TUid>& aUids); |
|
65 |
|
66 // From MProductPluginV4 |
|
67 TBool ConsumeMemoryKeys(TBool aDisk, TDes& aCheckboxName, TInt& aUpKeyCode, TInt& aUpScanCode, TInt& aDownKeyCode, TInt& aDownScanCode, TInt& aLogKeyCode, TInt& aLogScanCode); |
|
68 |
|
69 // Internal |
|
70 void EcomChangedL(); |
|
71 void ConstructL(); |
|
72 void DestroyPlugins(); |
|
73 void RescanPluginsL(); |
|
74 void LoadPluginL(TUid aImplUid, TInt aVersion); |
|
75 void DisablePanicCheckPushL(); // Disables panic checks, pushes an item onto the cleanupstack that restores them |
|
76 static void EnablePanicCheck(TAny* aSelf); |
|
77 |
|
78 private: |
|
79 REComSession iEcom; |
|
80 RImplInfoPtrArray iEcomPluginList; |
|
81 RPointerArray<MProductPlugin> iPlugins; |
|
82 MProductPluginV1* iPluginForThisDevice; // Not owned, may be NULL. Is explicitly typed to be MProductPluginV1 to remind people they have to check the version before calling any non-V1 functions |
|
83 TInt iPluginForThisDeviceVersion; // Will be 0 if iPluginForThisDevice == NULL |
|
84 RArray<TUid> iPluginDestructors; |
|
85 TCallBack iPluginsChangedCallback; |
|
86 CEcomWatcher* iEcomChangeWatcher; |
|
87 CQikMultiPageViewBase* iParentView; |
|
88 TBool iShuttingDown; |
|
89 }; |
|
90 |
|
91 #ifdef __DLL__ |
|
92 #define gPlugin ((CDefaultProductPlugin*)Dll::Tls()) |
|
93 #else |
|
94 extern CDefaultProductPlugin* gPlugin; |
|
95 #endif |
|
96 |
|
97 void StartProfilerL(); |
|
98 TBool IsProfilerRunning(); |
|
99 void StopProfiler(); |
|
100 |
|
101 TUint CriticalToFlags(User::TCritical aCrit); |
|
102 User::TCritical FlagsToCritical(TUint aFlags); |
|
103 |
|
104 |
|
105 #endif |