/**
Test SEID()
*/
void CT_AvdtpSEPInfoData::DoCmdSEIDL(const TDesC& aSection)
	{
	INFO_PRINTF1(_L("TAvdtpSEPInfo SEID() Call."));
	INFO_PRINTF1(_L("Execute SEID()"));
	TSEID actual = iData->SEID();	
	_LIT(KLogSeid,"actual seid: %d");
	INFO_PRINTF2(KLogSeid, actual.SEID());
	_LIT(KLogIslocalTrue, "IsLocal: true");
	_LIT(KLogIslocalFalse, "IsLocal: false");
	if(actual.IsLocal())
		{
		INFO_PRINTF1(KLogIslocalTrue);
		}
	else
		{
		INFO_PRINTF1(KLogIslocalFalse);
		}
	
	TSEID*	expected=NULL;
	TSEID*	setbackSeid=NULL;
	TPtrC	seidName;
	if ( !GetStringFromConfig(aSection, KFldExpected, seidName) )
		{
		if ( !GetStringFromConfig(aSection, KFldSeid, seidName) )
			{
			ERR_PRINTF3(KLogMissingParameter2, &KFldExpected, &KFldSeid);
			SetBlockResult(EFail);
			}
		else
			{
			_LIT(KLogSetSEIDBack,"Set SEID back. Not compare with expected.");
			INFO_PRINTF1(KLogSetSEIDBack);
			setbackSeid = static_cast<TSEID*>(GetDataObjectL(seidName));
			*setbackSeid = actual;
			}	
		}
	else
		{
		expected = static_cast<TSEID*>(GetDataObjectL(seidName));
		
		if(expected != NULL)
			{
			if(actual != (*expected))
				{
				ERR_PRINTF1(KLogNotExpectedValue);
				SetBlockResult(EFail);
				}
			}
		else
			{
			ERR_PRINTF1(_L("TSEID pointer is NULL"));
			SetBlockResult(EFail);			
			}
		}	
	}
/**
Test TInquirySockAddr()
*/
void CT_InquirySockAddrData::DoCmdTInquirySockAddr(const TDesC& aSection)
	{
	TPtrC myTSockAddrName;
	TSockAddr* myTSockAddr = NULL;
	if ( !GetStringFromConfig(aSection, KTSockAddr(), myTSockAddrName) )
		{
		DestroyData();
		//Use default constructor	
		INFO_PRINTF1(_L("TInquirySockAddr Constructor Call"));	
		iData = new (ELeave) T_InquirySockAddrChild();
		iTInquirySockAddrOwned=ETrue;
		}
	else
		{
		myTSockAddr = static_cast<TSockAddr*>(GetDataObjectL(myTSockAddrName));
		
		if ( myTSockAddr!=NULL )
			{
			DestroyData();
			INFO_PRINTF1(_L("TInquirySockAddr Constructor Call"));	
			iData = new (ELeave) T_InquirySockAddrChild(*myTSockAddr);
			iTInquirySockAddrOwned=ETrue;
			}
		else
			{
			ERR_PRINTF1(_L("TInquirySockAddr Construct From TSockAddr. TSockAddr is NULL"));
			SetBlockResult(EFail);	
			}	
		}
	if ( iData == NULL ) 
		{
		ERR_PRINTF1(_L("TInquirySockAddr is NULL"));
		SetBlockResult(EFail);
		}
	}
