当前位置: 首页>>代码示例>>C++>>正文


C++ TBuf8::Compare方法代码示例

本文整理汇总了C++中TBuf8::Compare方法的典型用法代码示例。如果您正苦于以下问题:C++ TBuf8::Compare方法的具体用法?C++ TBuf8::Compare怎么用?C++ TBuf8::Compare使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TBuf8的用法示例。


在下文中一共展示了TBuf8::Compare方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Configure

// -----------------------------------------------------------------------------
// CRedirDesc::Configure
// Implementation for Configure the Media i.e. connect to stdio server
// -----------------------------------------------------------------------------
//
TInt CRedirDesc::Configure()
	{
	TInt ret;
	TBuf8<1> aDes;
	iStatus = ENoServer;
	ret = iSession.Connect(); 
	if( KErrNone  == ret)
		{
		ret = iSession.CheckMedia(aDes);
		if( KErrNone == ret)
			{
			iStatus = EConnected;
			//In case both the media is NONE the server would fail the connection and 
			//this block of the code in not executed. If any of media either read or 
			//write in NONE specified in config.ini file then the iReadNone and iWriteNone
			//flag is set to ETrue which is check in read and write functions.
			if( !aDes.Compare(_L8("R")) )
				{
				iReadNone = ETrue;
				}
			else
				{
				if( !aDes.Compare(_L8("W")) )
					{
					iWriteNone = ETrue;	
					}
				}
			}
		}
	return ret;
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:36,代码来源:uredirdesc.cpp

示例2:

void CTestUtilClass::TestUtilClass_Step2L()
	{
	//
	// Test AppendBinaryDataToAscii
	//

	TBuf8<10> testPdu;
	testPdu.Append(0x00);
	testPdu.Append(0x10);
	testPdu.Append(0x20);
	testPdu.Append(0x40);
	testPdu.Append(0xf3);
	testPdu.Append(0x7b);
	testPdu.Append(0x99);
	testPdu.Append(0x5e);
	testPdu.Append(0x01);
	testPdu.Append(0x02);

	TBuf8<400> buf;
	buf.Zero();
	INFO_PRINTF1(_L(".."));
	CATSmsUtils::AppendDataToAscii(buf,testPdu);

	if(buf.Compare(_L8("00102040f37b995e0102"))!=0)
		TESTL(KErrCorrupt);

	TBuf8<10> testPdu2;

	INFO_PRINTF1(_L(".."));
	TESTL(KErrNone == CATSmsUtils::ConvertAsciiToBinary(buf,testPdu2));
	if(testPdu.Compare(testPdu2)!=0)
		TESTL(KErrCorrupt);
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:33,代码来源:Te_SimSms.cpp

示例3: SetL

//Setting OOM testing
void CenrepSrvOOMTest::SetL()
	{
	TInt ret=KErrNone;
	TInt intValue=0;
	TReal realValue=0;

	//---------------SetL-----------------------------------
	//Setting an integer key
	ret = RepositorySingleSetL(*iServerRepo, 0x60, 600);
	TESTKErrNoneL(ret);
	ret=iServerRepo->Get(0x60,intValue);
	TESTL(intValue== 600);

	//Setting a real key
	ret = RepositorySingleSetL(*iServerRepo, 0x66, 99.99);
	TESTKErrNoneL(ret);
	ret=iServerRepo->Get(0x66,realValue);
	TESTL(realValue==99.99);

	//Setting a string key
	//Even ascii(8 bytes) are stored as 16 bytes!!!
	_LIT8(KString,"sixhundred");
	TBuf8<50> stringChangeValue=KString();
	ret = RepositorySingleSetL(*iServerRepo, 0x69, stringChangeValue);
	TESTKErrNoneL(ret);

	TBuf8<50> keyString;
	ret=iServerRepo->Get(0x69,keyString);
	TESTKErrNoneL(ret);
	TESTL(keyString.Compare(KString)==0);
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:32,代码来源:t_oomcenrepsrv.cpp

示例4: DoControllerCalled

TVerdict CTestStepUnitMMFVidClient::DoControllerCalled(TInt aFunction, const TDesC8& aText, TBool aExpected)
	{
	// Get the controller
	TInt err = KErrNone;
	RMMFController* controller = NULL;
	err = GetPlayerController(controller);
	if (err != KErrNone)
		{
		INFO_PRINTF2(_L("Error getting controller %d"), err);
		return EInconclusive;
		}

	// Check that the correct functions were called in the controller
	TBuf8<64> functionText;
	TUid uid = { KMmfVideoTestControllerUid };
	TMMFMessageDestination handleInfo(uid);
	TMMFMessageDestinationPckg message(handleInfo);

	TBuf<64> functionText16;
	err = controller->CustomCommandSync(message, aFunction, KNullDesC8, KNullDesC8, functionText);
	if (err == KErrNone ) 
		{
		functionText16.Copy(aText);
		
		if (aExpected)
			{
			INFO_PRINTF2(_L("Expect %S"), &functionText16);
			}
		else
			{
			INFO_PRINTF2(_L("Should not have %S"), &functionText16);
			}
			
		if ((functionText.Compare(aText) == 0 && aExpected) ||
			(functionText.Compare(aText) != 0 && !aExpected))
			{
			iTestStepResult = EPass;
			}
		else 
			{
			iTestStepResult = EFail;
			return iTestStepResult;
			}
		}
	return iTestStepResult;
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:46,代码来源:TestStepUnitMMFVidClient.cpp

示例5: FsFileTempL

void CPreModifierPlugin::FsFileTempL(TFsPluginRequest& aRequest)
	{
	TBuf<256> testfilename1;

	//setting up test files
	testfilename1.Append(iDriveToTest);
	testfilename1.Append(_L(":\\Data\\"));

	if (aRequest.IsPostOperation())
		{
		_LOG(_L("CPreModifierPlugin::FsFileTempL, post intercept"));

		RFilePlugin fileplugin(aRequest);
		TInt err = fileplugin.AdoptFromClient();
		iLastError = err;
		iLineNumber = __LINE__;
		if(err!=KErrNone)
			User::Leave(err); //trapped in DoRequestL
		
		//write to the newly created temp file
		TBuf8<64> wbuffer;
		wbuffer.Copy(_L8("TestTestTest"));
		err = fileplugin.Write(0, wbuffer);
		_LOG2(_L("CPreModifierPlugin::FsFileTempL, RFilePlugin::Write to the newly created temp file returned %d"), err);
		iLastError = err;
		iLineNumber = __LINE__;
		if(err!=KErrNone)
			User::Leave(err); //trapped in DoRequestL

		TInt length = wbuffer.Length();
		HBufC8* tempBuf = HBufC8::NewMaxLC(length);
		TPtr8 tempBufPtr((TUint8 *)tempBuf->Des().Ptr(), length, length);
		err = fileplugin.Read(0, tempBufPtr);
		_LOG2(_L("CPreModifierPlugin::FsFileTempL, RFilePlugin::Read returned %d"), err);
		iLastError = err;
		iLineNumber = __LINE__;
		if(err!=KErrNone)
			User::Leave(err); //trapped in DoRequestL
		
		fileplugin.Close();

		//testing the correct thing has been written to the drive
		err = wbuffer.Compare(tempBufPtr);
		iLastError = err;
		iLineNumber = __LINE__;
		if(err!=KErrNone)
			User::Leave(err); //trapped in DoRequestL
			
		CleanupStack::PopAndDestroy();
		}
	else
		{
		User::Invariant();
		}
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:55,代码来源:premodifier_plugin.cpp

示例6: SetGetAndResetAlertInfoL

TInt CTestHistoryLog::SetGetAndResetAlertInfoL( CStifItemParser& /*aItem */)
{
	//Defining Constants
	const TInt KBufSize = 10;
  TBuf8<KBufSize> vendorInfo;
  vendorInfo.Copy(KVendorInfo);  	
	
	//Creating Object
	CSmlAlertInfo* info = CSmlAlertInfo::NewLC();

	//Setting Info 
	info->TaskIds().Append(1);
	info->TaskIds().Append(KTwo);
	info->TaskSyncTypes().Append( (TSmlSyncType)0);
	info->TaskSyncTypes().Append( (TSmlSyncType)1);
	info->SetConfirmation(EFalse);
	info->SetConnectionId(KUidNSmlMediumTypeInternet.iUid);
	info->SetErrorCode(KErrorEleven);
	info->SetJobControl(CSmlAlertInfo::ECreateJob);
	info->SetProfileId(KOne);
	info->SetProtocolType(ESmlDataSync);
	info->SetSessionId(KTwo);
	info->SetTransportId(KUidNSmlMediumTypeInternet.iUid);
	info->SetVendorSpecificInfoL(vendorInfo);
	info->SetUimode(KTwelve);
	
	//Verifying the info
	TL( info->Connection() == KUidNSmlMediumTypeInternet.iUid );
	TL( info->ErrorCode() == KErrorEleven );
	TL( info->JobControl() == CSmlAlertInfo::ECreateJob );
	TL( info->Profile() == KOne );
	TL( info->Protocol() == ESmlDataSync );
	TL( info->SessionId() == KTwo );
	TL( info->Transport() == KUidNSmlMediumTypeInternet.iUid );	
	TBuf8<KBufSize> getVendorInfo = info->VendorSpecificInfo();
	TL(!(vendorInfo.Compare(getVendorInfo)));
	TL( info->GetUimode() == KTwelve );
	TL( info->CreateSession() );
	
	//Reset
	info->Reset();
	
	//Verification after Reset
	TL( info->JobControl() == CSmlAlertInfo::EDoNotCreateJob );
	TL( !info->CreateSession() );
	TL( info->VendorSpecificInfo() == KNullDesC8 );
	
	//Destroy the object
	CleanupStack::PopAndDestroy(info);
	//Return no error if everything passes
  return KErrNone; 
}	
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:52,代码来源:TestHistoryLogBlocks.cpp

示例7: SetFaxSharedHeaderFile

TInt CCallDummyBase::SetFaxSharedHeaderFile(const TTsyReqHandle aTsyReqHandle, CFaxSharedFileHandles* aFaxSharedFileHandles)
	{
	TBuf8<25> line;
	TInt ret = aFaxSharedFileHandles->File().Read(0, line);

	if(ret!=KErrNone || line.Compare(DACQ_MFAXFILE) != KErrNone)
		TsyPanic(KTsyPanicDataCorrupted);
	
	delete aFaxSharedFileHandles;
	aFaxSharedFileHandles = NULL;
	
	ReqCompleted(aTsyReqHandle,KErrNone);
	return KErrNone;
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:14,代码来源:ACQUIRE.CPP

示例8: ValidateSha

TBool ShaUtils::ValidateSha(const TDesC8& aBuffer, const TDesC8& aSha)
	{
	//calculate sha on buffer
	TBuf8<20> bufferSha;
	CSHA1* payloadSha1 = CSHA1::NewL();
	CleanupStack::PushL(payloadSha1);
	payloadSha1->Update(aBuffer);
	bufferSha.Copy(payloadSha1->Final());
	CleanupStack::PopAndDestroy(payloadSha1);
	
	if(bufferSha.Compare(aSha) == 0)
		return ETrue;
	else
		return EFalse;
	}
开发者ID:BwRy,项目名称:core-symbian,代码行数:15,代码来源:shautils.cpp

示例9: VerifyFileContent

static void VerifyFileContent(const TDesC8& aPattern, TInt64 aFilePos)
	{
	__ASSERT_DEBUG(aFilePos >= 0, User::Invariant());
	
	TheBuf.Zero();
	
	RFile64 file;
	TInt err = file.Open(TheFs, KTestFile, EFileShareReadersOrWriters);
	TEST2(err, KErrNone);

	err = file.Read(aFilePos, TheBuf, aPattern.Length());
	TEST2(err, KErrNone);
	
	file.Close();
	
	err = TheBuf.Compare(aPattern);
	TEST2(err, 0);
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:18,代码来源:t_sqlfilebuf64.cpp

示例10: IsOperatorProfile

//-----------------------------------------------------------------------------
// CNSmlDsProvisioningAdapter::IsOperatorProfile
// 
//-----------------------------------------------------------------------------
//
TBool CNSmlDsProvisioningAdapter::IsOperatorProfile( const CNSmlDsProfileElement& aProfile )
    {
    TBuf8<KMaxValueLength> value;
    CRepository* rep = NULL;
    TRAPD ( err, rep = CRepository::NewL( KCRUidOperatorDatasyncInternalKeys ) );
    if ( err == KErrNone )
        {
        rep->Get( KNsmlOpDsOperatorSyncServerId, value );
        delete rep;
        }
    
    if ( aProfile.iServerId )
    	{
        if ( value.Compare( *aProfile.iServerId ) == 0 )
            {
            return ETrue;
            }
    	}
    return EFalse;
    }
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:25,代码来源:NSmlDsProvisioningAdapter.cpp

示例11: LaunchController

TInt CStreamControl::LaunchController()
    {
    TInt status(KErrNotReady);
    // KUidMediaTypeAudio need to be part of source
    ConfigureControllerLoader(KUidMediaTypeAudio,
            CMMFFindAndOpenController::EPlayback);
    // if Streaming case

    if (!iSourceControl || !iSinkControl)
        return KErrNotReady;
   CSourceBase *sourceBase=(dynamic_cast<CSourceBase*>(iSourceControl));
   TUid sourceUID ;

   if (sourceBase)
      {
       sourceUID = sourceBase->GetSourceUid();
      }
   else
       {
       return KErrNotReady;
       }

   CSinkBase *sinkBase=(dynamic_cast<CSinkBase*>(iSinkControl));
   TUid sinkUID;

   if(sinkBase)
      sinkUID = sinkBase ->GetSinkUid();
   else
      return KErrNotReady;

    if (iSourceControl->Type() == KDataBufferSourceControl)
        {
        MDataBufferSource* streamingSource =
                static_cast<MDataBufferSource*>(iSourceControl);
        iFindAndOpenController->ConfigureSourceSink(
                CMMFFindAndOpenController::TSourceSink( /*TUid::Uid(0x10207AF3)*/sourceUID),
                CMMFFindAndOpenController::TSourceSink( /*KUidMmfAudioOutput*/sinkUID) );
        TBuf8<KMaxMimeLength> mimeType;
        status = streamingSource->GetMimeType(mimeType);
        if (status == KErrNone)
            {

            // This Flag is defined so that if the Helix Controller Supports
            // the playback of Local Media for WMA, then the HTTP Streaming still
            // goes through the Old WMA Controller( AdvancedAudioController)                
            // We are launching the Old WMA Controller using the UID.

#ifdef __WINDOWS_MEDIA                
#ifndef RD_PD_FOR_AUDIO_CONTENT_VIA_HELIX_ENGINE
            if(!mimeType.Compare(KWMAMimeType()))
                {
                iFindAndOpenController->OpenByControllerUid(TUid::Uid(0x10207A9B),KNullUid);
                }
            else
#endif
#endif
                {
                iFindAndOpenController->OpenByMimeType(mimeType);
                }
            }
        }

    if (iSourceControl->Type() == KFileSourceControl)
        {
        MFileSource* fileSource = static_cast<MFileSource*>(iSourceControl);

        HBufC* fileName = HBufC::NewLC(KMaxPath);
        TPtr fileNamePtr = fileName->Des();

        TInt err = fileSource->GetFileName(fileNamePtr);

        HBufC8* fileName1 = HBufC8::NewLC(KMaxPath);
        TPtr8 fileNamePtr1 = fileName1->Des();
        fileNamePtr1.Copy(fileNamePtr);

        HBufC8* mimeType = HBufC8::NewLC(KMaxMimeLength);
        TPtr8 mimeTypePtr = mimeType->Des();

        status = iSourceControl->GetMimeType(mimeTypePtr);

        iFindAndOpenController->ConfigureSourceSink(
                CMMFFindAndOpenController::TSourceSink(sourceUID,
                        fileNamePtr1),
                CMMFFindAndOpenController::TSourceSink(sinkUID));

        TMMFileSource source(fileNamePtr,
                ContentAccess::KDefaultContentObject, ContentAccess::EPlay);
        iFindAndOpenController->OpenByFileSource(source);

        CleanupStack::PopAndDestroy(mimeType); // mimeType
        CleanupStack::PopAndDestroy(fileName1); // fileName
        CleanupStack::PopAndDestroy(fileName); // fileName
        }

    if (iSourceControl->Type() == KDescriptorSourceControl)
        {
        MDescriptorSource* descriptorSource =
                static_cast<MDescriptorSource*>(iSourceControl);
        iFindAndOpenController->ConfigureSourceSink(
                CMMFFindAndOpenController::TSourceSink( /*TUid::Uid(0x10207AF3)*/sourceUID),
//.........这里部分代码省略.........
开发者ID:kuailexs,项目名称:symbiandump-mw2,代码行数:101,代码来源:ClientStreamControl.cpp

示例12: FsFileReplaceL

void CPreModifierPlugin::FsFileReplaceL(TFsPluginRequest& aRequest)
	{
	TFileName filename;
	TParse parse;
	
	filename = aRequest.Src().FullName();

	TUint mode;
	TInt err = aRequest.Read(TFsPluginRequest::EMode, mode);
	iLastError = err;
	iLineNumber = __LINE__;
	if(err!=KErrNone)
		User::Leave(err); //trapped in DoRequestL

	parse.Set(filename, NULL, NULL);
	TPtrC extension(parse.Ext());

	_LOG2(_L("CPreModifierPlugin::FsFileReplaceL, file: %S"), &filename);
	
	if (aRequest.IsPostOperation())
		{
		_LOG(_L("CPreModifierPlugin::FsFileReplaceL, post intercept"));
		if ((extension.CompareF(_L(".tst")) == 0) && (aRequest.Message().Int1() != 0))
			{
			//write to the newly replaced file
			TBuf8<64> wbuffer;
			wbuffer.Copy(_L8("TestTestTest"));

			RFilePlugin fileplugin(aRequest);
			TInt err = fileplugin.AdoptFromClient();
			iLastError = err;
			iLineNumber = __LINE__;
			if(err!=KErrNone)
				User::Leave(err); //trapped in DoRequestL

    		err = fileplugin.Write(0, wbuffer);
			_LOG2(_L("CPreModifierPlugin::FsFileReplaceL, RFilePlugin::Write to the newly created file returned %d"), err);
			iLastError = err;
			iLineNumber = __LINE__;
			if(err!=KErrNone)
				User::Leave(err); //trapped in DoRequestL

			TInt length = wbuffer.Length();
			HBufC8* tempBuf = HBufC8::NewMaxLC(length);
			TPtr8 tempBufPtr((TUint8 *)tempBuf->Des().Ptr(), length, length);
			err = fileplugin.Read(0, tempBufPtr);
			_LOG2(_L("CPreModifierPlugin::FsFileReplaceL, RFilePlugin::Read returned %d"), err);
			iLastError = err;
			iLineNumber = __LINE__;
			if(err!=KErrNone)
				User::Leave(err); //trapped in DoRe

			//testing the correct thing has been written to the drive
			err = wbuffer.Compare(tempBufPtr);
			iLastError = err;
			iLineNumber = __LINE__;
			if(err!=KErrNone)
				User::Leave(err); //trapped in DoRequestL
			
			fileplugin.Close();
			CleanupStack::PopAndDestroy();
			}
		}
	else
		{
		User::Invariant();
		}
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:68,代码来源:premodifier_plugin.cpp

示例13: doTestStepL


//.........这里部分代码省略.........
    //CommInitL(EFalse);
    
	//Start Comms server
// 	_LIT(KPhbkSyncCMI, "phbsync.cmi");
//    (void)StartC32WithCMISuppressions(KPhbkSyncCMI);
	
	SetTestStepResult(EPass);
    INFO_PRINTF1(_L("Starting: Socket Server\n"));
    
    RSocketServ ss;

    // Start the socket server
    TEST(KErrNone == ss.Connect());
    RSocket sock;
    TRequestStatus sta;
	INFO_PRINTF1(_L("Open a socket\n"));
    
    // Get the test address
    TInetAddr RemAddr(7);
    TPtrC testAddr;
	TEST(GetStringFromConfig(_L("AddressInfo"), _L("TestPPPIPAddr"), testAddr));
	
    if(testAddr.Length())
		{
		RemAddr.Input(testAddr); 
		}
    else
		{
		INFO_PRINTF1(_L("Test FAILED\nMissing address information in config file: "));
		return EFail;
		}
    
    // Open a socket
    TEST(KErrNone == sock.Open(ss, KAfInet, KSockStream, KProtocolInetTcp)); 
    INFO_PRINTF1(_L("Connecting Socket to:"));
	
    TBuf<30> printAddr;
    RemAddr.Output(printAddr);
	
    INFO_PRINTF1(printAddr);
	
    // Connect a socket
    sock.Connect(RemAddr,sta);
	
    // Wait for Connect to complete
    User::WaitForRequest(sta);
    TEST(sta.Int() == 0);
    
    TInt iterEnd;
	GetIntFromConfig(_L("MMUInfo"), _L("TestPPPmaxMMU"), iterEnd);
    if (iterEnd > KMaxMMU)
		iterEnd = KMaxMMU;
	
    TInt iterStart;
	GetIntFromConfig(_L("MMUInfo"), _L("TestPPPminMMU"), iterStart);
    if (iterStart < KMinMMU)
		iterStart = KMinMMU;
	
    TInt i,j;
    TSockXfrLength recvLen;
    INFO_PRINTF1(_L("Send/Recv frames"));
    for(j=iterStart;j<=iterEnd;j++)
		{
		sendBuf->Zero();
		
		for (i=0;i<j;i++)
			sendBuf->Append(Math::Random() & 0x7f);
		
		INFO_PRINTF2(_L("Sending Packet of Size: %d"),j);
		// Send data to echo port
		sock.Write(*sendBuf,sta);
		User::WaitForRequest(sta);
		TEST(sta.Int() == 0);
		i=0;
		recvBuf->Zero();
		
		while(i<j)
			{
			// Receive data from echo port
			sock.RecvOneOrMore(*recvBuf2,0,sta,recvLen); 
			User::WaitForRequest(sta);
			TEST(sta.Int() == 0);
			i += recvBuf2->Length();
			recvBuf->Append(*recvBuf2);
			}
		
		TEST(KErrNone == recvBuf->Compare(*sendBuf));
		INFO_PRINTF1(_L("   Received echoed Packet"));
		}
    
    sock.Shutdown(RSocket::EStopOutput,sta);
    User::WaitForRequest(sta);
    TEST(sta.Int() == 0);
    sock.Close();
    ss.Close();

	CleanupStack::PopAndDestroy(3);

	return TestStepResult();
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:101,代码来源:TestSteps.cpp

示例14: OpenSockets

TVerdict CEsockTest29::easyTestStepL()
	{

	// Open Sockets, one to manipulate mBufPool and one to send/revieve with tcp or udp
	TESTL( OpenSockets() == KErrNone );

	// Bind Test Socket To local Address
	TInetAddr local;
	SetPort( local, KPort, KLocal );
	iTestSocket.Bind( local );
	
	// Connect Test Socket to LoopBack Address
	TInetAddr loopBack;
	SetPort( loopBack, KPort, KLoopback );
	ConnectSocketL( iTestSocket, loopBack );
	
	// Gobble all the Buf's in the MBuf Pool return the number of mBufs in Use
	TInt totalUsedBufs = iDummySocket.SetOpt( KDummyOptionSetGobbleMBufs, 0, 0 );
	TInt bufsToBeFreed = 0;
	
	// Data to be used during socket Send
	GetIntFromConfig(KSection29, KBufSize, iBufSize);
	TBool keepSending = ETrue;
	TBuf8<4500> recvBuf;
	TBuf8<4500> sendData;
	sendData.Fill(TChar('z'), iBufSize );
	TRequestStatus sendStatus;
	TRequestStatus recvStatus;
	const TInt KOneSecond = 1000000;
	
	
	
	for( TInt freeBufCounter = 0; freeBufCounter < totalUsedBufs && keepSending; freeBufCounter += bufsToBeFreed )
	// OOB loop that will gradually release more MBufs
		{
		
		// release some mBufs and send
		iDummySocket.SetOpt( KDummyOptionSetFreeSomeMBufs, bufsToBeFreed , 0);
		iTestSocket.Send( sendData, 0, sendStatus );
		
		// Wait for a second to allow time for server/protocol to send
		User::After( KOneSecond );
		
		// Cancel the send and start to recv
		iTestSocket.CancelSend();
		User::WaitForRequest(sendStatus);
		
		iTestSocket.Recv(recvBuf, 0, recvStatus);
		
		// Wait for a second to allow time for server/protocol to recieve
		User::After( KOneSecond );
		iTestSocket.CancelRecv();
		User::WaitForRequest( recvStatus );
		
		if( freeBufCounter % 5 == 0 )
			{
			INFO_PRINTF2( _L("freeBufs now >= %d "),  freeBufCounter );
			}
		
		if( recvBuf.Compare(sendData) == 0 )
		// if we have recieved data then exit the loop
			{
			keepSending = EFalse;
			}
			
		bufsToBeFreed = 2;
		
		}
	
	// Now do a regular send for good measure to make sure everything is ok
	sendData.Fill(TChar('c'), iBufSize );
	INFO_PRINTF1( _L("End of Loop, Now sending....") );
	iTestSocket.Send( sendData, 0, sendStatus );
	User::WaitForRequest( sendStatus );
	INFO_PRINTF2( _L("Send Returned %d, now recieving...."), sendStatus.Int() );
	iTestSocket.Recv( recvBuf, 0, recvStatus );
	User::After( KOneSecond ); 
	iTestSocket.CancelRecv();
	User::WaitForRequest( recvStatus );
	
	INFO_PRINTF2( _L("Recieve returned %d ") , recvStatus.Int() );
	if( recvBuf.Compare(sendData) != 0 )
		{
		return EFail;
		}
	
	return EPass;
	
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:89,代码来源:EsockTestSection29.cpp

示例15: DoTestStepL

/**
 *
 * Do the test step.
 * Each test step must supply an implementation for DoTestStepL.
 *
 * @return	"TVerdict"
 *			The result of the test step
 *
 * @xxxx
 * 
 */
TVerdict CTestStepRecorderSendCustomCommandAsync::DoTestStepL()
	{
	TInt err;
	err = KErrNone;
	iTestStepResult = EFail;

	iRecorder = CMMFMdaAudioRecorderUtility::NewL(*this);
	
	TUid testController= TUid::Uid(KUidTestController);
	
	TRAP(err, iRecorder->OpenFileL(iFileName,
									testController,
									testController,
									KNullUid));
	if (err!=KErrNone)
		return EInconclusive;
		
	CActiveScheduler::Start();
	
	if (iError!=KErrNone)
		return EInconclusive;	

	TUid uid;
	uid = TUid::Uid(0x101f72B4);
	// destinationPckg can be temporary as the asynchronous custom command returns before the temporary variable goes out of scope
	TMMFMessageDestinationPckg destinationPckg(uid);
	
	// test without a return value
	iRecorder->RecordControllerCustomCommandAsync(destinationPckg,
								EMMFTestCustomCommandGeneralAsynchronous,
								KFirstParameter,
								KSecondParameter,
								iAsyncObserver->ActiveStatus());

	CActiveScheduler::Start();	
	if (iAsyncObserver->iStatus.Int() !=KTestCustomCommandSuccess)
		return EFail;
								
	TBuf8<256> buf;
		
	iRecorder->RecordControllerCustomCommandAsync(destinationPckg,
								EMMFTestCustomCommandGeneralAsynchronousWithReturn,
								KFirstParameter,
								KSecondParameter,
								buf,
								iAsyncObserver->ActiveStatus());

	CActiveScheduler::Start();	
	if (iAsyncObserver->iStatus.Int() !=KTestCustomCommandSuccess)
		return EFail;
		
	if (buf.Compare(KReturnParameter)==0)
		iTestStepResult = EPass;
	else
		iTestStepResult = EFail;
		
		// test without a return value
	iRecorder->PlayControllerCustomCommandAsync(destinationPckg,
								EMMFTestCustomCommandGeneralAsynchronous,
								KFirstParameter,
								KSecondParameter,
								iAsyncObserver->ActiveStatus());

	CActiveScheduler::Start();	
	if (iAsyncObserver->iStatus.Int() !=KTestCustomCommandSuccess)
		return EFail;
								
	iRecorder->PlayControllerCustomCommandAsync(destinationPckg,
								EMMFTestCustomCommandGeneralAsynchronousWithReturn,
								KFirstParameter,
								KSecondParameter,
								buf,
								iAsyncObserver->ActiveStatus());

	CActiveScheduler::Start();	
	if (iAsyncObserver->iStatus.Int() !=KTestCustomCommandSuccess)
		return EFail;
		
	if (buf.Compare(KReturnParameter)==0)
		iTestStepResult = EPass;
	else
		iTestStepResult = EFail;
		
	delete iRecorder;
	iRecorder = NULL;


	INFO_PRINTF1(_L("finished with this test step"));
	// test steps return a result
//.........这里部分代码省略.........
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:101,代码来源:TESTSTEPRecorderVARIOUS.cpp


注:本文中的TBuf8::Compare方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。