/**
 * @SYMTestCaseID BA-CTSYD-DIS-SMS-NEGATIVE-UN0001
 * @SYMComponent telephony_ctsy
 * @SYMTestCaseDesc Test handing in CTSY dispatch when the NackSmsStored API is disabled 
 * @SYMTestPriority High
 * @SYMTestActions Disable API, call API, check correct error returned
 * @SYMTestExpectedResults Pass
 * @SYMTestType CT
 */
void CCTsySmsFUNegative::TestNackSmsStoredL()
	{
	TConfig config;
	config.SetSupportedValue(MLtsyDispatchSmsNackSmsStored::KLtsyDispatchSmsNackSmsStoredApiId, EFalse);
	config.PushL();

    OpenEtelServerL(EUseExtendedError);
    CleanupStack::PushL(TCleanupItem(Cleanup,this));
    OpenPhoneL();

    RMobileSmsMessaging messaging;
    TInt err = messaging.Open(iPhone);
    ASSERT_EQUALS(KErrNone, err);
    CleanupClosePushL(messaging);
 
    RBuf8 data;
    CleanupClosePushL(data);
    
    TRequestStatus reqStatus;
    TRequestStatus mockLtsyStatus;
    RMobileSmsMessaging::TMobileSmsReceiveAttributesV1 receiveAttr;
    RMobileSmsMessaging::TMobileSmsReceiveAttributesV1Pckg receiveAttrPckg(receiveAttr);
  
    _LIT8(KMessage, "Happy New Year");
    TBuf8<100> forMsg;
  
    // receiving message:
    messaging.ReceiveMessage(reqStatus, forMsg, receiveAttrPckg);

    TSmsMsg smsMsg;
    TSmsMsg* smsMsgPtr(&smsMsg);
    TBool ind(EFalse);
    
    smsMsg.iSmsClass2 = ETrue;
    smsMsg.iDeleteAfterClientAck = ETrue;
    smsMsg.iSmsMsg.Copy(KMessage);

    TMockLtsyData2<TBool, TSmsMsg*> compTsyData(ind, smsMsgPtr);
    compTsyData.SerialiseL(data);

    iMockLTSY.CompleteL(KMockLtsyDispatchSmsNotifyReceiveSmsMessageIndId, KErrNone, data);
    
    User::WaitForRequest(reqStatus);    
    ASSERT_EQUALS(KErrNone, reqStatus.Int());
    AssertMockLtsyStatusL();
    
    TDesC8* msgPtr = const_cast<TDesC8*>(&KMessage);
    TInt rpCause(0);
    TMockLtsyData2<TDesC8*, TInt> expTsyData(msgPtr, rpCause);
    data.Close();
    expTsyData.SerialiseL(data);

    messaging.NackSmsStored(reqStatus, KMessage, rpCause); 

    User::WaitForRequest(reqStatus);
    ASSERT_EQUALS(KErrNotSupported, reqStatus.Int());
    AssertMockLtsyStatusL();
    
    CleanupStack::PopAndDestroy(4, &config);    //  messaging, this, data, config
	}
/**
 * @SYMTestCaseID BA-CTSYD-DIS-SIM-NEGATIVE-UN0023
 * @SYMComponent telephony_ctsy
 * @SYMTestCaseDesc Test handing in CTSY dispatch when the GetAnswerToReset (ATR) API is disabled 
 * @SYMTestPriority High
 * @SYMTestActions Disable API, call API, check correct error returned
 * @SYMTestExpectedResults Pass
 * @SYMTestType CT
 */
void CCTsySimFUNegative::TestGetAnswerToResetL()
	{
	TConfig config;
	config.SetSupportedValue(MLtsyDispatchSimGetAnswerToReset::KLtsyDispatchSimGetAnswerToResetApiId, EFalse);
	config.PushL();
	
	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));
	OpenPhoneL();

	RMmCustomAPI customApi;
	OpenCustomApiLC(customApi);

	_LIT8(KAnswerToResetSend, "ExampleAnswerToResetSend");
	TBuf8<100> answerToReset(KAnswerToResetSend);
	
	TRequestStatus status;
	customApi.GetATR(status, answerToReset);
	User::WaitForRequest(status);
	ASSERT_EQUALS(status.Int(), KErrNotSupported);

	AssertMockLtsyStatusL();
	config.Reset();
	CleanupStack::PopAndDestroy(3, &config);	// customAPI, this, config		
	}
/**
 * @SYMTestCaseID BA-CTSYD-DIS-SMS-NEGATIVE-UN0006
 * @SYMComponent telephony_ctsy
 * @SYMTestCaseDesc Test handing in CTSY dispatch when the SendMessageNoFdnCheck API is disabled 
 * @SYMTestPriority High
 * @SYMTestActions Disable API, call API, check correct error returned
 * @SYMTestExpectedResults Pass
 * @SYMTestType CT
 */
void CCTsySmsFUNegative::TestSendMessageNoFdnCheckL()
	{
	TConfig config;
	config.SetSupportedValue(MLtsyDispatchSmsSendSmsMessageNoFdnCheck::KLtsyDispatchSmsSendSmsMessageNoFdnCheckApiId, EFalse);
	config.PushL();
	
    OpenEtelServerL(EUseExtendedError);
    CleanupStack::PushL(TCleanupItem(Cleanup,this));
    OpenPhoneL();
    
    RMobileSmsMessaging messaging;
    TInt err = messaging.Open(iPhone);
    CleanupClosePushL(messaging);
    
    _LIT8(KMessage, "Hello");

    RMobileSmsMessaging::TMobileSmsSendAttributesV1 smsAttr;
    RMobileSmsMessaging::TMobileSmsSendAttributesV1Pckg smsAttrPckg(smsAttr);
    
	TRequestStatus status;
    messaging.SendMessageNoFdnCheck(status, KMessage, smsAttrPckg);
	User::WaitForRequest(status);
    ASSERT_EQUALS(status.Int(), KErrNotSupported);   
	    
    AssertMockLtsyStatusL();
    
    CleanupStack::PopAndDestroy(3, &config);	//  messaging, this, config
	}
