telephonyserverplugins/simatktsy/tests/src/ccsatclosechannelfu.cpp
changeset 0 3553901f7fa8
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     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 //
       
    15 
       
    16 
       
    17 
       
    18 /**
       
    19  @file The TEFUnit test suite for CloseChannel in the SAT.
       
    20 */
       
    21 
       
    22 #include <cstktsy/bertlv_defs.h>
       
    23 #include <etel.h>
       
    24 #include <etelmm.h>
       
    25 #include <etelsat.h>
       
    26 #include <ctsy/serviceapi/gsmerror.h>
       
    27 #include <ctsy/mmtsy_names.h>
       
    28 #include <satcs.h>                 
       
    29 #include <ctsy/ltsy/sat_defs.h>
       
    30 #include <cstktsy/ttlv.h>
       
    31 
       
    32 #include <ctsy/ltsy/mltsydispatchsatinterface.h>
       
    33 #include <ctsy/ltsy/mltsydispatchphoneinterface.h> 
       
    34 #include <test/mockltsyindicatorids.h>
       
    35 #include <test/tmockltsydata.h>
       
    36 
       
    37 
       
    38 #include "ccsatclosechannelfu.h"
       
    39 
       
    40 const TUint KDelay = 10;
       
    41 
       
    42 CTestSuite* CCSatCloseChannelFU::CreateSuiteL(const TDesC& aName)
       
    43 	{
       
    44 	SUB_SUITE;
       
    45 
       
    46 	ADD_TEST_STEP_ISO_CPP(CCSatCloseChannelFU, TestNotifyCloseChannelPCmd0001L);
       
    47 	ADD_TEST_STEP_ISO_CPP(CCSatCloseChannelFU, TestNotifyCloseChannelPCmd0002L);
       
    48 	ADD_TEST_STEP_ISO_CPP(CCSatCloseChannelFU, TestNotifyCloseChannelPCmd0004L);
       
    49 
       
    50 	END_SUITE;
       
    51 	}
       
    52 
       
    53 
       
    54 //
       
    55 // Actual test cases
       
    56 //
       
    57 
       
    58 
       
    59 /**
       
    60 @SYMTestCaseID BA-CSAT-CHAN-SCCHANPC-0001
       
    61 @SYMPREQ 1780
       
    62 @SYMComponent  telephony_ctsy
       
    63 @SYMTestCaseDesc Test support in CTSY for RSat::NotifyCloseChannelPCmd
       
    64 @SYMTestPriority High
       
    65 @SYMTestActions Invokes RSat::NotifyCloseChannelPCmd
       
    66 @SYMTestExpectedResults Pass
       
    67 @SYMTestType CT
       
    68 */
       
    69 void CCSatCloseChannelFU::TestNotifyCloseChannelPCmd0001L()
       
    70 	{
       
    71 	OpenEtelServerL(EUseExtendedError);
       
    72 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
    73 	OpenPhoneL();
       
    74 	OpenSatL();	
       
    75 	
       
    76 	RBuf8 data;
       
    77 	CleanupClosePushL(data);
       
    78 
       
    79 	_LIT8(KAlpha, "Alpha");
       
    80 	_LIT16(KAlpha16, "Alpha");
       
    81 	TUint8 KPCmdNumber = 1;
       
    82 	TUint8 cmdQualifier(0x00);	
       
    83 	TTlv tlv;	
       
    84 	
       
    85 	PrepareTlv( tlv, KPCmdNumber, cmdQualifier, KChannel1, KAlpha);
       
    86 	TDesC8* tlvDscPtr = &const_cast<TDesC8&>(tlv.End());
       
    87 	TMockLtsyData1<TDesC8*> tlvDscPack(tlvDscPtr);
       
    88 
       
    89 	TRequestStatus notifyStatus;
       
    90 	RSat::TCloseChannelV2 closeChan;
       
    91 	RSat::TCloseChannelV2Pckg closeChanPck(closeChan);
       
    92 
       
    93  	//-------------------------------------------------------------------------
       
    94 	// TEST C: Successful completion request of RSat::NotifyCloseChannelPCmd 
       
    95  	//-------------------------------------------------------------------------
       
    96 	PrepareDispatchL();
       
    97 
       
    98 	iSat.NotifyCloseChannelPCmd(notifyStatus, closeChanPck);
       
    99 
       
   100 	CompleteDispatchL( *tlvDscPtr );
       
   101 	
       
   102 	User::WaitForRequest(notifyStatus);
       
   103 	ASSERT_EQUALS(KErrNone, notifyStatus.Int());
       
   104 
       
   105 	ASSERT_EQUALS( KPCmdNumber, closeChan.PCmdNumber());
       
   106 	ASSERT_EQUALS( RSat::ENoIconId, closeChan.iIconId.iQualifier);	
       
   107 	ASSERT_EQUALS( RSat::KChannel1, closeChan.iDestination);
       
   108 	ASSERT_EQUALS( RSat::EAlphaIdProvided, closeChan.iAlphaId.iStatus);	
       
   109 	ASSERT_EQUALS(0, closeChan.iAlphaId.iAlphaId.Compare(KAlpha16));	
       
   110 
       
   111 	//terminal response	
       
   112 	RSat::TCloseChannelRspV2 terminalRsp;
       
   113 	RSat::TCloseChannelRspV2Pckg terminalRspPckg(terminalRsp);
       
   114 	terminalRsp.SetPCmdNumber(KPCmdNumber);
       
   115 	terminalRsp.iGeneralResult = RSat::KSuccess;
       
   116 	terminalRsp.iInfoType = RSat::KNoAdditionalInfo;
       
   117 	terminalRsp.iAdditionalInfo = KNullDesC;
       
   118 
       
   119 	GenerateTerminalResponseL(KPCmdNumber,	KCloseChannel,	cmdQualifier,
       
   120 			RSat::ECloseChannel, terminalRspPckg,	terminalRsp.iAdditionalInfo, 
       
   121 			terminalRsp.iGeneralResult);
       
   122 	
       
   123 	AssertMockLtsyStatusL();
       
   124 	
       
   125 	// testing all variants of terminal response
       
   126 	DoTestTerminalResponseL();	
       
   127 	
       
   128  	//-------------------------------------------------------------------------
       
   129 	// TEST E: Unsolicited completion of RSat::NotifyCloseChannelPCmd from LTSY.
       
   130  	//-------------------------------------------------------------------------
       
   131 	TRequestStatus mockLtsyStatus;
       
   132 	iMockLTSY.NotifyTerminated(mockLtsyStatus);	    
       
   133 
       
   134 	tlvDscPack.SerialiseL(data);
       
   135 	iMockLTSY.CompleteL(KMockLtsyDispatchSatPcmdIndId, KErrNone, data, KDelay);
       
   136 
       
   137 	RSat::TAdditionalInfo addInfo;
       
   138 	addInfo.Zero();
       
   139 	addInfo.Append(RSat::KNoSpecificMeProblem);
       
   140 	
       
   141 	PrepareTerminalResponseMockDataL( KPCmdNumber, KCloseChannel, cmdQualifier,
       
   142 			addInfo, RSat::KMeUnableToProcessCmd, KNullDesC8);	
       
   143 	
       
   144 	User::WaitForRequest(mockLtsyStatus);
       
   145 	AssertMockLtsyStatusL();
       
   146 	ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
       
   147 		
       
   148 	//-------------------------------------------------------------------------
       
   149 	// TEST B: failure on completion of pending request from LTSY->CTSY
       
   150  	//-------------------------------------------------------------------------
       
   151 	PrepareDispatchL();
       
   152 
       
   153 	iSat.NotifyCloseChannelPCmd(notifyStatus, closeChanPck);
       
   154 
       
   155 	CompleteDispatchL( *tlvDscPtr, KErrUnknown );
       
   156 	
       
   157 	User::WaitForRequest(notifyStatus);
       
   158 	ASSERT_EQUALS(KErrUnknown, notifyStatus.Int());
       
   159 
       
   160 	AssertMockLtsyStatusL();	
       
   161 
       
   162  	//-------------------------------------------------------------------------
       
   163 	// TEST F: Coverage test(s) for RSat::NotifyCloseChannelPCmd
       
   164  	//-------------------------------------------------------------------------
       
   165 	
       
   166 	// TLV buffer without any channel Id and device identifier
       
   167 	tlv.Begin(KBerTlvProactiveSimCommandTag);
       
   168 	tlv.AddTag(KTlvCommandDetailsTag);
       
   169 	tlv.AddByte(KPCmdNumber);//ETLV_CommandNumber
       
   170 	tlv.AddByte(KCloseChannel); //ETLV_TypeOfCommand
       
   171 	tlv.AddByte(cmdQualifier); //ETLV_CommandQualifier
       
   172 	tlv.AddTag(KTlvAlphaIdentifierTag);
       
   173 	tlv.AddData(KNullDesC8);//ETLV_AlphaIdentifier
       
   174 
       
   175 	PrepareDispatchL();
       
   176 
       
   177 	iSat.NotifyCloseChannelPCmd(notifyStatus, closeChanPck);
       
   178 
       
   179 	CompleteDispatchL( tlv.End() );
       
   180 
       
   181 	PrepareTerminalResponseMockDataL( KPCmdNumber, KCloseChannel, cmdQualifier,
       
   182 			KNullDesC, RSat::KErrorRequiredValuesMissing, KNullDesC8);	
       
   183 	
       
   184 	User::WaitForRequest(notifyStatus);
       
   185 	ASSERT_EQUALS(KErrCorrupt, notifyStatus.Int());
       
   186 	AssertMockLtsyStatusL();
       
   187 	
       
   188 	
       
   189 	CleanupStack::PopAndDestroy(2, this); // data, this
       
   190 	}
       
   191 
       
   192 
       
   193 /**
       
   194 @SYMTestCaseID BA-CSAT-CHAN-SCCHANPC-0002
       
   195 @SYMPREQ 1780
       
   196 @SYMComponent  telephony_ctsy
       
   197 @SYMTestCaseDesc Test support in CTSY for cancelling of RSat::NotifyCloseChannelPCmd
       
   198 @SYMTestPriority High
       
   199 @SYMTestActions Invokes cancelling of RSat::NotifyCloseChannelPCmd
       
   200 @SYMTestExpectedResults Pass
       
   201 @SYMTestType CT
       
   202 */
       
   203 void CCSatCloseChannelFU::TestNotifyCloseChannelPCmd0002L()
       
   204 	{
       
   205 	OpenEtelServerL(EUseExtendedError);
       
   206 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   207 	OpenPhoneL();
       
   208 	OpenSatL();	
       
   209 	
       
   210 	TRequestStatus notifyStatus;
       
   211 	RSat::TCloseChannelV2 closeChan;
       
   212 	RSat::TCloseChannelV2Pckg closeChanPck(closeChan);
       
   213 
       
   214 	PrepareDispatchL( );
       
   215 
       
   216 	iSat.NotifyCloseChannelPCmd(notifyStatus, closeChanPck);
       
   217 	
       
   218 	iSat.CancelAsyncRequest(ESatNotifyCloseChannelPCmd);
       
   219 
       
   220 	User::WaitForRequest(notifyStatus);
       
   221 	ASSERT_EQUALS(KErrCancel, notifyStatus.Int());
       
   222 
       
   223 	AssertMockLtsyStatusL();	
       
   224 	
       
   225 	CleanupStack::PopAndDestroy(1, this); 
       
   226 	}
       
   227 
       
   228 
       
   229 /**
       
   230 @SYMTestCaseID BA-CSAT-CHAN-SCCHANPC-0004
       
   231 @SYMPREQ 1780
       
   232 @SYMComponent  telephony_ctsy
       
   233 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RSat::NotifyCloseChannelPCmd
       
   234 @SYMTestPriority High
       
   235 @SYMTestActions Invokes multiple client requests to RSat::NotifyCloseChannelPCmd
       
   236 @SYMTestExpectedResults Pass
       
   237 @SYMTestType CT
       
   238 */
       
   239 void CCSatCloseChannelFU::TestNotifyCloseChannelPCmd0004L()
       
   240 	{
       
   241 	OpenEtelServerL(EUseExtendedError);
       
   242 	CleanupStack::PushL(TCleanupItem(Cleanup,this));
       
   243 	OpenPhoneL();
       
   244 	OpenSatL();
       
   245 
       
   246 	// Open second client
       
   247 	RTelServer telServer2;
       
   248 	TInt ret = telServer2.Connect();
       
   249 	ASSERT_EQUALS(KErrNone, ret);
       
   250 	CleanupClosePushL(telServer2);
       
   251 
       
   252 	RMobilePhone phone2;
       
   253 	ret = phone2.Open(telServer2,KMmTsyPhoneName);
       
   254 	ASSERT_EQUALS(KErrNone, ret);
       
   255 	CleanupClosePushL(phone2);
       
   256 	
       
   257 	RSat sat2;	
       
   258 	User::LeaveIfError(sat2.Open(phone2));
       
   259 	CleanupClosePushL(sat2);
       
   260 	
       
   261 	TUint8 KPCmdNumber = 2;
       
   262 	TUint8 cmdQualifier(0x00);
       
   263 	TTlv tlv;	
       
   264 	
       
   265 	PrepareTlv( tlv, KPCmdNumber, cmdQualifier, KChannel1);
       
   266 
       
   267 	TRequestStatus notifyStatus;
       
   268 	RSat::TCloseChannelV2 closeChan;
       
   269 	RSat::TCloseChannelV2Pckg closeChanPck(closeChan);
       
   270 	
       
   271 	PrepareDispatchL();
       
   272 
       
   273 	iSat.NotifyCloseChannelPCmd(notifyStatus, closeChanPck);
       
   274 
       
   275 	CompleteDispatchL( tlv.End() );
       
   276 
       
   277 	TRequestStatus notifyStatus2;
       
   278 	RSat::TCloseChannelV2 closeChan2;
       
   279 	RSat::TCloseChannelV2Pckg closeChanPck2(closeChan2);
       
   280 
       
   281 	sat2.NotifyCloseChannelPCmd(notifyStatus2, closeChanPck2);
       
   282 	
       
   283 	User::WaitForRequest(notifyStatus);
       
   284 	ASSERT_EQUALS(KErrNone, notifyStatus.Int());
       
   285 
       
   286 	ASSERT_EQUALS( KPCmdNumber, closeChan.PCmdNumber());
       
   287 	ASSERT_EQUALS( RSat::ENoIconId, closeChan.iIconId.iQualifier);	
       
   288 	ASSERT_EQUALS( RSat::KChannel1, closeChan.iDestination);
       
   289 	ASSERT_EQUALS( RSat::EAlphaIdNotPresent, closeChan.iAlphaId.iStatus);
       
   290 	
       
   291 	User::WaitForRequest(notifyStatus2);
       
   292 	ASSERT_EQUALS(KErrNone, notifyStatus2.Int());
       
   293 
       
   294 	ASSERT_EQUALS( KPCmdNumber, closeChan2.PCmdNumber());
       
   295 	ASSERT_EQUALS( RSat::ENoIconId, closeChan2.iIconId.iQualifier);	
       
   296 	ASSERT_EQUALS( RSat::KChannel1, closeChan2.iDestination);
       
   297 	ASSERT_EQUALS( RSat::EAlphaIdNotPresent, closeChan2.iAlphaId.iStatus);
       
   298 	
       
   299 	AssertMockLtsyStatusL();
       
   300 
       
   301 	CleanupStack::PopAndDestroy(4, this); 
       
   302 	}
       
   303 
       
   304 
       
   305 void CCSatCloseChannelFU::PrepareTlv(TTlv& aTlv, TUint8 aCmdNum, TUint8 aCmdQualifier, 
       
   306 		TUint8 aChan, const TDesC8& aAlpha ) 
       
   307 	{
       
   308 	aTlv.Begin(KBerTlvProactiveSimCommandTag);
       
   309 	aTlv.AddTag(KTlvCommandDetailsTag);
       
   310 	aTlv.AddByte(aCmdNum);//ETLV_CommandNumber
       
   311 	aTlv.AddByte(KCloseChannel); //ETLV_TypeOfCommand
       
   312 	aTlv.AddByte(aCmdQualifier); //ETLV_CommandQualifier
       
   313 
       
   314 	aTlv.AddTag(KTlvDeviceIdentityTag); 
       
   315 	aTlv.AddByte(KSim); //ETLV_SourceDeviceIdentity
       
   316 	aTlv.AddByte(aChan); //ETLV_DestinationDeviceIdentity
       
   317 	
       
   318 	if(0 < aAlpha.Size())
       
   319 		{			
       
   320 		aTlv.AddTag(KTlvAlphaIdentifierTag);
       
   321 		aTlv.AddData(aAlpha);//ETLV_AlphaIdentifier
       
   322 		}
       
   323 	
       
   324 	}
       
   325 
       
   326 
       
   327 void CCSatCloseChannelFU::CompleteDispatchL(TPtrC8 aTlvDsc, TInt aRes)
       
   328 	{
       
   329 	RBuf8 data;
       
   330 	CleanupClosePushL(data);
       
   331 
       
   332 	TDesC8* tlvDscPtr = &aTlvDsc;
       
   333 	TMockLtsyData1<TDesC8*> tlvDscPack(tlvDscPtr);
       
   334 
       
   335 	tlvDscPack.SerialiseL(data);
       
   336 	iMockLTSY.CompleteL(KMockLtsyDispatchSatPcmdIndId, aRes, data, KDelay);
       
   337 
       
   338 	CleanupStack::PopAndDestroy(1); 
       
   339 	}
       
   340 
       
   341 void CCSatCloseChannelFU::PrepareDispatchL()
       
   342 	{
       
   343 	RBuf8 data;
       
   344 	CleanupClosePushL(data);
       
   345 
       
   346 	TUint8 pcmdCode = KCloseChannel;
       
   347 	TMockLtsyData1<TUint8> expLtsyData(pcmdCode);
       
   348 	expLtsyData.SerialiseL(data);
       
   349 	
       
   350 	iMockLTSY.ExpectL(MLtsyDispatchSatPCmdNotification::KLtsyDispatchSatPCmdNotificationApiId,data);
       
   351  	
       
   352 	CleanupStack::PopAndDestroy(1); 
       
   353 	}
       
   354 
       
   355 
       
   356 void CCSatCloseChannelFU::DoTestTerminalResponseL()
       
   357 	{
       
   358 	static const struct 
       
   359 		{
       
   360 		RSat::TPCmdResult			iGeneralResult;
       
   361 		RSat::TAdditionalInfoType	iInfoType;
       
   362 		TBool						iIntentionallyOmmitAdditionalInfo;
       
   363 		TUint8						iAdditionalInfo;
       
   364 		TInt						iExpectedResult;
       
   365 		} 
       
   366 	KResponsesToTest[] = 
       
   367 		{
       
   368 			{
       
   369 			// 0x01 - Command performed with partial comprehension;
       
   370 			RSat::KPartialComprehension,
       
   371 			RSat::KNoAdditionalInfo,
       
   372 			ETrue,
       
   373 			0,
       
   374 			KErrNone
       
   375 			},
       
   376 			{
       
   377 			// 0x02 - Command performed, with missing information;
       
   378 			RSat::KMissingInformation,
       
   379 			RSat::KNoAdditionalInfo,
       
   380 			ETrue,
       
   381 			0,
       
   382 			KErrNone
       
   383 			},
       
   384 			{
       
   385 			// 0x03 - REFRESH performed with additional EFs read;
       
   386 			RSat::KRefreshAdditionEFRead,
       
   387 			RSat::KNoAdditionalInfo,
       
   388 			ETrue,
       
   389 			0,
       
   390 			KErrCorrupt
       
   391 			},
       
   392 			{ 
       
   393 			// 0x04 - Command performed successfully, but requested icon could not be displayed;
       
   394 			RSat::KSuccessRequestedIconNotDisplayed,
       
   395 			RSat::KNoAdditionalInfo,
       
   396 			ETrue,
       
   397 			0,
       
   398 			KErrNone
       
   399 			},
       
   400 			{
       
   401 			// 0x05 - Command performed, but modified by call control by NAA;
       
   402 			RSat::KModifiedByCallControl,
       
   403 			RSat::KNoAdditionalInfo,
       
   404 			ETrue,
       
   405 			0,
       
   406 			KErrCorrupt
       
   407 			},
       
   408 			{
       
   409 			// 0x06 - Command performed successfully, limited service;
       
   410 			RSat::KSuccessLimitedService,
       
   411 			RSat::KNoAdditionalInfo,
       
   412 			ETrue,
       
   413 			0,
       
   414 			KErrCorrupt
       
   415 			},
       
   416 			{
       
   417 			// 0x07 - Command performed with modification;
       
   418 			RSat::KPerformedWithModifications,
       
   419 			RSat::KNoAdditionalInfo,
       
   420 			ETrue,
       
   421 			0,
       
   422 			KErrCorrupt
       
   423 			},
       
   424 			{
       
   425 			// 0x08 - REFRESH performed but indicated NAA was not active;
       
   426 			RSat::KRefreshUSIMNotActive,
       
   427 			RSat::KNoAdditionalInfo,
       
   428 			ETrue,
       
   429 			0,
       
   430 			KErrCorrupt
       
   431 			},
       
   432 			{
       
   433 			// 0x09 - Command performed successfully, tone not played;
       
   434 			RSat::KPlayTonePerformedSuccessfully,
       
   435 			RSat::KNoAdditionalInfo,
       
   436 			ETrue,
       
   437 			0,
       
   438 			KErrCorrupt
       
   439 			},
       
   440 			{
       
   441 			// 0x10 - Proactive UICC session terminated by the user;
       
   442 			RSat::KPSessionTerminatedByUser,
       
   443 			RSat::KNoAdditionalInfo,
       
   444 			ETrue,
       
   445 			0,
       
   446 			KErrNone
       
   447 			},
       
   448 			{
       
   449 			// 0x11 - Backward move in the proactive UICC session requested by the user;
       
   450 			RSat::KBackwardModeRequestedByUser,
       
   451 			RSat::KNoAdditionalInfo,
       
   452 			ETrue,
       
   453 			0,
       
   454 			KErrCorrupt			
       
   455 			},
       
   456 			{
       
   457 			// 0x12 - No response from user;
       
   458 			RSat::KNoResponseFromUser,
       
   459 			RSat::KNoAdditionalInfo,
       
   460 			ETrue,
       
   461 			0,
       
   462 			KErrCorrupt			
       
   463 			},
       
   464 			{
       
   465 			// 0x13 - Help information required by the user;
       
   466 			RSat::KHelpRequestedByUser,
       
   467 			RSat::KNoAdditionalInfo,
       
   468 			ETrue,
       
   469 			0,
       
   470 			KErrCorrupt			
       
   471 			},
       
   472 			{
       
   473 			// 0x14 - reserved for GSM/3G.
       
   474 			RSat::KUssdTransactionTerminatedByUser,
       
   475 			RSat::KNoAdditionalInfo, 
       
   476 			ETrue,
       
   477 			0,
       
   478 			KErrCorrupt
       
   479 			},
       
   480 			{
       
   481 			// 0x20 - terminal currently unable to process command;
       
   482 			RSat::KMeUnableToProcessCmd,
       
   483 			RSat::KMeProblem,
       
   484 			EFalse,
       
   485 			0,
       
   486 			KErrNone
       
   487 			},
       
   488 			{
       
   489 			// 0x20 without additional information (erroneous)
       
   490 			RSat::KMeUnableToProcessCmd,
       
   491 			RSat::KMeProblem, 
       
   492 			ETrue, // Intentional error !
       
   493 			0,
       
   494 			KErrCorrupt
       
   495 			},	
       
   496 			{
       
   497 			// 0x21 - Network currently unable to process command;
       
   498 			RSat::KNetworkUnableToProcessCmd,
       
   499 			RSat::KNoAdditionalInfo,
       
   500 			EFalse,
       
   501 			0,
       
   502 			KErrCorrupt
       
   503 			},
       
   504 			{
       
   505 			// 0x22 - User did not accept the proactive command;
       
   506 			RSat::KPCmdNotAcceptedByUser,
       
   507 			RSat::KNoAdditionalInfo,
       
   508 			ETrue,
       
   509 			0,
       
   510 			KErrCorrupt
       
   511 			},
       
   512 			{
       
   513 			// 0x23 - User cleared down call before connection or network release;
       
   514 			RSat::KCallClearedBeforeConnectionOrReleased,
       
   515 			RSat::KNoAdditionalInfo,
       
   516 			EFalse,
       
   517 			0,
       
   518 			KErrCorrupt
       
   519 			},
       
   520 			{
       
   521 			// 0x24 - Action in contradiction with the current timer state;
       
   522 			RSat::KContradictionWithTimerState,
       
   523 			RSat::KNoAdditionalInfo,
       
   524 			EFalse,
       
   525 			0,
       
   526 			KErrCorrupt
       
   527 			},
       
   528 			{
       
   529 			// 0x25 - Interaction with call control by NAA, temporary problem;
       
   530 			RSat::KInteractionWithCCTemporaryError,
       
   531 			RSat::KNoAdditionalInfo,
       
   532 			EFalse,
       
   533 			0,
       
   534 			KErrCorrupt
       
   535 			},
       
   536 			{
       
   537 			// 0x26 - Launch browser generic error code;
       
   538 			RSat::KLaunchBrowserError,
       
   539 			RSat::KNoAdditionalInfo,
       
   540 			EFalse,
       
   541 			0,
       
   542 			KErrCorrupt
       
   543 			},
       
   544 			{
       
   545 			// 0x27 - MMS temporary problem.
       
   546 			RSat::KMMSTemporaryProblem,
       
   547 			RSat::KNoAdditionalInfo,
       
   548 			EFalse,
       
   549 			0,
       
   550 			KErrCorrupt
       
   551 			},
       
   552 			{
       
   553 			// 0x30 - Command beyond terminal's capabilities;
       
   554 			RSat::KCmdBeyondMeCapabilities,
       
   555 			RSat::KNoAdditionalInfo,
       
   556 			EFalse,
       
   557 			0,
       
   558 			KErrNone
       
   559 			},
       
   560 			{
       
   561 			// 0x31 - Command type not understood by terminal;
       
   562 			RSat::KCmdTypeNotUnderstood,
       
   563 			RSat::KNoAdditionalInfo,
       
   564 			EFalse,
       
   565 			0,
       
   566 			KErrNone
       
   567 			},
       
   568 			{ 
       
   569 			// 0x32 - Command data not understood by terminal;
       
   570 			RSat::KCmdDataNotUnderstood,
       
   571 			RSat::KNoAdditionalInfo,
       
   572 			EFalse,
       
   573 			0,
       
   574 			KErrNone
       
   575 			},
       
   576 			{
       
   577 			// 0x33 - Command number not known by terminal;
       
   578 			RSat::KCmdNumberNotKnown,
       
   579 			RSat::KNoAdditionalInfo,
       
   580 			EFalse,
       
   581 			0,
       
   582 			KErrNone
       
   583 			},
       
   584 			{
       
   585 			// 0x34 - reserved for GSM/3G;
       
   586 			RSat::KSsReturnError,
       
   587 			RSat::KNoAdditionalInfo,
       
   588 			ETrue,
       
   589 			0,
       
   590 			KErrCorrupt
       
   591 			},
       
   592 			{
       
   593 			// 0x35 - reserved for GSM/3G;
       
   594 			RSat::KSmsRpError,
       
   595 			RSat::KNoAdditionalInfo,
       
   596 			ETrue,
       
   597 			0,
       
   598 			KErrCorrupt
       
   599 			},
       
   600 			{ 
       
   601 			// 0x36 - Error, required values are missing;
       
   602 			RSat::KErrorRequiredValuesMissing,
       
   603 			RSat::KNoAdditionalInfo,
       
   604 			ETrue,
       
   605 			0,
       
   606 			KErrNone
       
   607 			},
       
   608 			{
       
   609 			// 0x37 - reserved for GSM/3G;
       
   610 			RSat::KUssdReturnError,
       
   611 			RSat::KNoAdditionalInfo,
       
   612 			ETrue,
       
   613 			0,
       
   614 			KErrCorrupt
       
   615 			},
       
   616 			{
       
   617 			// 0x38 - MultipleCard commands error;
       
   618 			RSat::KMultipleCardCmdsError,
       
   619 			RSat::KNoAdditionalInfo,
       
   620 			EFalse,
       
   621 			0,
       
   622 			KErrCorrupt
       
   623 			},
       
   624 			{
       
   625 			// 0x39 - Interaction with call control by NAA, permanent problem;
       
   626 			RSat::KInteractionWithCCPermanentError,
       
   627 			RSat::KNoAdditionalInfo,
       
   628 			EFalse,
       
   629 			0,
       
   630 			KErrCorrupt
       
   631 			},
       
   632 			{
       
   633 			// 0x3A - Bearer Independent Protocol error;
       
   634 			RSat::KBearerIndepProtocolError,
       
   635 			RSat::KMeProblem, 
       
   636 			EFalse,
       
   637 			RSat::KNoSpecificBIPError,
       
   638 			KErrNone
       
   639 			},
       
   640 			{
       
   641 			// 0x3A without additional information (erroneous)
       
   642 			RSat::KBearerIndepProtocolError,
       
   643 			RSat::KMeProblem, 
       
   644 			ETrue, // Intentional error
       
   645 			0,
       
   646 			KErrCorrupt
       
   647 			},
       
   648 			{
       
   649 			// 0x3B - Access Technology unable to process command;
       
   650 			RSat::KAccessTechUnableProcessCmd,
       
   651 			RSat::KNoAdditionalInfo,
       
   652 			EFalse,
       
   653 			0,
       
   654 			KErrCorrupt
       
   655 			},
       
   656 			{
       
   657 			// 0x3C - Frames error;
       
   658 			RSat::KFramesError,
       
   659 			RSat::KMeProblem,
       
   660 			EFalse,
       
   661 			RSat::KNoSpecificCauseCanBeGiven,
       
   662 			KErrNone
       
   663 			},
       
   664 			{
       
   665 			// 0x3D - MMS Error.
       
   666 			RSat::KMMSError,
       
   667 			RSat::KNoAdditionalInfo,
       
   668 			EFalse,
       
   669 			0,
       
   670 			KErrCorrupt
       
   671 			}
       
   672 		};	
       
   673 
       
   674 	const TInt KNumberOfResponsesToTest = sizeof(KResponsesToTest)/ sizeof(KResponsesToTest[0]); 
       
   675 
       
   676 	_LIT8(KAlpha, "Alpha");
       
   677 	TUint8 KPCmdNumber = 1;
       
   678 	TUint8 cmdQualifier(0x00);	
       
   679 	TTlv tlv;	
       
   680 	
       
   681 	PrepareTlv( tlv, KPCmdNumber, cmdQualifier, KChannel1, KAlpha);
       
   682 	TDesC8* tlvDscPtr = &const_cast<TDesC8&>(tlv.End());
       
   683 	TMockLtsyData1<TDesC8*> tlvDscPack(tlvDscPtr);
       
   684 
       
   685 	TRequestStatus notifyStatus;
       
   686 	RSat::TCloseChannelV2 closeChan;
       
   687 	RSat::TCloseChannelV2Pckg closeChanPck(closeChan);
       
   688 
       
   689 	for(TInt i = 0; i <= KNumberOfResponsesToTest; i++)
       
   690 		{				
       
   691 		// notify request
       
   692 		PrepareDispatchL();
       
   693 		iSat.NotifyCloseChannelPCmd(notifyStatus, closeChanPck);
       
   694 		CompleteDispatchL( *tlvDscPtr );		
       
   695 		User::WaitForRequest(notifyStatus);
       
   696 		ASSERT_EQUALS(KErrNone, notifyStatus.Int());
       
   697 
       
   698 		AssertMockLtsyStatusL();	
       
   699 		
       
   700 		// now test a "TERMINAL RESPONSE" specific to this loop 
       
   701 		RSat::RSat::TCloseChannelRspV2  rsp;
       
   702 		RSat::RSat::TCloseChannelRspV2Pckg rspPckg(rsp);
       
   703 		rsp.SetPCmdNumber(KPCmdNumber);
       
   704 
       
   705 		if(i < KNumberOfResponsesToTest)
       
   706 			{
       
   707 			// looping through KResponsesToTest table
       
   708 			rsp.iGeneralResult	= KResponsesToTest[i].iGeneralResult;
       
   709 			rsp.iInfoType 		= KResponsesToTest[i].iInfoType;
       
   710 			if(rsp.iInfoType != RSat::KNoAdditionalInfo && 
       
   711 			   !KResponsesToTest[i].iIntentionallyOmmitAdditionalInfo)
       
   712 				{
       
   713 				rsp.iAdditionalInfo.Append(KResponsesToTest[i].iAdditionalInfo);
       
   714 				}
       
   715 			GenerateTerminalResponseL(KPCmdNumber,	KCloseChannel,	cmdQualifier,
       
   716 					RSat::ECloseChannel, rspPckg,	rsp.iAdditionalInfo, 
       
   717 					rsp.iGeneralResult, KNullDesC8, KResponsesToTest[i].iExpectedResult);
       
   718 			}
       
   719 		else
       
   720 			{
       
   721 			// now tell Mock to return KErrUnknown when dispatching forthcoming RSat::TerminalRsp()
       
   722 			rsp.iGeneralResult	= RSat::KSuccess;
       
   723 			rsp.iInfoType 		= RSat::KNoAdditionalInfo;
       
   724 			
       
   725 			PrepareTerminalResponseMockDataL( KPCmdNumber, KCloseChannel, cmdQualifier,
       
   726 					rsp.iAdditionalInfo, rsp.iGeneralResult, KNullDesC8, KErrUnknown);
       
   727 
       
   728 			TerminalResponseL( RSat::ECloseChannel, rspPckg, KErrUnknown);
       
   729 			}
       
   730 		
       
   731 		AssertMockLtsyStatusL();			
       
   732 		}
       
   733 	}