|
1 /* |
|
2 * Copyright (c) 2007-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "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 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Results database item |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef DIAGRESULTSDATABASEITEM_H |
|
20 #define DIAGRESULTSDATABASEITEM_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> // CBase |
|
24 |
|
25 // FORWARD DECLARATIONS |
|
26 class RWriteStream; |
|
27 class RReadStream; |
|
28 class TTime; |
|
29 class TStreamId; |
|
30 class CStreamStore; |
|
31 class CBufFlat; |
|
32 |
|
33 /** |
|
34 * Results database item. |
|
35 * |
|
36 * @since S60 v5.0 |
|
37 **/ |
|
38 class CDiagResultsDatabaseItem : public CBase |
|
39 { |
|
40 public: |
|
41 /** |
|
42 * Result of test. |
|
43 */ |
|
44 enum TResult |
|
45 { |
|
46 ESuccess = 0, |
|
47 EFailed, // Test failed |
|
48 ESkipped, // Test was never executed because it was skipped |
|
49 // before it is started. (e.g. during initial delay timer) |
|
50 ECancelled, // Test session was cancelled. ( ECancelAll ) |
|
51 EInterrupted, // Interrupted. Test was already running, but interrupted |
|
52 // by end user, or other external cause. |
|
53 ENotPerformed, // Not performed due to invalid set up. |
|
54 EDependencyFailed, // Failed because dependent test failed. |
|
55 EWatchdogCancel, // Watchdog cancelled testing. |
|
56 ESuspended, // Test is scheduled to run later. |
|
57 EQueuedToRun, // Test is waiting for execution. It is possible that |
|
58 // EQueuedToRun is never overwritten. |
|
59 EDependencySkipped // Skipped because common dependency was not executed |
|
60 // either due to it was skipped or interrupted. |
|
61 }; |
|
62 |
|
63 public: |
|
64 |
|
65 /** |
|
66 * NewL. Construct from a stream. |
|
67 * @param aStream Stream to read from. |
|
68 */ |
|
69 IMPORT_C static CDiagResultsDatabaseItem* NewL ( RReadStream& aStream ); |
|
70 |
|
71 /** |
|
72 * NewL. |
|
73 */ |
|
74 IMPORT_C static CDiagResultsDatabaseItem* NewL ( |
|
75 TUid aTestUid, |
|
76 TBool aDependencyExecution, |
|
77 TResult aResult, |
|
78 TTime aStartTime, |
|
79 TTime aEndTime, |
|
80 CBufFlat* aDetailsData ); |
|
81 /** |
|
82 * NewLC. |
|
83 */ |
|
84 IMPORT_C static CDiagResultsDatabaseItem* NewLC ( |
|
85 TUid aTestUid, |
|
86 TBool aDependencyExecution, |
|
87 TResult aResult, |
|
88 TTime aStartTime, |
|
89 TTime aEndTime, |
|
90 CBufFlat* aDetailsData ); |
|
91 |
|
92 /** |
|
93 * NewL. Copy constructor. This will do a deep copy. |
|
94 * |
|
95 * @param aOriginal - Original to copy data from. |
|
96 * @return a new instance of CDiagResultsDatabaseItem that is a deep |
|
97 * copy of the original given. Ownership is transferred. |
|
98 */ |
|
99 IMPORT_C static CDiagResultsDatabaseItem* NewL ( |
|
100 const CDiagResultsDatabaseItem& aOriginal ); |
|
101 /** |
|
102 * Destructor. |
|
103 */ |
|
104 IMPORT_C virtual ~CDiagResultsDatabaseItem(); |
|
105 |
|
106 /** |
|
107 * Get Uid of test plug-in. |
|
108 * |
|
109 * @return TUid - uid of the test plug-in. |
|
110 */ |
|
111 IMPORT_C TUid TestUid() const; |
|
112 |
|
113 /** |
|
114 * Whether the test was executed to satisfy dependency or not. |
|
115 * |
|
116 * @return ETrue if executed as dependency. |
|
117 * EFalse otherwise. |
|
118 */ |
|
119 IMPORT_C TBool WasDependency() const; |
|
120 |
|
121 /** |
|
122 * Get Test Result. |
|
123 * |
|
124 * @return TResult. |
|
125 */ |
|
126 IMPORT_C TResult TestResult() const; |
|
127 |
|
128 /** |
|
129 * Time that test execution was started. |
|
130 * Universal time is used. |
|
131 * |
|
132 * @return Time that execution was started. |
|
133 */ |
|
134 IMPORT_C TTime TimeStarted() const; |
|
135 |
|
136 /** |
|
137 * Time that test execution was completed. |
|
138 * Universal time is used. |
|
139 * |
|
140 * @return Time that execution was completed. |
|
141 */ |
|
142 IMPORT_C TTime TimeCompleted() const; |
|
143 |
|
144 /** |
|
145 * Details data. This must be interpreted by the plug-ins before |
|
146 * it can be used. Data is in object form. |
|
147 */ |
|
148 IMPORT_C const CBufFlat* DetailsData() const; |
|
149 |
|
150 /** |
|
151 * Calculate stream size in bytes. Size can be used to evaluate needed |
|
152 * stream size. |
|
153 * |
|
154 * @return Size in bytes. |
|
155 */ |
|
156 IMPORT_C TInt Size() const; |
|
157 |
|
158 public: |
|
159 |
|
160 /** |
|
161 * Externalize the test result to a stream. |
|
162 * |
|
163 * @param aStream Stream to write to. |
|
164 */ |
|
165 IMPORT_C void ExternalizeL( RWriteStream& aStream ) const; |
|
166 |
|
167 |
|
168 private: //internalization methods |
|
169 |
|
170 /** |
|
171 * Internalize the test result from a stream. |
|
172 * |
|
173 * @param aStream Stream to read from. |
|
174 */ |
|
175 IMPORT_C void InternalizeL( RReadStream& aStream ); |
|
176 |
|
177 /** |
|
178 * Write TTime into write stream. |
|
179 * |
|
180 * @param aStream Stream to write to. |
|
181 * @param aTime TTime that is written into the stream. |
|
182 **/ |
|
183 void WriteTimeToStreamL( RWriteStream& aStream, const TTime& aTime ) const; |
|
184 |
|
185 /** |
|
186 * Read TTime from read stream. |
|
187 * |
|
188 * @param aStream read stream. |
|
189 * @param aTime Contains time after stream is read. |
|
190 **/ |
|
191 void ReadTimeFromStreamL( RReadStream& aStream, TTime& aTime ); |
|
192 |
|
193 private: |
|
194 |
|
195 /** |
|
196 * C++ Constructors. |
|
197 */ |
|
198 CDiagResultsDatabaseItem ( |
|
199 TUid aTestUid, |
|
200 TBool aDependencyExecution, |
|
201 TResult aResult, |
|
202 TTime aStartTime, |
|
203 TTime aEndTime, |
|
204 CBufFlat* aDetailsData ); |
|
205 |
|
206 /** |
|
207 * Construct from a stream. |
|
208 * |
|
209 * @param aStream Read stream. |
|
210 */ |
|
211 void ConstructL ( RReadStream& aStream ); |
|
212 |
|
213 /** |
|
214 * Default C++ constructor. |
|
215 **/ |
|
216 CDiagResultsDatabaseItem (); |
|
217 |
|
218 private: // data |
|
219 |
|
220 // Uid of the test plug-in. |
|
221 TUid iTestUid; |
|
222 |
|
223 // Has this been executed as a part of another execution (precondition). |
|
224 TBool iDependencyExecution; |
|
225 |
|
226 // Test result |
|
227 TResult iResult; |
|
228 |
|
229 // When the test began. |
|
230 TTime iStartTime; |
|
231 |
|
232 // When the test ended |
|
233 TTime iEndTime; |
|
234 |
|
235 // Contains flat buffer that can hold additional data |
|
236 // For example debugging data or further analysis. |
|
237 CBufFlat* iDetailsData; |
|
238 |
|
239 }; |
|
240 |
|
241 #endif // DIAGRESULTSDATABASEITEM_H |