/**
 * @SYMTestCaseID BA-CTSYD-DIS-SMS-NEGATIVE-UN0004
 * @SYMComponent telephony_ctsy
 * @SYMTestCaseDesc Test handing in CTSY dispatch when the GetMessageStoreInfo (a.k.a GetSmsStoreInfo) API is disabled 
 * @SYMTestPriority High
 * @SYMTestActions Disable API, call API, check correct error returned
 * @SYMTestExpectedResults Pass
 * @SYMTestType CT
 */
void CCTsySmsFUNegative::TestGetSmsStoreInfoL()
	{
	TConfig config;
	config.SetSupportedValue(MLtsyDispatchSmsGetSmsStoreInfo::KLtsyDispatchSmsGetSmsStoreInfoApiId, EFalse);
	config.PushL();
	
    OpenEtelServerL(EUseExtendedError);
    CleanupStack::PushL(TCleanupItem(Cleanup,this));
    OpenPhoneL();
    
    RMobileSmsMessaging messaging;
    TInt err = messaging.Open(iPhone);
    CleanupClosePushL(messaging);
    
    RMobilePhoneStore::TMobilePhoneStoreInfoV1 info;
    RMobilePhoneStore::TMobilePhoneStoreInfoV1Pckg pckgInfo(info);
    TInt index(0);
    
    TRequestStatus status;
    messaging.GetMessageStoreInfo(status, index, pckgInfo);  
	User::WaitForRequest(status);
    ASSERT_EQUALS(status.Int(), KErrNotSupported);   
	    
    AssertMockLtsyStatusL();
    
    CleanupStack::PopAndDestroy(3, &config);	//  messaging, this, config	
	}
/**
 * @SYMTestCaseID BA-CTSYD-DIS-SIM-NEGATIVE-UN0010
 * @SYMComponent telephony_ctsy
 * @SYMTestCaseDesc Test handing in CTSY dispatch when the ChangeSecurityCode API is disabled 
 * @SYMTestPriority High
 * @SYMTestActions Disable API, call API, check correct error returned
 * @SYMTestExpectedResults Pass
 * @SYMTestType CT
 */
void CCTsySimFUNegative::TestChangeSecurityCodeL()
	{
	TConfig config;
	config.SetSupportedValue(MLtsyDispatchSimChangeSecurityCode::KLtsyDispatchSimChangeSecurityCodeApiId, EFalse);
	config.PushL();
	
	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));
	OpenPhoneL();
	
	_LIT(KOldPwd,"oldPswd");
	_LIT(KNewPwd,"newPswd");
	RMobilePhone::TMobilePhonePasswordChangeV1 pwdChange;
	pwdChange.iNewPassword = KNewPwd;
	pwdChange.iOldPassword = KOldPwd;
	// Choose Phone Device Lock
	RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePhonePassword;
	
	TRequestStatus status;
	iPhone.ChangeSecurityCode(status, secCode, pwdChange);
	User::WaitForRequest(status);
	ASSERT_EQUALS(status.Int(), KErrNotSupported);

	AssertMockLtsyStatusL();
	config.Reset();
	CleanupStack::PopAndDestroy(2, &config);	// this, config		
	}
/**
 * @SYMTestCaseID BA-CTSYD-DIS-SIM-NEGATIVE-UN0022
 * @SYMComponent telephony_ctsy
 * @SYMTestCaseDesc Test handing in CTSY dispatch when the  API is disabled 
 * @SYMTestPriority High
 * @SYMTestActions Disable API, call API, check correct error returned for both async & sync APIs
 * @SYMTestExpectedResults Pass
 * @SYMTestType CT
 */
void CCTsySimFUNegative::TestDeActivateSimLockL()
	{
	TConfig config;
	config.SetSupportedValue(MLtsyDispatchSimSimLockDeActivate::KLtsyDispatchSimSimLockDeActivateApiId, EFalse);
	config.PushL();
	
	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));
	OpenPhoneL();

	RMmCustomAPI customApi;
	OpenCustomApiLC(customApi);

	_LIT(KPassword, "12345");
	
	RMmCustomAPI::TSimLockPassword simLockPassword;
	RMmCustomAPI::TLockNumber lockNumber;
	
	lockNumber = RMmCustomAPI::EOperator;
	simLockPassword.Copy(KPassword);
	
	TRequestStatus status;
	// async version
	customApi.DeActivateSimLock(status, simLockPassword, lockNumber);
	User::WaitForRequest(status);
	ASSERT_EQUALS(status.Int(), KErrNotSupported);

	// synchronous version
	TInt ret = customApi.DeActivateSimLock(simLockPassword, lockNumber);
	ASSERT_EQUALS(ret, KErrNotSupported);
	
	AssertMockLtsyStatusL();
	config.Reset();
	CleanupStack::PopAndDestroy(3, &config);	// customAPI, this, config		
	}
/**
 * @SYMTestCaseID BA-CTSYD-DIS-SIM-NEGATIVE-UN0016
 * @SYMComponent telephony_ctsy
 * @SYMTestCaseDesc Test handing in CTSY dispatch when the SendAPDUReq API is disabled 
 * @SYMTestPriority High
 * @SYMTestActions Disable API, call API, check correct error returned
 * @SYMTestExpectedResults Pass
 * @SYMTestType CT
 */
void CCTsySimFUNegative::TestSendAPDUReqL()
	{
	TConfig config;
	config.SetSupportedValue(MLtsyDispatchSimSendApduRequest::KLtsyDispatchSimSendApduRequestApiId, EFalse);
	config.PushL();
	
	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));
	OpenPhoneL();

	RMmCustomAPI customApi;
	OpenCustomApiLC(customApi);
	
	TBuf8<3> info;
	info.Append(1);
	info.Append(1);
	info.Append(1);
	
	RBuf8 dataBuf;
	CleanupClosePushL(dataBuf);
	_LIT8(KApduDataExp,"APDU DATA EXP ");
	dataBuf.CreateL(KApduDataExp);
	
	RMmCustomAPI::TApdu apdu(info,dataBuf);
	
	TRequestStatus status;
	customApi.SendAPDUReq(status, apdu);
	User::WaitForRequest(status);
	ASSERT_EQUALS(status.Int(), KErrNotSupported);

	AssertMockLtsyStatusL();
	config.Reset();
	CleanupStack::PopAndDestroy(4, &config);	// dataBuf, customApi, this, config		
	}
