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