smsprotocols/smsstack/test/smsstacktestcase.cpp
branchRCL_3
changeset 14 7ef16719d8cb
child 24 6638e7f4bd8f
equal deleted inserted replaced
9:962e6306d9d2 14:7ef16719d8cb
       
     1 // Copyright (c) 1999-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 #include "smsstacktestcase.h"
       
    17 
       
    18 EXPORT_C TTestCase::TTestCase()
       
    19 //
       
    20 // Constructor
       
    21 //
       
    22 	{
       
    23 	CommonInit();
       
    24 	}
       
    25 
       
    26 EXPORT_C TTestCase::TTestCase(const TDesC& aMsg, const TDesC& aMatch)
       
    27 //
       
    28 // Constructor
       
    29 //
       
    30 : iMatchType(ESmsAddrMatchText), iMsg(aMsg), iMatch(aMatch)
       
    31 	{
       
    32 
       
    33 	CommonInit();
       
    34 	}
       
    35 
       
    36 EXPORT_C void TTestCase::CommonInit()
       
    37 //
       
    38 // Reset member variables
       
    39 //
       
    40 	{
       
    41 
       
    42 	iTestSmsClass = EFalse;
       
    43 	iTestValidityPeriod = EFalse;
       
    44 	iTestForever=EFalse;
       
    45 	iTestIndicators=EFalse;
       
    46 	}
       
    47 
       
    48 EXPORT_C TTestCase::TTestCase(const TDesC& aMsg, CSmsInformationElement::TSmsInformationElementIdentifier aIdentifier)
       
    49 //
       
    50 // Constructor
       
    51 //
       
    52 : iMatchType(ESmsAddrMatchIEI), iMsg(aMsg), iIdentifierMatch(aIdentifier)
       
    53 	{
       
    54 
       
    55 	CommonInit();
       
    56 	}
       
    57 
       
    58 EXPORT_C TTestCase::TTestCase(const TDesC& aMsg, TSmsFirstOctet::TSmsStatusReportRequest /*aSRR*/)
       
    59 //
       
    60 // Match on status report - ignore actual value of aSRR
       
    61 //
       
    62 : iMatchType(ESmsAddrStatusReport), iMsg(aMsg)
       
    63 	{
       
    64 
       
    65 	CommonInit();
       
    66 	}
       
    67 
       
    68 EXPORT_C TTestCase::TTestCase(const TDesC& aMsg, TSmsDataCodingScheme::TSmsIndicationType aIndicationType,
       
    69 					 TSmsDataCodingScheme::TSmsDCSBits7To4 aBits7To4,
       
    70 					 TSmsDataCodingScheme::TSmsIndicationState aIndicationState)
       
    71 //
       
    72 // Match on a type of message indication
       
    73 //
       
    74 : iMatchType(ESmsAddrMessageIndication), iMsg(aMsg), iIndicationType(aIndicationType),
       
    75 	iBits7To4(aBits7To4), iIndicationState(aIndicationState)
       
    76 	{
       
    77 
       
    78 	__ASSERT_ALWAYS(iBits7To4==TSmsDataCodingScheme::ESmsDCSMessageWaitingIndicationDiscardMessage
       
    79 		|| iBits7To4==TSmsDataCodingScheme::ESmsDCSMessageWaitingIndication7Bit
       
    80 		|| iBits7To4==TSmsDataCodingScheme::ESmsDCSMessageWaitingIndicationUCS2,
       
    81 		User::Panic(_L("TestCase"), KErrNotSupported));
       
    82 
       
    83 	CommonInit();
       
    84 	iTestIndicators=ETrue;
       
    85 
       
    86 	}
       
    87 
       
    88 EXPORT_C TTestCase::TTestCase(const TDesC& aMsg)
       
    89 //
       
    90 // Constructor
       
    91 //
       
    92 : iMatchType(ESmsAddrRecvAny), iMsg(aMsg)
       
    93 	{
       
    94 
       
    95 	CommonInit();
       
    96 	}
       
    97 
       
    98 EXPORT_C const TTestCase& TTestCase::operator=(const TTestCase& aTest)
       
    99 //
       
   100 // Assignment operator
       
   101 //
       
   102 	{
       
   103 
       
   104 	iMatchType = aTest.iMatchType;
       
   105 	iMsg.Set(aTest.iMsg);
       
   106 	iMatch.Set(aTest.iMatch);
       
   107 	iIdentifierMatch = aTest.iIdentifierMatch;
       
   108 	iTestForever = aTest.iTestForever;
       
   109 	return *this;
       
   110 	}
       
   111 
       
   112 EXPORT_C void TTestCase::SetSmsClass(TSmsDataCodingScheme::TSmsClass aClass)
       
   113 //
       
   114 // Set Sms Class
       
   115 //
       
   116 	{
       
   117 
       
   118 	iTestSmsClass = ETrue;
       
   119 	iSmsClass = aClass;
       
   120 	}
       
   121 
       
   122 EXPORT_C void TTestCase::SetValidityPeriod(const TTimeIntervalMinutes& aTimeInterval)
       
   123 //
       
   124 // Set the validity period
       
   125 //
       
   126 	{
       
   127 
       
   128 	iTestValidityPeriod = ETrue;
       
   129 	iValidityPeriod = aTimeInterval;
       
   130 	}
       
   131 
       
   132 EXPORT_C void TTestCase::SetRecvForever()
       
   133 //
       
   134 // Recv all messages forever
       
   135 //
       
   136 	{
       
   137 
       
   138 	iTestForever = ETrue;
       
   139 	iMatchType = ESmsAddrRecvAny;
       
   140 	}