messagingfw/scheduledsendmtm/test/base/inc/pigeonservermtm.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 __PIGEONSERVERMTM_H__
       
    17 #define __PIGEONSERVERMTM_H__
       
    18 
       
    19 #include <schedulebaseservermtm.h>
       
    20 #include <msvschedulesend.h>
       
    21 #include <msvoffpeaktime.h>
       
    22 #include "t_schsendshare.h"
       
    23 
       
    24 
       
    25 
       
    26 const TUid KUidMsgTypePigeon = {0x1000127E};
       
    27 	
       
    28 class CPigeonScheduledSend;
       
    29 class MPigeonObserver;
       
    30 
       
    31 class CPigeonServerMtm : public CScheduleBaseServerMtm
       
    32 	{
       
    33 public:
       
    34 	
       
    35 	IMPORT_C static CPigeonServerMtm* NewL(CRegisteredMtmDll& aRegisteredMtmDll, CMsvServerEntry& aServerEntry);
       
    36 
       
    37 	~CPigeonServerMtm();
       
    38 
       
    39 	void			ScheduleL(CMsvEntrySelection& aSelection, const TBool aMove, const TDesC8& aParameter, TRequestStatus& /*aStatus*/);
       
    40 	void			RestoreScheduleSettingsL();
       
    41 	void			SendScheduledL(CMsvEntrySelection& aSelection, const TBool aMove, const TDesC8& aParameter, TRequestStatus& aStatus);
       
    42 	void			SetFailFirstSendL(CMsvEntrySelection& aSelection);
       
    43 	void			StartCommandL(CMsvEntrySelection& aSelection, TInt aCommand, const TDesC8& aParameter, TRequestStatus& aStatus);
       
    44 
       
    45 	void			DoCancel(){};
       
    46 	void			CopyToLocalL(const CMsvEntrySelection& /*aSelection*/, long /*aLong*/, TRequestStatus& /*aStatus*/){};
       
    47 	void			CopyFromLocalL(const CMsvEntrySelection& /*aSelection*/, long /*aLong*/, TRequestStatus& /*aStatus*/){};
       
    48 	void			CopyWithinServiceL(const CMsvEntrySelection& /*aSelection*/, long /*aLong*/, TRequestStatus& /*aStatus*/){};
       
    49 	void			DeleteAllL(const CMsvEntrySelection& /*aSelection*/, TRequestStatus& /*aStatus*/){};
       
    50 	void			CreateL(TMsvEntry /*aEntry*/, TRequestStatus& /*aStatus*/){};
       
    51 	void			ChangeL(TMsvEntry /*aEntry*/, TRequestStatus& /*aStatus*/){};
       
    52 	TBool			CommandExpected(){return ETrue;};
       
    53 	const TDesC8&	Progress();
       
    54 	void			MoveToLocalL(const CMsvEntrySelection& /*aSelection*/, long /*aLong*/, TRequestStatus& /*aStatus*/){};
       
    55 	void			MoveFromLocalL(const CMsvEntrySelection& /*aSelection*/, long /*aLong*/, TRequestStatus& /*aStatus*/){};
       
    56 	void			MoveWithinServiceL(const CMsvEntrySelection& /*aSelection*/, long /*aLong*/, TRequestStatus& /*aStatus*/){};
       
    57 	void			DoRunL(){};
       
    58 	void			DoComplete(int /*i*/){};
       
    59 	void			LoadResourceFileL(){};
       
    60 	void			PopulateSchedulePackage(const TDesC8& /*aDes*/, const int /*i*/, TMsvSchedulePackage& /*aPackage*/) const{};
       
    61 
       
    62 
       
    63 
       
    64 
       
    65 private:
       
    66 	void					ConstructL();
       
    67 	void					RestoreSettingsL();
       
    68 	void					DoStartCommandL(CMsvEntrySelection& aSelection, TSchSendTestOperation aCommand, const TDesC8& aParameter, TRequestStatus& aStatus);
       
    69 							CPigeonServerMtm(CRegisteredMtmDll& aRegisteredMtmDll, CMsvServerEntry* aServerEntry);// 
       
    70 	void					UpdateProgressL(const CMsvEntrySelection& aSelection);
       
    71 	CMsvScheduledEntry*		ScheduledEntryLC(TMsvId aId);
       
    72 	CMsvStore*				GetServiceEntryEditStoreLC();
       
    73 private:
       
    74 	TMsvId					iServiceId;
       
    75 	CPigeonScheduledSend*	iScheduleSend;
       
    76 	
       
    77 	TSchSendTestProgressBuf	iProgress;
       
    78 
       
    79 	TBool					iHeapFailure;
       
    80 	TInt					iNextFailure;
       
    81 	};
       
    82 
       
    83 class CPigeonScheduledEntry : public CMsvScheduledEntry 
       
    84 	{
       
    85 public:
       
    86 	IMPORT_C static CPigeonScheduledEntry*	NewL(const TMsvEntry& aMsvEntry);
       
    87 	TBool					CanSendToAnyRecipients(const TMsvSendErrorAction&);
       
    88 	TBool					CanSendToAnyRecipients(const CMsvSendErrorActions&, TMsvSendErrorAction&);
       
    89 	void					RecipientsResetRetries(){};
       
    90 	void					RecipientsIncreaseRetries(){};
       
    91 	void					RecipientsSetFailed(){};
       
    92 	TBool					RecipientsAllSent() const;
       
    93 	void					RecipientsStoreL(CMsvStore&) const{};
       
    94 	void					RecipientsRestoreL(CMsvStore&) {};
       
    95 	
       
    96 private:
       
    97 	void					ConstructL();
       
    98 	CPigeonScheduledEntry(const TMsvEntry& aMsvEntry) : CMsvScheduledEntry(aMsvEntry){};
       
    99 	};
       
   100 
       
   101 class CPigeonScheduledSend : public CMsvScheduleSend
       
   102 	{
       
   103 public:
       
   104 	IMPORT_C static CPigeonScheduledSend* NewL(CMsvServerEntry& aServerEntry);
       
   105 							~CPigeonScheduledSend();
       
   106 	CMsvScheduledEntry*		GetMessageL(const TMsvId aId) const;
       
   107 
       
   108 	void					SetupL(TSchSendTestOperation aOption);
       
   109 	void 					SaveSysAgentActionsL(CRepository& aRepository);	
       
   110 	void 					LoadSysAgentActionsL(CRepository& aRepository);
       
   111 	void 					LoadPendingConditionsTimeoutL(CRepository& aRepository);
       
   112 	void					PopulateErrorListL();
       
   113 
       
   114 private:
       
   115 
       
   116 	//Two arrays of possible values for iSettings and iErrorActions
       
   117 	//This class takes ownership of _all_ of them including the ones installed in 
       
   118 	//iSettings and iErrorActions at destructing time.
       
   119 
       
   120 	CArrayFixFlat<TMsvSendErrorAction>*			iActionsList;
       
   121 	CArrayFixFlat<TMsvOffPeakTime>*				iOffPeakList;
       
   122 
       
   123 private:
       
   124 							CPigeonScheduledSend(CMsvServerEntry& aServerEntry)
       
   125 								: CMsvScheduleSend(aServerEntry){};
       
   126 	void					ConstructL();
       
   127 
       
   128 	enum					TActions
       
   129 								{
       
   130 								EActionDefault = 0,
       
   131 								EActionImmediately = 1,
       
   132 								EActionLater = 2,
       
   133 								EActionVariable = 3,
       
   134 								EActionFail = 4
       
   135 								};
       
   136 	enum					TSettings
       
   137 								{
       
   138 								ESettingsDefault = 0,
       
   139 								ESettingsCustom = 1
       
   140 								};
       
   141 	enum					TOffPeak
       
   142 								{
       
   143 								EOffPeakCurrent = 0,
       
   144 								EOffPeakFinished = 1,
       
   145 								EOffPeakFuture = 2
       
   146 								};
       
   147 
       
   148 	// Add all the different possible settings/actions to the lists
       
   149 	void					PopulateSettingsL();
       
   150 	void					PopulateActionsListL();
       
   151 	void					PopulateOffPeakListL();
       
   152 	
       
   153 	//Set the current settings/actions from the lists
       
   154 	void					SetActionL(TActions aAction);
       
   155 	void					SetOffPeakL(TOffPeak aSetting);
       
   156 	};
       
   157 	
       
   158 #endif