void CT_RMmCustomApiData::DoCmdOpen(const TTEFSectionName& aSection)
{
    INFO_PRINTF1(_L("*START*CT_RMmCustomApiData::DoCmdOpen"));
    TPtrC mobilePhoneName;
    TInt error(0);
    if ( !GetStringFromConfig(aSection, KMobilePhoneKey(), mobilePhoneName) )
    {
        ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KMobilePhoneKey);
        SetBlockResult(EFail);
    }
    else
    {
        RMobilePhone* mobilePhoneObject = static_cast<RMobilePhone*>(GetDataObjectL(mobilePhoneName));
        INFO_PRINTF1(_L("Initializing the custom phone API"));
        error = iCustomPhone->Open(*mobilePhoneObject);
        if (error != KErrNone)
        {
            ERR_PRINTF2(_L("Failed to initialize the custom phone API with error %d"), error);
            SetError(error);
        }
        else
        {
            INFO_PRINTF1(_L("Initialize the custom phone API Succeeded"));
        }
    }
    INFO_PRINTF1(_L("*END*CT_RMmCustomApiData::DoCmdOpen"));
}
Exemplo n.º 4
0
void CT_DataAnimDll::DoCmdnewL(const TDesC& aSection)
	{
	DestroyData();

	// Get test data for command input parameter(s)
	TPtrC		wsName;
	RWsSession*	ws = NULL;
	if ( GetStringFromConfig(aSection, KFldWs, wsName) )
		{
		ws = static_cast<RWsSession*>(GetDataObjectL(wsName));
		}

	TInt err = KErrNone;
	if ( ws!= NULL )
		{
		// Execute command and log parameters
		INFO_PRINTF1(KLogInfoCmdnewL1);
		TRAP( err, iAnimDll = new (ELeave) RAnimDll(*ws) );
		}
	else
		{
		// Execute command and log parameters
		INFO_PRINTF1(KLogInfoCmdnewL2);
		TRAP(err, iAnimDll = new (ELeave) RAnimDll());
		}
	
	// Check the command return code
	if ( err!=KErrNone )
		{
		ERR_PRINTF2(KLogErrNum, err);
		SetError(err);
		}
	}
/**
Test SetSEID()
*/
void CT_AvdtpSEPInfoData::DoCmdSetSEIDL(const TDesC& aSection)
	{
	INFO_PRINTF1(_L("TAvdtpSEPInfo SetSEID() Call."));
	TSEID*	seid=NULL;
	TPtrC	seidName;
	if ( !GetStringFromConfig(aSection, KFldSeid, seidName) )
		{
		ERR_PRINTF2(KLogMissingParameter, &KFldSeid);
		SetBlockResult(EFail);
		}
	else
		{
		seid = static_cast<TSEID*>(GetDataObjectL(seidName));
		
		if(!seid)
			{
			ERR_PRINTF1(_L("TSEID pointer is NULL"));
			SetBlockResult(EFail);
			}
		else 
			{
			INFO_PRINTF1(_L("Execute SetSEID(TSEID)"));
			iData->SetSEID(*seid);
			}
		}	
	}
/**
Test Cast()
*/
void CT_InquirySockAddrData::DoCmdCast(const TDesC& aSection)
	{			
	TPtrC myTSockAddrName;
	TSockAddr* myTSockAddr = NULL;
	
	if (GetStringFromConfig(aSection, KTSockAddr(), myTSockAddrName) )
		{
		myTSockAddr = static_cast<TSockAddr*>(GetDataObjectL(myTSockAddrName));
		if ( myTSockAddr!=NULL )
			{
			DestroyData();
			
			INFO_PRINTF1(_L("TInquirySockAddr Cast Call"));
			iData = &T_InquirySockAddrChild::Cast(*myTSockAddr);
			iTInquirySockAddrOwned=EFalse;			
			}		
		else
			{
			ERR_PRINTF1(_L("TSockAddr is NULL"));
			SetBlockResult(EFail);	
			}	
		}
	else
		{
		ERR_PRINTF2(KLogMissingParameter, &KTSockAddr());
		SetBlockResult(EFail);
		}
	}
Exemplo n.º 7
0
void CT_EntryData::DoCmdAssignmentOperatorL( const TDesC& aSection )
/** Assigns another TEntry to this TEntry using "=" operator */
	{
	TPtrC entryObjectName;
	if( GET_MANDATORY_STRING_PARAMETER( KParamObject, aSection, entryObjectName ) )
		{
		INFO_PRINTF2( _L( "Assign a %S to this TEntry" ), &entryObjectName );
		
		TEntry* entryObject = NULL;
		TRAPD( err, entryObject = (TEntry*)GetDataObjectL(entryObjectName));
		if ( err == KErrNone && entryObject)
			{
			*iEntry = iEntry->operator=(*entryObject);
			}
		else
			{
			ERR_PRINTF3( _L( "Object not found or not initialised: %S. Error %d"), &entryObjectName, err );
			SetBlockResult( EFail );
			}
		}

	if ( !FileserverUtil::VerifyTEntryDataFromIniL(*this, aSection, *iEntry))
		{
		SetBlockResult(EFail);
		}
	}
