|
1 /* |
|
2 * Copyright (c) 2004-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: The Refresh handler to inform refresses. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "PSetRefreshHandlerImpl.h" |
|
22 #include <etelmm.h> |
|
23 #include <msssettingsrefreshhandler.h> |
|
24 #include <csssettingsrefreshcontainer.h> |
|
25 #include <PsetCSP.h> |
|
26 #include "PhoneSettingsLogger.h" |
|
27 |
|
28 |
|
29 // ============================ MEMBER FUNCTIONS =============================== |
|
30 |
|
31 // ----------------------------------------------------------------------------- |
|
32 // CPSetRefreshHandlerImpl::CPSetRefreshHandlerImpl |
|
33 // |
|
34 // C++ constructor can NOT contain any code, that might leave. |
|
35 // ----------------------------------------------------------------------------- |
|
36 // |
|
37 CPSetRefreshHandlerImpl::CPSetRefreshHandlerImpl() |
|
38 { |
|
39 } |
|
40 |
|
41 |
|
42 // ----------------------------------------------------------------------------- |
|
43 // CPSetRefreshHandlerImpl::ConstructL |
|
44 // |
|
45 // Symbian 2nd phase constructor can leave. |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 void CPSetRefreshHandlerImpl::ConstructL() |
|
49 { |
|
50 __PHSLOGSTRING("[PHS]--> CPSetRefreshHandlerImpl::ConstructL"); |
|
51 iCsp = CPsetCustomerServiceProfile::NewL(); |
|
52 |
|
53 iSSSetRefContainer = CSSSettingsRefreshContainer::NewL(); |
|
54 iSSSetRefHandler = &iSSSetRefContainer->RefreshHandler(); |
|
55 __PHSLOGSTRING("[PHS] <--CPSetRefreshHandlerImpl::ConstructL"); |
|
56 } |
|
57 |
|
58 |
|
59 // ----------------------------------------------------------------------------- |
|
60 // CPSetRefreshHandlerImpl::NewL |
|
61 // |
|
62 // Two-phased constructor. |
|
63 // ----------------------------------------------------------------------------- |
|
64 // |
|
65 CPSetRefreshHandlerImpl* CPSetRefreshHandlerImpl::NewL() |
|
66 { |
|
67 CPSetRefreshHandlerImpl* self = new( ELeave ) CPSetRefreshHandlerImpl; |
|
68 |
|
69 CleanupStack::PushL( self ); |
|
70 self->ConstructL(); |
|
71 CleanupStack::Pop(); |
|
72 |
|
73 return self; |
|
74 } |
|
75 |
|
76 |
|
77 // ----------------------------------------------------------------------------- |
|
78 // CPSetRefreshHandlerImpl::~CPSetRefreshHandlerImpl |
|
79 // |
|
80 // Destructor. |
|
81 // ----------------------------------------------------------------------------- |
|
82 // |
|
83 CPSetRefreshHandlerImpl::~CPSetRefreshHandlerImpl() |
|
84 { |
|
85 iObserver = NULL; |
|
86 |
|
87 iSSSetRefHandler = NULL; |
|
88 delete iSSSetRefContainer; |
|
89 iSSSetRefContainer = NULL; |
|
90 |
|
91 delete iCsp; |
|
92 iCsp = NULL; |
|
93 } |
|
94 |
|
95 |
|
96 // ----------------------------------------------------------------------------- |
|
97 // CPSetRefreshHandlerImpl::NotifyFileChangeL |
|
98 // |
|
99 // |
|
100 // ----------------------------------------------------------------------------- |
|
101 // |
|
102 void CPSetRefreshHandlerImpl::NotifyFileChangeL( |
|
103 MSSSettingsRefreshObserver& aObserver, |
|
104 TSatElementaryFiles aObservedFiles, |
|
105 TSatRefreshType aObservedRefreshType ) |
|
106 { |
|
107 __PHSLOGSTRING("[PHS]--> CPSetRefreshHandlerImpl::NotifyFileChangeL"); |
|
108 iObserver = &aObserver; |
|
109 |
|
110 iSSSetRefHandler->NotifyFileChangeL( |
|
111 *this, |
|
112 aObservedFiles, |
|
113 aObservedRefreshType ); |
|
114 __PHSLOGSTRING("[PHS] <--CPSetRefreshHandlerImpl::NotifyFileChangeL"); |
|
115 } |
|
116 |
|
117 |
|
118 // ----------------------------------------------------------------------------- |
|
119 // CPSetRefreshHandlerImpl::CancelNotify |
|
120 // |
|
121 // |
|
122 // ----------------------------------------------------------------------------- |
|
123 // |
|
124 void CPSetRefreshHandlerImpl::CancelNotify() |
|
125 { |
|
126 iObserver = NULL; |
|
127 |
|
128 iSSSetRefHandler->CancelNotify(); |
|
129 } |
|
130 |
|
131 |
|
132 // ----------------------------------------------------------------------------- |
|
133 // CPSetRefreshHandlerImpl::ChangedCspSettings |
|
134 // |
|
135 // |
|
136 // ----------------------------------------------------------------------------- |
|
137 // |
|
138 TInt CPSetRefreshHandlerImpl::ChangedCspSettings( |
|
139 TPSetChangedCspSetting& aChangedCspSettings, |
|
140 TPSetChangedCspSetting& aNewValues ) |
|
141 { |
|
142 __PHSLOGSTRING("[PHS]--> CPSetRefreshHandlerImpl::ChangedCspSettings"); |
|
143 RMobilePhone::TMobilePhoneCspFileV1 cspSettings; |
|
144 RMobilePhone::TMobilePhoneCspFileV1Pckg cspSettingsPckg ( cspSettings ); |
|
145 RMobilePhone::TMobilePhoneCspFileV1 cspValues; |
|
146 RMobilePhone::TMobilePhoneCspFileV1Pckg cspValuePckg ( cspValues ); |
|
147 |
|
148 TInt err = iSSSetRefHandler->ChangedCspTable( |
|
149 cspSettingsPckg, |
|
150 cspValuePckg ); |
|
151 |
|
152 if ( err == KErrNone ) |
|
153 { |
|
154 // First reset the parameters to contain nothing. |
|
155 TInt changedSettings = EPSetNoChangedSetting; |
|
156 TInt newValues = EPSetNoChangedSetting; |
|
157 |
|
158 |
|
159 // Call waiting support. |
|
160 if ( iCsp->CheckIfCWSupported( ( RMobilePhone::TCspCallCompletion ) |
|
161 cspSettings.iCallCompletionServices ) ) |
|
162 { |
|
163 // Call waiting settings have changed. |
|
164 changedSettings += EPSetCW; |
|
165 // Find the new value. |
|
166 if ( iCsp-> CheckIfCWSupported( ( RMobilePhone::TCspCallCompletion ) |
|
167 cspValues.iCallCompletionServices ) ) |
|
168 { |
|
169 newValues += EPSetCW; |
|
170 } |
|
171 } |
|
172 |
|
173 // Call barring support. |
|
174 if ( iCsp->CheckIfCBSupported( ( RMobilePhone::TCspCallRestriction ) |
|
175 cspSettings.iCallRestrictionServices ) ) |
|
176 { |
|
177 // Call barring settings have changed. |
|
178 changedSettings += EPSetCB; |
|
179 |
|
180 // Find the new value. |
|
181 if ( iCsp->CheckIfCBSupported( ( RMobilePhone::TCspCallRestriction ) |
|
182 cspValues.iCallRestrictionServices ) ) |
|
183 { |
|
184 newValues += EPSetCB; |
|
185 } |
|
186 } |
|
187 |
|
188 // Call forwarding support. |
|
189 if ( iCsp->CheckIfCFSupported( ( RMobilePhone::TCspCallOffering ) |
|
190 cspSettings.iCallOfferingServices ) ) |
|
191 { |
|
192 // Call forwarding settings have changed. |
|
193 changedSettings += EPSetCF; |
|
194 |
|
195 // Find the new value. |
|
196 if ( iCsp->CheckIfCFSupported( ( RMobilePhone::TCspCallOffering ) |
|
197 cspValues.iCallOfferingServices ) ) |
|
198 { |
|
199 newValues += EPSetCF; |
|
200 } |
|
201 } |
|
202 |
|
203 // ALS support. |
|
204 if ( iCsp->CheckIfAlsSupported( ( RMobilePhone::TCspCPHSTeleservices ) |
|
205 cspSettings.iCphsTeleservices ) ) |
|
206 { |
|
207 // ALS settings have changed. |
|
208 changedSettings += EPSetALS; |
|
209 |
|
210 // Find the new value. |
|
211 if ( iCsp->CheckIfAlsSupported( ( RMobilePhone::TCspCPHSTeleservices ) |
|
212 cspValues.iCphsTeleservices ) ) |
|
213 { |
|
214 newValues += EPSetALS; |
|
215 } |
|
216 } |
|
217 |
|
218 // Network selection support. |
|
219 if ( iCsp->CheckIfNetworkSelectionSupported( ( |
|
220 RMobilePhone::TCspValueAdded ) cspSettings.iValueAddedServices ) ) |
|
221 { |
|
222 // Network selection support settings have changed. |
|
223 changedSettings += EPSetNetSelSup; |
|
224 |
|
225 // Find the new value. |
|
226 if ( iCsp->CheckIfNetworkSelectionSupported( ( |
|
227 RMobilePhone::TCspValueAdded ) cspValues.iValueAddedServices ) ) |
|
228 { |
|
229 newValues += EPSetNetSelSup; |
|
230 } |
|
231 } |
|
232 |
|
233 // Set the changed values to user parameter. |
|
234 aChangedCspSettings = ( TPSetChangedCspSetting ) changedSettings; |
|
235 aNewValues = ( TPSetChangedCspSetting ) newValues; |
|
236 } |
|
237 |
|
238 __PHSLOGSTRING1("[PHS] CPSetRefreshHandlerImpl::ChangedCspSettings: err: %d", err); |
|
239 __PHSLOGSTRING("[PHS] <--CPSetRefreshHandlerImpl::ChangedCspSettings"); |
|
240 return err; |
|
241 } |
|
242 |
|
243 // ----------------------------------------------------------------------------- |
|
244 // CPSetRefreshHandlerImpl::AllowRefresh |
|
245 // |
|
246 // |
|
247 // ----------------------------------------------------------------------------- |
|
248 // |
|
249 TBool CPSetRefreshHandlerImpl::AllowRefresh( |
|
250 const TSatRefreshType aType, |
|
251 const TSatElementaryFiles aFiles ) |
|
252 { |
|
253 TBool allow = ETrue; |
|
254 |
|
255 if ( iObserver ) |
|
256 { |
|
257 allow = iObserver->AllowRefresh( |
|
258 aType, |
|
259 aFiles ); |
|
260 } |
|
261 |
|
262 return allow; |
|
263 } |
|
264 |
|
265 // ----------------------------------------------------------------------------- |
|
266 // CPSetRefreshHandlerImpl::Refresh |
|
267 // |
|
268 // |
|
269 // ----------------------------------------------------------------------------- |
|
270 // |
|
271 void CPSetRefreshHandlerImpl::Refresh( |
|
272 const TSatRefreshType aType, |
|
273 const TSatElementaryFiles aFiles ) |
|
274 { |
|
275 if ( iObserver ) |
|
276 { |
|
277 iObserver->Refresh( |
|
278 aType, |
|
279 aFiles ); |
|
280 } |
|
281 } |
|
282 |
|
283 |
|
284 // End of File |