|
1 // Copyright (c) 2005-2010 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 // |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef TE_TRACECORE_DATAWRAPPER_H_ |
|
19 #define TE_TRACECORE_DATAWRAPPER_H_ |
|
20 |
|
21 #include <test/datawrapper.h> |
|
22 #include <test/TraceOnActivationIf.h> |
|
23 #include <TraceCoreOstDriverIf.h> //TraceCoreOstLdd |
|
24 #include <TcDriverIf.h> //TcLdd |
|
25 |
|
26 const TInt KNoOfSlots = 5; |
|
27 |
|
28 class CTraceCoreDataWrapper : public CDataWrapper |
|
29 { |
|
30 public: |
|
31 static CTraceCoreDataWrapper* NewLC(); |
|
32 static CTraceCoreDataWrapper* NewL(); |
|
33 ~CTraceCoreDataWrapper(); |
|
34 |
|
35 TAny* GetObject(); |
|
36 TBool DoCommandL(const TTEFFunction& aCommand, |
|
37 const TTEFSectionName& aSection, |
|
38 const TInt aAsyncErrorIndex); |
|
39 |
|
40 TBool GetStringFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TPtrC& aResult); |
|
41 TBool GetBoolFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TBool& aResult); |
|
42 TBool GetIntFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt& aResult); |
|
43 TBool GetHexFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt& aResult); |
|
44 |
|
45 TBool GetPathFromConfig(const TTEFSectionName& aSection, const TDesC& aPathKey, TFileName& aPath); |
|
46 TBool GetArgsFromConfig(const TTEFSectionName& aSection, TDes& aArgs); |
|
47 TBool GetLongStringFromConfig(const TTEFSectionName& aSection, const TDesC& aKeyName, TDes& aResult); |
|
48 |
|
49 protected: |
|
50 CTraceCoreDataWrapper(); |
|
51 void ConstructL(); |
|
52 |
|
53 // Command functions |
|
54 void DoCmdCopyFileL(const TTEFSectionName& aSection); |
|
55 void DoCmdDeleteFileFromAllDrivesL(const TTEFSectionName& aSection); |
|
56 void DoCmdDeleteFileL(const TTEFSectionName& aSection); |
|
57 void DoCmdDeleteEmptyFolder(const TTEFSectionName& aSection); |
|
58 void DoCmdFileExists(const TTEFSectionName& aSection); |
|
59 void DoCmdCheckFileSize(const TTEFSectionName& aSection); |
|
60 void DoCmdRunProcess(const TTEFSectionName& aSection); |
|
61 void DoCmdCreateSubstDrive(const TTEFSectionName& aSection); |
|
62 void DoCmdUnSubstDrive(const TTEFSectionName& aSection); |
|
63 void DoCmdCheckMaxFileSizeL(const TTEFSectionName& aSection); |
|
64 void DoCmdCheckFileIsAppendedL(const TTEFSectionName& aSection); |
|
65 void DoCmdVerifyTraceDataL(const TTEFSectionName& aSection); |
|
66 void DoCmdVerifyPrimingDataL(const TTEFSectionName& aSection); |
|
67 void DoCmdVerifyDroppedTracesL(const TTEFSectionName& aSection); |
|
68 void DoCmdVerifySlot(const TTEFSectionName& aSection); |
|
69 void DoCmdFileChangeNotification(const TTEFSectionName& aSection, const TInt aAsyncErrorIndex); |
|
70 void DoCmdRegisterNotifReceiver(const TTEFSectionName& aSection); |
|
71 void DoCmdUnregisterNotifReceiver(const TTEFSectionName& aSection); |
|
72 void DoCmdInstrumentTraceSequence(const TTEFSectionName& aSection); |
|
73 void DoCmdSetUpTcLdd(const TTEFSectionName& aSection); |
|
74 void DoCmdCleanUpTcLdd(const TTEFSectionName& aSection); |
|
75 void DoCmdSetUpTcOstLdd(const TTEFSectionName& aSection); |
|
76 void DoCmdCleanUpTcOstLdd(const TTEFSectionName& aSection); |
|
77 void DoCmdSetUpTraceOnActivation(const TTEFSectionName& aSection); |
|
78 void DoCmdCleanUpTraceOnActivation(const TTEFSectionName& aSection); |
|
79 void DoCmdActivateDeactivateTrace(const TTEFSectionName& aSection); |
|
80 void DoCmdReadTracesFromBuffer(); |
|
81 |
|
82 protected: |
|
83 // Helper methods |
|
84 void CopyFileL(const TDesC& aSrcFile, const TDesC& aDstFile); |
|
85 void DeleteFileFromAllDrivesL(const TDesC& aFile); |
|
86 void DeleteFileL(const TDesC& aFile, TInt aStrictMode = ETrue); |
|
87 void DeleteEmptyFolder(const TDesC& aFolder); |
|
88 TBool FileExists(const TDesC& aFile); |
|
89 TInt CheckFileSize(const TDesC& aFile, TInt aMinSize, TInt aMaxSize); |
|
90 void RunProcess(const TDesC& aProgramName, const TDesC& aCmdLineArgs, TInt aNoOfCalls = 1, TInt aAllowedErrorCode = KErrNone); |
|
91 void CreateSubstDrive(const TDesC& aFolderPath, TDriveNumber aDrive); |
|
92 void UnSubstDrive(TDriveNumber aDrive); |
|
93 TBool DriveNumberFromString(const TDesC& aDriveString, TDriveNumber& aDriveNumber); |
|
94 void VerifyPrimingDataL(const TDesC& aFile, TInt aGroupId, TBool aVerifyData, TInt& aNumTraces, TInt& aNumPrimingTraces); |
|
95 void VerifyDroppedPrintfTracesL(const TDesC& aFile, const TDesC& aFindString, TInt& aLastNumberFound, TInt& aNumDroppedTraces); |
|
96 void VerifyDroppedBinaryTracesL(const TDesC& aFile, TInt aGroupId, TInt aComponentId, TInt& aLastNumberFound, TInt& aNumDroppedTraces); |
|
97 void StoreInSlot(TInt aEntry, TInt aSlot); |
|
98 TInt ReadFromSlot(TInt aSlot); |
|
99 TInt GetSlotValue(const TTEFSectionName& aSection, const TDesC& aValueKey, const TDesC& aSlotNumberKey); |
|
100 void FileHasPrintfStringL(const TDesC& aFile, const TDesC& aFindString, TInt& aNumFound); |
|
101 void BufferHasPrintfStringL(TDesC8& aBuffer, const TDesC& aFindString, TInt& aNumFound); |
|
102 void InstrumentBinaryTracePoint(TInt aGroupId, TInt aComponentId, TInt aData, TInt aTraceId = 1); |
|
103 void InstrumentBinaryTraceSequence(TInt aSequenceLength, TInt aGroupId, TInt aComponentId); |
|
104 void InstrumentPrintfTraceSequence(TInt aSequenceLength, const TDesC& aString); |
|
105 TInt LoadLdd(const TDesC& aLddName, TBool aSingleUse); |
|
106 TInt FreeLdd(const TDesC& aLddName); |
|
107 TBool LoadLdd(const TDesC& aLddName, const TTEFSectionName& aSection); |
|
108 template <class T> TInt OpenLdd(const TDesC& aLddName, T& aLdd); |
|
109 template <class T> TBool OpenLdd(const TDesC& aLddName, T& aLdd, const TTEFSectionName& aSection); |
|
110 |
|
111 // MActiveCallback implementation |
|
112 void RunL(CActive* aActive, TInt aIndex); |
|
113 void DoCancel(CActive* aActive, TInt aIndex); |
|
114 |
|
115 protected: |
|
116 // Member variables |
|
117 RFs iFs; |
|
118 RTimer iTimer; |
|
119 TFixedArray<TInt, KNoOfSlots> iSlots; |
|
120 CActiveCallback* iActiveFileChangeNotification; |
|
121 CActiveCallback* iActiveFileChangeNotificationTimeout; |
|
122 TPtrC iCurrentSectionName; |
|
123 RTraceOnActivation iTraceOnActivationLdd; |
|
124 RTcDriver iTcLdd; |
|
125 RTraceCoreOstDriver iTraceCoreOstLdd; |
|
126 RBuf8 iTraceBuffer; |
|
127 TBool iTcLddLoadedAtStart; |
|
128 TBool iTcOstLddLoadedAtStart; |
|
129 TBool iTraceOnActivationLoadedAtStart; |
|
130 }; |
|
131 |
|
132 |
|
133 #endif /* TE_TRACECORE_DATAWRAPPER_H_ */ |