messagingfw/scheduledsendmtm/schedulesendmtm/inc/MsvSendErrorAction.h
changeset 62 db3f5fa34ec7
parent 0 8e480a14352b
equal deleted inserted replaced
60:9f5ae1728557 62:db3f5fa34ec7
       
     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".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __MSVSENDERRORACTION_H__
       
    17 #define __MSVSENDERRORACTION_H__
       
    18 
       
    19  
       
    20 
       
    21 
       
    22 //
       
    23 //
       
    24 //	Includes
       
    25 //
       
    26 //
       
    27 
       
    28 #include <schsend.hrh>
       
    29 #include <barsread.h>
       
    30 #include <msvstore.h>
       
    31 
       
    32 //
       
    33 //
       
    34 //	Constants
       
    35 //
       
    36 //
       
    37 
       
    38 
       
    39 //
       
    40 //
       
    41 //	TMsvSendErrorAction Declaration
       
    42 //
       
    43 //
       
    44 
       
    45 /**
       
    46 Encapsulates the action to take for a particular error. 
       
    47 
       
    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. 
       
    54 
       
    55 @publishedAll
       
    56 @released
       
    57 */
       
    58 
       
    59 class TMsvSendErrorAction
       
    60 	{
       
    61 public:
       
    62 	IMPORT_C TMsvSendErrorAction();
       
    63 
       
    64 	IMPORT_C void Reset();
       
    65 
       
    66 	IMPORT_C void SetMaxRetries(const TInt16 aMaxRetries);
       
    67 	IMPORT_C TInt16 MaxRetries() const;
       
    68 
       
    69 	/** The error. */
       
    70 	TInt					iError;
       
    71 
       
    72 	/** The action to take if this error occurs. */
       
    73 	TMsvSendAction			iAction;
       
    74 
       
    75 	/** The number of attempts to make at sending a message if this error occurs. 
       
    76 	
       
    77 	If iRetries equals ESendRetriesInfinite, then sending will be attempted until 
       
    78 	successful (or the user intervenes). This member is ignored if iAction equals 
       
    79 	ESendActionFail. */
       
    80 	TMsvSendRetries			iRetries;
       
    81 
       
    82 	/** Retry behaviour.
       
    83 	
       
    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;
       
    87 
       
    88 private:
       
    89 	TInt16	iMaxRetries;
       
    90 	};
       
    91 
       
    92 
       
    93 //
       
    94 //
       
    95 // CMsvSendErrorActions
       
    96 //
       
    97 //
       
    98 
       
    99 /**
       
   100 This class determines what action to take if an error occurs while the Server 
       
   101 MTM is sending a message (or messages).
       
   102 
       
   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. 
       
   107 
       
   108 @publishedAll
       
   109 @released
       
   110 */
       
   111 
       
   112 class CMsvSendErrorActions : public CBase
       
   113 	{
       
   114 public:
       
   115 	IMPORT_C static CMsvSendErrorActions* NewL();
       
   116 	IMPORT_C static CMsvSendErrorActions* NewLC();	
       
   117 	IMPORT_C ~CMsvSendErrorActions();
       
   118 
       
   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;
       
   122 	
       
   123 	IMPORT_C void Reset();
       
   124 
       
   125 	IMPORT_C void RestoreFromResourceL(TResourceReader& aReader);
       
   126 
       
   127 	IMPORT_C void SetErrorsL(const CArrayFixFlat<TMsvSendErrorAction>& aErrors);
       
   128 	IMPORT_C const CArrayFixFlat<TMsvSendErrorAction>& Errors() const;
       
   129 
       
   130 	IMPORT_C const TMsvSendErrorAction& Default() const;
       
   131 	IMPORT_C void SetDefault(const TMsvSendErrorAction& aAction);
       
   132 
       
   133 private:
       
   134 	CMsvSendErrorActions();
       
   135 	void ConstructL();
       
   136 	void RestoreErrorActionL(TResourceReader& aReader, TInt aActionCount, const TBool aDefault);
       
   137 
       
   138 
       
   139 	TInt Find(const TInt aError, TInt& aIndex) const;
       
   140 
       
   141 	
       
   142 	CArrayFixFlat<TMsvSendErrorAction>* iErrors;
       
   143 	TMsvSendErrorAction iDefault;
       
   144 	};
       
   145 
       
   146 #endif	// __MSVSENDERRORACTION_H__