smsprotocols/smsstack/smsprot/Inc/smspenum.h
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2003-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 __SMSPENUM_H__
       
    23 #define __SMSPENUM_H__
       
    24 
       
    25 #include <e32base.h>
       
    26 #include <etelmm.h>
       
    27 #include "gsmuSmsSlot.h"
       
    28 #include "smspcomm.h"
       
    29 #include "smspproc.h"
       
    30 #include "smsuset.h"
       
    31 
       
    32 #include <mmretrieve.h>
       
    33 #include "smsuact.h"
       
    34 #include "smspqueue.h"
       
    35 
       
    36 #include "es_ini.h"
       
    37 
       
    38 class CSmsSegmentationStore;
       
    39 class CFacadeSmsReassemblyStore;
       
    40 class CQueuedSmsMessage;
       
    41 
       
    42 
       
    43 /**
       
    44  *  
       
    45  *  Class CSmsStoreRead for reading messages from the store. Messages can be read
       
    46  *  to the list all at once or one by one, depending on capabilities of the Tsy.
       
    47  *  @internalComponent
       
    48  */
       
    49 class CSmsStoreRead : public CSmsuActiveBase
       
    50 	{
       
    51 private:
       
    52         enum
       
    53             {
       
    54             KDefaultEnumerateTimeoutSeconds=255000000 //<255 sec
       
    55             };
       
    56 public:
       
    57 	static CSmsStoreRead* NewL(MSmsComm& aSmsComm,
       
    58 							   const TSmsSettings& aSmsSettings,
       
    59 							   RMobileSmsMessaging& aSmsMessaging,
       
    60 							   CFacadeSmsReassemblyStore& aReassemblyStore,
       
    61 							   CSmsSegmentationStore& aSegmentationStore,
       
    62 							   TInt aPriority,
       
    63 							   CSmsMonitorDiskSpace& aSmsMonitorDiskSpace);
       
    64 	~CSmsStoreRead();
       
    65 
       
    66 	void Start(TRequestStatus& aStatus,TInt aStoreIndex);
       
    67 
       
    68 	void CloseStore();
       
    69 
       
    70 protected:
       
    71 	void DoCancel();
       
    72 	void  ReadConfigurableSmsSettingsL();
       
    73 private:
       
    74 	CSmsStoreRead(MSmsComm& aSmsComm,
       
    75 				  const TSmsSettings& aSmsSettings,
       
    76 				  RMobileSmsMessaging& aSmsMessaging,
       
    77 				  CFacadeSmsReassemblyStore& aReassemblyStore,
       
    78 				  CSmsSegmentationStore& aSegmentationStore,
       
    79 				  TInt aPriority,
       
    80 				  CSmsMonitorDiskSpace& aSmsMonitorDiskSpace);
       
    81 
       
    82 	void ConstructL();
       
    83 	void DoRunL();
       
    84 
       
    85 	void Complete(TInt aStatus);
       
    86 
       
    87 	void ReadNextSlotL();
       
    88 	void ProcessPduL();
       
    89 
       
    90 private:
       
    91 	enum TSmsStoreReadState
       
    92 		{
       
    93 		ESmsStoreReadIdle,					//< Idle
       
    94 		ESmsStoreReadGettingStoreInfo,		//< Getting message store info
       
    95 		ESmsStoreReadReadingList,			//< Reading message list at once
       
    96 		ESmsStoreReadReadingSlot,			//< Reading message list one message at the time
       
    97 		ESmsStoreReadReadingSlotCancel		//< Reading message list cancel
       
    98 		};
       
    99 
       
   100 private:
       
   101 	TSmsStoreReadState iState;				//< The current state of the state machine
       
   102 	MSmsComm& iSmsComm;
       
   103 	const TSmsSettings& iSmsSettings;
       
   104 	RMobileSmsMessaging& iSmsMessaging;
       
   105 	CFacadeSmsReassemblyStore& iReassemblyStore;
       
   106 	CSmsSegmentationStore& iSegmentationStore;
       
   107 	CSmsMonitorDiskSpace& iSmsMonitorDiskSpace;
       
   108 	RMobileSmsStore iSmsStorage;			//< Phone side message store
       
   109 
       
   110 	RMobileSmsStore::TMobilePhoneStoreInfoV1Pckg iStoreInfoPckg;
       
   111 	RMobilePhoneStore::TMobilePhoneStoreInfoV1 iStoreInfo;		//< Capabilities of the current store
       
   112 	CRetrieveMobilePhoneSmsList* iRetrieveMobilePhoneSmsList;	//< Pointer for getting SMS list from TSY
       
   113 	CMobilePhoneGsmSmsList* iMobilePhoneGsmSmsList;		//< Pointer to a SMS list
       
   114 	RMobileSmsStore::TMobileGsmSmsEntryV1Pckg iEntryV1Pckg;
       
   115 	RMobileSmsStore::TMobileGsmSmsEntryV1 iSmsEntry;	//< Data of a SMS entry
       
   116 
       
   117 	TGsmSmsSlot iSlot;					//< Data of a SMS entry including store name
       
   118 
       
   119 	TInt iCurrentSlotIndex;				//< Index to a slot, identifies the index of iSlot
       
   120     TBool  iConfigAutomaticDeletionForClass2;
       
   121     TBool  iConfigDiscardingType0Class2;
       
   122     TBool  iConfigDiscardingType0Class0;
       
   123 	};
       
   124 
       
   125 
       
   126 /**
       
   127  *  Class CSmsPhoneEnumeration for enumerating all stores.
       
   128  *  @internalComponent
       
   129  */
       
   130 class CSmsPhoneEnumeration : public CSmsuActiveBase
       
   131 	{
       
   132 public:
       
   133 	static CSmsPhoneEnumeration* NewL(MSmsComm& aSmsComm,const TSmsSettings& aSmsSettings, CFacadeSmsReassemblyStore& aReassemblyStore, CSmsSegmentationStore& aSegmentationStore,RMobilePhone& aGsmPhone, TInt aPriority, CSmsMonitorDiskSpace& aSmsMonitorDiskSpace);
       
   134 	~CSmsPhoneEnumeration();
       
   135 
       
   136 	void Start();
       
   137 
       
   138 protected:
       
   139 
       
   140 	void DoRunL();
       
   141 	void DoCancel();
       
   142 
       
   143 private:
       
   144 
       
   145 	CSmsPhoneEnumeration(MSmsComm& aSmsComm,const TSmsSettings& aSmsSettings, RMobilePhone& aGsmPhone, TInt aPriority);
       
   146 	void ConstructL(CFacadeSmsReassemblyStore& aReassemblyStore,CSmsSegmentationStore& aSegmentationStore,CSmsMonitorDiskSpace& aSmsMonitorDiskSpace);
       
   147 
       
   148 	void Complete(TInt aStatus);
       
   149 
       
   150 private:
       
   151 	enum TSmsPhoneEnumerationState
       
   152 		{
       
   153 		ESmsPhoneEnumerationIdle,				//< Idle
       
   154 		ESmsPhoneEnumerationInitializing,		//< Initializing mobile phone
       
   155 		ESmsPhoneEnumerationReadingStores		//< Reading all stores one at the time
       
   156 		};
       
   157 
       
   158 private:
       
   159 	TSmsPhoneEnumerationState iState;		//< The current state of the state machine
       
   160 	MSmsComm& iSmsComm;						//< The reference to the observer
       
   161 	const TSmsSettings& iSmsSettings;		//< Global SMS Protocol settings
       
   162 	RMobilePhone& iGsmPhone;				//< Etel phone susession
       
   163 	RMobileSmsMessaging iSmsMessaging;		//< ETEL phone subsession for messaging services
       
   164 	TInt iNumStores;						//< Number of the phone side stores
       
   165 	TInt iCurrentStore;						//< Index to a store
       
   166 	CSmsStoreRead* iSmsStoreRead;			//< Pointer for reading store from the phone side
       
   167 	};
       
   168 
       
   169 
       
   170 
       
   171 
       
   172 
       
   173 /**
       
   174  *  Class CSmsMessageWrite for writing messages to the store.
       
   175  *  @internalComponent
       
   176  */
       
   177 class CSmsMessageWrite : public CSmsuActiveBase
       
   178 	{
       
   179 	friend class CSmspWriteQueue;
       
   180 
       
   181 private:
       
   182 
       
   183 	static CSmsMessageWrite* NewL(MSmsComm& aSmsComm, const TSmsSettings& aSmsSettings,
       
   184 								  RMobilePhone& aGsmPhone,
       
   185 								  CSmsSegmentationStore& aSegmentationStore
       
   186 								  );
       
   187 	~CSmsMessageWrite();
       
   188 
       
   189 	void Start(CSmsMessage* aSmsMessage, TRequestStatus& aStatus);
       
   190 
       
   191 private:
       
   192 
       
   193 	void DoRunL();
       
   194 	void DoCancel();
       
   195 
       
   196 private:
       
   197 	CSmsMessageWrite(MSmsComm& aSmsComm, const TSmsSettings& aSmsSettings,
       
   198 					 RMobilePhone& aGsmPhone,
       
   199 					 CSmsSegmentationStore& aSegmentationStore
       
   200 					 );
       
   201 
       
   202 	void ConstructL();
       
   203 	void SegmentMessageL();
       
   204 	void WriteNextSlot();
       
   205 	void Complete(TInt aStatus);
       
   206 
       
   207 private:
       
   208 	enum TSmsMessageWriteState
       
   209 		{
       
   210 		ESmsMessageWriteIdle,				//< Idle
       
   211 		ESmsMessageWriteInitializing,		//< Initializing mobile phone
       
   212 		ESmsMessageWriteGettingStoreInfo,	//< Getting message store info
       
   213 		ESmsMessageWriteWritingPDUs,		//< Writing slot to the store
       
   214 		};
       
   215 
       
   216 private:
       
   217 
       
   218 	MSmsComm& iSmsComm;
       
   219 	TSmsMessageWriteState iState;		//< The current state of the state machine
       
   220 	const TSmsSettings& iSmsSettings;	//< Global SMS Protocol settings
       
   221 	RMobilePhone& iGsmPhone;			//< Etel phone susession
       
   222 	RMobileSmsMessaging iSmsMessaging;	//< ETEL phone subsession for messaging services
       
   223 	RMobileSmsStore iSmsStorage;		//< Phone side message store
       
   224 
       
   225 	RMobileSmsStore::TMobilePhoneStoreInfoV1Pckg iStoreInfoPckg;
       
   226 	RMobilePhoneStore::TMobilePhoneStoreInfoV1 iStoreInfo;	//< Capabilities of the current store
       
   227 
       
   228 	RMobileSmsStore::TMobileGsmSmsEntryV1Pckg iWriteEntryV1Pckg;
       
   229 	RMobileSmsStore::TMobileGsmSmsEntryV1 iEntryToWrite;	//< Given entry for writing
       
   230 
       
   231 	CSmsSegmentationStore& iSegmentationStore;	//< Segmentation store, used to get next 8 or 16bit reference
       
   232 	CArrayFixFlat<TGsmSms> iSmsArray;	//< Array for Pdus
       
   233 	CSmsMessage* iSmsMessage;		//< The Message to write
       
   234 	TInt iNumStores;				//< Number of the phone side stores
       
   235 	TInt iCurrentStore;				//< Index to a store
       
   236 	TGsmSmsSlot iSlot;				//< a slot
       
   237 	};
       
   238 
       
   239 
       
   240 
       
   241 #endif // !defined __SMSPENUM_H__