void CT_RMobileCallData::DoCmdOpenExistingCall(const TTEFFunction& aSection)
	{
	INFO_PRINTF1(_L("*START*CT_RMobileCallData::DoCmdOpenExistingCall"));
	TInt callNameParameter;
	TBool dataOk = ETrue;
	if ( !GetIntFromConfig(aSection, KCallName, callNameParameter ))
		{
		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KCallName);
		SetBlockResult(EFail);
		dataOk = EFalse;
		}
	TPtrC mobileLineName;
	if ( !GetStringFromConfig (aSection, KMobileLineKey (), mobileLineName))
		{
		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KMobileLineKey );
		SetBlockResult(EFail);
		dataOk = EFalse;
		}
	if ( dataOk )
		{
		CT_RMobileLineData* mobileLineWrapper = static_cast<CT_RMobileLineData*>(GetDataWrapperL(mobileLineName));
		const TName* callName = NULL;
		TRAPD( error, callName = mobileLineWrapper->GetCallNameL (callNameParameter) );
		if(error != KErrNone)
			{
			ERR_PRINTF2(_L("Left while getting call name with error %d"), error);
			SetError(error);
			}
		else
			{
			INFO_PRINTF1(_L("Open handle to RMobileCall which can be used to receive incoming or dial outgoing call."));
			RMobileLine* mobileLineObject = static_cast<RMobileLine*>(GetDataObjectL(mobileLineName));
			INFO_PRINTF1(_L("Getting mobile call"));
			TRAP( error, iMobileCall = GetMobileCallL(callNameParameter) );
			if(error != KErrNone)
				{
				ERR_PRINTF2(_L("GetMobileCallL left when trying to obtain the MobileCall with error %d"), error);
				SetBlockResult(EFail);
				}
			else
				{
				INFO_PRINTF1(_L("Opening existing call"));
				error = iMobileCall->OpenExistingCall(*mobileLineObject, *callName);
				if ( error != KErrNone)
					{
					ERR_PRINTF2(_L("OpenExistingCall failed with error [%d]"), error);
					SetError (error);
					}
				else
					{
					INFO_PRINTF1(_L("OpenExistingCall succeeded"));
					}
				}
			}
		}
	INFO_PRINTF1(_L("*END*CT_RMobileCallData::DoCmdOpenExistingCall"));
	}
/**
Test BTAddr()
*/
void CT_InquirySockAddrData::DoCmdBTAddr(const TDesC& aSection)
	{
	INFO_PRINTF1(_L("TInquirySockAddr BTAddr Call"));	
	TBTDevAddr btDevAddr = iData->BTAddr();
	
	TBuf<KMaxSockAddrSize> tmpbtDevAddr;
	btDevAddr.GetReadable(tmpbtDevAddr);
	INFO_PRINTF2(_L("Returned BT Addres = (%S)"), &tmpbtDevAddr);		
    TBuf<KMaxSockAddrSize> tmptBTDevAddrData; 

	TPtrC	tBTDevAddrName;
	TBool	foundParameter=EFalse;	
	TBool result = EFalse;
	
	if(GetStringFromConfig(aSection, KTBTDevAddr(), tBTDevAddrName))
		{
		foundParameter=ETrue;			
		TBTDevAddr* tBTDevAddrData=static_cast<TBTDevAddr*>(GetDataObjectL(tBTDevAddrName));

		tBTDevAddrData->GetReadable(tmptBTDevAddrData);
		INFO_PRINTF2(_L("Expected BT address = (%S) from ini file"), &tmptBTDevAddrData);

		result = btDevAddr==(*tBTDevAddrData);
		
		if ( !result )
			{
			ERR_PRINTF3(_L("BT Address (%S) is not as expected (%S)"),&tmpbtDevAddr, &tmptBTDevAddrData);
			SetBlockResult(EFail);
			}
		}
	
	TInt	intBtDevAddr=0;	
	if(GetIntFromConfig(aSection, KIntDevAddr(), intBtDevAddr))
		{
		foundParameter=ETrue;			
		const TBTDevAddr expectedBTAddr(intBtDevAddr);
		
		result = btDevAddr==(expectedBTAddr);
		btDevAddr.GetReadable(tmpbtDevAddr);
		if ( !result )
			{
			ERR_PRINTF3(_L("BT Address (%S) is not as expected (%d)"), &tmpbtDevAddr, intBtDevAddr);
			SetBlockResult(EFail);
			}
		}
		
	if( !foundParameter )
		{
		ERR_PRINTF3(KLogMissingParameters, &KTBTDevAddr(), &KIntDevAddr());
		SetBlockResult(EFail);
		}
	}
