1 /* |
|
2 * Copyright (c) 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: Service Provider Settings API |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_SPSETTINGS_H |
|
20 #define C_SPSETTINGS_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <badesca.h> |
|
24 |
|
25 #include "spdefinitions.h" |
|
26 |
|
27 class CSPSettingsEngine; |
|
28 class CSPEntry; |
|
29 class CSPProperty; |
|
30 |
|
31 /** |
|
32 * Service provider settings API class |
|
33 * |
|
34 * Main class of managing service provider settings |
|
35 * |
|
36 * @code example code of how to add a new service entry to service table |
|
37 * CSPEntry* entry = CSPEntry::NewL(); |
|
38 * TInt err = entry->SetServiceName( _L("somename" ) ); |
|
39 * CSPProperty* property = CSPProperty::NewL(); |
|
40 * err = property->SetName( EPropertyServiceAttributeMask ); |
|
41 * property->SetValue( 100 ); |
|
42 * err = entry->AddProperty( property ); |
|
43 * // iSettings is instance of CSPSettings |
|
44 * TInt err = iSettings->AddEntryL( *entry ); |
|
45 * @endcode |
|
46 * |
|
47 * @lib serviceprovidersettings.lib |
|
48 * @since S60 v3.2 |
|
49 */ |
|
50 NONSHARABLE_CLASS( CSPSettings ): public CBase |
|
51 { |
|
52 |
|
53 public: // Constructors and destructor |
|
54 |
|
55 /** |
|
56 * Two-phased constructor. |
|
57 */ |
|
58 IMPORT_C static CSPSettings* NewL(); |
|
59 |
|
60 /** |
|
61 * Two-phased constructor. |
|
62 */ |
|
63 IMPORT_C static CSPSettings* NewLC(); |
|
64 |
|
65 /** |
|
66 * Destructors. |
|
67 */ |
|
68 IMPORT_C virtual ~CSPSettings(); |
|
69 |
|
70 public: |
|
71 |
|
72 /** |
|
73 * Stores new service provider settings entry, |
|
74 * service Id is returned inside aEntry object |
|
75 * |
|
76 * @since S60 v3.2 |
|
77 * @param aEntry New service provider settings entry, on return service Id is filled in |
|
78 * @return error code |
|
79 */ |
|
80 IMPORT_C TInt AddEntryL( CSPEntry& aEntry ); |
|
81 |
|
82 /** |
|
83 * Search service provider settings entry by service ID. |
|
84 * |
|
85 * @since S60 v3.2 |
|
86 * @param aServiceId Id of requested xSP settings entry |
|
87 * @param aEntry on return, SP settings entry corresponding to aServiceId. |
|
88 * @return error code, KErrNone if succeeded, otherwise system wide error code |
|
89 */ |
|
90 IMPORT_C TInt FindEntryL( TServiceId aServiceId, CSPEntry& aEntry ); |
|
91 |
|
92 |
|
93 /** |
|
94 * Updates service provider settings entry to settings storage. |
|
95 * Service ID must be set to entry before update. |
|
96 * |
|
97 * @since S60 v3.2 |
|
98 * @param aEntry Updated service provider settings entry |
|
99 * @return error code, KErrNone if update succeeded, otherwise system wide error code |
|
100 */ |
|
101 IMPORT_C TInt UpdateEntryL( const CSPEntry& aEntry ); |
|
102 |
|
103 /** |
|
104 * Deletes service provider settings entry from storage by service ID. |
|
105 * |
|
106 * @since S60 v3.2 |
|
107 * @param aEntryId Id of settings entry which is going to be deleted |
|
108 * @return error code, KErrNone if delete succeeded, otherwise system wide error code |
|
109 */ |
|
110 IMPORT_C TInt DeleteEntryL( TServiceId aServiceId ); |
|
111 |
|
112 /** |
|
113 * Search property of service provider settings entry from storage. |
|
114 * |
|
115 * @since S60 v3.2 |
|
116 * @param aServiceId The service ID of requested service entry |
|
117 * @param aPropertyName property name to be found |
|
118 * @param aProperty on return, requested property |
|
119 * @return error code, KErrNone if succeeded, otherwise system wide error code |
|
120 */ |
|
121 IMPORT_C TInt FindPropertyL( TServiceId aServiceId, |
|
122 TServicePropertyName aPropertyName, |
|
123 CSPProperty& aProperty ); |
|
124 |
|
125 /** |
|
126 * Add or update properties of service provider settings entry to storage. |
|
127 * If property name exists, update property. If property doesn't exist, |
|
128 * add property |
|
129 * |
|
130 * @since S60 v3.2 |
|
131 * @param aServiceId The ID of updated service entry |
|
132 * @param aPropertyArray new properties to be added or updated |
|
133 * @return error code, KErrNone if update succeeded, otherwise system wide error code |
|
134 */ |
|
135 IMPORT_C TInt AddOrUpdatePropertiesL( TServiceId aServiceId, |
|
136 const RPropertyArray& aPropertyArray ); |
|
137 |
|
138 |
|
139 /** |
|
140 * Add or update one property of service provider settings entry to storage. |
|
141 * If property name exists, update property. If property doesn't exist, |
|
142 * add property |
|
143 * |
|
144 * @since S60 v3.2 |
|
145 * @param aServiceId The ID of updated service entry |
|
146 * @param aProperty new property to be added or updated |
|
147 * @return error code, KErrNone if update succeeded, otherwise system wide error code |
|
148 */ |
|
149 IMPORT_C TInt AddOrUpdatePropertyL( TServiceId aServiceId, |
|
150 const CSPProperty& aProperty ); |
|
151 |
|
152 /** |
|
153 * Return count of service provider settings entries in storage. |
|
154 * |
|
155 * @since S60 v3.2 |
|
156 * @return Count of stored service provider settings. |
|
157 */ |
|
158 IMPORT_C TInt SettingsCountL(); |
|
159 |
|
160 /** |
|
161 * Search all service provider IDs from storage |
|
162 * |
|
163 * @since S60 v3.2 |
|
164 * @param aServiceIds An array containing returned service IDs |
|
165 * @return error code |
|
166 */ |
|
167 IMPORT_C TInt FindServiceIdsL( RIdArray& aServiceIds ); |
|
168 |
|
169 |
|
170 /** |
|
171 * Search all service names from settings storage by given service IDs. |
|
172 * Removes ID from array if it is not found from settings storage. |
|
173 * |
|
174 * @since S60 v3.2 |
|
175 * @param aServiceIds An array of service IDs |
|
176 * @param aServiceNames on return, array which saves found service names |
|
177 * @return error code |
|
178 */ |
|
179 IMPORT_C TInt FindServiceNamesL( RIdArray& aServiceIds, |
|
180 CDesCArray& aServiceNames ); |
|
181 |
|
182 |
|
183 /** |
|
184 * Search subservice properties of requested service provider settings entry by ID |
|
185 * and subservice type |
|
186 * |
|
187 * @since S60 v3.2 |
|
188 * @param aServiceId The ID of requested service entry |
|
189 * @param aPropertyType property type of sub service |
|
190 * @param aPropertyArray on return, array which saves found subservice properties |
|
191 * @return error code |
|
192 */ |
|
193 IMPORT_C TInt FindSubServicePropertiesL( TServiceId aServiceId, |
|
194 TSPItemType aPropertyType, |
|
195 RPropertyArray& aPropertyArray ); |
|
196 |
|
197 /** |
|
198 * Deletes service properties by service ID and property name. |
|
199 * |
|
200 * @since S60 v3.2 |
|
201 * @param aServiceId The service ID of requested service entry |
|
202 * @param aNameArray name of properties to be deleted |
|
203 * @return error code |
|
204 */ |
|
205 IMPORT_C TInt DeleteServicePropertiesL( TServiceId aServiceId, |
|
206 const RPropertyNameArray& aNameArray ); |
|
207 |
|
208 /** |
|
209 * Find service IDs with same properties |
|
210 * |
|
211 * @since S60 v3.2 |
|
212 * @param aPropertyArray property array |
|
213 * @param on return, service Ids with same properties |
|
214 * @return error code |
|
215 */ |
|
216 IMPORT_C TInt FindServiceIdsFromPropertiesL( const RPropertyArray& aPropertyArray, |
|
217 RIdArray& aServiceIds ); |
|
218 |
|
219 /** |
|
220 * Get SIP VoIP software version. |
|
221 * |
|
222 * @since S60 v3.2 |
|
223 * @return SIP VoIP software version |
|
224 */ |
|
225 IMPORT_C static const TDesC& GetSIPVoIPSWVersion(); |
|
226 |
|
227 /** |
|
228 * Check feature is supported or not |
|
229 * |
|
230 * @since S60 v3.2 |
|
231 * @return SIP VoIP software version |
|
232 */ |
|
233 IMPORT_C TBool IsFeatureSupported( TSPServiceFeature aFeature ); |
|
234 |
|
235 private: |
|
236 |
|
237 /** |
|
238 * C++ default constructor. |
|
239 */ |
|
240 CSPSettings(); |
|
241 |
|
242 /** |
|
243 * By default Symbian 2nd phase constructor is private. |
|
244 */ |
|
245 void ConstructL(); |
|
246 |
|
247 /** |
|
248 * Commit or rollback transaction |
|
249 * @since S60 v3.2 |
|
250 * @param aError error code of CenRep operation |
|
251 * @param aServiceId changed service Id |
|
252 * @return error code |
|
253 */ |
|
254 TInt CommitOrRollbackL( TInt aError, TServiceId aServiceId ); |
|
255 |
|
256 /** |
|
257 * Check is VoIP Service Id and then are Properties VoIP related |
|
258 * |
|
259 * @since S60 v3.2.3 |
|
260 * @return KErrNotSupported if VoIP not supported and checking |
|
261 * of Service Id and Properties gives true |
|
262 */ |
|
263 TInt CheckSupportedL( TServiceId aServiceId, const RPropertyNameArray& aNameArray ); |
|
264 |
|
265 /** |
|
266 * Check is VoIP Service Id |
|
267 * |
|
268 * @since S60 v3.2.3 |
|
269 * @return KErrNotSupported if VoIP not supported and checking |
|
270 * of Service Id gives true |
|
271 */ |
|
272 TInt CheckSupportedL( TServiceId aServiceId ); |
|
273 |
|
274 /** |
|
275 * Check is SP item type VoIP related |
|
276 * |
|
277 * @since S60 v3.2.3 |
|
278 * @return KErrNotSupported if VoIP not supported and checking |
|
279 * of SP item type gives true |
|
280 */ |
|
281 TInt CheckSupportedL( TSPItemType aPropertyType ); |
|
282 |
|
283 /** |
|
284 * Check does an array have Properties VoIP related |
|
285 * |
|
286 * @since S60 v3.2.3 |
|
287 * @return KErrNotSupported if VoIP not supported and checking |
|
288 * of the array gives true |
|
289 */ |
|
290 TInt CheckSupportedL( const RPropertyArray& aPropertyArray ); |
|
291 |
|
292 private: // data |
|
293 |
|
294 /** |
|
295 * Settings engine |
|
296 * Own. |
|
297 */ |
|
298 CSPSettingsEngine* iSettingsEngine; |
|
299 |
|
300 |
|
301 /** |
|
302 * Feature manager support VoIP |
|
303 * Own. |
|
304 */ |
|
305 TBool iFeatureManagerSupportVoIP; |
|
306 /** |
|
307 * Writing settings allowed |
|
308 */ |
|
309 TBool iSettingsWriteAllowed; |
|
310 |
|
311 }; |
|
312 |
|
313 #endif // C_SPSETTINGS_H |
|