messagingappbase/smsmtm/servermtm/inc/smssactive.h
changeset 25 84d9eb65b26f
parent 23 238255e8b033
child 27 e4592d119491
child 37 518b245aa84c
child 79 2981cb3aa489
equal deleted inserted replaced
23:238255e8b033 25:84d9eb65b26f
     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 __SMSSACTIVE_H__
       
    17 #define __SMSSACTIVE_H__
       
    18 
       
    19 #ifdef _DEBUG
       
    20 #undef _MSG_NO_LOGGING
       
    21 #endif
       
    22 
       
    23 #include <e32base.h>
       
    24 #include <bif.h>
       
    25 #include <flogger.h>
       
    26 
       
    27 #ifdef _MSG_NO_LOGGING
       
    28 #define SMSSLOG(a)
       
    29 #else
       
    30 #define SMSSLOG(a) a
       
    31 #endif
       
    32 
       
    33 class RFs;
       
    34 class CSmsMessage;
       
    35 class CMsvServerEntry;
       
    36 class TMsvEntry;
       
    37 class CSmsNumber;
       
    38 class CSmsHeader;
       
    39 
       
    40 class CSmssActive : public CActive
       
    41 /**
       
    42 @internalComponent
       
    43 @released
       
    44 */
       
    45 	{
       
    46 public:
       
    47 	CSmssActive(RFs& aFs, CMsvServerEntry& aServerEntry, TInt aPriority = CActive::EPriorityStandard);
       
    48 
       
    49 protected:
       
    50 	
       
    51 	~CSmssActive();
       
    52 	void Queue(TRequestStatus& aStatus);
       
    53 	void RequestComplete(TRequestStatus* aStatus, TInt aError, TBool aSetActive = EFalse);
       
    54 
       
    55 	TBool CanSendMessage(const TMsvEntry& aEntry) const;
       
    56 	TBool CanSendMessageToRecipient(const TMsvEntry& aEntry, const CSmsNumber& aRcpt) const;
       
    57 	TInt Complete(TInt aStatus);
       
    58 
       
    59 	void ChangeEntryL(const TMsvEntry& aNewEntry); //< Calls iServerEntry.ChangeL
       
    60  	void StoreHeaderL(const CSmsHeader& aNewHeader);
       
    61 
       
    62 private:
       
    63 
       
    64 	virtual TInt RunError(TInt aError); //from CActive. Calls Complete(), then completes iReport if not IsActive().
       
    65 	virtual void RunL(); //From CActive. Will leave if aStatus != KErrNone
       
    66 	virtual void DoCancel(); //From CActive. Calls DoSmssCancel(), then calls Complete(KErrCancel)
       
    67 	virtual void DoRunL() = 0; //Called by RunL() if aStatus == KErrNone
       
    68 	virtual void DoComplete(TInt& aStatus) = 0;
       
    69 	virtual void DoSmssCancel() = 0;
       
    70 
       
    71 protected:
       
    72 
       
    73 #ifndef _MSG_NO_LOGGING
       
    74 
       
    75 	//16-bit	
       
    76 	void FLog(const TDesC& aFile, const TDesC& aInputLine, TBool aIgnoreLineBreaks = ETrue);
       
    77 	void FLog(const TDesC& aInputLine, TBool aIgnoreLineBreaks = ETrue);
       
    78 	void FLogFormat(TRefByValue<const TDesC> aFormat, ...);
       
    79 	void FLogFormat(const TDesC& aFile, TRefByValue<const TDesC> aFormat, ...);
       
    80 	void FLogFormat(const TDesC& aFile, TRefByValue<const TDesC> aFormat, VA_LIST& aList);
       
    81 	
       
    82 	//8-bit
       
    83 	void FLogFormat(TRefByValue<const TDesC8> aFormat, ...);
       
    84 	void FLogFormat(const TDesC& aFile, TRefByValue<const TDesC8> aFormat, ...);
       
    85 	void FLogFormat(const TDesC& aFile, TRefByValue<const TDesC8> aFormat, VA_LIST& aList);
       
    86 	
       
    87 	TInt FLogMessage(const TMsvEntry& aEntry, const CSmsMessage& aSmsMessage, TBioMsgIdType aBearer, const TDesC& aFile);
       
    88 	TBool IsLogging(const TDesC& aFile);
       
    89 
       
    90 private:
       
    91 	void DoFLogMessageL(const TMsvEntry& aEntry, const CSmsMessage& aSmsMessage, TBioMsgIdType aBearer, const TDesC& aFile);
       
    92 	TInt ConstructFlogger(const TDesC& aFile);
       
    93 	void DoConstructFloggerL(const TDesC& aFile);
       
    94 	RFileLogger iFlogger;
       
    95 	HBufC* iLastLogFile;
       
    96 
       
    97 #else
       
    98 	TInt8 iBCSpacer[sizeof(RFileLogger)+sizeof(HBufC*)];
       
    99 #endif
       
   100 
       
   101 
       
   102 protected:
       
   103 	RFs& iFs;
       
   104 	CMsvServerEntry& iServerEntry;
       
   105 
       
   106 private:
       
   107 	TRequestStatus* iReport;
       
   108 	};
       
   109 
       
   110 #endif	// __SMSSACTIVE_H__