33
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2005 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:
|
|
15 |
* Class for getting information about the Clir, Cug, Als and Als blocking
|
|
16 |
* status in the phone.
|
|
17 |
*
|
|
18 |
*/
|
|
19 |
|
|
20 |
|
|
21 |
#ifndef RSSSETTINGS_H
|
|
22 |
#define RSSSETTINGS_H
|
|
23 |
|
|
24 |
// INCLUDES
|
|
25 |
#include <etelmm.h>
|
|
26 |
#include <rcustomerserviceprofilecache.h>
|
|
27 |
|
|
28 |
// DATA TYPES
|
|
29 |
|
|
30 |
/**
|
|
31 |
* All enumerations are fixed - DO NOT CHANGE!!
|
|
32 |
*/
|
|
33 |
|
|
34 |
/**
|
|
35 |
* It enumerates all SSSettings settings.
|
|
36 |
*
|
|
37 |
* ESSSettingsCug - closed user group setting,
|
|
38 |
* for some values see TSSSettingsCugValue.
|
|
39 |
* ESSSettingsClir - default setting for calling line identification
|
|
40 |
* restriction, see TSSSettingsClirValue.
|
|
41 |
* ESSSettingsAls - selected line, see TSSSettingsAlsValue.
|
|
42 |
* ESSSettingsAlsBlocking - line selection blocking, see TSSSettingsAlsBlocking.
|
|
43 |
* ESSSettingsCugDefault - value for cug default.
|
|
44 |
*/
|
|
45 |
enum TSSSettingsSetting
|
|
46 |
{
|
|
47 |
ESSSettingsCug = 0,
|
|
48 |
ESSSettingsClir = 1,
|
|
49 |
ESSSettingsAls = 2,
|
|
50 |
ESSSettingsAlsBlocking = 3,
|
|
51 |
ESSSettingsDefaultCug = 4
|
|
52 |
};
|
|
53 |
|
|
54 |
/**
|
|
55 |
* It enumerates all values for CLIR.
|
|
56 |
*
|
|
57 |
* ESSSettingsClirNetworkDefault - use network default
|
|
58 |
* ESSSettingsClirExplicitInvoke - by default, invoke CLIR
|
|
59 |
* ESSSettingsClirExplicitSuppress - by default, suppress CLIR
|
|
60 |
*/
|
|
61 |
enum TSSSettingsClirValue
|
|
62 |
{
|
|
63 |
ESSSettingsClirNetworkDefault,
|
|
64 |
ESSSettingsClirExplicitInvoke,
|
|
65 |
ESSSettingsClirExplicitSuppress
|
|
66 |
};
|
|
67 |
|
|
68 |
/**
|
|
69 |
* It enumerates SOME values for CUG.
|
|
70 |
*
|
|
71 |
* Alternative CUG default (and min value) can be set on/off from
|
|
72 |
* shared data (shareddatakeys.h, key: KPhoneCUGIndexStartValue).
|
|
73 |
*
|
|
74 |
* CUG value is basically interger.
|
|
75 |
*
|
|
76 |
* ESSSettingsCugSuppress - special, suppress CUG
|
|
77 |
* ESSSettingsCugDefault - special, use network default CUG
|
|
78 |
* ESSSettingsCugMin - minimum value for proper CUG index.
|
|
79 |
* ESSSettingsCugMax - maximum value for proper CUG index.
|
|
80 |
* ESSSettingsAltCugDefault - special, alternative default CUG
|
|
81 |
* ESSSettingsAltCugMin - special, alternative minimum for CUG
|
|
82 |
*/
|
|
83 |
enum TSSSettingsCugValue
|
|
84 |
{
|
|
85 |
ESSSettingsCugSuppress = -1,
|
|
86 |
ESSSettingsCugDefault = 0, //Note: default can be 0 or 65535 (see above)
|
|
87 |
ESSSettingsCugMin = 1, //Note: min value can be 0 or 1 (see above)
|
|
88 |
ESSSettingsCugMax = 32767,
|
|
89 |
ESSSettingsAltCugDefault = 65535,
|
|
90 |
ESSSettingsAltCugMin = 0
|
|
91 |
};
|
|
92 |
|
|
93 |
/**
|
|
94 |
* It enumerates all values for ALS.
|
|
95 |
*
|
|
96 |
* ESSSettingsAlsNotSupported - ALS not supported, always primary line.
|
|
97 |
* ESSSettingsAlsPrimary - ALS supported, primary line selected.
|
|
98 |
* ESSSettingsAlsAlternate - ALS supported, alternate line selected.
|
|
99 |
*/
|
|
100 |
enum TSSSettingsAlsValue
|
|
101 |
{
|
|
102 |
ESSSettingsAlsNotSupported = 0,
|
|
103 |
ESSSettingsAlsPrimary = 1,
|
|
104 |
ESSSettingsAlsAlternate = 2
|
|
105 |
};
|
|
106 |
|
|
107 |
/**
|
|
108 |
* It enumerates all values for ALS blocking.
|
|
109 |
*
|
|
110 |
* ESSSettingsAlsBlockingNotSupported - ALS blocking not supported.
|
|
111 |
* ESSSettingsAlsBlockingOff - ALS blocking off.
|
|
112 |
* ESSSettingsAlsBlockingOn - ALS blocking on.
|
|
113 |
*/
|
|
114 |
enum TSSSettingsAlsBlockingValue
|
|
115 |
{
|
|
116 |
ESSSettingsAlsBlockingNotSupported,
|
|
117 |
ESSSettingsAlsBlockingOff,
|
|
118 |
ESSSettingsAlsBlockingOn
|
|
119 |
};
|
|
120 |
|
|
121 |
// FORWARD DECLARATIONS
|
|
122 |
class MSSSettingsObserver;
|
|
123 |
class CSSSettingsNotifier;
|
|
124 |
class RMmCustomAPI;
|
|
125 |
class CRepository;
|
|
126 |
|
|
127 |
|
|
128 |
// CLASS DECLARATION
|
|
129 |
|
|
130 |
/**
|
|
131 |
* It is class that can be used to fetch phone related settings.
|
|
132 |
* @since 1.0
|
|
133 |
* @lib sssettings.lib
|
|
134 |
*/
|
|
135 |
class RSSSettings
|
|
136 |
{
|
|
137 |
public: // Constructors and destructor
|
|
138 |
|
|
139 |
/**
|
|
140 |
* C++ default constructor.
|
|
141 |
*/
|
|
142 |
IMPORT_C RSSSettings();
|
|
143 |
|
|
144 |
public: // New functions
|
|
145 |
|
|
146 |
/**
|
|
147 |
* Closes SsSettings.
|
|
148 |
*
|
|
149 |
* After the use of the class, the method must be called.
|
|
150 |
*/
|
|
151 |
IMPORT_C void Close();
|
|
152 |
|
|
153 |
/**
|
|
154 |
* Opens SsSettings.
|
|
155 |
*
|
|
156 |
* Before using the class, one of Open methods must be called.
|
|
157 |
*
|
|
158 |
* @return error code. KErrNone, if success.
|
|
159 |
*/
|
|
160 |
IMPORT_C TInt Open();
|
|
161 |
|
|
162 |
/**
|
|
163 |
* Opens SsSettings.
|
|
164 |
*
|
|
165 |
* Ownership of parameters is NOT transferred. If parameter
|
|
166 |
* is NULL, then the instance creates its own sessions.
|
|
167 |
*
|
|
168 |
* Before using the class, one of Open methods must be called.
|
|
169 |
*
|
|
170 |
* @param aTelServer ETel server session.
|
|
171 |
* @return error code. KErrNone, if success.
|
|
172 |
*/
|
|
173 |
IMPORT_C TInt Open(
|
|
174 |
RTelServer* aTelServer );
|
|
175 |
|
|
176 |
|
|
177 |
// CHANGE NOTIFICATIONS
|
|
178 |
|
|
179 |
/**
|
|
180 |
* Registers an observer to receive all changes.
|
|
181 |
*
|
|
182 |
* @param aObserver observer.
|
|
183 |
* @return error code. If other than KErrNone, CancelAll is called
|
|
184 |
* automatically.
|
|
185 |
*/
|
|
186 |
IMPORT_C TInt RegisterAll(
|
|
187 |
MSSSettingsObserver& aObserver );
|
|
188 |
|
|
189 |
/**
|
|
190 |
* Registers an observer to receive changes of a setting.
|
|
191 |
*
|
|
192 |
* @param aSetting setting.
|
|
193 |
* @param aObserver observer.
|
|
194 |
* @return error code. KErrNone: observer is added
|
|
195 |
* KErrAlreadyExists: observer is already added
|
|
196 |
* KErrNotReady: Possible when BT SAP is on.
|
|
197 |
* KErrNotSupported: Possible with ALS.
|
|
198 |
* other: observer not registered
|
|
199 |
*/
|
|
200 |
IMPORT_C TInt Register(
|
|
201 |
TSSSettingsSetting aSetting,
|
|
202 |
MSSSettingsObserver& aObserver );
|
|
203 |
|
|
204 |
/**
|
|
205 |
* Cancels all registrations of the observer.
|
|
206 |
*
|
|
207 |
* @param aObserver observer.
|
|
208 |
*/
|
|
209 |
IMPORT_C void CancelAll(
|
|
210 |
MSSSettingsObserver& aObserver );
|
|
211 |
|
|
212 |
/**
|
|
213 |
* Cancel specific setting.
|
|
214 |
*
|
|
215 |
* @param aSetting setting.
|
|
216 |
* @param aObserver observer.
|
|
217 |
*/
|
|
218 |
IMPORT_C void Cancel(
|
|
219 |
TSSSettingsSetting aSetting,
|
|
220 |
MSSSettingsObserver& aObserver );
|
|
221 |
|
|
222 |
// CHANGE & FETCH VALUE
|
|
223 |
|
|
224 |
/**
|
|
225 |
* Fetch value of a setting.
|
|
226 |
*
|
|
227 |
* @param aSetting setting.
|
|
228 |
* @param aValue result will be stored here (if success).
|
|
229 |
* @return error code: KErrNone, all ok aValue updated.
|
|
230 |
* KErrCorrupt, value in shared data is not OK.
|
|
231 |
* KErrNotSupported, aSetting is not a "real" setting
|
|
232 |
* KErrNotReady, get CSP from ETEL has failed.
|
|
233 |
* KErrServerBusy, get CSP from ETEL has failed.
|
|
234 |
*/
|
|
235 |
IMPORT_C TInt Get(
|
|
236 |
TSSSettingsSetting aSetting,
|
|
237 |
TInt& aValue );
|
|
238 |
|
|
239 |
/**
|
|
240 |
* Changes value of a setting. Successfull function call generates notify
|
|
241 |
* call to each observer in this object even if the value is the same.
|
|
242 |
* From other objects of this class the observers will get only change
|
|
243 |
* notifications.
|
|
244 |
*
|
|
245 |
* @param aSetting setting.
|
|
246 |
* @param aValue new value for setting.
|
|
247 |
* @return error code. KErrNone in case of non-error.
|
|
248 |
* KErrArgument: parameter not valid
|
|
249 |
* KErrNotSupported: In als, if ME doesn't support
|
|
250 |
* other, from Shared data or from ETel
|
|
251 |
*/
|
|
252 |
IMPORT_C TInt Set(
|
|
253 |
TSSSettingsSetting aSetting,
|
|
254 |
TInt aValue );
|
|
255 |
|
|
256 |
// SIM CHANGE EVENT
|
|
257 |
|
|
258 |
/**
|
|
259 |
* It is called when SIM changes.
|
|
260 |
*
|
|
261 |
* @return error code.
|
|
262 |
*/
|
|
263 |
IMPORT_C TInt HandleSIMChanged();
|
|
264 |
|
|
265 |
/**
|
|
266 |
* Get previous CUG value
|
|
267 |
* @param aPreviousValue Old value is saved here. 0 if not set
|
|
268 |
* @return Error code
|
|
269 |
*/
|
|
270 |
IMPORT_C TInt PreviousCugValue( TInt& aPreviousValue );
|
|
271 |
|
|
272 |
/**
|
|
273 |
* Reset previous CUG value
|
|
274 |
* @return Error code
|
|
275 |
*/
|
|
276 |
IMPORT_C TInt ResetPreviousCugValue();
|
|
277 |
|
|
278 |
/**
|
|
279 |
* Handle refresh
|
|
280 |
* @return Error code
|
|
281 |
*/
|
|
282 |
IMPORT_C TInt HandleRefresh();
|
|
283 |
|
|
284 |
/**
|
|
285 |
* Check whether or not the given CUG index is valid.
|
|
286 |
* @param aValue CUG index
|
|
287 |
* @return Boolean, is it valid CUG index or not
|
|
288 |
*/
|
|
289 |
IMPORT_C TBool IsValueValidCugIndex( const TInt& aValue ) const;
|
|
290 |
|
|
291 |
private:
|
|
292 |
|
|
293 |
/**
|
|
294 |
* Checks if Alternate Line is to be supported.
|
|
295 |
* @param aPpAlsValue parameter to be checked.
|
|
296 |
* @param aSimAlsValue parameter to be checked.
|
|
297 |
* @param aAlsCspSupport parameter to be checked.
|
|
298 |
* @param aAlsCspError parameter to be checked.
|
|
299 |
* @return error code. KErrNone in case of ALS supported.
|
|
300 |
* KErrNotSupported in case if ME doesn't support
|
|
301 |
*/
|
|
302 |
TInt IsALSSupported( TInt aPpAlsValue, TInt aSimAlsValue,
|
|
303 |
TBool aAlsCspSupport, TInt aAlsCspError ) const;
|
|
304 |
|
|
305 |
// Gets ALS setting value.
|
|
306 |
TInt GetALSSettingValue( TInt& aValue, const TInt aSimState );
|
|
307 |
|
|
308 |
// Prohibit copy constructor if not deriving from CBase.
|
|
309 |
RSSSettings( const RSSSettings& );
|
|
310 |
// Prohibit assigment operator if not deriving from CBase.
|
|
311 |
RSSSettings& operator= ( const RSSSettings& );
|
|
312 |
|
|
313 |
// Opens connection. Leaves on error cases
|
|
314 |
void OpenL( RTelServer* aTelServer );
|
|
315 |
|
|
316 |
// Closes all connections and deletes own data
|
|
317 |
void DeleteSettingsData();
|
|
318 |
|
|
319 |
// Finds if observer is already added
|
|
320 |
TBool ExistsObserver( TSSSettingsSetting aSetting,
|
|
321 |
MSSSettingsObserver& aObserver );
|
|
322 |
|
|
323 |
// Informs observers about the value change
|
|
324 |
void InformChange( TSSSettingsSetting aSetting , TInt aNewValue );
|
|
325 |
|
|
326 |
// Finds next observer, NULL if there isn't any. Used in deleting data.
|
|
327 |
MSSSettingsObserver* FindOneObserver() const;
|
|
328 |
|
|
329 |
// Async call back for informing observer about own changes.
|
|
330 |
static TInt InformCallBack( TAny* aPtr );
|
|
331 |
|
|
332 |
// CUG value is divided into two parts - needs special handling...
|
|
333 |
TInt GetCug( TInt& aValue ) const;
|
|
334 |
TInt GetDefaultCugL( TInt& aValue ) const;
|
|
335 |
TInt SetCug( const TInt aValue, const TInt aCugDefault ) const;
|
|
336 |
|
|
337 |
private: // Data
|
|
338 |
|
|
339 |
//Private Array type for RSSSettings.
|
|
340 |
typedef RPointerArray<MSSSettingsObserver> RSSSettingsObserverArray;
|
|
341 |
|
|
342 |
/**
|
|
343 |
* All data members are included in one structure.
|
|
344 |
* This it can be changed accoring to needs, but the
|
|
345 |
* BC stays the same.
|
|
346 |
*/
|
|
347 |
struct TSSSettingsData
|
|
348 |
{
|
|
349 |
RTelServer* iTelServer; // ETel client
|
|
350 |
TBool iOwnTelServer; // ETrue if own
|
|
351 |
RMobilePhone iMobilePhone; // Mobile Phone
|
|
352 |
RArray<RSSSettingsObserverArray> iObservers;// Array for obs. arrays
|
|
353 |
CAsyncCallBack* iCallBack; // Async call back
|
|
354 |
TInt iCallBackSetting; // Setting that is changed
|
|
355 |
TInt iCallBackValue; // New value.
|
|
356 |
CSSSettingsNotifier* iNotifier; // Change notifier
|
|
357 |
RMmCustomAPI* iCustomPhone; // Custom Phone
|
|
358 |
TInt iCUGDefault; // CUG default
|
|
359 |
CRepository* iRepository; // Central repository.
|
|
360 |
};
|
|
361 |
|
|
362 |
TSSSettingsData* iData; // The data
|
|
363 |
|
|
364 |
protected:
|
|
365 |
// Friend class uses all members in iData. This procedure saves
|
|
366 |
// a lot of function from the API which are not meant for
|
|
367 |
// external use.
|
|
368 |
friend class CSSSettingsNotifier;
|
|
369 |
};
|
|
370 |
|
|
371 |
// Panic enums
|
|
372 |
enum TSSSettingsPanic
|
|
373 |
{
|
|
374 |
SSSettingsPanicOpenNotDone = 6000, // Some function is called before Open()
|
|
375 |
SSSettingsPanicInvalidRequest, // Given Setting is out of range.
|
|
376 |
SSSettingsPanicConflictInAls // Can't determine ALS state.
|
|
377 |
};
|
|
378 |
|
|
379 |
GLREF_C void Panic( TSSSettingsPanic aPanic );
|
|
380 |
|
|
381 |
#endif // RSSSETTINGS_H
|
|
382 |
|
|
383 |
// End of File
|