/**
 * @SYMTestCaseID BA-CTSYD-DIS-SMS-NEGATIVE-UN0009
 * @SYMComponent telephony_ctsy
 * @SYMTestCaseDesc Test handing in CTSY dispatch when the StoreSmspListEntry API is disabled 
 * @SYMTestPriority High
 * @SYMTestActions Disable API, call API, check correct error returned
 * @SYMTestExpectedResults Pass
 * @SYMTestType CT
 */
void CCTsySmsFUNegative::TestStoreSmspListEntryL()
	{
	TConfig config;
	config.SetSupportedValue(MLtsyDispatchSmsStoreSmspListEntry::KLtsyDispatchSmsStoreSmspListEntryApiId, EFalse);
	config.PushL();
	
    OpenEtelServerL(EUseExtendedError);
    CleanupStack::PushL(TCleanupItem(Cleanup,this));
    OpenPhoneL();
    
    RMobileSmsMessaging messaging;
    TInt err = messaging.Open(iPhone);
    CleanupClosePushL(messaging);
	
    RMobileSmsMessaging::TMobileSmspEntryV1 smspEntry;
    CMobilePhoneSmspList* smspListPtr = CMobilePhoneSmspList::NewL();
    CleanupStack::PushL(smspListPtr);
        
    smspListPtr->AddEntryL(smspEntry);
    
    TRequestStatus status;
    messaging.StoreSmspListL(status, smspListPtr);
	User::WaitForRequest(status);
    ASSERT_EQUALS(status.Int(), KErrNotSupported);   
	    
    AssertMockLtsyStatusL();
    
    CleanupStack::PopAndDestroy(4, &config);	//  smspListPtr, messaging, this, config
	}
/**
 * @SYMTestCaseID BA-CTSYD-DIS-SIM-NEGATIVE-UN0025
 * @SYMComponent telephony_ctsy
 * @SYMTestCaseDesc Test handing in CTSY dispatch when the GetSimAuthenticationEapSimData API is disabled 
 * @SYMTestPriority High
 * @SYMTestActions Disable API, call API, check correct error returned
 * @SYMTestExpectedResults Pass
 * @SYMTestType CT
 */
void CCTsySimFUNegative::TestGetSimAuthenticationEapSimDataL()
	{
	TConfig config;
	config.SetSupportedValue(MLtsyDispatchSimGetSimAuthenticationEapSimData::KLtsyDispatchSimGetSimAuthenticationEapSimDataApiId, EFalse);
	config.PushL();
	
	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));
	OpenPhoneL();

	RMmCustomAPI customApi;
	OpenCustomApiLC(customApi);

	// generate a random parameter 
	TUint32 randomValue; 
	TBuf8<16> randomParameter;
	for (TInt i = 0; i< 16; i++)
		{
		randomValue = Math::Random();
		randomParameter.Append(randomValue);
		}
		
	RMmCustomAPI::TSimAuthenticationEapSim eapSim;
	eapSim.iRandomParameters.Copy(randomParameter);
	RMmCustomAPI::TSimDataPckg simDataPckg(eapSim);
	
	TRequestStatus status;
	customApi.GetWlanSimAuthenticationData(status, simDataPckg);
	User::WaitForRequest(status);
	ASSERT_EQUALS(status.Int(), KErrNotSupported);

	AssertMockLtsyStatusL();
	config.Reset();
	CleanupStack::PopAndDestroy(3, &config);	// customAPI, this, config		
	}
/**
 * @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROLMULTIPARTY-NEGATIVE-UN0003
 * @SYMComponent telephony_ctsy
 * @SYMTestCaseDesc Test handing in CTSY dispatch when the CreateConference API is disabled 
 * @SYMTestPriority High
 * @SYMTestActions Disable API, call API, check correct error returned
 * @SYMTestExpectedResults Pass
 * @SYMTestType CT
 */
void CCTsyCallControlMultipartyFUNegative::TestCreateConferenceL()
	{
	TConfig config;
	config.SetSupportedValue(MLtsyDispatchCallControlMultipartyCreateConference::KLtsyDispatchCallControlMultipartyCreateConferenceApiId, EFalse);
	config.PushL();
	
	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));
	OpenPhoneL();

	RBuf8 data;
	CleanupClosePushL(data);

	// Set up correct conditions to be able to create a conference
	TInt callId1 = 1;
	TInt callId2 = 2;
	RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
	DriverDialAndHoldFirstCallDialSecondCallL(mobileService, callId1, callId2);

	RMobileLine mobileLine;
	CleanupClosePushL(mobileLine);
	RMobileCall mobileCall;
	CleanupClosePushL(mobileCall);

	RMobileLine mobileLine2;
	CleanupClosePushL(mobileLine2);
	RMobileCall mobileCall2;
	CleanupClosePushL(mobileCall2);

	ClientDialAndHoldFirstCallDialSecondCallL(mobileService, mobileCall, mobileLine,
			mobileCall2, mobileLine2);

	RMobileConferenceCall confCall;
	CleanupClosePushL(confCall);
	ASSERT_EQUALS(KErrNone, confCall.Open(iPhone));

	// Hang up cause for normal hang up
	DriverHangUpCallL(callId1, KErrGsmCCNormalCallClearing, EFalse);
	DriverHangUpCallL(callId2, KErrGsmCCNormalCallClearing);
	
	TRequestStatus status;
	confCall.CreateConference(status);
	User::WaitForRequest(status);
	ASSERT_EQUALS(status.Int(), KErrNotSupported);

	// Hang up the calls
	ClientHangUpCallL(mobileCall);
	ClientHangUpCallL(mobileCall2);
	
	User::After(100000); // Allow the lifetimer to be updated before ending the test
	
	mobileCall.Close();
	mobileCall2.Close();

	AssertMockLtsyStatusL();
    CleanupStack::PopAndDestroy(8, &config);
	}
