smsprotocols/smsstack/smsprot/Src/smspenum.cpp
changeset 42 3adadc800673
parent 20 244d7c5f118e
child 66 07a122eea281
equal deleted inserted replaced
31:8ab6687fb94c 42:3adadc800673
     1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 1999-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    15 
    15 
    16 /**
    16 /**
    17  @file
    17  @file
    18 */
    18 */
    19 
    19 
       
    20 
       
    21 #include "OstTraceDefinitions.h"
       
    22 #ifdef OST_TRACE_COMPILER_IN_USE
       
    23 #include "smspenumTraces.h"
       
    24 #endif
       
    25 
    20 #include "smspenum.h"
    26 #include "smspenum.h"
    21 #include "smspproc.h"
    27 #include "smspproc.h"
    22 #include "smsuset.h"
    28 #include "smsuset.h"
    23 #include "smspmain.h"
    29 #include "smspmain.h"
    24 #include "smspstor.h"
    30 #include "smspstor.h"
    50 								   CFacadeSmsReassemblyStore& aReassemblyStore,
    56 								   CFacadeSmsReassemblyStore& aReassemblyStore,
    51 								   CSmsSegmentationStore& aSegmentationStore,
    57 								   CSmsSegmentationStore& aSegmentationStore,
    52 								   TInt aPriority,
    58 								   TInt aPriority,
    53 								   CSmsMonitorDiskSpace& aSmsMonitorDiskSpace)
    59 								   CSmsMonitorDiskSpace& aSmsMonitorDiskSpace)
    54 	{
    60 	{
    55 	LOGSMSPROT1("CSmsStoreRead::NewL()");
    61 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSTOREREAD_NEWL_1, "CSmsStoreRead::NewL()");
    56 
    62 
    57 	CSmsStoreRead* smsStoreRead = new ( ELeave ) CSmsStoreRead(aSmsComm,
    63 	CSmsStoreRead* smsStoreRead = new ( ELeave ) CSmsStoreRead(aSmsComm,
    58 															   aSmsSettings,
    64 															   aSmsSettings,
    59 															   aSmsMessaging,
    65 															   aSmsMessaging,
    60 															   aReassemblyStore,
    66 															   aReassemblyStore,
   103 /**
   109 /**
   104  *  Calls ConstructTimeoutL from the class CSmsuActiveBase
   110  *  Calls ConstructTimeoutL from the class CSmsuActiveBase
   105  */
   111  */
   106 void CSmsStoreRead::ConstructL()
   112 void CSmsStoreRead::ConstructL()
   107 	{
   113 	{
   108 	LOGSMSPROT1("CSmsStoreRead::ConstructL()");
   114 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSTOREREAD_CONSTRUCTL_1, "CSmsStoreRead::ConstructL()");
   109 
   115 
   110 	ConstructTimeoutL();
   116 	ConstructTimeoutL();
   111 	ReadConfigurableSmsSettingsL();
   117 	ReadConfigurableSmsSettingsL();
   112 	} // CSmsStoreRead::ConstructL
   118 	} // CSmsStoreRead::ConstructL
   113 
   119 
   152  *  DiscardType0_Class0Message= 1
   158  *  DiscardType0_Class0Message= 1
   153  *  
   159  *  
   154  */
   160  */
   155 void CSmsStoreRead::ReadConfigurableSmsSettingsL()
   161 void CSmsStoreRead::ReadConfigurableSmsSettingsL()
   156     {
   162     {
   157     LOGSMSPROT1("CSmsStoreRead::ReadConfigurableSmsSettingsL()");
   163     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSTOREREAD_READCONFIGURABLESMSSETTINGSL_1, "CSmsStoreRead::ReadConfigurableSmsSettingsL()");
   158 
   164 
   159     CESockIniData*  ini = NULL;
   165     CESockIniData*  ini = NULL;
   160     TRAPD(ret, ini=CESockIniData::NewL(_L("smswap.sms.esk")));
   166     TRAPD(ret, ini=CESockIniData::NewL(_L("smswap.sms.esk")));
   161     if(ret!=KErrNone)
   167     if(ret!=KErrNone)
   162         {
   168         {
   163         LOGSMSPROT2("CSmsStoreRead::ReadConfigurableSmsSettingsL(): ret=%d", ret);
   169         OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSTOREREAD_READCONFIGURABLESMSSETTINGSL_2, "CSmsStoreRead::ReadConfigurableSmsSettingsL(): ret=%d", ret);
   164         User::Leave(ret);
   170         User::Leave(ret);
   165         }
   171         }
   166 
   172 
   167     CleanupStack::PushL(ini);
   173     CleanupStack::PushL(ini);
   168     
   174     
   175     				 _L("AutomaticDeletionOfClass2"), status))
   181     				 _L("AutomaticDeletionOfClass2"), status))
   176     	{
   182     	{
   177         iConfigAutomaticDeletionForClass2 = status;
   183         iConfigAutomaticDeletionForClass2 = status;
   178         }
   184         }
   179 
   185 
   180 	LOGSMSPROT2("CSmsStoreRead::ReadConfigurableSmsSettingsL(): iConfigAutomaticDeletionForClass2=%d",
   186 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSTOREREAD_READCONFIGURABLESMSSETTINGSL_3, "CSmsStoreRead::ReadConfigurableSmsSettingsL(): iConfigAutomaticDeletionForClass2=%d",iConfigAutomaticDeletionForClass2);
   181 				iConfigAutomaticDeletionForClass2);
       
   182 
   187 
   183     if (ini->FindVar(_L("Release6Configurability"),
   188     if (ini->FindVar(_L("Release6Configurability"),
   184     				 _L("DiscardType0_Class2Message"), status))
   189     				 _L("DiscardType0_Class2Message"), status))
   185     	{
   190     	{
   186         iConfigDiscardingType0Class2 = status;
   191         iConfigDiscardingType0Class2 = status;
   187         }
   192         }
   188 
   193 
   189 	LOGSMSPROT2("CSmsStoreRead::ReadConfigurableSmsSettingsL(): iConfigDiscardingType0Class2=%d",
   194 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSTOREREAD_READCONFIGURABLESMSSETTINGSL_4, "CSmsStoreRead::ReadConfigurableSmsSettingsL(): iConfigDiscardingType0Class2=%d",iConfigDiscardingType0Class2);
   190 				iConfigDiscardingType0Class2);
       
   191 
   195 
   192     if (ini->FindVar(_L("Release6Configurability"),
   196     if (ini->FindVar(_L("Release6Configurability"),
   193     				 _L("DiscardType0_Class0Message"), status))
   197     				 _L("DiscardType0_Class0Message"), status))
   194     	{
   198     	{
   195         iConfigDiscardingType0Class0 = status;
   199         iConfigDiscardingType0Class0 = status;
   196         }
   200         }
   197 
   201 
   198 	LOGSMSPROT2("CSmsStoreRead::ReadConfigurableSmsSettingsL(): iConfigDiscardingType0Class0=%d",
   202 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSTOREREAD_READCONFIGURABLESMSSETTINGSL_5, "CSmsStoreRead::ReadConfigurableSmsSettingsL(): iConfigDiscardingType0Class0=%d",iConfigDiscardingType0Class0);
   199 				iConfigDiscardingType0Class0);
       
   200 
   203 
   201     CleanupStack::PopAndDestroy(ini);
   204     CleanupStack::PopAndDestroy(ini);
   202     } // CSmsStoreRead::ReadConfigurableSmsSettingsL
   205     } // CSmsStoreRead::ReadConfigurableSmsSettingsL
   203 
   206 
   204 
   207 
   209  *  @param aStatus Reguest status
   212  *  @param aStatus Reguest status
   210  *  @param aStoreIndex Index to the store to be read
   213  *  @param aStoreIndex Index to the store to be read
   211  */
   214  */
   212 void CSmsStoreRead::Start( TRequestStatus& aStatus, TInt aStoreIndex )
   215 void CSmsStoreRead::Start( TRequestStatus& aStatus, TInt aStoreIndex )
   213 	{
   216 	{
   214 	LOGSMSPROT1("CSmsStoreRead::Start()");
   217 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSTOREREAD_START_1, "CSmsStoreRead::Start()");
   215 
   218 
   216 	iState = ESmsStoreReadGettingStoreInfo;
   219 	iState = ESmsStoreReadGettingStoreInfo;
   217 	// Initialises current slot index
   220 	// Initialises current slot index
   218 	iCurrentSlotIndex = 0;
   221 	iCurrentSlotIndex = 0;
   219 
   222 
   248  *  @leave Leaves with KErrNotSupported if store has no read access
   251  *  @leave Leaves with KErrNotSupported if store has no read access
   249  *  @leave Panic if complete is called while state is ESmsStoreReadIdle
   252  *  @leave Panic if complete is called while state is ESmsStoreReadIdle
   250  */
   253  */
   251 void CSmsStoreRead::DoRunL()
   254 void CSmsStoreRead::DoRunL()
   252 	{
   255 	{
   253 	LOGSMSPROT2("CSmsStoreRead::DoRunL [iStatus=%d]", iStatus.Int() );
   256 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSTOREREAD_DORUNL_1, "CSmsStoreRead::DoRunL [iStatus=%d]", iStatus.Int() );
   254 
   257 
   255 	TInt status = iStatus.Int();
   258 	TInt status = iStatus.Int();
   256 
   259 
   257 	//status is KErrNotFound or KErrGsmSMSInvalidMemoryIndex if last read entry was empty
   260 	//status is KErrNotFound or KErrGsmSMSInvalidMemoryIndex if last read entry was empty
   258 	//status is KErrCorrupt if the TSY declares a PDU to be corrupt
   261 	//status is KErrCorrupt if the TSY declares a PDU to be corrupt
   313 			{
   316 			{
   314 			if ( iStatus == KErrNone )
   317 			if ( iStatus == KErrNone )
   315 				{
   318 				{
   316 				// Add current message to the list
   319 				// Add current message to the list
   317 				iMobilePhoneGsmSmsList->AddEntryL( iSmsEntry );
   320 				iMobilePhoneGsmSmsList->AddEntryL( iSmsEntry );
   318 				LOGSMSIFSMSENTRY(_L8("SMSENTRY: "), iSmsEntry);
   321 #if (OST_TRACE_CATEGORY & OST_TRACE_CATEGORY_DEBUG)
       
   322                 LogSmsIfSmsEntry(_L8("SMSENTRY: "), iSmsEntry);
       
   323 #endif
   319 				iStoreInfo.iUsedEntries--;
   324 				iStoreInfo.iUsedEntries--;
   320 				}
   325 				}
   321 			// Reads next single message from the store
   326 			// Reads next single message from the store
   322 			ReadNextSlotL();
   327 			ReadNextSlotL();
   323 			}
   328 			}
   359 /**
   364 /**
   360  *  private method for reading one slot from the store
   365  *  private method for reading one slot from the store
   361  */
   366  */
   362 void CSmsStoreRead::ReadNextSlotL()
   367 void CSmsStoreRead::ReadNextSlotL()
   363 	{
   368 	{
   364 	LOGSMSPROT1("CSmsStoreRead::ReadNextSlotL()");
   369 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSTOREREAD_READNEXTSLOTL_1, "CSmsStoreRead::ReadNextSlotL()");
   365 
   370 
   366 	//Increments current slot index
   371 	//Increments current slot index
   367 	iCurrentSlotIndex++;
   372 	iCurrentSlotIndex++;
   368 	// Sets message entry index
   373 	// Sets message entry index
   369 	iSmsEntry.iIndex = iCurrentSlotIndex;
   374 	iSmsEntry.iIndex = iCurrentSlotIndex;
   385 /**
   390 /**
   386  *  private method for process one slot from the entry list
   391  *  private method for process one slot from the entry list
   387  */
   392  */
   388 void CSmsStoreRead::ProcessPduL()
   393 void CSmsStoreRead::ProcessPduL()
   389 	{
   394 	{
   390 	LOGSMSPROT1("CSmsStoreRead::ProcessPduL()");
   395 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSTOREREAD_PROCESSPDUL_1, "CSmsStoreRead::ProcessPduL()");
   391 
   396 
   392 	// Increments slot index
   397 	// Increments slot index
   393 	for ( iCurrentSlotIndex = 0; iCurrentSlotIndex < iMobilePhoneGsmSmsList->Enumerate(); iCurrentSlotIndex++ )
   398 	for ( iCurrentSlotIndex = 0; iCurrentSlotIndex < iMobilePhoneGsmSmsList->Enumerate(); iCurrentSlotIndex++ )
   394 		{
   399 		{
   395 		CSmsPDUProcessor*  pduProcessor = CSmsPDUProcessor::NewL(iSmsComm, iSmsSettings, iReassemblyStore,
   400 		CSmsPDUProcessor*  pduProcessor = CSmsPDUProcessor::NewL(iSmsComm, iSmsSettings, iReassemblyStore,
   414         // is stored as a deliver pdu in the SIM store
   419         // is stored as a deliver pdu in the SIM store
   415         // that is a defect in the modem software of the 9210
   420         // that is a defect in the modem software of the 9210
   416         // but in this case none of the messages have been passed
   421         // but in this case none of the messages have been passed
   417         // to the client, this has been fixed here
   422         // to the client, this has been fixed here
   418 		TRAPD(ret, pduProcessor->DecodeAndProcessPDUL(iSlot, ETrue));
   423 		TRAPD(ret, pduProcessor->DecodeAndProcessPDUL(iSlot, ETrue));
   419 		LOGSMSPROT2("CSmsStoreRead::ProcessPduL(): DecodeAndProcessPDUL() returned %d", ret);
   424 		OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSTOREREAD_PROCESSPDUL_2, "CSmsStoreRead::ProcessPduL(): DecodeAndProcessPDUL() returned %d", ret);
   420 
   425 
   421 		if (ret == KErrNone)
   426 		if (ret == KErrNone)
   422 			{
   427 			{
   423 			if (pduProcessor->IsForwardMessageToClient())
   428 			if (pduProcessor->IsForwardMessageToClient())
   424 				{
   429 				{
   460  *  
   465  *  
   461  *  @leave Panic if complete is called while state is ESmsStoreReadIdle
   466  *  @leave Panic if complete is called while state is ESmsStoreReadIdle
   462  */
   467  */
   463 void CSmsStoreRead::DoCancel()
   468 void CSmsStoreRead::DoCancel()
   464 	{
   469 	{
   465 	LOGSMSPROT1("CSmsStoreRead::DoCancel()");
   470 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSTOREREAD_DOCANCEL_1, "CSmsStoreRead::DoCancel()");
   466 
   471 
   467 	TimedSetActiveCancel();
   472 	TimedSetActiveCancel();
   468 
   473 
   469 	switch (iState)
   474 	switch (iState)
   470 		{
   475 		{
   520  *  @param aStatus a status value
   525  *  @param aStatus a status value
   521  *  @leave Panic if complete is called while state is ESmsStoreReadIdle
   526  *  @leave Panic if complete is called while state is ESmsStoreReadIdle
   522  */
   527  */
   523 void CSmsStoreRead::Complete(TInt aStatus)
   528 void CSmsStoreRead::Complete(TInt aStatus)
   524 	{
   529 	{
   525 	LOGSMSPROT1("CSmsStoreRead::Complete()");
   530 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSSTOREREAD_COMPLETE_1, "CSmsStoreRead::Complete()");
   526 
   531 
   527 	__ASSERT_DEBUG(iState != ESmsStoreReadIdle, SmspPanic(KSmspPanicUnexpectedState));
   532 	__ASSERT_DEBUG(iState != ESmsStoreReadIdle, SmspPanic(KSmspPanicUnexpectedState));
   528 
   533 
   529 	//
   534 	//
   530 	// Close the store if needed...
   535 	// Close the store if needed...
   581 												  CSmsSegmentationStore& aSegmentationStore,
   586 												  CSmsSegmentationStore& aSegmentationStore,
   582 												  RMobilePhone& aGsmPhone,
   587 												  RMobilePhone& aGsmPhone,
   583 												  TInt aPriority,
   588 												  TInt aPriority,
   584 												  CSmsMonitorDiskSpace& aSmsMonitorDiskSpace )
   589 												  CSmsMonitorDiskSpace& aSmsMonitorDiskSpace )
   585 	{
   590 	{
   586 	LOGSMSPROT1("CSmsPhoneEnumeration::NewL()");
   591 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPHONEENUMERATION_NEWL_1, "CSmsPhoneEnumeration::NewL()");
   587 
   592 
   588 	CSmsPhoneEnumeration* smsPhoneEnumeration =
   593 	CSmsPhoneEnumeration* smsPhoneEnumeration =
   589 		new ( ELeave ) CSmsPhoneEnumeration( aSmsComm,
   594 		new ( ELeave ) CSmsPhoneEnumeration( aSmsComm,
   590 											 aSmsSettings,
   595 											 aSmsSettings,
   591 											 aGsmPhone,
   596 											 aGsmPhone,
   636  *  Calls Initialise method from RMobilePhone object
   641  *  Calls Initialise method from RMobilePhone object
   637  *  Sets timed active
   642  *  Sets timed active
   638  */
   643  */
   639 void CSmsPhoneEnumeration::Start()
   644 void CSmsPhoneEnumeration::Start()
   640 	{
   645 	{
   641 	LOGSMSPROT1("CSmsPhoneEnumeration::Start()");
   646 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPHONEENUMERATION_START_1, "CSmsPhoneEnumeration::Start()");
   642 
   647 
   643 	iState = ESmsPhoneEnumerationInitializing;
   648 	iState = ESmsPhoneEnumerationInitializing;
   644 	iCurrentStore = 0;
   649 	iCurrentStore = 0;
   645 	iGsmPhone.Initialise( iStatus );
   650 	iGsmPhone.Initialise( iStatus );
   646 	TimedSetActive( iSmsSettings.Timeout() );
   651 	TimedSetActive( iSmsSettings.Timeout() );
   666  *  @leave Leaves if there was an error
   671  *  @leave Leaves if there was an error
   667  *  @leave Panic if called while state is ESmsPhoneEnumerationIdle
   672  *  @leave Panic if called while state is ESmsPhoneEnumerationIdle
   668  */
   673  */
   669 void CSmsPhoneEnumeration::DoRunL()
   674 void CSmsPhoneEnumeration::DoRunL()
   670 	{
   675 	{
   671 	LOGSMSPROT3("CSmsPhoneEnumeration::RunL [iStatus=%d], [iState=%d]", iStatus.Int(), iState );
   676 	OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPHONEENUMERATION_DORUNL_1, "CSmsPhoneEnumeration::RunL [iStatus=%d], [iState=%d]", iStatus.Int(), iState );
   672 
   677 
   673     switch (iState)
   678     switch (iState)
   674 		{
   679 		{
   675 		case ESmsPhoneEnumerationInitializing:
   680 		case ESmsPhoneEnumerationInitializing:
   676 			{
   681 			{
   714 	} // CSmsPhoneEnumeration::DoRunL
   719 	} // CSmsPhoneEnumeration::DoRunL
   715 
   720 
   716 
   721 
   717 void CSmsPhoneEnumeration::DoCancel()
   722 void CSmsPhoneEnumeration::DoCancel()
   718 	{
   723 	{
   719 	LOGSMSPROT1("CSmsPhoneEnumeration::DoCancel()");
   724 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPHONEENUMERATION_DOCANCEL_1, "CSmsPhoneEnumeration::DoCancel()");
   720 
   725 
   721 	TimedSetActiveCancel();
   726 	TimedSetActiveCancel();
   722 
   727 
   723 	switch (iState)
   728 	switch (iState)
   724 		{
   729 		{
   760 /**
   765 /**
   761  *  Creates instances to the classes CSmsTimeout and CSmsStoreRead
   766  *  Creates instances to the classes CSmsTimeout and CSmsStoreRead
   762  */
   767  */
   763 void CSmsPhoneEnumeration::ConstructL(CFacadeSmsReassemblyStore& aReassemblyStore,CSmsSegmentationStore& aSegmentationStore,CSmsMonitorDiskSpace& aSmsMonitorDiskSpace)
   768 void CSmsPhoneEnumeration::ConstructL(CFacadeSmsReassemblyStore& aReassemblyStore,CSmsSegmentationStore& aSegmentationStore,CSmsMonitorDiskSpace& aSmsMonitorDiskSpace)
   764 	{
   769 	{
   765 	LOGSMSPROT1("CSmsPhoneEnumeration::ConstructL()");
   770 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPHONEENUMERATION_CONSTRUCTL_1, "CSmsPhoneEnumeration::ConstructL()");
   766 
   771 
   767 	iSmsStoreRead = CSmsStoreRead::NewL(iSmsComm, iSmsSettings, iSmsMessaging, aReassemblyStore, aSegmentationStore, Priority(), aSmsMonitorDiskSpace);
   772 	iSmsStoreRead = CSmsStoreRead::NewL(iSmsComm, iSmsSettings, iSmsMessaging, aReassemblyStore, aSegmentationStore, Priority(), aSmsMonitorDiskSpace);
   768 	ConstructTimeoutL();
   773 	ConstructTimeoutL();
   769 	} // CSmsPhoneEnumeration::ConstructL
   774 	} // CSmsPhoneEnumeration::ConstructL
   770 
   775 
   771 
   776 
   772 void CSmsPhoneEnumeration::Complete(TInt aStatus)
   777 void CSmsPhoneEnumeration::Complete(TInt aStatus)
   773 	{
   778 	{
   774 	LOGSMSPROT2("CSmsPhoneEnumeration::Complete [aStatus=%d]", aStatus);
   779 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPHONEENUMERATION_COMPLETE_1, "CSmsPhoneEnumeration::Complete [aStatus=%d]", aStatus);
   775 
   780 
   776 	//
   781 	//
   777 	// Call the base function to perform the actual complete...
   782 	// Call the base function to perform the actual complete...
   778 	//
   783 	//
   779 	CSmsuActiveBase::Complete(aStatus);
   784 	CSmsuActiveBase::Complete(aStatus);
   801 CSmsMessageWrite* CSmsMessageWrite::NewL( MSmsComm& aSmsComm, const TSmsSettings& aSmsSettings,
   806 CSmsMessageWrite* CSmsMessageWrite::NewL( MSmsComm& aSmsComm, const TSmsSettings& aSmsSettings,
   802 										  RMobilePhone& aGsmPhone,
   807 										  RMobilePhone& aGsmPhone,
   803 										  CSmsSegmentationStore& aSegmentationStore
   808 										  CSmsSegmentationStore& aSegmentationStore
   804 										  )
   809 										  )
   805 	{
   810 	{
   806 	LOGSMSPROT1("CSmsMessageWrite::NewL()");
   811 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGEWRITE_NEWL_1, "CSmsMessageWrite::NewL()");
   807 
   812 
   808 	CSmsMessageWrite* smsMessageWrite = new (ELeave) CSmsMessageWrite(aSmsComm, aSmsSettings,
   813 	CSmsMessageWrite* smsMessageWrite = new (ELeave) CSmsMessageWrite(aSmsComm, aSmsSettings,
   809 																	  aGsmPhone,
   814 																	  aGsmPhone,
   810 																	  aSegmentationStore);
   815 																	  aSegmentationStore);
   811 	CleanupStack::PushL(smsMessageWrite);
   816 	CleanupStack::PushL(smsMessageWrite);
   818 /**
   823 /**
   819  *  Destructor
   824  *  Destructor
   820  */
   825  */
   821 CSmsMessageWrite::~CSmsMessageWrite()
   826 CSmsMessageWrite::~CSmsMessageWrite()
   822 	{
   827 	{
   823 	LOGSMSPROT1("CSmsMessageWrite::~CSmsMessageWrite()");
   828 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGEWRITE_DTOR_1, "CSmsMessageWrite::~CSmsMessageWrite()");
   824 
   829 
   825 	Cancel();
   830 	Cancel();
   826 	iSmsStorage.Close();
   831 	iSmsStorage.Close();
   827 	iSmsMessaging.Close();
   832 	iSmsMessaging.Close();
   828 	} // CSmsMessageWrite::~CSmsMessageWrite
   833 	} // CSmsMessageWrite::~CSmsMessageWrite
   837 
   842 
   838 	iState = ESmsMessageWriteInitializing;
   843 	iState = ESmsMessageWriteInitializing;
   839 
   844 
   840 
   845 
   841 	iSmsMessage = aSmsMessage;
   846 	iSmsMessage = aSmsMessage;
   842     LOGSMSPROT3("CSmsMessageWrite::Start  Storage=[%d]   Type=[%d]", iSmsMessage->Storage(), iSmsMessage->Type());
   847     OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGEWRITE_START_1, "CSmsMessageWrite::Start  Storage=[%d]   Type=[%d]", iSmsMessage->Storage(), iSmsMessage->Type());
   843 	iCurrentStore = 0;
   848 	iCurrentStore = 0;
   844 	iStoreInfo.iName = KNullDesC;
   849 	iStoreInfo.iName = KNullDesC;
   845 
   850 
   846 	switch (iSmsMessage->Storage())
   851 	switch (iSmsMessage->Storage())
   847 		{
   852 		{
   908 	} // CSmsMessageWrite::Start
   913 	} // CSmsMessageWrite::Start
   909 
   914 
   910 
   915 
   911 void CSmsMessageWrite::DoRunL()
   916 void CSmsMessageWrite::DoRunL()
   912 	{
   917 	{
   913 	LOGSMSPROT3("CSmsMessageWrite::DoRunL [iStatus=%d iState=%d]", iStatus.Int() , iState);
   918 	OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGEWRITE_DORUNL_1, "CSmsMessageWrite::DoRunL [iStatus=%d iState=%d]", iStatus.Int() , iState);
   914 
   919 
   915 	switch (iState)
   920 	switch (iState)
   916 		{
   921 		{
   917 		case ESmsMessageWriteInitializing:
   922 		case ESmsMessageWriteInitializing:
   918 			{
   923 			{
   935 				{
   940 				{
   936 				if (iStoreInfo.iName == iSlot.iStore)
   941 				if (iStoreInfo.iName == iSlot.iStore)
   937 					{
   942 					{
   938 					if ((iStoreInfo.iCaps & RMobilePhoneStore::KCapsWriteAccess) == 0)
   943 					if ((iStoreInfo.iCaps & RMobilePhoneStore::KCapsWriteAccess) == 0)
   939 						{
   944 						{
   940                         LOGSMSPROT2("CSmsMessageWrite::DoRunL left with KErrNotSuported [iState=%d]", iState);
   945                         OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGEWRITE_DORUNL_2, "CSmsMessageWrite::DoRunL left with KErrNotSuported [iState=%d]", iState);
   941 						User::Leave(KErrNotSupported);
   946 						User::Leave(KErrNotSupported);
   942 						}
   947 						}
   943 
   948 
   944 					iState = ESmsMessageWriteWritingPDUs;
   949 					iState = ESmsMessageWriteWritingPDUs;
   945 					SegmentMessageL();
   950 					SegmentMessageL();
   953 	 					iSmsMessaging.GetMessageStoreInfo(iStatus, iCurrentStore, iStoreInfoPckg);
   958 	 					iSmsMessaging.GetMessageStoreInfo(iStatus, iCurrentStore, iStoreInfoPckg);
   954 						TimedSetActive(iSmsSettings.Timeout());
   959 						TimedSetActive(iSmsSettings.Timeout());
   955 						}
   960 						}
   956 					else
   961 					else
   957 						{
   962 						{
   958                         LOGSMSPROT2("CSmsMessageWrite::DoRunL left with KErrNotFound [iState=%d]", iState);            
   963                         OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGEWRITE_DORUNL_3, "CSmsMessageWrite::DoRunL left with KErrNotFound [iState=%d]", iState);
   959 						User::Leave(KErrNotFound);
   964 						User::Leave(KErrNotFound);
   960 						}
   965 						}
   961 					}
   966 					}
   962 				}
   967 				}
   963 			}
   968 			}
   997 	} // CSmsMessageWrite::DoRunL
  1002 	} // CSmsMessageWrite::DoRunL
   998 
  1003 
   999 
  1004 
  1000 void CSmsMessageWrite::DoCancel()
  1005 void CSmsMessageWrite::DoCancel()
  1001 	{
  1006 	{
  1002 	LOGSMSPROT1("CSmsMessageWrite::DoCancel()");
  1007 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGEWRITE_DOCANCEL_1, "CSmsMessageWrite::DoCancel()");
  1003 
  1008 
  1004 	TimedSetActiveCancel();
  1009 	TimedSetActiveCancel();
  1005 
  1010 
  1006 	switch (iState)
  1011 	switch (iState)
  1007 		{
  1012 		{
  1056 	iStoreInfoPckg (iStoreInfo),
  1061 	iStoreInfoPckg (iStoreInfo),
  1057 	iWriteEntryV1Pckg(iEntryToWrite),
  1062 	iWriteEntryV1Pckg(iEntryToWrite),
  1058 	iSegmentationStore(aSegmentationStore),
  1063 	iSegmentationStore(aSegmentationStore),
  1059 	iSmsArray(8)
  1064 	iSmsArray(8)
  1060 	{
  1065 	{
  1061 	LOGSMSPROT1("CSmsMessageWrite::CSmsMessageWrite()");
  1066 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGEWRITE_CTOR_1, "CSmsMessageWrite::CSmsMessageWrite()");
  1062 
  1067 
  1063 	} // CSmsMessageWrite::CSmsMessageWrite
  1068 	} // CSmsMessageWrite::CSmsMessageWrite
  1064 
  1069 
  1065 
  1070 
  1066 void CSmsMessageWrite::ConstructL()
  1071 void CSmsMessageWrite::ConstructL()
  1067 	{
  1072 	{
  1068 	LOGSMSPROT1("CSmsMessageWrite::ConstructL()");
  1073 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGEWRITE_CONSTRUCTL_1, "CSmsMessageWrite::ConstructL()");
  1069 
  1074 
  1070 	ConstructTimeoutL();
  1075 	ConstructTimeoutL();
  1071 	} // CSmsMessageWrite::ConstructL
  1076 	} // CSmsMessageWrite::ConstructL
  1072 
  1077 
  1073 
  1078 
  1074 void CSmsMessageWrite::SegmentMessageL()
  1079 void CSmsMessageWrite::SegmentMessageL()
  1075 	{
  1080 	{
  1076 	LOGSMSPROT1("CSmsMessageWrite::SegmentMessageL()");
  1081 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGEWRITE_SEGMENTMESSAGEL_1, "CSmsMessageWrite::SegmentMessageL()");
  1077 
  1082 
  1078 	if (iStoreInfo.iTotalEntries == iStoreInfo.iUsedEntries)
  1083 	if (iStoreInfo.iTotalEntries == iStoreInfo.iUsedEntries)
  1079 		{
  1084 		{
  1080 		User::Leave(KErrNoMemory);
  1085 		User::Leave(KErrNoMemory);
  1081 		}
  1086 		}
  1115 	} // CSmsMessageWrite::SegmentMessageL
  1120 	} // CSmsMessageWrite::SegmentMessageL
  1116 
  1121 
  1117 
  1122 
  1118 void CSmsMessageWrite::WriteNextSlot()
  1123 void CSmsMessageWrite::WriteNextSlot()
  1119 	{
  1124 	{
  1120 	LOGSMSPROT1("CSmsMessageWrite::WriteNextSlot()");
  1125 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGEWRITE_WRITENEXTSLOT_1, "CSmsMessageWrite::WriteNextSlot()");
  1121 
  1126 
  1122 	if (iSmsArray.Count()>0)
  1127 	if (iSmsArray.Count()>0)
  1123 		{
  1128 		{
  1124 		iState=ESmsMessageWriteWritingPDUs;
  1129 		iState=ESmsMessageWriteWritingPDUs;
  1125 		//Set PDU to the slot
  1130 		//Set PDU to the slot
  1139 	} // CSmsMessageWrite::WriteNextSlot
  1144 	} // CSmsMessageWrite::WriteNextSlot
  1140 
  1145 
  1141 
  1146 
  1142 void CSmsMessageWrite::Complete(TInt aStatus)
  1147 void CSmsMessageWrite::Complete(TInt aStatus)
  1143 	{
  1148 	{
  1144 	LOGSMSPROT2("CSmsMessageWrite::Complete [aStatus=%d]", aStatus);
  1149 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSMESSAGEWRITE_COMPLETE_1, "CSmsMessageWrite::Complete [aStatus=%d]", aStatus);
  1145 
  1150 
  1146 	__ASSERT_DEBUG(iState != ESmsMessageWriteIdle, SmspPanic(KSmspPanicUnexpectedState));
  1151 	__ASSERT_DEBUG(iState != ESmsMessageWriteIdle, SmspPanic(KSmspPanicUnexpectedState));
  1147 
  1152 
  1148 	//
  1153 	//
  1149 	// Finish up...
  1154 	// Finish up...