31
|
1 |
/*
|
|
2 |
* Copyright (c) 2004-2007 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: mmsschedulesettingsutils implementation
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
// INCLUDE FILES
|
|
21 |
#include <centralrepository.h>
|
|
22 |
#include <msvids.h>
|
|
23 |
#include <msvschedulesettings.h>
|
|
24 |
#include <msvoffpeaktime.h>
|
|
25 |
#include <msvsenderroraction.h>
|
|
26 |
#include <msvsysagentaction.h>
|
|
27 |
|
|
28 |
// USERINCLUDE FILES
|
|
29 |
#include "mmsschedulesettingsutils.h"
|
|
30 |
#include "mmsdebuglogging.h"
|
|
31 |
#include "MmsEnginePrivateCRKeys.h"
|
|
32 |
|
|
33 |
// EXTERNAL DATA STRUCTURES
|
|
34 |
|
|
35 |
// EXTERNAL FUNCTION PROTOTYPES
|
|
36 |
|
|
37 |
// CONSTANTS
|
|
38 |
|
|
39 |
// MACROS
|
|
40 |
|
|
41 |
// LOCAL CONSTANTS AND MACROS
|
|
42 |
|
|
43 |
// MODULE DATA STRUCTURES
|
|
44 |
|
|
45 |
// LOCAL FUNCTION PROTOTYPES
|
|
46 |
|
|
47 |
// ============================== LOCAL FUNCTIONS ==============================
|
|
48 |
|
|
49 |
// ============================== MEMBER FUNCTIONS =============================
|
|
50 |
|
|
51 |
// -----------------------------------------------------------------------------
|
|
52 |
// LoadScheduleSendSettingsL
|
|
53 |
//
|
|
54 |
// -----------------------------------------------------------------------------
|
|
55 |
//
|
|
56 |
void TMmsScheduleSettingsUtils::LoadScheduleSendSettingsL(
|
|
57 |
CMsvScheduleSettings& aScheduleSettings,
|
|
58 |
CRepository& aRepository )
|
|
59 |
{
|
|
60 |
LOG(_L("TMmsScheduleSettingsUtils::LoadScheduleSendSettingsL"));
|
|
61 |
|
|
62 |
LoadScheduleSettingsL(
|
|
63 |
aScheduleSettings,
|
|
64 |
aRepository,
|
|
65 |
KMmsScheduleSendLongInterval,
|
|
66 |
KMmsScheduleSendShortInterval,
|
|
67 |
KMmsScheduleSendVariableIntervalsCount,
|
|
68 |
KMmsScheduleSendVariableIntervalArrayBase );
|
|
69 |
|
|
70 |
}
|
|
71 |
|
|
72 |
// -----------------------------------------------------------------------------
|
|
73 |
// LoadScheduleReceiveSettingsL
|
|
74 |
//
|
|
75 |
// -----------------------------------------------------------------------------
|
|
76 |
//
|
|
77 |
void TMmsScheduleSettingsUtils::LoadScheduleReceiveSettingsL(
|
|
78 |
CMsvScheduleSettings& aScheduleSettings,
|
|
79 |
CRepository& aRepository )
|
|
80 |
{
|
|
81 |
LOG(_L("TMmsScheduleSettingsUtils::LoadScheduleReceiveSettingsL"));
|
|
82 |
|
|
83 |
LoadScheduleSettingsL(
|
|
84 |
aScheduleSettings,
|
|
85 |
aRepository,
|
|
86 |
KMmsScheduleRecvLongInterval,
|
|
87 |
KMmsScheduleRecvShortInterval,
|
|
88 |
KMmsScheduleRecvVariableIntervalsCount,
|
|
89 |
KMmsScheduleRecvVariableIntervalArrayBase );
|
|
90 |
|
|
91 |
}
|
|
92 |
|
|
93 |
// -----------------------------------------------------------------------------
|
|
94 |
// LoadScheduleSettingsL
|
|
95 |
//
|
|
96 |
// -----------------------------------------------------------------------------
|
|
97 |
//
|
|
98 |
void TMmsScheduleSettingsUtils::LoadScheduleSettingsL(
|
|
99 |
CMsvScheduleSettings& aScheduleSettings,
|
|
100 |
CRepository& aRepository,
|
|
101 |
const TUint32 aLongInterval,
|
|
102 |
const TUint32 aShortInterval,
|
|
103 |
const TUint32 aVariableIntervalsCount,
|
|
104 |
const TUint32 aVariableIntervalArrayBase )
|
|
105 |
{
|
|
106 |
aScheduleSettings.Reset();
|
|
107 |
|
|
108 |
TInt temp = 0;
|
|
109 |
User::LeaveIfError( aRepository.Get( KMmsSchedulePriority, temp ) );
|
|
110 |
aScheduleSettings.SetPriority( temp );
|
|
111 |
|
|
112 |
User::LeaveIfError( aRepository.Get( KMmsScheduleValidityPeriod, temp ) );
|
|
113 |
aScheduleSettings.SetValidityPeriod( static_cast<TTimeIntervalMinutes>( temp ) );
|
|
114 |
|
|
115 |
User::LeaveIfError( aRepository.Get( KMmsScheduleIntervalType, temp ) );
|
|
116 |
aScheduleSettings.SetIntervalType( static_cast<TIntervalType>( temp ) );
|
|
117 |
|
|
118 |
User::LeaveIfError( aRepository.Get( KMmsScheduleLatency, temp ) );
|
|
119 |
aScheduleSettings.SetLatency( static_cast<TTimeIntervalMicroSeconds32>( temp ) );
|
|
120 |
|
|
121 |
User::LeaveIfError( aRepository.Get( aLongInterval, temp ) );
|
|
122 |
aScheduleSettings.SetLongInterval( static_cast<TTimeIntervalSeconds>( temp ) );
|
|
123 |
|
|
124 |
User::LeaveIfError( aRepository.Get( aShortInterval, temp) );
|
|
125 |
aScheduleSettings.SetShortInterval( static_cast<TTimeIntervalSeconds>( temp ) );
|
|
126 |
|
|
127 |
User::LeaveIfError( aRepository.Get( KMmsSchedulePendingConditionsTimeout, temp ) );
|
|
128 |
aScheduleSettings.SetPendingConditionsTimeout(static_cast<TTimeIntervalMinutes>(temp));
|
|
129 |
|
|
130 |
User::LeaveIfError( aRepository.Get( aVariableIntervalsCount, temp ) );
|
|
131 |
TInt count = temp;
|
|
132 |
|
|
133 |
if( count > 0 )
|
|
134 |
{
|
|
135 |
TUint32 variableIntervalId = aVariableIntervalArrayBase;
|
|
136 |
CArrayFixFlat<TTimeIntervalSeconds>* intervals
|
|
137 |
= new(ELeave) CArrayFixFlat<TTimeIntervalSeconds>( count );
|
|
138 |
CleanupStack::PushL( intervals ); // ***
|
|
139 |
for( TInt cur = 0; cur < count; cur++ )
|
|
140 |
{
|
|
141 |
User::LeaveIfError(aRepository.Get(variableIntervalId, temp));
|
|
142 |
intervals->AppendL(static_cast<TTimeIntervalSeconds>(temp));
|
|
143 |
variableIntervalId++;
|
|
144 |
}
|
|
145 |
|
|
146 |
if( intervals->Count() > 0 )
|
|
147 |
{
|
|
148 |
aScheduleSettings.SetVariableIntervalsL( *intervals );
|
|
149 |
}
|
|
150 |
CleanupStack::PopAndDestroy( intervals );
|
|
151 |
}
|
|
152 |
}
|
|
153 |
|
|
154 |
|
|
155 |
// -----------------------------------------------------------------------------
|
|
156 |
// LoadOffPeakSettingsL
|
|
157 |
//
|
|
158 |
// -----------------------------------------------------------------------------
|
|
159 |
//
|
|
160 |
void TMmsScheduleSettingsUtils::LoadOffPeakSettingsL(
|
|
161 |
CMsvOffPeakTimes& /*aOffPeakTimes*/,
|
|
162 |
CRepository& /*aRepository*/ )
|
|
163 |
{
|
|
164 |
// DOES NOTHING
|
|
165 |
}
|
|
166 |
|
|
167 |
// -----------------------------------------------------------------------------
|
|
168 |
// LoadSendErrorSettingsL
|
|
169 |
//
|
|
170 |
// -----------------------------------------------------------------------------
|
|
171 |
//
|
|
172 |
void TMmsScheduleSettingsUtils::LoadSendErrorSettingsL(
|
|
173 |
CMsvSendErrorActions& aErrorActions,
|
|
174 |
CRepository& aRepository )
|
|
175 |
{
|
|
176 |
LOG(_L("TMmsScheduleSettingsUtils::LoadSendErrorSettingsL"));
|
|
177 |
|
|
178 |
LoadErrorSettingsL( aErrorActions,
|
|
179 |
aRepository,
|
|
180 |
KMmsScheduleSendErrorDefaultAction,
|
|
181 |
KMmsScheduleSendErrorActionsCount,
|
|
182 |
KMmsScheduleSendErrorActionsBase );
|
|
183 |
|
|
184 |
}
|
|
185 |
|
|
186 |
// -----------------------------------------------------------------------------
|
|
187 |
// LoadReceiveErrorSettingsL
|
|
188 |
//
|
|
189 |
// -----------------------------------------------------------------------------
|
|
190 |
//
|
|
191 |
void TMmsScheduleSettingsUtils::LoadReceiveErrorSettingsL(
|
|
192 |
CMsvSendErrorActions& aErrorActions,
|
|
193 |
CRepository& aRepository )
|
|
194 |
{
|
|
195 |
LOG(_L("TMmsScheduleSettingsUtils::LoadReceiveErrorSettingsL"));
|
|
196 |
|
|
197 |
LoadErrorSettingsL( aErrorActions,
|
|
198 |
aRepository,
|
|
199 |
KMmsScheduleRecvErrorDefaultAction,
|
|
200 |
KMmsScheduleRecvErrorActionsCount,
|
|
201 |
KMmsScheduleRecvErrorActionsBase );
|
|
202 |
|
|
203 |
}
|
|
204 |
|
|
205 |
// -----------------------------------------------------------------------------
|
|
206 |
// LoadErrorSettingsL
|
|
207 |
//
|
|
208 |
// -----------------------------------------------------------------------------
|
|
209 |
//
|
|
210 |
void TMmsScheduleSettingsUtils::LoadErrorSettingsL(
|
|
211 |
CMsvSendErrorActions& aErrorActions,
|
|
212 |
CRepository& aRepository,
|
|
213 |
const TUint32 aDefaultErrorActionId,
|
|
214 |
const TUint32 aErrorActionCount,
|
|
215 |
const TUint32 aErrorActionBase )
|
|
216 |
{
|
|
217 |
TMsvSendErrorAction action;
|
|
218 |
LoadErrorActionL( aDefaultErrorActionId, action, aRepository );
|
|
219 |
aErrorActions.SetDefault( action );
|
|
220 |
|
|
221 |
LoadImmediateFailuresL( aErrorActions, aRepository );
|
|
222 |
|
|
223 |
TInt temp = 0;
|
|
224 |
User::LeaveIfError( aRepository.Get( aErrorActionCount, temp ) );
|
|
225 |
TInt count = temp;
|
|
226 |
|
|
227 |
TUint32 errorActionId = aErrorActionBase;
|
|
228 |
LOG2(_L("- loading %d error actions"), count);
|
|
229 |
for( TInt counter = 0; counter < count; ++counter )
|
|
230 |
{
|
|
231 |
LoadErrorActionL( errorActionId, action, aRepository );
|
|
232 |
aErrorActions.AddSendErrorActionL( action );
|
|
233 |
errorActionId += KMmsErrorActionElementIncrement;
|
|
234 |
}
|
|
235 |
}
|
|
236 |
|
|
237 |
|
|
238 |
// -----------------------------------------------------------------------------
|
|
239 |
// LoadSysAgentSettingsL
|
|
240 |
//
|
|
241 |
// -----------------------------------------------------------------------------
|
|
242 |
//
|
|
243 |
void TMmsScheduleSettingsUtils::LoadSysAgentSettingsL(
|
|
244 |
CMsvSysAgentActions& /*aSysAgentActions*/,
|
|
245 |
CRepository& /*aRepository*/ )
|
|
246 |
{
|
|
247 |
// DOES NOTHING
|
|
248 |
}
|
|
249 |
|
|
250 |
|
|
251 |
// -----------------------------------------------------------------------------
|
|
252 |
// LoadErrorActionL
|
|
253 |
//
|
|
254 |
// -----------------------------------------------------------------------------
|
|
255 |
//
|
|
256 |
void TMmsScheduleSettingsUtils::LoadErrorActionL(
|
|
257 |
TUint32 aErrorActionId,
|
|
258 |
TMsvSendErrorAction& aErrorAction,
|
|
259 |
CRepository& aRepository )
|
|
260 |
{
|
|
261 |
aErrorAction.Reset();
|
|
262 |
|
|
263 |
TInt temp = 0;
|
|
264 |
TUint32 settingId = aErrorActionId + KMmsErrorActionError;
|
|
265 |
User::LeaveIfError( aRepository.Get( settingId, temp ) );
|
|
266 |
aErrorAction.iError = temp;
|
|
267 |
|
|
268 |
settingId = aErrorActionId + KMmsErrorActionMaxRetries;
|
|
269 |
User::LeaveIfError( aRepository.Get(settingId, temp ) );
|
|
270 |
aErrorAction.SetMaxRetries( static_cast<TInt16>( temp ) );
|
|
271 |
|
|
272 |
settingId = aErrorActionId + KMmsErrorActionRetries;
|
|
273 |
User::LeaveIfError( aRepository.Get( settingId, temp ) );
|
|
274 |
aErrorAction.iRetries = static_cast<TMsvSendRetries>( temp );
|
|
275 |
|
|
276 |
settingId = aErrorActionId + KMmsErrorActionAction;
|
|
277 |
User::LeaveIfError( aRepository.Get( settingId, temp ) );
|
|
278 |
aErrorAction.iAction = static_cast<TMsvSendAction>( temp );
|
|
279 |
|
|
280 |
settingId = aErrorActionId + KMmsErrorActionRetrySpacing;
|
|
281 |
User::LeaveIfError( aRepository.Get( settingId, temp ) );
|
|
282 |
aErrorAction.iRetrySpacing = static_cast<TMsvSendRetrySpacing>( temp );
|
|
283 |
|
|
284 |
LOG2(_L("- load error action for error value %d"), aErrorAction.iError );
|
|
285 |
}
|
|
286 |
|
|
287 |
// -----------------------------------------------------------------------------
|
|
288 |
//
|
|
289 |
// -----------------------------------------------------------------------------
|
|
290 |
//
|
|
291 |
void TMmsScheduleSettingsUtils::LoadImmediateFailuresL(
|
|
292 |
CMsvSendErrorActions& aErrorActions,
|
|
293 |
CRepository& aRepository )
|
|
294 |
{
|
|
295 |
|
|
296 |
TInt temp = 0;
|
|
297 |
TMsvSendErrorAction action;
|
|
298 |
|
|
299 |
// Immediate failure actions
|
|
300 |
action.iAction = ESendActionFail;
|
|
301 |
action.iError = KErrNotFound;
|
|
302 |
action.SetMaxRetries( 0 );
|
|
303 |
action.iRetries = ESendRetriesFixed;
|
|
304 |
action.iRetrySpacing = ESendRetrySpacingStatic;
|
|
305 |
|
|
306 |
TInt count = 0;
|
|
307 |
User::LeaveIfError( aRepository.Get( KMmsImmediateFailureErrorCount, temp ) );
|
|
308 |
count = temp;
|
|
309 |
|
|
310 |
TInt i = 0;
|
|
311 |
LOG2(_L("- loading %d immediate failures error"), count);
|
|
312 |
for (i = 0; i < count; ++i )
|
|
313 |
{
|
|
314 |
User::LeaveIfError( aRepository.Get( KMmsImmediateFailureErrorBase + i, temp ) );
|
|
315 |
action.iError = temp;
|
|
316 |
aErrorActions.AddSendErrorActionL( action );
|
|
317 |
}
|
|
318 |
|
|
319 |
}
|
|
320 |
|
|
321 |
|
|
322 |
// =========================== OTHER EXPORTED FUNCTIONS ========================
|
|
323 |
|
|
324 |
// End of File
|