/**
 * @SYMTestCaseID BA-CTSYD-DIS-SIM-NEGATIVE-UN0020
 * @SYMComponent telephony_ctsy
 * @SYMTestCaseDesc Test handing in CTSY dispatch when the ReadSimFile API is disabled 
 * @SYMTestPriority High
 * @SYMTestActions Disable API, call API, check correct error returned
 * @SYMTestExpectedResults Pass
 * @SYMTestType CT
 */
void CCTsySimFUNegative::TestReadSimFileL()
	{
	TConfig config;
	config.SetSupportedValue(MLtsyDispatchSimReadSimFile::KLtsyDispatchSimReadSimFileApiId, EFalse);
	config.PushL();
	
	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));
	OpenPhoneL();

	RMmCustomAPI customApi;
	OpenCustomApiLC(customApi);
	
	//example Ef(Imsi) path
	RMmCustomAPI::TSimFilePath path;
	path.Append(0x3F);
	path.Append(0x00);
	path.Append(0x7F);
	path.Append(0x00);
	path.Append(0x6F);
	path.Append(0x07);
	path.Append(0x00);
	path.Append(0x00);
	
	const TUint16 offset = 0;
	const TUint16 size = 15;
	
	RMmCustomAPI::TSimFileInfo simFileInfo;
	simFileInfo.iPath = path;
	simFileInfo.iOffSet = offset;
	simFileInfo.iSize = size;
	RMmCustomAPI::TSimFileInfoPckg simFileInfoPckg(simFileInfo);
	
	TBuf8<20> responseBytes;
	
	TRequestStatus status;
	customApi.ReadSimFile(status, simFileInfoPckg, responseBytes);
	User::WaitForRequest(status);
	ASSERT_EQUALS(status.Int(), KErrNotSupported);

	AssertMockLtsyStatusL();
	config.Reset();
	CleanupStack::PopAndDestroy(3, &config);	// customAPI, this, config	
	}
/**
 * @SYMTestCaseID BA-CTSYD-DIS-SIM-NEGATIVE-UN0008
 * @SYMComponent telephony_ctsy
 * @SYMTestCaseDesc Test handing in CTSY dispatch when the DeleteAPNName API is disabled 
 * @SYMTestPriority High
 * @SYMTestActions Disable API, call API, check correct error returned
 * @SYMTestExpectedResults Pass
 * @SYMTestType CT
 */
void CCTsySimFUNegative::TestDeleteAPNNameL()
	{
	TConfig config;
	config.SetSupportedValue(MLtsyDispatchSimDeleteApnName::KLtsyDispatchSimDeleteApnNameApiId, EFalse);
	config.PushL();
	
	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));
	OpenPhoneL();
	
	TRequestStatus status;
	iPhone.DeleteAPNName(status, 1);
	User::WaitForRequest(status);
	ASSERT_EQUALS(status.Int(), KErrNotSupported);

	AssertMockLtsyStatusL();
	config.Reset();
	CleanupStack::PopAndDestroy(2, &config);	// this, config	
	}
/**
 * @SYMTestCaseID BA-CTSYD-DIS-SIM-NEGATIVE-UN0005
 * @SYMComponent telephony_ctsy
 * @SYMTestCaseDesc Test handing in CTSY dispatch when the SetApnControlListServiceStatus API is disabled 
 * @SYMTestPriority High
 * @SYMTestActions Disable API, call SetAPNControlListServiceStatus, check correct error returned
 * @SYMTestExpectedResults Pass
 * @SYMTestType CT
 */
void CCTsySimFUNegative::TestSetApnControlListServiceStatusL()
	{
	TConfig config;
	config.SetSupportedValue(MLtsyDispatchSimSetApnControlListServiceStatus::KLtsyDispatchSimSetApnControlListServiceStatusApiId, EFalse);
	config.PushL();
	
	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));
	OpenPhoneL();
	
	RMobilePhone::TAPNControlListServiceStatus statusSet = RMobilePhone::EAPNControlListServiceEnabled;
	
	TRequestStatus status;
	iPhone.SetAPNControlListServiceStatus(status, statusSet);
	User::WaitForRequest(status);
	ASSERT_EQUALS(status.Int(), KErrNotSupported);

	AssertMockLtsyStatusL();
	config.Reset();
	CleanupStack::PopAndDestroy(2, &config);	// this, config
	}
/**
 * @SYMTestCaseID BA-CTSYD-DIS-SIM-NEGATIVE-UN0011
 * @SYMComponent telephony_ctsy
 * @SYMTestCaseDesc Test handing in CTSY dispatch when the GetSubscriberId API is disabled 
 * @SYMTestPriority High
 * @SYMTestActions Disable API, call API, check correct error returned
 * @SYMTestExpectedResults Pass
 * @SYMTestType CT
 */
void CCTsySimFUNegative::TestGetSubscriberIdL()
	{
	TConfig config;
	config.SetSupportedValue(MLtsyDispatchSimGetSubscriberId::KLtsyDispatchSimGetSubscriberIdApiId, EFalse);
	config.PushL();
	
	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));
	OpenPhoneL();
	
	RMobilePhone::TMobilePhoneSubscriberId idGet;
	
	TRequestStatus status;
	iPhone.GetSubscriberId(status, idGet);
	User::WaitForRequest(status);
	ASSERT_EQUALS(status.Int(), KErrNotSupported);

	AssertMockLtsyStatusL();
	config.Reset();
	CleanupStack::PopAndDestroy(2, &config);	// this, config	
	}
