1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef __MSVSENDERRORACTION_H__
17 #define __MSVSENDERRORACTION_H__
28 #include <schsend.hrh>
41 // TMsvSendErrorAction Declaration
46 Encapsulates the action to take for a particular error.
48 An error may occur when the Server MTM is attempting to send a message or
49 messages. If the Server MTM supports scheduling, then, depending on the error
50 or conditions, the Server MTM may want to re-schedule the message on the Task
51 Scheduler to send at a later time. CMsvScheduleSend::ReScheduleL()
52 (in combination with CMsvSendErrorActions) uses the TMsvSendErrorAction
53 to determine whether to re-schedule the message.
59 class TMsvSendErrorAction
62 IMPORT_C TMsvSendErrorAction();
64 IMPORT_C void Reset();
66 IMPORT_C void SetMaxRetries(const TInt16 aMaxRetries);
67 IMPORT_C TInt16 MaxRetries() const;
72 /** The action to take if this error occurs. */
73 TMsvSendAction iAction;
75 /** The number of attempts to make at sending a message if this error occurs.
77 If iRetries equals ESendRetriesInfinite, then sending will be attempted until
78 successful (or the user intervenes). This member is ignored if iAction equals
80 TMsvSendRetries iRetries;
84 This member is used by CMsvSendErrorActions to determine when to resend the
85 message. This member is ignored if iAction equals ESendActionFail. */
86 TMsvSendRetrySpacing iRetrySpacing;
95 // CMsvSendErrorActions
100 This class determines what action to take if an error occurs while the Server
101 MTM is sending a message (or messages).
103 It encapsulates an array of TMsvSendErrorAction objects, which it uses to
104 determine the action to take for a particular error. If the error is not
105 found in the array, then CMsvSendErrorActions uses its default
106 TMsvSendErrorAction object.
112 class CMsvSendErrorActions : public CBase
115 IMPORT_C static CMsvSendErrorActions* NewL();
116 IMPORT_C static CMsvSendErrorActions* NewLC();
117 IMPORT_C ~CMsvSendErrorActions();
119 IMPORT_C void AddSendErrorActionL(const TMsvSendErrorAction& aErrorAction);
120 IMPORT_C TInt RemoveSendErrorAction(const TInt aError);
121 IMPORT_C TInt GetSendErrorAction(const TInt aError, TMsvSendErrorAction& aErrorAction) const;
123 IMPORT_C void Reset();
125 IMPORT_C void RestoreFromResourceL(TResourceReader& aReader);
127 IMPORT_C void SetErrorsL(const CArrayFixFlat<TMsvSendErrorAction>& aErrors);
128 IMPORT_C const CArrayFixFlat<TMsvSendErrorAction>& Errors() const;
130 IMPORT_C const TMsvSendErrorAction& Default() const;
131 IMPORT_C void SetDefault(const TMsvSendErrorAction& aAction);
134 CMsvSendErrorActions();
136 void RestoreErrorActionL(TResourceReader& aReader, TInt aActionCount, const TBool aDefault);
139 TInt Find(const TInt aError, TInt& aIndex) const;
142 CArrayFixFlat<TMsvSendErrorAction>* iErrors;
143 TMsvSendErrorAction iDefault;
146 #endif // __MSVSENDERRORACTION_H__