Exemplo n.º 10
0
//== Mobile Line functions
void CT_RMobilePhoneData::DoCmdOpen(const TDesC& aSection)
	{
	INFO_PRINTF1(_L("*START*CT_RMobilePhoneData::DoCmdOpen"));
	// Check that first phone is available and log phone name.
	RTelServer::TPhoneInfo info;
	// Reading phone info for the first available phone
	TInt error(0);
	TBool dataOk = ETrue;
	TInt parPhone = 0;
	if ( !GetIntFromConfig(aSection, KPhone(), parPhone) )
		{
		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KPhone);
		SetBlockResult(EFail);
		dataOk = EFalse;
		}
	TPtrC telServerName;
	if ( !GetStringFromConfig(aSection, KTelServerKey(), telServerName) )
		{
		ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KTelServerKey);
		SetBlockResult(EFail);
		dataOk = EFalse;
		}
	if ( dataOk )
		{
		RTelServer* telServerObject = static_cast<RTelServer*>(GetDataObjectL(telServerName));
		INFO_PRINTF1(_L("Check if phone info was found."));
		error = telServerObject->GetPhoneInfo(parPhone, info);
		if (error != KErrNone)
			{
			ERR_PRINTF2(_L("Failed to read phone info for phone KFirstPhone with error %d"), error);
			SetError(error);
			}
		else
			{
			// Connect to RMobilePhone interface.
			INFO_PRINTF1(_L("Opening connection to phone"));
			error = iMobilePhone->Open(*telServerObject, info.iName);
			if (error != KErrNone)
				{
				ERR_PRINTF2(_L("Connection to phone failed with error %d"), error);
				SetError(error);
				}
			else
				{
				INFO_PRINTF1(_L("Opening connection to phone sucessfull"));
				}
			}
		}
	INFO_PRINTF1(_L("*END*CT_RMobilePhoneData::DoCmdOpen"));
	}
/**
Test NewLC()
*/
void CT_BluetoothSynchronousLinkData::DoCmdNewLC(const TDesC& aSection)
	{
	INFO_PRINTF1(_L("CBluetoothSynchronousLink NewLC Call"));
	DestroyData();
	
	TPtrC	socketServName;
	if(GetStringFromConfig(aSection, KRSocketServ(), socketServName))
		{
		RSocketServ* socketServ=static_cast<RSocketServ*>(GetDataObjectL(socketServName));
		TRAPD(err, iData = CBluetoothSynchronousLink::NewLC(*this, *socketServ); CleanupStack::Pop(););
		if( err!=KErrNone )
			{
			INFO_PRINTF2(_L("CBluetoothSynchronousLink Standard Constructor NewLC err=%d" ),err);
			SetError(err);
			}
		}
Exemplo n.º 12
0
/**
 * Create an instance of CAudioOutput
 * @param aSection  - Section to read param from the ini file
 * @return none
 */
void CT_CAudioOutputData::DoCmdNewL(const TTEFSectionName& aSection) //quite return
	{
	DestroyData();
	INFO_PRINTF1(_L("*START*CT_CAudioOutputData::DoCmdNewL"));
	TPtrC devSoundObject;
    if( !GetStringFromConfig(aSection, KDevSoundKey, devSoundObject) )
    	{
    	ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KDevSoundKey);
    	SetBlockResult(EFail);
    	}
    else
    	{
	    CMMFDevSound* DevSoundObject = static_cast<CMMFDevSound*>(GetDataObjectL(devSoundObject));
	    iAudioOutput = (CAudioOutput*)DevSoundObject->CustomInterface(KUidAudioOutput);
	    INFO_PRINTF1(_L("*END*CT_CAudioOutputData::DoCmdNewL"));
    	}
    }
/**
 Purpose: To test that an wrapped object exists in the dictionary. And optionally to check the object's value.

 @internalComponent
 @param  aSection Current ini file command section
 */