/**
 * @SYMTestCaseID BA-CTSYD-DIS-SMS-NEGATIVE-UN0005
 * @SYMComponent telephony_ctsy
 * @SYMTestCaseDesc Test handing in CTSY dispatch when the ReadSmspListPhase1L API is disabled 
 * @SYMTestPriority High
 * @SYMTestActions Disable API, call API via the CRetrieveMobilePhoneSmspList AO, check correct error returned
 * @SYMTestExpectedResults Pass
 * @SYMTestType CT
 */
void CCTsySmsFUNegative::TestGetSmspListL()
	{
	TConfig config;
	config.SetSupportedValue(MLtsyDispatchSmsGetSmspList::KLtsyDispatchSmsGetSmspListApiId, EFalse);
	config.PushL();
	
    OpenEtelServerL(EUseExtendedError);
    CleanupStack::PushL(TCleanupItem(Cleanup,this));
    OpenPhoneL();
    
    RMobileSmsMessaging messaging;
    TInt err = messaging.Open(iPhone);
    CleanupClosePushL(messaging);
    
	//CFilteringActiveScheduler does not need to be used, this should be changed
	//to a listretrieverao type class (see "listretrieverao.h")
	CFilteringActiveScheduler* scheduler = new (ELeave) CFilteringActiveScheduler();
	CleanupStack::PushL(scheduler);
	CActiveScheduler::Install(scheduler);
	CRetrieveMobilePhoneSmspList* asyncRetrieveList
		= CRetrieveMobilePhoneSmspList::NewL(messaging);    
	CleanupStack::PushL(asyncRetrieveList);
	
	CActiveRetriever::ResetRequestsNumber();
	CActiveRetriever* activeRetriever = 
						CActiveRetriever::NewL(*asyncRetrieveList);
	CleanupStack::PushL(activeRetriever);
	scheduler->AddRetrieverL(*activeRetriever);
	
	asyncRetrieveList->Start(activeRetriever->iStatus);
	activeRetriever->Activate();
	scheduler->StartScheduler();
	
	ASSERT_EQUALS(CActiveRetriever::ResetRequestsNumber(), 0);
	ASSERT_EQUALS(activeRetriever->iStatus.Int(), KErrNotSupported);
	
    AssertMockLtsyStatusL();
    
    CleanupStack::PopAndDestroy(6, &config);	//  activeRetriever, asyncRetrieveList, scheduler, , messaging, this, config			
	}
/**
 * @SYMTestCaseID BA-CTSYD-DIS-SIM-NEGATIVE-UN0015
 * @SYMComponent telephony_ctsy
 * @SYMTestCaseDesc Test handing in CTSY dispatch when the PowerSimOff API is disabled 
 * @SYMTestPriority High
 * @SYMTestActions Disable API, call API, check correct error returned
 * @SYMTestExpectedResults Pass
 * @SYMTestType CT
 */
void CCTsySimFUNegative::TestPowerSimOffL()
	{
	TConfig config;
	config.SetSupportedValue(MLtsyDispatchSimPowerSimOff::KLtsyDispatchSimPowerSimOffApiId, EFalse);
	config.PushL();
	
	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));
	OpenPhoneL();

	RMmCustomAPI customApi;
	OpenCustomApiLC(customApi);
	
	TRequestStatus status;
	customApi.PowerSimOff(status);
	User::WaitForRequest(status);
	ASSERT_EQUALS(status.Int(), KErrNotSupported);

	AssertMockLtsyStatusL();
	config.Reset();
	CleanupStack::PopAndDestroy(3, &config);	// customApi, this, config		
	}
/**
 * @SYMTestCaseID BBA-CTSYD-DIS-SIM-NEGATIVE-UN0002
 * @SYMComponent telephony_ctsy
 * @SYMTestCaseDesc Test handing in CTSY dispatch when the SetIccMessageWaitingIndicators API is disabled 
 * @SYMTestPriority High
 * @SYMTestActions Disable API, call API, check correct error returned
 * @SYMTestExpectedResults Pass
 * @SYMTestType CT
 */
void CCTsySimFUNegative::TestSetIccMessageWaitingIndicatorsL()
	{
	TConfig config;
	config.SetSupportedValue(MLtsyDispatchSimSetIccMessageWaitingIndicators::KLtsyDispatchSimSetIccMessageWaitingIndicatorsApiId, EFalse);
	config.PushL();
	
	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));
	OpenPhoneL();
	
	RMobilePhone::TMobilePhoneMessageWaitingV1 mwiSet;
	RMobilePhone::TMobilePhoneMessageWaitingV1Pckg mwiSetRetPckg(mwiSet);

	TRequestStatus status;
	iPhone.SetIccMessageWaitingIndicators(status, mwiSetRetPckg);
	User::WaitForRequest(status);
	ASSERT_EQUALS(status.Int(), KErrNotSupported);
	AssertMockLtsyStatusL();
	
	config.Reset();
	CleanupStack::PopAndDestroy(2, &config);	// this, config
	}
/**
 * @SYMTestCaseID BA-CTSYD-DIS-SMS-NEGATIVE-UN0007
 * @SYMComponent telephony_ctsy
 * @SYMTestCaseDesc Test handing in CTSY dispatch when the ResumeSmsReception API is disabled 
 * @SYMTestPriority High
 * @SYMTestActions Disable API, call API, check correct error returned
 * @SYMTestExpectedResults Pass
 * @SYMTestType CT
 */
void CCTsySmsFUNegative::TestResumeSmsReceptionL()
	{
	TConfig config;
	config.SetSupportedValue(MLtsyDispatchSmsResumeSmsReception::KLtsyDispatchSmsResumeSmsReceptionApiId, EFalse);
	config.PushL();
	
    OpenEtelServerL(EUseExtendedError);
    CleanupStack::PushL(TCleanupItem(Cleanup,this));
    OpenPhoneL();
    
    RMobileSmsMessaging messaging;
    TInt err = messaging.Open(iPhone);
    CleanupClosePushL(messaging);
	
    TRequestStatus status;
    messaging.ResumeSmsReception(status);  
	User::WaitForRequest(status);
    ASSERT_EQUALS(status.Int(), KErrNotSupported);   
	    
    AssertMockLtsyStatusL();
    
    CleanupStack::PopAndDestroy(3, &config);	//  messaging, this, config
	}
