|
1 /* |
|
2 * Copyright (c) 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 "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: CNcdEngineConfiguration declaration |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_NCDENGINECONFIGURATION_H |
|
20 #define C_NCDENGINECONFIGURATION_H |
|
21 |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <f32file.h> |
|
25 #include "ncdengineconfiguration.h" |
|
26 #include "ncdconfigurationparser.h" |
|
27 |
|
28 class CNcdKeyValuePair; |
|
29 class MNcdDeviceService; |
|
30 |
|
31 /** |
|
32 * Engine configuration handling |
|
33 * |
|
34 * This class is used to read the engine configuration from a configuration |
|
35 * file and access the read configuration during runtime |
|
36 */ |
|
37 class CNcdEngineConfiguration : |
|
38 public CBase, |
|
39 public MNcdEngineConfiguration, |
|
40 public MNcdConfigurationParserObserver |
|
41 { |
|
42 public: |
|
43 |
|
44 /** |
|
45 * NewL |
|
46 * |
|
47 * @param aDeviceService Device service needed to ask MCC/MNC. |
|
48 */ |
|
49 static CNcdEngineConfiguration* NewL( MNcdDeviceService& aDeviceService ); |
|
50 |
|
51 /** |
|
52 * Destructor |
|
53 */ |
|
54 ~CNcdEngineConfiguration(); |
|
55 |
|
56 |
|
57 /** |
|
58 * Reads the configuration from the given file. |
|
59 * |
|
60 * Engine's private path is automatically used as the root for |
|
61 * the filename. The config file is first searched from C: or E: |
|
62 * and then from Z: |
|
63 * |
|
64 * @param aFilename Name of the file without path |
|
65 */ |
|
66 void ReadConfigurationL( const TDesC& aFilename ); |
|
67 |
|
68 public: // MNcdEngineConfiguration |
|
69 |
|
70 /** |
|
71 * @see MNcdEngineConfiguration::EngineType() |
|
72 */ |
|
73 const TDesC& EngineType() const; |
|
74 |
|
75 /** |
|
76 * @see MNcdEngineConfiguration::EngineVersion() |
|
77 */ |
|
78 const TDesC& EngineVersion() const; |
|
79 |
|
80 /** |
|
81 * @see MNcdEngineConfiguration::EngineUid() |
|
82 */ |
|
83 const TDesC& EngineUid() const; |
|
84 |
|
85 |
|
86 /** |
|
87 * @see MNcdEngineConfiguration::EngineProvisiong() |
|
88 */ |
|
89 const TDesC& EngineProvisioning() const; |
|
90 |
|
91 |
|
92 /** |
|
93 * @see MNcdEngineConfiguration::EngineInstallDrive() |
|
94 */ |
|
95 const TDesC& EngineInstallDrive() const; |
|
96 |
|
97 |
|
98 /** |
|
99 * @see MNcdEngineConfiguration::EngineTempDrive() |
|
100 */ |
|
101 TInt EngineTempDrive() const; |
|
102 |
|
103 |
|
104 /** |
|
105 * @see MNcdEngineConfiguration::ClientDataPathLC() |
|
106 */ |
|
107 HBufC* ClientDataPathLC( |
|
108 const TDesC& aClientId, TBool aTemp ); |
|
109 |
|
110 |
|
111 /** |
|
112 * @see MNcdEngineConfiguration::UseFixedAp() |
|
113 */ |
|
114 virtual TBool UseFixedAp() const; |
|
115 |
|
116 |
|
117 /** |
|
118 * @see MNcdEngineConfiguration::FixedApDetailsL() |
|
119 */ |
|
120 virtual const RPointerArray<CNcdKeyValuePair>& FixedApDetails() const; |
|
121 |
|
122 |
|
123 /** |
|
124 * @see MNcdEngineConfiguration::ClearClientDataL() |
|
125 */ |
|
126 void ClearClientDataL( const TDesC& aClientId, TBool aTemp ); |
|
127 |
|
128 |
|
129 protected: // MNcdConfigurationParserObserver |
|
130 |
|
131 /** |
|
132 * @see MNcdConfigurationParserObserver::ConfigurationElementEndL() |
|
133 */ |
|
134 void ConfigurationElementEndL( |
|
135 const TDesC8& aElement, |
|
136 const TDesC8& aData ); |
|
137 |
|
138 |
|
139 /** |
|
140 * @see MNcdConfigurationParserObserver::ConfigurationAttributeL() |
|
141 */ |
|
142 void ConfigurationAttributeL( |
|
143 const TDesC8& aElement, |
|
144 const TDesC8& aAttribute, |
|
145 const TDesC8& aValue ); |
|
146 |
|
147 |
|
148 /** |
|
149 * @see MNcdConfigurationParserObserver::ConfigurationError() |
|
150 */ |
|
151 void ConfigurationError( TInt aError ); |
|
152 |
|
153 protected: |
|
154 |
|
155 /** |
|
156 * Constructor. |
|
157 * |
|
158 * @param aDeviceService Device service needed to ask MCC/MNC. |
|
159 */ |
|
160 CNcdEngineConfiguration( MNcdDeviceService& aDeviceService ); |
|
161 |
|
162 /** |
|
163 * 2nd phase constructor |
|
164 */ |
|
165 void ConstructL(); |
|
166 |
|
167 /** |
|
168 * Determines the drive with most free space |
|
169 * |
|
170 * @return Drive number |
|
171 */ |
|
172 TDriveNumber DetermineDataDriveL() const; |
|
173 |
|
174 private: |
|
175 |
|
176 HBufC* iType; |
|
177 HBufC* iVersion; |
|
178 HBufC* iProvisioning; |
|
179 HBufC* iUid; |
|
180 TBuf<2> iInstallationDrive; |
|
181 |
|
182 TDriveUnit iDataDrive; // Drive that is used for storing (temp) data |
|
183 |
|
184 // Temporary variables used in AP parsing. |
|
185 |
|
186 TBool iParseApDetails; // AP details should be parsed. |
|
187 TBool iApIdFound; // Correct AP id found. |
|
188 |
|
189 HBufC* iMcc; // MCC of the AP. |
|
190 HBufC* iMnc; // MNC of the AP. |
|
191 HBufC8* iApId; // Id of the correct AP. |
|
192 HBufC* iApDetailId; // Access point detail id. |
|
193 HBufC* iApDetailValue; // Access point detail value. |
|
194 |
|
195 HBufC8* iCorrectApId; // The correct AP id, when it is found. |
|
196 |
|
197 RBuf iHomeMcc; |
|
198 RBuf iHomeMnc; |
|
199 |
|
200 // Access point details are stored here. |
|
201 RPointerArray<CNcdKeyValuePair> iApDetails; |
|
202 |
|
203 MNcdDeviceService& iDeviceService; |
|
204 |
|
205 }; |
|
206 |
|
207 #endif // C_NCDENGINECONFIGURATION_H |