void CTEFLoggerTestWrapper::DoCmdGetDataObject(const TDesC& aSection)
	{
	// check if null is expected
	TBool nullExpected = EFalse;
	GetBoolFromConfig(aSection, KNullExpected(), nullExpected);

	// call GetDataObject() and check that the wrapped object is found
	TInt* wrappedObject= NULL;
	TRAPD(err, wrappedObject = static_cast<TInt*>(GetDataObjectL(aSection)));

	if (err != KErrNone)
		{
		ERR_PRINTF2(_L("GetDataObjectL() error: %d"), err);
		SetBlockResult(EFail);
		SetError(err);
		}

	// check if is null if is expetced to be null and vice versa
	if (wrappedObject == NULL && !nullExpected)
		{
		ERR_PRINTF1(_L("Wrapped object is not expected to be null!"));
		SetBlockResult(EFail);
		}
	else
		if (wrappedObject != NULL)
			{
			if (nullExpected)
				{
				ERR_PRINTF1(_L("Wrapped object is expected to be null!"));
				SetBlockResult(EFail);
				}
			else
				{
				// check expected value
				TInt objectValue = 0;
				if (GetIntFromConfig(aSection, KObjectValue(), objectValue))
					{
					if (*wrappedObject != objectValue)
						{
						ERR_PRINTF3(_L("Wrapped object's value is not as expected. expected=%d, actual=%d"), objectValue, *wrappedObject);
						SetBlockResult(EFail);
						}					
					}
				}
			}
	}
void CT_DataSdpAttrValueUint::DoCmdNewUintL(const TDesC& aSection)
	{
	
	DestroyData();
	TPtrC	theString;
	TPtrC	sdpIntBufName;
	TBool	foundParameter=EFalse;
	if ( GetStringFromConfig(aSection, KInputInt(), theString) )
		{
		foundParameter=ETrue;			
		HBufC8*	string8 = HBufC8::NewLC(theString.Length());
		string8->Des().Copy(theString);
		TPtrC8 stringPtr = string8->Des();
		TRAPD(err, iAttrValUint = CSdpAttrValueUint::NewUintL(stringPtr));
		if ( err!=KErrNone )
			{
			ERR_PRINTF2(_L("CSdpAttrValueUint::NewUintL failed with error %d"), err);
			SetError(err);
			}
		CleanupStack::PopAndDestroy(string8);
		}	   
		
	if ( GetStringFromConfig(aSection, KSdpIntBufObj(), sdpIntBufName) )
		{
		foundParameter=ETrue;
		TAny* object=GetDataObjectL(sdpIntBufName);
		TSdpIntBuf<TUint8>*	sdpIntBuf = static_cast<TSdpIntBuf<TUint8>*>(object);
		TSdpIntBuf<TUint8>	sdpIntObj = *sdpIntBuf;
		const TUint8 *tmp=&sdpIntObj[0];			
		TPtrC8 bufferPtr(tmp, sdpIntObj.Length());
		TRAPD(err, iAttrValUint = CSdpAttrValueUint::NewUintL(bufferPtr));
	    if ( err!=KErrNone )
			{
			ERR_PRINTF2(_L("CSdpAttrValueInt::NewUintL failed with error %d"), err);
			SetError(err);
			}		
		}
		
	if (!foundParameter)
		{
		ERR_PRINTF2(_L("Missing parameter %S"), &KSdpIntBufObj());
		SetBlockResult(EFail);
		}
	}
/**
Test UpdateFromRPNTransaction()
*/
void CT_RfcommRemotePortParamsData::DoCmdUpdateFromRPNTransaction(const TDesC& aSection)
	{
	TPtrC	object;
	
	if(GetStringFromConfig(aSection, KPRNTobject(), object) )
		{
		TRfcommRPNTransaction* thePRNTrascationData=static_cast<TRfcommRPNTransaction*>(GetDataObjectL(object));
		
		INFO_PRINTF2(_L("TRfcommRPNTransaction.iParamMask (%d)"), thePRNTrascationData->iParamMask );
		
		INFO_PRINTF1(_L("TRfcommRemotePortParams UpdateFromRPNTransaction Call"));
		iData->UpdateFromRPNTransaction(*thePRNTrascationData);
		}
	else
		{
		ERR_PRINTF2(KLogMissingParameter, &KPRNTobject());
		SetBlockResult(EFail);
		}
	}