/**
 * @SYMTestCaseID BA-CTSYD-DIS-SIM-NEGATIVE-UN0001
 * @SYMComponent telephony_ctsy
 * @SYMTestCaseDesc Test handing in CTSY dispatch when the GetServiceTable API is disabled 
 * @SYMTestPriority High
 * @SYMTestActions Disable API, call API, check correct error returned
 * @SYMTestExpectedResults Pass
 * @SYMTestType CT
 */
void CCTsySimFUNegative::TestGetServiceTableL()
	{
	TConfig config;
	config.SetSupportedValue(MLtsyDispatchSimGetServiceTable::KLtsyDispatchSimGetServiceTableApiId, EFalse);
	config.PushL();
	
	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));

	OpenPhoneNegativeL(MLtsyDispatchSimGetServiceTable::KLtsyDispatchSimGetServiceTableApiId);
	
	RMobilePhone::TMobilePhoneServiceTableV1 tbData;
	RMobilePhone::TMobilePhoneServiceTableV1Pckg pkg(tbData);
	
	TRequestStatus status;
	iPhone.GetServiceTable(status, RMobilePhone::EUSIMServiceTable, pkg);
	User::WaitForRequest(status);
	ASSERT_EQUALS(status.Int(), KErrMMEtelWrongMode);
	
	AssertMockLtsyStatusL();
		
	config.Reset();
	CleanupStack::PopAndDestroy(2, &config); // this, config
	}
/**
 * @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROLMULTIPARTY-NEGATIVE-UN0001
 * @SYMComponent telephony_ctsy
 * @SYMTestCaseDesc Test handing in CTSY dispatch when the Hangup API is disabled 
 * @SYMTestPriority High
 * @SYMTestActions Disable API, call API, check correct error returned
 * @SYMTestExpectedResults Pass
 * @SYMTestType CT
 */
void CCTsyCallControlMultipartyFUNegative::TestHangUpL()
	{
	// Note: based on original non-negative test void CCTsyCallControlMultipartyFU::TestUseCase0003L()
	
	TConfig config;
	config.SetSupportedValue(MLtsyDispatchCallControlMultipartyConferenceHangUp::KLtsyDispatchCallControlMultipartyConferenceHangUpApiId, EFalse);
	config.PushL();
	
	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup, this));
	OpenPhoneL();

	RBuf8 data;
	CleanupClosePushL(data);

	TInt callId1 = 1;
	TInt callId2 = 2;
	RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
	DriverCreateConferenceCallL(mobileService, callId1, callId2);

	DriverHangUpCallL(callId1, KErrGsmCCNormalCallClearing, EFalse);
	DriverHangUpCallL(callId2, KErrGsmCCNormalCallClearing);

	// Client side test

    RMobileLine mobileLine;
	CleanupClosePushL(mobileLine);
	RMobileCall mobileCall;
	CleanupClosePushL(mobileCall);

	RMobileLine mobileLine2;
	CleanupClosePushL(mobileLine2);
	RMobileCall mobileCall2;
	CleanupClosePushL(mobileCall2);

	ClientDialAndHoldFirstCallDialSecondCallL(mobileService, mobileCall, mobileLine,
			mobileCall2, mobileLine2);

	RMobileConferenceCall confCall;
	CleanupClosePushL(confCall);

	TRequestStatus notifyCall1Status;
	RMobileCall::TMobileCallStatus call1Status;
	mobileCall.NotifyMobileCallStatusChange(notifyCall1Status, call1Status);
	
	ClientCreateConferenceCallL(confCall);

	User::WaitForRequest(notifyCall1Status);
	ASSERT_EQUALS(KErrNone, notifyCall1Status.Int());
	ASSERT_EQUALS(RMobileCall::EStatusConnected, call1Status);
	
	TRequestStatus hangupStatus;
	confCall.HangUp(hangupStatus);
	User::WaitForRequest(hangupStatus);
	ASSERT_EQUALS(KErrNotSupported, hangupStatus.Int());

	// Boths calls should still be connected
	RMobileCall::TMobileCallStatus callStatus;
	ASSERT_EQUALS(KErrNone, mobileCall.GetMobileCallStatus(callStatus));
	ASSERT_EQUALS(RMobileCall::EStatusConnected, callStatus);
	ASSERT_EQUALS(KErrNone, mobileCall2.GetMobileCallStatus(callStatus));
	ASSERT_EQUALS(RMobileCall::EStatusConnected, callStatus);

	// Hang up the calls
	ClientHangUpCallL(mobileCall);
	ClientHangUpCallL(mobileCall2);
	
	User::After(100000); // Allow the lifetimer to be updated before ending the test
	
	mobileCall.Close();
	mobileCall2.Close();

    AssertMockLtsyStatusL();
    CleanupStack::PopAndDestroy(8, &config);	//  confCall, this, config
	}
/**
 * @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROLMULTIPARTY-NEGATIVE-UN0005
 * @SYMComponent telephony_ctsy
 * @SYMTestCaseDesc Test handing in CTSY dispatch when the GoOneToOne API is disabled 
 * @SYMTestPriority High
 * @SYMTestActions Disable API, call API, check correct error returned
 * @SYMTestExpectedResults Pass
 * @SYMTestType CT
 */
