1 /* |
|
2 * Copyright (c) 2002-2006 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 the License "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: Icon testing class for SimAtkTsy testtool. Provides |
|
15 * functionality to load icon data and verify it's content. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef SATICON_H |
|
22 #define SATICON_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32base.h> |
|
26 #include <etelsat.h> |
|
27 |
|
28 // FORWARDS |
|
29 class CStifLogger; |
|
30 class CSatFile; |
|
31 |
|
32 // CONSTANTS |
|
33 _LIT( KLoadIcon, "LoadIcon" ); |
|
34 |
|
35 |
|
36 // CLASS DECLARATION |
|
37 |
|
38 /** |
|
39 * Icon testing class for SimAtkTsy testtool. |
|
40 * @lib SimAtk.dll |
|
41 */ |
|
42 NONSHARABLE_CLASS( CSatIcon ) : public CBase |
|
43 { |
|
44 public: // Constructors and destructor |
|
45 |
|
46 /** |
|
47 * Constructor. |
|
48 * @param aSat Reseference to Etel Sat |
|
49 * @param aType Type of SIM. Used when verifying icon data. |
|
50 * @param aRecordId Record/IconId that shall be used in tests. |
|
51 */ |
|
52 CSatIcon( const RSat& aSat, const TPtrC aType, const TUint8 aRecordId ); |
|
53 |
|
54 /** |
|
55 * Destructor. |
|
56 */ |
|
57 virtual ~CSatIcon(); |
|
58 |
|
59 |
|
60 public: // New Functions |
|
61 |
|
62 /** |
|
63 * Calling of this method start the icon loading and verification |
|
64 * procedure. |
|
65 * @param aLog Reference to logger |
|
66 * @param aImageNumber Parameter decides which icon to load if a record |
|
67 * contain more than one icon description |
|
68 * @return KErrNone if verification went successfully or other system |
|
69 * wided error code if some error was encountered. |
|
70 */ |
|
71 TInt CheckIcon( CStifLogger* aLog, const TUint8 aImageNumber = 1 ); |
|
72 |
|
73 private: // New functions |
|
74 |
|
75 /** |
|
76 * Opens SIM reference data file for verification purposes. |
|
77 * @return KErrNone if file was opened succesfully, KErrNotFound |
|
78 * if not. |
|
79 */ |
|
80 TInt OpenFile(); |
|
81 |
|
82 /** |
|
83 * Reads a record from SIM. |
|
84 * @param aRecord Output for received record data |
|
85 * @return Error code returned by TSY |
|
86 */ |
|
87 TInt ReadRecord( RSat::TIcon& aRecord ); |
|
88 |
|
89 /** |
|
90 * Verifies the validity of received record against data read from |
|
91 * reference SIM file. |
|
92 * @param aLog Reference to logger |
|
93 * @param aRecord Reference to record data to be verified |
|
94 * @return KErrNone if validation was successfull, KErrCorrupt if |
|
95 * not and KErrNotFound if reference data was not found. |
|
96 */ |
|
97 TInt CheckRecord( CStifLogger* aLog, const RSat::TIcon& aRecord ); |
|
98 |
|
99 /** |
|
100 * Method parses InstanceInfo structure from received record data. |
|
101 * @param aRecord Reference to record data |
|
102 * @param aImageNumber Decides which image is selected of icons |
|
103 * described by the record. |
|
104 * @return KErrNone if Instance info was parsed successfully. |
|
105 * KErrNotFound if requested image was not found. |
|
106 */ |
|
107 TInt ReadInstanceInfo( const RSat::TIcon& aRecord, const TUint8 aImageNumber ); |
|
108 |
|
109 /** |
|
110 * Checks if the parsed InstanceInfo contain reasonable data. |
|
111 * @param aLog Reference to logger |
|
112 * @return KErrNone if validation was successful, KErrCorrupt if not. |
|
113 */ |
|
114 TInt CheckInstanceInfo( CStifLogger* aLog ); |
|
115 |
|
116 /** |
|
117 * Reads image data from SIM. |
|
118 * @param aImageData Output for received image data |
|
119 * @return Error code returned by TSY |
|
120 */ |
|
121 TInt ReadImage( TDes8& aImageData ); |
|
122 |
|
123 /** |
|
124 * Verifies the validity of received image data against data read from |
|
125 * reference SIM file. |
|
126 * @param aLog Reference to logger |
|
127 * @param aImageData Reference to image data to be verified |
|
128 * @return KErrNone if validation was successfull, KErrCorrupt if |
|
129 * not and KErrNotFound if reference data was not found. |
|
130 */ |
|
131 TInt CheckImage( CStifLogger* aLog, const TDes8& aImageData ); |
|
132 |
|
133 /** |
|
134 * Reads clut information data from reference SIM data, as TSY does |
|
135 * not provide all necessary data. Needed for color icons. |
|
136 */ |
|
137 TInt ReadClutInfo(); |
|
138 |
|
139 /** |
|
140 * Reads clut data from SIM. |
|
141 * @param aClutData Output for received clut data |
|
142 * @return Error code returned by TSY |
|
143 */ |
|
144 TInt ReadClut( TDes8& aClutData ); |
|
145 |
|
146 /** |
|
147 * Verifies the validity of received clut data against data read from |
|
148 * reference SIM file. |
|
149 * @param aLog Reference to logger |
|
150 * @param aClutData Reference to clut data to be verified |
|
151 * @return KErrNone if validation was successfull, KErrCorrupt if |
|
152 * not and KErrNotFound if reference data was not found. |
|
153 */ |
|
154 TInt CheckClut( CStifLogger* aLog, const TDes8& aClutData ); |
|
155 |
|
156 |
|
157 private: // Data |
|
158 |
|
159 // Structure contain data needed when reading clut information |
|
160 struct TClutInfo |
|
161 { |
|
162 TUint iOffset; // Start offset of clut data whitin image file |
|
163 TUint iLength; // Length of clut data |
|
164 }; |
|
165 |
|
166 // Reference to SAT |
|
167 const RSat& iSat; |
|
168 |
|
169 // Type of SIM used as reference |
|
170 const TPtrC iType; |
|
171 |
|
172 // Record identifier of icon to be loaded and verified |
|
173 const TUint8 iRecordId; |
|
174 |
|
175 // SIM data file |
|
176 CSatFile* iFile; |
|
177 |
|
178 // Icon instance info |
|
179 RSat::TInstanceInfoV3 iInfo; |
|
180 |
|
181 // Clut information element |
|
182 TClutInfo iClutInfo; |
|
183 }; |
|
184 |
|
185 #endif // SATICON_H |
|
186 |
|
187 // End of |
|