Exemplo n.º 16
0
/**
Test operator!=()
*/
void CT_SEIDData::DoCmdNegativeCompareL(const TDesC& aSection)
	{
	INFO_PRINTF1(_L("TSEID != Call."));
	TSEID*	seid=NULL;
	TPtrC	seidName;
	if ( !GetStringFromConfig(aSection, KFldSeid, seidName) )
		{
		ERR_PRINTF2(KLogMissingParameter, &KFldSeid);
		SetBlockResult(EFail);
		}
	else
		{
		seid = static_cast<TSEID*>(GetDataObjectL(seidName));
		}	
	
	if(seid)
		{
		TBool actual = iData->operator !=(*seid);
		INFO_PRINTF2(_L("execuete operator !=(TSEID) = %d"), actual);
		
		TBool expected=EFalse;
		if( !GetBoolFromConfig(aSection, KFldExpected(), expected) )
			{
			ERR_PRINTF2(KLogMissingParameter, &KFldExpected);
			SetBlockResult(EFail);
			}
		else
			{
			if ( actual!=expected )
				{
				ERR_PRINTF1(KLogNotExpectedValue);
				SetBlockResult(EFail);
				}
			}
		}
	else
		{
		ERR_PRINTF1(_L("seid is NULL"));
		SetBlockResult(EFail);
		}
	}
Exemplo n.º 17
0
void CT_DataSdpAgent::DoCmdSetRecordFilterL(const TDesC& aSection)
	{
	INFO_PRINTF1(_L("CSdpAgent SetRecordFilterL call"));
	TPtrC	searchPatternName;
	if( GetStringFromConfig(aSection, KTBTSearchPattern(), searchPatternName))
		{
		CSdpSearchPattern*	searchPattern = static_cast<CSdpSearchPattern*>(GetDataObjectL(searchPatternName));
		// Set the search pattern on the agent
		TRAPD(err, 	iSdpAgent->SetRecordFilterL(*searchPattern));
		if(err != KErrNone)
			{
			ERR_PRINTF2(_L("CSdpAgent SetRecordFilterL failed with error %d"), err);
			SetError(err);
			}
		}
	else
		{
		ERR_PRINTF2(_L("Missing parameter %S"), &KTBTSearchPattern());
		SetBlockResult(EFail);
		}
	}
Exemplo n.º 18
0
void CT_DataSdpAgent::DoCmdSetAttributePredictorListL(const TDesC& aSection)
	{
	INFO_PRINTF1(_L("CSdpAgent SetAttributePredictorListL call"));
	TPtrC	dataAttrIdListName;

	if( GetStringFromConfig(aSection, KTBTAttrIdList(), dataAttrIdListName))
		{
		CSdpAttrIdMatchList*	attrIdList = static_cast<CSdpAttrIdMatchList*>(GetDataObjectL(dataAttrIdListName));

 		TRAPD(err, iSdpAgent->SetAttributePredictorListL(*attrIdList));
		if(err != KErrNone)
			{
			ERR_PRINTF2(_L("CSdpAgent SetAttributePredictorListL failed with error %d"), err);
			SetError(err);
			}
		}
	else
		{
		ERR_PRINTF2(_L("Missing parameter %S"), &KTBTAttrIdList());
		SetBlockResult(EFail);
		}
	}
/**
Test NewL()
*/
void CT_BluetoothSynchronousLinkData::DoCmdNewL(const TDesC& aSection)
	{
	INFO_PRINTF1(_L("CBluetoothSynchronousLink NewL Call"));
	DestroyData();
	
	TPtrC	socketServName;
	if(GetStringFromConfig(aSection, KRSocketServ(), socketServName))
		{
		RSocketServ* socketServ=static_cast<RSocketServ*>(GetDataObjectL(socketServName));
		TRAPD(err, iData = CBluetoothSynchronousLink::NewL(*this, *socketServ));
		if( err!=KErrNone )
			{
			INFO_PRINTF2(_L("CBluetoothSynchronousLink Standard Constructor NewL err=%d" ),err);
			SetError(err);
			}
		}
	else
		{
		ERR_PRINTF2(KLogMissingParameter, &KRSocketServ());
		SetBlockResult(EFail);
		}
	}
