epoc32/include/mw/msvsenderroraction.h
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/mw/msvsenderroraction.h	Wed Mar 31 12:27:01 2010 +0100
     1.3 @@ -0,0 +1,146 @@
     1.4 +// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#ifndef __MSVSENDERRORACTION_H__
    1.20 +#define __MSVSENDERRORACTION_H__
    1.21 +
    1.22 + 
    1.23 +
    1.24 +
    1.25 +/////////////////////////////////////////////////////////////////////////////
    1.26 +//
    1.27 +//	Includes
    1.28 +//
    1.29 +/////////////////////////////////////////////////////////////////////////////
    1.30 +
    1.31 +#include <schsend.hrh>
    1.32 +#include <barsread.h>
    1.33 +#include <msvstore.h>
    1.34 +
    1.35 +/////////////////////////////////////////////////////////////////////////////
    1.36 +//
    1.37 +//	Constants
    1.38 +//
    1.39 +/////////////////////////////////////////////////////////////////////////////
    1.40 +
    1.41 +
    1.42 +/////////////////////////////////////////////////////////////////////////////
    1.43 +//
    1.44 +//	TMsvSendErrorAction Declaration
    1.45 +//
    1.46 +/////////////////////////////////////////////////////////////////////////////
    1.47 +
    1.48 +/**
    1.49 +Encapsulates the action to take for a particular error. 
    1.50 +
    1.51 +An error may occur when the Server MTM is attempting to send a message or 
    1.52 +messages. If the Server MTM supports scheduling, then, depending on the error 
    1.53 +or conditions, the Server MTM may want to re-schedule the message on the Task 
    1.54 +Scheduler to send at a later time. CMsvScheduleSend::ReScheduleL() 
    1.55 +(in combination with CMsvSendErrorActions) uses the TMsvSendErrorAction 
    1.56 +to determine whether to re-schedule the message. 
    1.57 +
    1.58 +@publishedAll
    1.59 +@released
    1.60 +*/
    1.61 +
    1.62 +class TMsvSendErrorAction
    1.63 +	{
    1.64 +public:
    1.65 +	IMPORT_C TMsvSendErrorAction();
    1.66 +
    1.67 +	IMPORT_C void Reset();
    1.68 +
    1.69 +	IMPORT_C void SetMaxRetries(const TInt16 aMaxRetries);
    1.70 +	IMPORT_C TInt16 MaxRetries() const;
    1.71 +
    1.72 +	/** The error. */
    1.73 +	TInt					iError;
    1.74 +
    1.75 +	/** The action to take if this error occurs. */
    1.76 +	TMsvSendAction			iAction;
    1.77 +
    1.78 +	/** The number of attempts to make at sending a message if this error occurs. 
    1.79 +	
    1.80 +	If iRetries equals ESendRetriesInfinite, then sending will be attempted until 
    1.81 +	successful (or the user intervenes). This member is ignored if iAction equals 
    1.82 +	ESendActionFail. */
    1.83 +	TMsvSendRetries			iRetries;
    1.84 +
    1.85 +	/** Retry behaviour.
    1.86 +	
    1.87 +	This member is used by CMsvSendErrorActions to determine when to resend the 
    1.88 +	message. This member is ignored if iAction equals ESendActionFail. */
    1.89 +	TMsvSendRetrySpacing	iRetrySpacing;
    1.90 +
    1.91 +private:
    1.92 +	TInt16	iMaxRetries;
    1.93 +	};
    1.94 +
    1.95 +
    1.96 +/////////////////////////////////////////////////////////////////////////////
    1.97 +//
    1.98 +// CMsvSendErrorActions
    1.99 +//
   1.100 +/////////////////////////////////////////////////////////////////////////////
   1.101 +
   1.102 +/**
   1.103 +This class determines what action to take if an error occurs while the Server 
   1.104 +MTM is sending a message (or messages).
   1.105 +
   1.106 +It encapsulates an array of TMsvSendErrorAction objects, which it uses to 
   1.107 +determine the action to take for a particular error. If the error is not 
   1.108 +found in the array, then CMsvSendErrorActions uses its default 
   1.109 +TMsvSendErrorAction object. 
   1.110 +
   1.111 +@publishedAll
   1.112 +@released
   1.113 +*/
   1.114 +
   1.115 +class CMsvSendErrorActions : public CBase
   1.116 +	{
   1.117 +public:
   1.118 +	IMPORT_C static CMsvSendErrorActions* NewL();
   1.119 +	IMPORT_C static CMsvSendErrorActions* NewLC();	
   1.120 +	IMPORT_C ~CMsvSendErrorActions();
   1.121 +
   1.122 +	IMPORT_C void AddSendErrorActionL(const TMsvSendErrorAction& aErrorAction);
   1.123 +	IMPORT_C TInt RemoveSendErrorAction(const TInt aError);
   1.124 +	IMPORT_C TInt GetSendErrorAction(const TInt aError, TMsvSendErrorAction& aErrorAction) const;
   1.125 +	
   1.126 +	IMPORT_C void Reset();
   1.127 +
   1.128 +	IMPORT_C void RestoreFromResourceL(TResourceReader& aReader);
   1.129 +
   1.130 +	IMPORT_C void SetErrorsL(const CArrayFixFlat<TMsvSendErrorAction>& aErrors);
   1.131 +	IMPORT_C const CArrayFixFlat<TMsvSendErrorAction>& Errors() const;
   1.132 +
   1.133 +	IMPORT_C const TMsvSendErrorAction& Default() const;
   1.134 +	IMPORT_C void SetDefault(const TMsvSendErrorAction& aAction);
   1.135 +
   1.136 +private:
   1.137 +	CMsvSendErrorActions();
   1.138 +	void ConstructL();
   1.139 +	void RestoreErrorActionL(TResourceReader& aReader, TInt aActionCount, const TBool aDefault);
   1.140 +
   1.141 +
   1.142 +	TInt Find(const TInt aError, TInt& aIndex) const;
   1.143 +
   1.144 +	
   1.145 +	CArrayFixFlat<TMsvSendErrorAction>* iErrors;
   1.146 +	TMsvSendErrorAction iDefault;
   1.147 +	};
   1.148 +
   1.149 +#endif	// __MSVSENDERRORACTION_H__