smsprotocols/smsstack/smsprot/Inc/smspread.h
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 1997-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 /**
       
    17  @file
       
    18  @internalAll 
       
    19 */
       
    20 
       
    21 
       
    22 #ifndef __SMSPREAD_H__
       
    23 #define __SMSPREAD_H__
       
    24 
       
    25 #include <e32base.h>
       
    26 #include "smspcomm.h"
       
    27 #include <etelmm.h>
       
    28 #include "smsuact.h"
       
    29 #include <logwrap.h>
       
    30 #include "smspproc.h"
       
    31 #include "smspenum.h" // for TGsmSmsSlot definition
       
    32 
       
    33 
       
    34 class CFacadeSmsReassemblyStore;
       
    35 class CSmsSegmentationStore;
       
    36 class RFs;
       
    37 class CSmsEventLogger;
       
    38 class CSmspReceiveMode;
       
    39 class CSmsEventLogger;
       
    40 class TLogSmsPduData;
       
    41 class TSmsSettings;
       
    42 class CSmsPduReadTimer;
       
    43 
       
    44 
       
    45 /**
       
    46  *  Logs a CSmsMessage
       
    47  *  @internalComponent
       
    48  */
       
    49 class CSmsPDUReadLogger : public CSmsuActiveBase
       
    50 	{
       
    51 	public:
       
    52 
       
    53 		static CSmsPDUReadLogger* NewL(RFs& aFs, TInt aPriority);
       
    54 		~CSmsPDUReadLogger();
       
    55 		void ChangeOrAddLogEvent(CSmsMessage& aSmsMessage, const TLogSmsPduData& aSmsPDUData, const TTime* aTime, TRequestStatus& aStatus);
       
    56 
       
    57 	private:
       
    58 
       
    59 		CSmsPDUReadLogger(TInt aPriority);
       
    60 		void ConstructL(RFs& aFs);
       
    61 
       
    62 		void AddLogEvent();
       
    63 		void GetLogEvent();
       
    64 		void ChangeLogEvent();
       
    65 		void DoRunL();
       
    66 		void DoCancel();
       
    67 		void Complete(TInt aStatus);
       
    68 
       
    69 	private:
       
    70 
       
    71 		enum TSmsPDUReadLoggerState
       
    72 			{
       
    73 			ESmsPDUReadLoggerIdle,	//< Idle
       
    74 			ESmsPDUReadLoggerGet,	//< Getting Log Event
       
    75 			ESmsPDUReadLoggerChange,//< Changing Log Event
       
    76 			ESmsPDUReadLoggerAdd	//< Adding Log Event
       
    77 			} iState;
       
    78 
       
    79 		CSmsEventLogger* iLogger;			//< Used for Logging the CSmsMessage
       
    80 		CSmsMessage* iSmsMessage;			//< The Message to Log. Pointer not "owned" by this class
       
    81 		TTime iTime;
       
    82 		const TTime* iTimePtr;
       
    83 		const TLogSmsPduData* iSmsPDUData;	//< Data to add to the Log Event. Pointer not "owned" by this class
       
    84 	};
       
    85 
       
    86 
       
    87 /**
       
    88  *  Class CSmsStoreRead for setting TSY receive mode and receiving new incoming
       
    89  *  message from the phone side
       
    90  *  @internalComponent
       
    91  */
       
    92 class CSmsPDURead : public CSmsuActiveBase
       
    93 	{
       
    94 friend class CSmsPduReadTimer;
       
    95 public:
       
    96 	static CSmsPDURead* NewL(MSmsComm& aSmsComm,
       
    97 							 const TSmsSettings& aSmsSettings,
       
    98 							 RMobileSmsMessaging& aSmsMessaging,
       
    99 							 CFacadeSmsReassemblyStore& aReassemblyStore,
       
   100 							 CSmsSegmentationStore& aSegmentationStore,
       
   101 							 const RMobileSmsMessaging::TMobileSmsCapsV1& aMobileSmsCaps,
       
   102 							 TInt aPriority,
       
   103 							 CSmspReceiveMode& aSmspReceiveMode,
       
   104 							 CSmsMonitorDiskSpace& aSmsMonitorDiskSpace);
       
   105 	~CSmsPDURead();
       
   106 
       
   107 	void Start();
       
   108 	void ResumeSmsReception();
       
   109 
       
   110 	const CSmsMessage* CurrentMessage() {return (iPduProcessor ? iPduProcessor->SmsMessage() : NULL);}
       
   111 
       
   112 protected:
       
   113 	void DoRunL();
       
   114 	void DoCancel();
       
   115 
       
   116 private:
       
   117     enum TRpErrorCodeIndex
       
   118         {
       
   119         // Only error conditions which can be configured to be negatively acknowledged
       
   120         // are enumerated.
       
   121         // MemoryCapacityExceeded is not enumerated, as this condition will always be
       
   122         // negatively acknowledged.
       
   123         EInvalidShortMsgTransferReferenceValue = 0,
       
   124         ESemanticallyIncorrectMessage = 1,
       
   125         EInvalidMandatoryInformaton = 2,
       
   126         EMessageTypeNonExistent = 3,
       
   127         EMessageNotCompatibleWithShortMessageProtocolState = 4,
       
   128         EInformationElementNonExistentOrNotImplemented = 5,
       
   129         EProtocolErrorUnspecified = 6,
       
   130         EUndefinedIndex = 7
       
   131         };
       
   132 
       
   133 private:
       
   134 	CSmsPDURead(MSmsComm& aSmsComm,
       
   135 				const TSmsSettings& aSmsSettings,
       
   136 				RMobileSmsMessaging& aSmsMessaging,
       
   137 				CFacadeSmsReassemblyStore& aReassemblyStore,
       
   138 				CSmsSegmentationStore& aSegmentationStore,
       
   139 				const RMobileSmsMessaging::TMobileSmsCapsV1& aMobileSmsCaps,
       
   140 				TInt aPriority,
       
   141 				CSmspReceiveMode& aSmspReceiveMode,
       
   142 				CSmsMonitorDiskSpace& aSmsMonitorDiskSpace);
       
   143 
       
   144     void ConstructL();
       
   145     void Receive();
       
   146     void ProcessPDUL();
       
   147     void AddLogEvent();
       
   148     void DoEncodeDeliverReportL();
       
   149     void SendDeliverReport();
       
   150     TBool IsSupported() const;
       
   151     void Complete(TInt aError);
       
   152 
       
   153     void SetErrorCodeStatus(enum TRpErrorCodeIndex aIndex, TBool aValue);
       
   154     TBool GetErrorCodeStatus(enum TRpErrorCodeIndex aIndex);
       
   155 
       
   156     void  ReadConfigurableSmsSettingsL();
       
   157     TBool MapRpErrorToIndex(TInt aRpErrorCode, TRpErrorCodeIndex& aIndex);
       
   158 
       
   159     void MakeStateTransitionBasedOnErrorCode();
       
   160 
       
   161 
       
   162 private:
       
   163 	enum TSmsPDUReadState
       
   164 		{
       
   165 		ESmsPDUReadIdle,				//< Idle
       
   166 		ESmsPDUReadSetReceiveMode,		//< Setting receive mode
       
   167 		ESmsPDUReadResumeReception,		//< Resuming reception of SMSs
       
   168 		ESmsPDUReadWaitingForPDU,		//< Waiting new incoming message
       
   169 		ESmsPDUReadProcessingPDU,		//< Performing various async procesing
       
   170 
       
   171 		ESmsPDUReadForwardingPDUToClient,
       
   172 		ESmsPDUReadNotForwardingPDUToClient,
       
   173 
       
   174 		ESmsPDUReadSystemOutOfMemorySendNegativeAck,
       
   175 		ESmsPDUReadAcceptValidPduSendPositiveAck,
       
   176 		ESmsPDUReadAbsorbInvalidPduSendPositiveAck,
       
   177 		ESmsPDUReadInvalidPDUSendNegativeAck,
       
   178 
       
   179 		ESmsPDUReadLogging,
       
   180 		ESmsPDUWaitTimerAfterOOM,
       
   181 		ESmsPDUWaitingForDiskMonitor,
       
   182 		ESmsPDUReadAbsorbValidPduSendPositiveAck
       
   183 		};
       
   184 
       
   185 private:
       
   186 	TSmsPDUReadState iState;			//< The current state of the state machine
       
   187 
       
   188 	RMobileSmsMessaging& iSmsMessaging;
       
   189 	RMobileSmsMessaging::TMobileSmsGsmTpdu iMsgData;	//< Pdu buffer
       
   190     RMobileSmsMessaging::TMobileSmsReceiveAttributesV1 iMsgReceiveAttributes;	//< Class for received message attributes
       
   191     RMobileSmsMessaging::TMobileSmsReceiveAttributesV1Pckg iMsgReceiveAttributesPckg;	//< Package for iMsgReceiveAttributes
       
   192     
       
   193 	TGsmSmsSlot iSlot;  //  Current iSlot entry
       
   194 
       
   195 	CSmsPDUProcessor*  iPduProcessor;
       
   196 
       
   197 	MSmsComm& iSmsComm;
       
   198 	const TSmsSettings& iSmsSettings;
       
   199 	CFacadeSmsReassemblyStore& iReassemblyStore;
       
   200 	CSmsSegmentationStore& iSegmentationStore;
       
   201 	const RMobileSmsMessaging::TMobileSmsCapsV1& iMobileSmsCaps;
       
   202 	TGsmSms iDeliverReport;
       
   203 
       
   204 	CSmsPDUReadLogger* iLogger;
       
   205 
       
   206 	CSmspReceiveMode& iReceiveMode;	// a reference to owner class's instance
       
   207 	RTimer	iOOMTimer;
       
   208 	CSmsMonitorDiskSpace& iSmsMonitorDiskSpace;  // a reference to the iSmsMonitorDiskSpace object
       
   209 
       
   210 	TUint8 iRpErrorCodesSupported;
       
   211     TBool  iConfigAutomaticDeletionForClass2;
       
   212     TBool  iConfigDiscardingType0Class2;
       
   213     TBool  iConfigDiscardingType0Class0; 
       
   214 
       
   215 	TBool  iSmsReceptionSupended;
       
   216 	TBool  iDelayedResumeSmsReceptionRequired;
       
   217 	};
       
   218 
       
   219 #endif // !defined __SMSPREAD_H__