Exemplo n.º 20
0
void CT_EntryData::DoCmdNew( const TDesC& aSection )
/** Creates new TEntry class instance */
	{
	DoCleanup();
	
	TPtrC entryObjectName;	
	if( GET_OPTIONAL_STRING_PARAMETER( KParamObject, aSection, entryObjectName ) )
		{
		INFO_PRINTF1( _L( "Create new TEntry(TEntry) class instance." ) );
		
		TEntry* entryObject = NULL;
		TRAPD( err, entryObject = (TEntry*)GetDataObjectL(entryObjectName));
		if ( err == KErrNone )
			{
			TRAPD( err, iEntry = new (ELeave) TEntry(*entryObject) );
			if ( err != KErrNone )
				{
				ERR_PRINTF2( _L( "new TEntry(TEntry) error %d" ), err );
				SetError( err );
				}
			}
		else
			{
			ERR_PRINTF3( _L( "Unrecognized object name parameter value: %S. Error %d"), &entryObjectName, err );
			SetBlockResult( EFail );
			}
		}
	else
		{
		INFO_PRINTF1( _L( "Create new TEntry() class instance." ) );
		TRAPD( err, iEntry = new (ELeave) TEntry() );
		if ( err!=KErrNone )
			{
			ERR_PRINTF2( _L( "new TEntry() error %d" ), err );
			SetError( err );
			}
		}
	}
/**
RHostResolver::Open()
*/
void CT_InquirySockAddrData::DoCmdOpenHostResolver(const TDesC& aSection)
	{
	RSocketServ	sockServ;
	TPtrC		bluetoothSocketName;
	if(GetStringFromConfig(aSection, KBTSocket(), bluetoothSocketName))
		{
		CT_BluetoothSocketNotifier*	bluetoothSocketData=static_cast<CT_BluetoothSocketNotifier*>(GetDataObjectL(bluetoothSocketName));
		if ( bluetoothSocketData!=NULL )
			{
			sockServ = bluetoothSocketData->iSocketServer;
			}
		else
			{
			ERR_PRINTF1(_L("CT_CBluetoothSocketDataPersistentObject is NULL"));
			SetBlockResult(EFail);
			}
		}
	
	
	//	Find protocol from socket
	TProtocolDesc	protocolDesc;
	TInt			err=sockServ.FindProtocol(_L("BTLinkManager"), protocolDesc);
	if ( err!=KErrNone )
		{
		ERR_PRINTF2(_L("iSockServ.FindProtocol(aProtocolName, protocolDesc) = %d"), err);
        SetBlockResult(EFail);
		}
	if ( protocolDesc.iAddrFamily != KBTAddrFamily )
		{
		ERR_PRINTF1(_L("Wrong iAddrFamily"));
        SetBlockResult(EFail);
		}
		
	INFO_PRINTF1(_L("Close a RHostResolver first..."));
	iHostResolver.Close();
	//	Open host resolver
	INFO_PRINTF1(_L("Create and initialise an RHostResolver"));
	err=iHostResolver.Open(sockServ, protocolDesc.iAddrFamily, protocolDesc.iProtocol);
	if ( err!=KErrNone )
		{
		ERR_PRINTF2(_L("iHostResolver.Open(iSockServ, protocolDesc.iAddrFamily, protocolDesc.iProtocol) = %d"), err);
        SetError(err);
		}
	else
		{
		iHostResolverOpen = ETrue;
		INFO_PRINTF1(_L("Create and initialise an RHostResolver Completed..."));
		}
	}