void CCTsyCallControlMultipartyFUNegative::TestGoOneToOneL()
	{
	// Note: Equiv non-negative test CCTsyCallControlMultipartyFU::TestUseCase0008L()
	
	TConfig config;
	config.SetSupportedValue(MLtsyDispatchCallControlMultipartyConferenceGoOneToOne::KLtsyDispatchCallControlMultipartyConferenceGoOneToOneApiId, EFalse);
	config.PushL();
	
	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup, this));
	OpenPhoneL();

	RBuf8 data;
	CleanupClosePushL(data);

	TInt callId1 = 1;
	TInt callId2 = 2;
	RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
	DriverCreateConferenceCallL(mobileService, callId1, callId2);

    RArray<TInt> callIds;
    CleanupClosePushL( callIds );
    callIds.AppendL( callId1 );
    callIds.AppendL( callId2 );
    
	TMockLtsyData1<RArray<TInt> > ltsyData(callIds);
	data.Close();
	ltsyData.SerialiseL(data);			
	
    iMockLTSY.ExpectL(MLtsyDispatchCallControlMultipartyConferenceHangUp::KLtsyDispatchCallControlMultipartyConferenceHangUpApiId, data);
    iMockLTSY.CompleteL(MLtsyDispatchCallControlMultipartyConferenceHangUp::KLtsyDispatchCallControlMultipartyConferenceHangUpApiId, KErrNone);

    DriverCompleteSuccessfulHangUpNotificationsL(callId1, EFalse, KErrGsmCCNormalCallClearing, EFalse);
    DriverCompleteSuccessfulHangUpNotificationsL(callId2, EFalse, KErrGsmCCNormalCallClearing, ETrue);

	// Client Side Test

    RMobileLine mobileLine;
	CleanupClosePushL(mobileLine);
	RMobileCall mobileCall;
	CleanupClosePushL(mobileCall);

	RMobileLine mobileLine2;
	CleanupClosePushL(mobileLine2);
	RMobileCall mobileCall2;
	CleanupClosePushL(mobileCall2);

	ClientDialAndHoldFirstCallDialSecondCallL(mobileService, mobileCall, mobileLine,
			mobileCall2, mobileLine2);

	RMobileConferenceCall confCall;
	CleanupClosePushL(confCall);

	TRequestStatus notifyCall1Status;
	RMobileCall::TMobileCallStatus call1Status;
	mobileCall.NotifyMobileCallStatusChange(notifyCall1Status, call1Status);
	
	ClientCreateConferenceCallL(confCall);

	User::WaitForRequest(notifyCall1Status);
	ASSERT_EQUALS(KErrNone, notifyCall1Status.Int());
	ASSERT_EQUALS(RMobileCall::EStatusConnected, call1Status);
	
	TRequestStatus oneToOneStatus;
	mobileCall2.GoOneToOne(oneToOneStatus);
	User::WaitForRequest(oneToOneStatus);
	ASSERT_EQUALS(KErrNotSupported, oneToOneStatus.Int());

	TInt numCalls;
	ASSERT_EQUALS(KErrNone, confCall.EnumerateCalls(numCalls));
	ASSERT_EQUALS(2, numCalls);

	TRequestStatus hangupStatus;
	confCall.HangUp(hangupStatus);
	User::WaitForRequest(hangupStatus);
	ASSERT_EQUALS(KErrNone, hangupStatus.Int());
	
	mobileCall.Close();
	mobileCall2.Close();

	AssertMockLtsyStatusL();
	CleanupStack::PopAndDestroy(9, &config);
	}
/**
 * @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROLMULTIPARTY-NEGATIVE-UN0004
 * @SYMComponent telephony_ctsy
 * @SYMTestCaseDesc Test handing in CTSY dispatch when the Swap API is disabled 
 * @SYMTestPriority High
 * @SYMTestActions Disable API, call API, check correct error returned
 * @SYMTestExpectedResults Pass
 * @SYMTestType CT
 */
void CCTsyCallControlMultipartyFUNegative::TestSwapL()
	{
	// Note: Equiv non-negative test is CCTsyCallControlMultipartyFU::TestUseCase0006L
	
	TConfig config;
	config.SetSupportedValue(MLtsyDispatchCallControlMultipartyConferenceSwap::KLtsyDispatchCallControlMultipartyConferenceSwapApiId, EFalse);
	config.PushL();
	
	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup, this));
	OpenPhoneL();

	RBuf8 data;
	CleanupClosePushL(data);

	TInt callId1 = 1;
	TInt callId2 = 2;
	RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
	DriverCreateConferenceCallAndHoldItL(mobileService, callId1, callId2);

	TInt callId3 = 3;
	DriverDialCallL(callId3, mobileService);
	
	DriverHangUpCallL(callId1, KErrGsmCCNormalCallClearing, EFalse);
	DriverHangUpCallL(callId2, KErrGsmCCNormalCallClearing, EFalse);
	DriverHangUpCallL(callId3, KErrGsmCCNormalCallClearing);

	// Client side test

    RMobileLine mobileLine;
	CleanupClosePushL(mobileLine);
	RMobileCall mobileCall;
	CleanupClosePushL(mobileCall);

	RMobileLine mobileLine2;
	CleanupClosePushL(mobileLine2);
	RMobileCall mobileCall2;
	CleanupClosePushL(mobileCall2);

	RMobileConferenceCall confCall;
	CleanupClosePushL(confCall);

	ClientCreateConferenceCallAndHoldItL(mobileService, mobileCall,
			mobileLine, mobileCall2, mobileLine2, confCall);

	TRequestStatus notifyCall1Status;
	RMobileCall::TMobileCallStatus call1Status;
	mobileCall.NotifyMobileCallStatusChange(notifyCall1Status, call1Status);
	
	TRequestStatus notifyCall2Status;
	RMobileCall::TMobileCallStatus call2Status;
	mobileCall2.NotifyMobileCallStatusChange(notifyCall2Status, call2Status);
	
	// Dial a new call and attempt to swap the conference with it
	RMobileLine mobileLine3;
	CleanupClosePushL(mobileLine3);
	RMobileCall mobileCall3;
	CleanupClosePushL(mobileCall3);

	ClientDialCallL(mobileLine3, mobileCall3, mobileService);

	User::WaitForRequest(notifyCall1Status);
	ASSERT_EQUALS(KErrNone, notifyCall1Status.Int());
	ASSERT_EQUALS(RMobileCall::EStatusConnected, call1Status);
	
	mobileCall.NotifyMobileCallStatusChange(notifyCall1Status, call1Status);
	
	TRequestStatus swapStatus;
	confCall.Swap(swapStatus);
	User::WaitForRequest(swapStatus);
	ASSERT_EQUALS(KErrNotSupported, swapStatus.Int());

	User::WaitForRequest(notifyCall1Status);
	ASSERT_EQUALS(KErrNone, notifyCall1Status.Int());
	ASSERT_EQUALS(RMobileCall::EStatusHold, call1Status);
	
	User::WaitForRequest(notifyCall2Status);
	ASSERT_EQUALS(KErrNone, notifyCall2Status.Int());
	ASSERT_EQUALS(RMobileCall::EStatusHold, call2Status);
	
	RMobileConferenceCall::TMobileConferenceStatus confStatus;
	ASSERT_EQUALS(KErrNone, confCall.GetConferenceStatus(confStatus));
	ASSERT_EQUALS(RMobileConferenceCall::EConferenceHold, confStatus);

	// Hang up the calls
	ClientHangUpCallL(mobileCall);
	ClientHangUpCallL(mobileCall2);
	ClientHangUpCallL(mobileCall3);
	
	User::After(100000); // Allow the lifetimer to be updated before ending the test
    
	mobileCall.Close();
	mobileCall2.Close();
	mobileCall3.Close();

	AssertMockLtsyStatusL();

	CleanupStack::PopAndDestroy(10, &config);
	}
