cbsref/telephonyrefplugins/atltsy/integrationtest/src/testltsysmsbase.cpp
branchRCL_3
changeset 20 07a122eea281
parent 19 630d2f34d719
child 21 4814c5a49428
equal deleted inserted replaced
19:630d2f34d719 20:07a122eea281
     1 // Copyright (c) 2008-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 // Implementation of the Class CTestLtsySmsBase
       
    15 // 
       
    16 //
       
    17 
       
    18 // user include
       
    19 #include "testltsysmsbase.h"
       
    20 #include "testltsysmsshareddata.h"
       
    21 
       
    22 //const define
       
    23 _LIT16(KPhoneTSY, "phonetsy");
       
    24 
       
    25 
       
    26 /**
       
    27  * Constructor
       
    28  * 
       
    29  */
       
    30 CTestLtsySmsBase::CTestLtsySmsBase(CTestLtsyModel& aTestModel):
       
    31                                    iModel(aTestModel)
       
    32 	{
       
    33 	}
       
    34 
       
    35 /**
       
    36  * Destructor
       
    37  *
       
    38  */
       
    39 CTestLtsySmsBase::~CTestLtsySmsBase()
       
    40 	{
       
    41 
       
    42 	}
       
    43 
       
    44 TVerdict CTestLtsySmsBase::doTestStepPreambleL()
       
    45 	{
       
    46 	OpenPhoneL();
       
    47 	
       
    48 	if (TestStepResult() == EPass)
       
    49 		{
       
    50 		GetIndex();
       
    51 		}
       
    52 
       
    53 	return TestStepResult();
       
    54 	}
       
    55 
       
    56 TVerdict CTestLtsySmsBase::doTestStepPostambleL()
       
    57 	{
       
    58 	return TestStepResult();
       
    59 	}
       
    60 
       
    61 /**
       
    62  * Get sms message number
       
    63  * 
       
    64  */
       
    65 void CTestLtsySmsBase::GetIndex()
       
    66 	{
       
    67 	iIndexNum = 0;
       
    68 	iStoreIndex = 0;
       
    69 	}
       
    70 
       
    71 void CTestLtsySmsBase::OpenPhoneL()
       
    72 	{
       
    73 	INFO_PRINTF1(_L("starting opne phone"));
       
    74 		
       
    75 	if (!iModel.SharedEnv().PhoneOpened())
       
    76 		{
       
    77 		iModel.SharedEnv().OpenPhoneL(KPhoneTSY);
       
    78 		}
       
    79 	}
       
    80 /**
       
    81  * Open sms message
       
    82  * 
       
    83  */
       
    84 void CTestLtsySmsBase::OpenSmsL()
       
    85 	{
       
    86 	RMobileSmsMessaging smsMsg;
       
    87 	iModel.SmsSharedData().SmsMessagingArray().AppendL(smsMsg);
       
    88     
       
    89 	iIndexNum = iModel.SmsSharedData().SmsMessagingArray().Count()-1;
       
    90     
       
    91 	TInt ret( KErrNone );
       
    92     ret = Sms().Open(iModel.SharedEnv().Phone());
       
    93 	if (KErrNone != ret)
       
    94 		{
       
    95 		INFO_PRINTF1(_L("Can't open the RMobileSmsMessaging service"));
       
    96 		SetTestStepResult(EFail);
       
    97 		}
       
    98 	}
       
    99 
       
   100 /**
       
   101  * Get the sms object
       
   102  * 
       
   103  */
       
   104 RMobileSmsMessaging& CTestLtsySmsBase::Sms()
       
   105 	{
       
   106 	return iModel.SmsSharedData().SmsMessagingArray()[iIndexNum];
       
   107 	}
       
   108 
       
   109 /**
       
   110  * Get the sms store object
       
   111  * 
       
   112  */
       
   113 RMobileSmsStore& CTestLtsySmsBase::SmsStore()
       
   114 	{
       
   115 	return iModel.SmsSharedData().SmsStoreArray()[iStoreIndex];
       
   116 	}
       
   117 
       
   118 /**
       
   119  * Open sms message store
       
   120  * 
       
   121  */
       
   122 void CTestLtsySmsBase::OpenSmsStoreL()
       
   123 	{
       
   124 	RMobileSmsStore smsStore;
       
   125 	iModel.SmsSharedData().SmsStoreArray().AppendL(smsStore);
       
   126 
       
   127 	iStoreIndex = iModel.SmsSharedData().SmsStoreArray().Count()-1;
       
   128 
       
   129 	TInt ret = SmsStore().Open(Sms(), KETelIccSmsStore);
       
   130 	if (KErrNone != ret)
       
   131 		{
       
   132 		ERR_PRINTF1(_L("Can't open the RMobileSmsStore service"));
       
   133 		SetTestStepResult(EFail);
       
   134 		}
       
   135 	}
       
   136 
       
   137 /**
       
   138  * Close sms
       
   139  */
       
   140 void CTestLtsySmsBase::CloseSmsL()
       
   141 	{
       
   142 	Sms().Close();
       
   143 	iModel.SmsSharedData().SmsMessagingArray().Remove(iIndexNum);
       
   144 	iModel.SmsSharedData().SmsMessagingArray().Compress();
       
   145 	}
       
   146 
       
   147 /**
       
   148  * Close sms store
       
   149  * 
       
   150  */
       
   151 void CTestLtsySmsBase::CloseSmsStoreL()
       
   152 	{
       
   153 	SmsStore().Close();
       
   154 	iModel.SmsSharedData().SmsStoreArray().Remove(iStoreIndex);
       
   155 	iModel.SmsSharedData().SmsStoreArray().Compress();
       
   156 	}
       
   157 
       
   158 // end of file