Exemplo n.º 22
0
void CT_DataSdpAgent::DoCmdAttributeRequestL(const TDesC& aSection, const TInt aIndex)
	{
	TInt 	attrId;
	TPtrC	attrValListName;
	TPtrC	theType;
	TPtrC	dataAttrIdListName;
	TPtrC	expectedAttrValListName;
	CSdpAttrIdMatchList*	attrIdList=NULL;
	TBool	ifAttrIdExist=EFalse;
	TBool	ifAttrValListExist=EFalse;
	TBool	ifAttrIdListExist=EFalse;

	
	// Get AttrId from config (test data) file
	if( GetIntFromConfig(aSection, KAttrid(), attrId) )
	   	{
		ifAttrIdExist=ETrue;
		}

	//Get dictionary name of AttrValueList Wrapper
	if( GetStringFromConfig(aSection, KAttrValListName(), attrValListName) )
		{
		//Get the list type to cast to
		if( GetStringFromConfig(aSection, KListType(), theType) )
			{
			ifAttrValListExist=ETrue;
			iAttrValueList = CT_BTUtil::AttrValueListCastL(*this, attrValListName, theType);
			}
		}

	//Get the dictionary name of AttrIdMatchList Wrapper
	if( GetStringFromConfig(aSection, KTBTAttrIdList(), dataAttrIdListName) )
		{
		ifAttrIdListExist=ETrue;
		attrIdList = static_cast<CSdpAttrIdMatchList*>(GetDataObjectL(dataAttrIdListName));
		}

	TInt	err=KErrNone;
	iAttrReqIndex = aIndex;
	if(!ifAttrValListExist && ifAttrIdExist)
		{
		INFO_PRINTF1(_L("CSdpAgent AttributeRequestL(TSdpServRecordHandle, TSdpAttributeID) call"));
		TRAP(err, iSdpAgent->AttributeRequestL(iSSRHandle, attrId));
		if(err != KErrNone)
			{
			ERR_PRINTF2(_L("CSdpAgent AttributeRequestL failed with error %d"), err);
			SetError(err);
			}	
		else
			{	
			IncOutstanding();
			}
		}
	else if(ifAttrValListExist && ifAttrIdExist)
		{
		INFO_PRINTF1(_L("CSdpAgent AttributeRequestL(MSdpElementBuilder, TSdpServRecordHandle, TSdpAttributeID) call"));
		TRAP(err, iSdpAgent->AttributeRequestL(iAttrValueList, iSSRHandle, attrId));
		if(err != KErrNone)
			{
			ERR_PRINTF2(_L("CSdpAgent AttributeRequestL failed with error %d"), err);
			SetError(err);
			}	
		else
			{	
			IncOutstanding();
			}
		}
	else if(!ifAttrValListExist && ifAttrIdListExist)
		{
		INFO_PRINTF1(_L("CSdpAgent AttributeRequestL(TSdpServRecordHandle, const CSdpAttrIdMatchList&) call"));
 		TRAP(err, iSdpAgent->AttributeRequestL(iSSRHandle, *attrIdList));
		if(err != KErrNone)
			{
			ERR_PRINTF2(_L("CSdpAgent AttributeRequestL failed with error %d"), err);
			SetError(err);
			}	
		else
			{	
			IncOutstanding();
			}
		}
	else if(ifAttrValListExist && ifAttrIdListExist)
		{
		INFO_PRINTF1(_L("CSdpAgent AttributeRequestL(MSdpElementBuilder, TSdpServRecordHandle, const CSdpAttrIdMatchList&) call"));
 		TRAP(err, iSdpAgent->AttributeRequestL(iAttrValueList, iSSRHandle, *attrIdList));
		if(err != KErrNone)
			{
			ERR_PRINTF2(_L("CSdpAgent AttributeRequestL failed with error %d"), err);
			SetError(err);
			}	
		else
			{	
			IncOutstanding();
			}
		}
	else
		{
		ERR_PRINTF2(_L("Missing parameter %S"), &KTBTAttrIdList());
		SetBlockResult(EFail);
		}
	}
void CT_DataRSubConParameterBundle::DoCmdFindFamily( const TDesC& aSection )
/**
Test code for RSubConParameterBundle FindFamily

Ini file options:
	subconparameterfamily	- a CSubConParameterFamily dictionary entry

@internalComponent
*/
	{
	TPtrC		subConParameterFamilyName;

	if( !GetStringFromConfig(aSection, KSubConParameterFamily(), subConParameterFamilyName) )
		{
		MissingParamError( KSubConParameterFamily() );
		}
	else
		{
		CSubConParameterFamily*	subConParameterFamily = static_cast<CSubConParameterFamily*>(GetDataObjectL(subConParameterFamilyName));

		if (subConParameterFamily == NULL)
			{
			ERR_PRINTF1(_L("CSubConParameterBundle DoCmdFindFamily - CSubConParameterFamily is NULL"));
			SetBlockResult(EFail);
			}

		INFO_PRINTF1(_L("Calling RSubConParameterBundle FindFamily"));
		TRAPD (err, subConParameterFamily = iSubConParameterBundle->FindFamily(KSubConQoSFamily));

		if( err != KErrNone )
			{
			ERR_PRINTF2(_L("FindFamily() failed with error %d"), err);
			SetError(err);
			}
		}
	}