smsprotocols/smsstack/smsprot/Src/smsppara.cpp
branchRCL_3
changeset 65 630d2f34d719
parent 0 3553901f7fa8
child 66 07a122eea281
equal deleted inserted replaced
61:17af172ffa5f 65:630d2f34d719
     1 // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2001-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".
    12 //
    12 //
    13 // Description:
    13 // Description:
    14 //
    14 //
    15 
    15 
    16 
    16 
       
    17 
       
    18 #include "OstTraceDefinitions.h"
       
    19 #ifdef OST_TRACE_COMPILER_IN_USE
       
    20 #include "smspparaTraces.h"
       
    21 #endif
       
    22 
    17 #include "smsppara.h"
    23 #include "smsppara.h"
    18 #include "smsuset.h"
    24 #include "smsuset.h"
    19 #include "smsulog.h"
    25 #include "smsulog.h"
    20 #include "smspmain.h"
    26 #include "smspmain.h"
    21 
    27 
    48  *  Creates CSmsTimeout object.
    54  *  Creates CSmsTimeout object.
    49  *  
    55  *  
    50  */
    56  */
    51 void CSmsParamsBase::ConstructL()
    57 void CSmsParamsBase::ConstructL()
    52 	{
    58 	{
    53 	LOGSMSPROT1("CSmsParamsBase::ConstructL()");
    59 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSPARAMSBASE_CONSTRUCTL_1, "CSmsParamsBase::ConstructL()");
    54 
    60 
    55 	ConstructTimeoutL();
    61 	ConstructTimeoutL();
    56 	} // CSmsParamsBase::ConstructL
    62 	} // CSmsParamsBase::ConstructL
    57 
    63 
    58 
    64 
    66  *  @return a new CSmsReadParams object.
    72  *  @return a new CSmsReadParams object.
    67  *  
    73  *  
    68  */
    74  */
    69 CSmsReadParams* CSmsReadParams::NewL(MSmsComm& aSmsComm,const TSmsSettings& aSmsSettings,RMobileSmsMessaging& aSmsMessaging)
    75 CSmsReadParams* CSmsReadParams::NewL(MSmsComm& aSmsComm,const TSmsSettings& aSmsSettings,RMobileSmsMessaging& aSmsMessaging)
    70 	{
    76 	{
    71 	LOGSMSPROT1("CSmsReadParams::NewL()");
    77 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREADPARAMS_NEWL_1, "CSmsReadParams::NewL()");
    72 
    78 
    73 	CSmsReadParams* smsReadParams=new(ELeave) CSmsReadParams(aSmsComm,aSmsSettings,aSmsMessaging);
    79 	CSmsReadParams* smsReadParams=new(ELeave) CSmsReadParams(aSmsComm,aSmsSettings,aSmsMessaging);
    74 	CleanupStack::PushL(smsReadParams);
    80 	CleanupStack::PushL(smsReadParams);
    75 	smsReadParams->ConstructL();
    81 	smsReadParams->ConstructL();
    76 	CleanupStack::Pop(smsReadParams);
    82 	CleanupStack::Pop(smsReadParams);
   113  *  
   119  *  
   114  *  @param aObserver a reference to the observer object.
   120  *  @param aObserver a reference to the observer object.
   115  */
   121  */
   116 void CSmsReadParams::Start(MSmsMessageObserver& aObserver)
   122 void CSmsReadParams::Start(MSmsMessageObserver& aObserver)
   117 	{
   123 	{
   118 	LOGSMSPROT1("CSmsReadParams::Start()");
   124 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREADPARAMS_START_1, "CSmsReadParams::Start()");
   119 
   125 
   120 	__ASSERT_DEBUG(iSmsMessageObserver == NULL  &&  iReport == NULL,
   126 	__ASSERT_DEBUG(iSmsMessageObserver == NULL  &&  iReport == NULL,
   121 				   SmspPanic(KSmspPanicUnexpectedState));
   127 				   SmspPanic(KSmspPanicUnexpectedState));
   122 
   128 
   123 	//
   129 	//
   153  *  
   159  *  
   154  *  @param aStatus a reference to the outstanding request.
   160  *  @param aStatus a reference to the outstanding request.
   155  */
   161  */
   156 void CSmsReadParams::Start(TRequestStatus& aStatus)
   162 void CSmsReadParams::Start(TRequestStatus& aStatus)
   157 	{
   163 	{
   158 	LOGSMSPROT1("CSmsReadParams::Start()");
   164 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREADPARAMS_START1_1, "CSmsReadParams::Start()");
   159 
   165 
   160 	__ASSERT_DEBUG(iSmsMessageObserver == NULL  &&  iReport == NULL,
   166 	__ASSERT_DEBUG(iSmsMessageObserver == NULL  &&  iReport == NULL,
   161 				   SmspPanic(KSmspPanicUnexpectedState));
   167 				   SmspPanic(KSmspPanicUnexpectedState));
   162 
   168 
   163 	//
   169 	//
   179  *  
   185  *  
   180  *  @leave Leave if RetrieveListL() leaves.
   186  *  @leave Leave if RetrieveListL() leaves.
   181  */
   187  */
   182 void CSmsReadParams::DoRunL()
   188 void CSmsReadParams::DoRunL()
   183 	{
   189 	{
   184 	LOGSMSPROT2("CSmsReadParams::RunL [iStatus=%d]", iStatus.Int() );
   190 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREADPARAMS_DORUNL_1, "CSmsReadParams::RunL [iStatus=%d]", iStatus.Int() );
   185 
   191 
   186 	//
   192 	//
   187 	// If the start retrieve was successful, then continue retrieving the list.
   193 	// If the start retrieve was successful, then continue retrieving the list.
   188 	// A temporary variable is used to keep the old list until the new one is
   194 	// A temporary variable is used to keep the old list until the new one is
   189 	// obtained successfully.
   195 	// obtained successfully.
   210  *  Cancel also retrieving of parameters process.
   216  *  Cancel also retrieving of parameters process.
   211  *  Call complete.
   217  *  Call complete.
   212  */
   218  */
   213 void CSmsReadParams::DoCancel()
   219 void CSmsReadParams::DoCancel()
   214 	{
   220 	{
   215 	LOGSMSPROT1("CSmsReadParams::DoCancel()");
   221 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREADPARAMS_DOCANCEL_1, "CSmsReadParams::DoCancel()");
   216 
   222 
   217 	TimedSetActiveCancel();
   223 	TimedSetActiveCancel();
   218 
   224 
   219 	//
   225 	//
   220 	// Cancel the request...
   226 	// Cancel the request...
   256  *  Creates CRetrieveMobilePhoneSmspList object.
   262  *  Creates CRetrieveMobilePhoneSmspList object.
   257  *  
   263  *  
   258  */
   264  */
   259 void CSmsReadParams::ConstructL()
   265 void CSmsReadParams::ConstructL()
   260 	{
   266 	{
   261 	LOGSMSPROT1("CSmsReadParams::ConstructL()");
   267 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREADPARAMS_CONSTRUCTL_1, "CSmsReadParams::ConstructL()");
   262 
   268 
   263 	CSmsParamsBase::ConstructL();
   269 	CSmsParamsBase::ConstructL();
   264 
   270 
   265 	iRetrieveMobilePhoneSmspList = CRetrieveMobilePhoneSmspList::NewL(iSmsMessaging);
   271 	iRetrieveMobilePhoneSmspList = CRetrieveMobilePhoneSmspList::NewL(iSmsMessaging);
   266 	} // CSmsReadParams::ConstructL
   272 	} // CSmsReadParams::ConstructL
   275  *  @leave Leave if aMobilePhoneSmspList object contains too many SMSP sets.
   281  *  @leave Leave if aMobilePhoneSmspList object contains too many SMSP sets.
   276  *  
   282  *  
   277  */
   283  */
   278 void CSmsReadParams::CheckListValidityL(CMobilePhoneSmspList& aMobilePhoneSmspList)
   284 void CSmsReadParams::CheckListValidityL(CMobilePhoneSmspList& aMobilePhoneSmspList)
   279 	{
   285 	{
   280 	LOGSMSPROT1("CSmsReadParams::CheckListValidityL()");
   286 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREADPARAMS_CHECKLISTVALIDITYL_1, "CSmsReadParams::CheckListValidityL()");
   281 
   287 
   282 	//
   288 	//
   283 	// MaxNumberEntries method returns the maximum number of entries that can
   289 	// MaxNumberEntries method returns the maximum number of entries that can
   284 	// be stored in this list. This attribute is required because most phone-side
   290 	// be stored in this list. This attribute is required because most phone-side
   285 	// storage will have an upper storage limit. If the TSY has not set this
   291 	// storage will have an upper storage limit. If the TSY has not set this
   306  *  @param aMobilePhoneSmspList a reference to the CMobilePhoneSmspList object.
   312  *  @param aMobilePhoneSmspList a reference to the CMobilePhoneSmspList object.
   307  *  
   313  *  
   308  */
   314  */
   309 void CSmsReadParams::StoreParameters(CMobilePhoneSmspList* aMobilePhoneSmspList)
   315 void CSmsReadParams::StoreParameters(CMobilePhoneSmspList* aMobilePhoneSmspList)
   310 	{
   316 	{
   311 	LOGSMSPROT1("CSmsReadParams::StoreParameters()");
   317 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREADPARAMS_STOREPARAMETERS_1, "CSmsReadParams::StoreParameters()");
   312 
   318 
   313 	__ASSERT_DEBUG(iMobilePhoneSmspList != NULL && aMobilePhoneSmspList != NULL && iMobilePhoneSmspList->MaxNumberEntries() == aMobilePhoneSmspList->MaxNumberEntries(),SmspPanic(KSmspPanicCorruptedSmspList));
   319 	__ASSERT_DEBUG(iMobilePhoneSmspList != NULL && aMobilePhoneSmspList != NULL && iMobilePhoneSmspList->MaxNumberEntries() == aMobilePhoneSmspList->MaxNumberEntries(),SmspPanic(KSmspPanicCorruptedSmspList));
   314 
   320 
   315 	delete iMobilePhoneSmspList;
   321 	delete iMobilePhoneSmspList;
   316 	iMobilePhoneSmspList = aMobilePhoneSmspList;
   322 	iMobilePhoneSmspList = aMobilePhoneSmspList;
   326  *  @param aStatus a status value.
   332  *  @param aStatus a status value.
   327  *  
   333  *  
   328  */
   334  */
   329 void CSmsReadParams::Complete(TInt aStatus)
   335 void CSmsReadParams::Complete(TInt aStatus)
   330 	{
   336 	{
   331 	LOGSMSPROT1("CSmsReadParams::Complete()");
   337 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSREADPARAMS_COMPLETE_1, "CSmsReadParams::Complete()");
   332 
   338 
   333 	//
   339 	//
   334 	// Call the base function to perform the actual complete...
   340 	// Call the base function to perform the actual complete...
   335 	//
   341 	//
   336 	CSmsuActiveBase::Complete(aStatus);
   342 	CSmsuActiveBase::Complete(aStatus);
   355  *  @return a new CSmsReadParams object.
   361  *  @return a new CSmsReadParams object.
   356  *  
   362  *  
   357  */
   363  */
   358 CSmsWriteParams* CSmsWriteParams::NewL(MSmsComm& aSmsComm,const TSmsSettings& aSmsSettings,RMobileSmsMessaging& aSmsMessaging,CSmsReadParams& aSmsReadParams)
   364 CSmsWriteParams* CSmsWriteParams::NewL(MSmsComm& aSmsComm,const TSmsSettings& aSmsSettings,RMobileSmsMessaging& aSmsMessaging,CSmsReadParams& aSmsReadParams)
   359 	{
   365 	{
   360 	LOGSMSPROT1("CSmsWriteParams::NewL()");
   366 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSWRITEPARAMS_NEWL_1, "CSmsWriteParams::NewL()");
   361 
   367 
   362 	CSmsWriteParams* smsWriteParams=new(ELeave) CSmsWriteParams(aSmsComm,aSmsSettings,aSmsMessaging,aSmsReadParams);
   368 	CSmsWriteParams* smsWriteParams=new(ELeave) CSmsWriteParams(aSmsComm,aSmsSettings,aSmsMessaging,aSmsReadParams);
   363 	CleanupStack::PushL(smsWriteParams);
   369 	CleanupStack::PushL(smsWriteParams);
   364 	smsWriteParams->ConstructL();
   370 	smsWriteParams->ConstructL();
   365 	CleanupStack::Pop(smsWriteParams);
   371 	CleanupStack::Pop(smsWriteParams);
   394  *  @param aMobilePhoneSmspList a pointer to SMSP list to be saved.
   400  *  @param aMobilePhoneSmspList a pointer to SMSP list to be saved.
   395  *  
   401  *  
   396  */
   402  */
   397 void CSmsWriteParams::Start(MSmsMessageObserver& aObserver,CMobilePhoneSmspList* aMobilePhoneSmspList)
   403 void CSmsWriteParams::Start(MSmsMessageObserver& aObserver,CMobilePhoneSmspList* aMobilePhoneSmspList)
   398 	{
   404 	{
   399 	LOGSMSPROT1("CSmsWriteParams::Start()");
   405 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSWRITEPARAMS_START_1, "CSmsWriteParams::Start()");
   400 
   406 
   401 	__ASSERT_DEBUG(iState==ESmsParamsIdle,SmspPanic(KSmspPanicUnexpectedState));
   407 	__ASSERT_DEBUG(iState==ESmsParamsIdle,SmspPanic(KSmspPanicUnexpectedState));
   402 	
   408 	
   403 	iState = ESmsParamsStoringList;
   409 	iState = ESmsParamsStoringList;
   404 
   410 
   433  *  @leave Panic if RunL is called while object is in idle state.
   439  *  @leave Panic if RunL is called while object is in idle state.
   434  *  
   440  *  
   435  */
   441  */
   436 void CSmsWriteParams::DoRunL()
   442 void CSmsWriteParams::DoRunL()
   437 	{
   443 	{
   438 	LOGSMSPROT2("CSmsWriteParams::DoRunL [iStatus=%d]", iStatus.Int() );
   444 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSWRITEPARAMS_DORUNL_1, "CSmsWriteParams::DoRunL [iStatus=%d]", iStatus.Int() );
   439 
   445 
   440 	switch (iState)
   446 	switch (iState)
   441 		{
   447 		{
   442 		case ESmsParamsStoringList:
   448 		case ESmsParamsStoringList:
   443 			{
   449 			{
   495  *  if they are running.
   501  *  if they are running.
   496  *  
   502  *  
   497  */
   503  */
   498 void CSmsWriteParams::DoCancel()
   504 void CSmsWriteParams::DoCancel()
   499 	{
   505 	{
   500 	LOGSMSPROT1("CSmsWriteParams::DoCancel()");
   506 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSWRITEPARAMS_DOCANCEL_1, "CSmsWriteParams::DoCancel()");
   501 
   507 
   502 	TimedSetActiveCancel();
   508 	TimedSetActiveCancel();
   503 
   509 
   504 	switch (iState)
   510 	switch (iState)
   505 		{
   511 		{
   560  *  Creates CSmsuTimeout object.
   566  *  Creates CSmsuTimeout object.
   561  *  
   567  *  
   562  */
   568  */
   563 void CSmsWriteParams::ConstructL()
   569 void CSmsWriteParams::ConstructL()
   564 	{
   570 	{
   565 	LOGSMSPROT1("CSmsWriteParams::ConstructL()");
   571 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSWRITEPARAMS_CONSTRUCTL_1, "CSmsWriteParams::ConstructL()");
   566 
   572 
   567 	CSmsParamsBase::ConstructL();
   573 	CSmsParamsBase::ConstructL();
   568 	} // CSmsWriteParams::ConstructL
   574 	} // CSmsWriteParams::ConstructL
   569 
   575 
   570 
   576 
   578  *  @leave Panic if Complete is called while object is in ESmsParamsIdle state.
   584  *  @leave Panic if Complete is called while object is in ESmsParamsIdle state.
   579  *  
   585  *  
   580  */
   586  */
   581 void CSmsWriteParams::Complete(TInt aStatus)
   587 void CSmsWriteParams::Complete(TInt aStatus)
   582 	{
   588 	{
   583 	LOGSMSPROT1("CSmsWriteParams::Complete()");
   589 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSMSWRITEPARAMS_COMPLETE_1, "CSmsWriteParams::Complete()");
   584 
   590 
   585 	//
   591 	//
   586 	// Call the base function to perform the actual complete...
   592 	// Call the base function to perform the actual complete...
   587 	//
   593 	//
   588 	CSmsuActiveBase::Complete(aStatus);
   594 	CSmsuActiveBase::Complete(aStatus);