/**
 * @SYMTestCaseID BA-CTSYD-DIS-CALLCONTROLMULTIPARTY-NEGATIVE-UN0002
 * @SYMComponent telephony_ctsy
 * @SYMTestCaseDesc Test handing in CTSY dispatch when the AddCall API is disabled 
 * @SYMTestPriority High
 * @SYMTestActions Disable API, call API, check correct error returned
 * @SYMTestExpectedResults Pass
 * @SYMTestType CT
 */
void CCTsyCallControlMultipartyFUNegative::TestAddCallL()
	{
	// Note: based on non-negative test CCTsyCallControlMultipartyFU::TestUseCase0007L()  
	
	TConfig config;
	config.SetSupportedValue(MLtsyDispatchCallControlMultipartyConferenceAddCall::KLtsyDispatchCallControlMultipartyConferenceAddCallApiId, EFalse);
	config.PushL();
	
	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup, this));
	OpenPhoneL();

	TInt callId1 = 1;
	TInt callId2 = 2;
	RMobilePhone::TMobileService mobileService = RMobilePhone::EVoiceService;
	DriverCreateConferenceCallAndHoldItL(mobileService, callId1, callId2);

	TInt callId3 = 3;
	DriverDialCallL(callId3, mobileService);

	DriverHangUpCallL(callId1, KErrGsmCCNormalCallClearing, EFalse);
	DriverHangUpCallL(callId2, KErrGsmCCNormalCallClearing, EFalse);
	DriverHangUpCallL(callId3, KErrGsmCCNormalCallClearing);

	// Client side test

    RMobileLine mobileLine;
	CleanupClosePushL(mobileLine);
	RMobileCall mobileCall;
	CleanupClosePushL(mobileCall);

	RMobileLine mobileLine2;
	CleanupClosePushL(mobileLine2);
	RMobileCall mobileCall2;
	CleanupClosePushL(mobileCall2);

	ClientDialAndHoldFirstCallDialSecondCallL(mobileService, mobileCall, mobileLine,
			mobileCall2, mobileLine2);

	RMobileConferenceCall confCall;
	CleanupClosePushL(confCall);

	TRequestStatus notifyCall1Status;
	RMobileCall::TMobileCallStatus call1Status;
	mobileCall.NotifyMobileCallStatusChange(notifyCall1Status, call1Status);
	
	ClientCreateConferenceCallL(confCall);

	User::WaitForRequest(notifyCall1Status);
	ASSERT_EQUALS(KErrNone, notifyCall1Status.Int());
	ASSERT_EQUALS(RMobileCall::EStatusConnected, call1Status);
	
	mobileCall.NotifyMobileCallStatusChange(notifyCall1Status, call1Status);
	
	TRequestStatus notifyCall2Status;
	RMobileCall::TMobileCallStatus call2Status;
	mobileCall2.NotifyMobileCallStatusChange(notifyCall2Status, call2Status);
	
	ClientSwapConferenceCallL(confCall, RMobileConferenceCall::EConferenceSwapped,
			RMobileConferenceCall::EConferenceHold);

	User::WaitForRequest(notifyCall1Status);
	ASSERT_EQUALS(KErrNone, notifyCall1Status.Int());
	ASSERT_EQUALS(RMobileCall::EStatusHold, call1Status);
	
	User::WaitForRequest(notifyCall2Status);
	ASSERT_EQUALS(KErrNone, notifyCall2Status.Int());
	ASSERT_EQUALS(RMobileCall::EStatusHold, call2Status);
	
	// Dial a new call and attempt to add it to the conference
	RMobileLine mobileLine3;
	CleanupClosePushL(mobileLine3);
	RMobileCall mobileCall3;
	CleanupClosePushL(mobileCall3);

	ClientDialCallL(mobileLine3, mobileCall3, mobileService);

	RMobileCall::TMobileCallInfoV1 callInfo;
	RMobileCall::TMobileCallInfoV1Pckg callInfoPckg(callInfo);
	ASSERT_EQUALS(KErrNone, mobileCall3.GetMobileCallInfo(callInfoPckg));

	TRequestStatus status;
	confCall.AddCall(status, callInfo.iCallName);
	User::WaitForRequest(status);
    ASSERT_EQUALS(status.Int(), KErrNotSupported);

	// Hang up the calls
	ClientHangUpCallL(mobileCall);
	ClientHangUpCallL(mobileCall2);
	ClientHangUpCallL(mobileCall3);

    User::After(100000); // Allow the lifetimer to be updated before ending the test	
	
	mobileCall.Close();
	mobileCall2.Close();
	mobileCall3.Close();

	AssertMockLtsyStatusL();
    CleanupStack::PopAndDestroy(9, &config);
	}