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


C++ RBuf8::Create方法代码示例

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


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

示例1:

void CTcpClientTestUPnP13::NewData(TUint aCount)
	{
	RMBufChain data;
	RBuf8 resData;
	
	iLogger.WriteFormat(_L("<i>NewData..... </i>"));
	iSSP->GetOption(1,KCHMaxLength,resData);
	resData.Create( aCount );
	iSSP->GetOption(KCHOptionLevel,KCHMaxLength,resData);
	TInt len = *(TUint*) resData.Ptr();
	resData.Close();
	
	iSSPData->GetData(data,aCount,0);
	resData.Create( aCount );
	data.CopyOut(resData);
	resData.Close();
	resData.Create( aCount );
	iSSP->GetOption(KCHOptionLevel,KCHLastMessage,resData);
	TBool isLastMsg = *(TUint*) resData.Ptr();
	resData.Close();
	data.Init();
	
	if(isLastMsg)
		{
		iLogger.WriteFormat(_L("<i>NewData.LastMsg.... </i>"));
		CompleteSelf ( KErrNone );
		}
	}
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:28,代码来源:ctcpclienttestupnp13.cpp

示例2: PublishServiceL

/*
	Tests whether Publishing a Service/Device is performing as specified in UPnP specifications.
	@param			aOperationType is reference to a section name in ini file where required parameters
					needs to be referred for this operation.
	@return			None.
 */
void CTestRControlChannel::PublishServiceL (const TDesC& aOperationType)
	{
	_LIT(KInfoLogFile, "CTestRControlChannel::PublishServiceL ().... \n");
	INFO_PRINTF1(KInfoLogFile);
	CRControlChannelObserver* upnpObserver = CRControlChannelObserver::NewL(this);
	CleanupStack::PushL( upnpObserver );
	iObserverArray.Append(upnpObserver);

	RPnPParameterBundle pnpBundle ;
	pnpBundle.Open();
    CleanupClosePushL( pnpBundle );
    pnpBundle.SetPnPObserver((MPnPObserver*)upnpObserver);
    RParameterFamily family = pnpBundle.CreateFamilyL(EUPnPServiceRegisterParamSet);
   	CUPnPServiceRegisterParamSet* registerServiceParamSet = CUPnPServiceRegisterParamSet::NewL(family );

   	_LIT(KParentDeviceUid, "ParentDeviceUid");
   	TPtrC parentDeviceUid;
	GetStringFromConfig(aOperationType, KParentDeviceUid, parentDeviceUid);

	RBuf8 parentDeviceUidBuf;
	parentDeviceUidBuf.Create(parentDeviceUid.Length());
	parentDeviceUidBuf.Copy(parentDeviceUid);
	registerServiceParamSet->SetDeviceUidL (parentDeviceUidBuf);


	TPtrC serviceType;
	GetStringFromConfig(aOperationType, KServiceType, serviceType);
	RBuf8 serviceTypeBuf;
	serviceTypeBuf.Create(serviceType.Length());
	serviceTypeBuf.Copy(serviceType);
	registerServiceParamSet->SetUriL ( serviceTypeBuf );


	TInt duration;
	GetIntFromConfig(aOperationType, KCacheControl, duration);
	registerServiceParamSet->SetCacheControlData (duration);

	ExtractServiceDescriptionL (aOperationType, *registerServiceParamSet);

	_LIT8(KInitialMessage, "Initial notification message");
	registerServiceParamSet->SetInitialMessageL(KInitialMessage);
	
	OpenPublisherL();

	iPublisher.Publish( pnpBundle );
	CActiveScheduler::Start();

	serviceTypeBuf.Close();
	parentDeviceUidBuf.Close();
	CleanupStack::PopAndDestroy( &pnpBundle );
	CleanupStack::Pop( upnpObserver );
	
	InitiateControlL();
	_LIT(KInfoLogFile1, "CTestRControlChannel::PublishServiceL () Stop.... \n");
	INFO_PRINTF1(KInfoLogFile1);
	
	}
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:63,代码来源:testrcontrolchannel.cpp

示例3: execute

/*!
  Implementation for traverse so always true.
*/
bool SdFixture::execute(void * objectInstance, QString actionName, QHash<QString, QString> parameters, QString & stdOut)
{
    debug("SdFixture::execute");
    bool returnValue = true;
#ifdef Q_OS_SYMBIAN
    const TUid fixtureUid = TUid::Uid(0x20026F7E);    
    THashFunction32<RBuf8> hashFunc( RBufHashFunction );
    TIdentityRelation<RBuf8> idFunc( RBufIdentityFunction );
    RHashMap<RBuf8, RBuf8> paramPairs( hashFunc, idFunc );
    CleanupClosePushL( paramPairs );
    debug("SdFixture::execute read params");
    QHashIterator<QString, QString> i(parameters);
    while (i.hasNext()) {
        i.next();
        if(!i.key().isEmpty() && !i.value().isEmpty() && i.key() != OBJECT_TYPE){
            debug("parametrit: " + i.key()+";"+ i.value());
            debug("SdFixture::execute read key");
            RBuf8 keyBuf;
            RBuf8 valueBuf;
            TPtrC16 keyStr(reinterpret_cast<const TUint16*>(i.key().utf16()));
            TPtrC16 valueStr(reinterpret_cast<const TUint16*>(i.value().utf16()));
            keyBuf.Create(keyStr.Length());
            valueBuf.Create(valueStr.Length());
            keyBuf.Copy(keyStr);
            valueBuf.Copy(valueStr);
            debug("SdFixture::execute insert to hash");    
            paramPairs.InsertL( keyBuf, valueBuf );
            debug("SdFixture::execute pop hbufs");    
        }
    }
    debug("SdFixture::execute make fixture");
    CTasFixturePluginInterface* fixture = CTasFixturePluginInterface::NewL( fixtureUid );
    CleanupStack::PushL( fixture );
    debug("SdFixture::execute conver actionname");
    TPtrC16 actionStr(reinterpret_cast<const TUint16*>(actionName.utf16()));
    RBuf8 actionBuf;
    actionBuf.Create(actionStr.Length());
    CleanupClosePushL( actionBuf );
    actionBuf.Copy(actionStr);
    debug("SdFixture::execute execute fixture");
    RBuf8 response;
    CleanupClosePushL( response );
    if(fixture->Execute( NULL, actionBuf, paramPairs, response ) != KErrNone){
        returnValue = false;
    }
    debug("SdFixture::execute convert response");
    stdOut  = XQConversions::s60Desc8ToQString(response);
    CleanupStack::PopAndDestroy( 4 );//response, fixture, paramPairs
#endif    
    debug("SdFixture::execute done");
    return returnValue;
}
开发者ID:alirezaarmn,项目名称:cutedriver-agent_qt,代码行数:55,代码来源:sdfixture.cpp

示例4: main

int main()
{
    __UHEAP_MARK;
    RBuf8 myrbuf;
    TBufC8<20> myTBufC (_L8(""));
    myrbuf.Create(myTBufC);
    myrbuf.CleanupClosePushL();
    wchar_t * des= new wchar_t [20]; 
    int size=20;
    int retval =ESuccess;
    retval= Rbuf8ToWchar(myrbuf,des,size);

    if(retval == EDescriptorNoData)
    {
    printf("Test_rbuf8towchar_nodata passed\n");
    }
    else
    {
    assert_failed = true;
    printf("Test_rbuf8towchar_nodata FAILURE\n");
    }
    delete[] des;
    des = NULL;
    CleanupStack::PopAndDestroy(1);
    __UHEAP_MARKEND;
    testResultXml("test_rbuf8towchar_nodata");
	return 0;
}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:28,代码来源:test_rbuf8towchar_nodata.cpp

示例5: main

int main()
{
    int retval =ESuccess;
    wstring des;
    __UHEAP_MARK;
    RBuf8  buf;
    buf.Create(10);
    buf.Copy((TUint8 *)"Hello", 5);
    buf.CleanupClosePushL();
    //int size =15;
    retval = Rbuf8ToWstring(buf, des  );

    int rbuf_len = buf.Length();
    int string_len = des.length();
    if (retval ==ESuccess && rbuf_len == string_len && rbuf_len == 5 && string_len == 5)
    {
        printf("test rbuf8towstring boundary2 Passed\n");
    }
    else
    {
        assert_failed = true;
        printf("test rbuf8towstring boundary2 Failed\n");
    }
    CleanupStack::PopAndDestroy(1);
    __UHEAP_MARKEND;
    testResultXml("test_rbuf8towstring_boundary2");
    return 0;
}
开发者ID:kuailexs,项目名称:symbiandump-os2,代码行数:28,代码来源:test_rbuf8towstring_boundary2.cpp

示例6: ParseContinuingResponse

/** Decode PDU ID 0x40 - fragmentation support
 */
TInt CControlCommand::ParseContinuingResponse(TPtrC8& aMtPayload,
										  CAVRCPFragmenter& aFragmenter)
	{
	// Check if in fragmentation state, return error if not
	if (! aFragmenter.InFragmentedState())
		{
		return KErrAvrcpMetadataInvalidCommand;
		}
	
	// Check if the parameter matches the fragmented response
	TMetadataTransferPDUID pduId = MetadataTransferParser::GetPDUID(aMtPayload);
	if (pduId != aFragmenter.GetPDU())
		{
		return KErrAvrcpMetadataInvalidParameter;
		}
	
	RBuf8 respPayload;
	CAVCFrame* frame = NULL;
	TRAPD(err, frame = CAVCVendorDependentResponse::NewL(KBluetoothSIGVendorId));
	err = respPayload.Create(KAVCMaxVendorDependentPayload); //longest resp
	if (err == KErrNone)
		{
		respPayload.Append(aFragmenter.GetNextFragmentHeader());
		respPayload.Append(aFragmenter.GetNextFragment());
		frame->SetType(AVC::EStable);
		frame->Append(respPayload);
		delete iFrame;
		iFrame = frame;
		respPayload.Close();
		}
	else
		return KErrAvrcpMetadataInternalError;
	
	return KErrAvrcpHandledInternallyRespondNow;
	}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:37,代码来源:avrcpMetadataTransfer.cpp

示例7: doTestStepL

/**
 * @see GetInfoCpm test case NET-CONFIGURATOR-I-0018-HP
 *
 * doTestStepL virtual function does the below action
 * Connect to a configurator
 * Configurator get the module inidata section. Inidata section contains
   module initialisation information in the module's configuration file.
 * close the connection to configuator
 * Expected:-GetInfoCpm return kerrNone
*/
TVerdict CGetInfoCpm::doTestStepL()
	{

	SetTestStepResult(EFail);
	_LIT8(KNameDummyCpm,"DummyCpm");

	RBuf8 data;
	data.Create(100);
	TInt actualdatasize;

	//Configurator call to get the module inidata section
	TInt error = iConfigurator.GetModuleIniData(KNameDummyCpm(), data, actualdatasize);
	if (error == KErrOverflow)
		{
		INFO_PRINTF2(_L("GetModuleIniData returned KErrOverflow (%d)  \n"), error);
		data.ReAlloc(actualdatasize);
	    error = iConfigurator.GetModuleIniData(KNameDummyCpm(), data, actualdatasize);
	  	}
	else if (error == KErrRSModuleUnknown )
		{
		INFO_PRINTF2(_L("GetModuleIniData returned KErrRSModuleUnknown (%d)  \n"), error);
		}
	else if (error == KErrNone)
		{
	    INFO_PRINTF1(_L("GetModuleIniData Sucessful"));
	    SetTestStepResult(EPass);
		}
	else
		{
		INFO_PRINTF2(_L("GetModuleIniData  (DummyCpm) returned Error (%d)  \n"), error);
		}

    data.Close();
	return TestStepResult();
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:45,代码来源:getinienumerateStep.cpp

示例8: main

int main()
{
    __UHEAP_MARK;
    RBuf8 myrbuf;
    TBufC8<5> myTBufC (_L8("hello"));
    myrbuf.Create(myTBufC);
    myrbuf.CleanupClosePushL();
    char *des= new char[5];
    int retval=ESuccess;
    int size=5;
    retval= Rbuf8ToChar(myrbuf,des,size);

    if(retval ==ESuccess)
    {
    printf("Test_rbuf8tochar_minsize passed\n");
    }
    else
    {
    assert_failed = true;
    printf("Test_rbuf8tochar_minsize FAILURE\n");
    }
    delete[] des;
    des=NULL;
    CleanupStack::PopAndDestroy(1);
    __UHEAP_MARKEND;
    testResultXml("Test_rbuf8tochar_minsize");
	return 0;
}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:28,代码来源:test_rbuf8tochar_minsize.cpp

示例9: ILibSocketWrapper_recv

int ILibSocketWrapper_recv(int socketObject, char *buffer, int bufferLength)
{
	RSocket *s = (RSocket*)SocketArray[socketObject];
	RBuf8 *buf = new RBuf8();
	
	TRequestStatus status;
	TSockXfrLength aLen;
	int RetVal=0;
	
	if(buf->Create(bufferLength)==KErrNone)
	{
		s->RecvOneOrMore(*buf,0,status,aLen);
		User::WaitForRequest(status);
		if(status!=KErrNone)
		{
			RetVal = 0;
		}
		else
		{
			RetVal = aLen();
			Mem::Copy(buffer,(void*)buf->Ptr(),RetVal);
		}
	}
	buf->Close();
	delete buf;
	return(RetVal);
}
开发者ID:GufCab,项目名称:Semester-Projekt---Test-Kode,代码行数:27,代码来源:ILibSocketWrapper.cpp

示例10: sendChatData

bool ChatSessionImpl::sendChatData(QString newChatData)
{
	TPtrC16 dataPtr(reinterpret_cast<const TUint16*>(newChatData.utf16()));
	RBuf8 chatData;
	chatData.Create(300);
	chatData.Copy(dataPtr);

	mMessageSource->SendDataL(chatData);

	chatData.Close();

	return true;
}
开发者ID:wannaphongcom,项目名称:symbian-incubation-projects.fcl-rcschat,代码行数:13,代码来源:chatsessionimpl_sym.cpp

示例11: ExtractServiceDescriptionL

void CTestRControlChannel::ExtractServiceDescriptionL (const TDesC& aConfigSection, CUPnPServiceRegisterParamSet& aServiceRegisterParamSet)
	{
	RFs fs;
	RFile file;
	RBuf8 buf;

	User::LeaveIfError(fs.Connect());
	CleanupClosePushL(fs);

	TPtrC descriptionPath;
	_LIT(KDescriptionPath, "Description_Path");
	GetStringFromConfig(aConfigSection, KDescriptionPath, descriptionPath);

	TInt err = file.Open(fs, descriptionPath, EFileShareReadersOnly);
	
	// For Hardware system path is c:, so descriptionPath value present in '.ini' is referring 'c:'
	if ( err == KErrPathNotFound )
		{				
		RBuf fileName;
		TDriveName aSystemDrive;
		TDriveUnit driveunit(RFs::GetSystemDrive());
		aSystemDrive.Zero();
		aSystemDrive=driveunit.Name();				
		fileName.CreateL ( descriptionPath.Length () );
		fileName.Zero();
		fileName.Append(aSystemDrive);
		fileName.Append ( descriptionPath.Mid ( aSystemDrive.Length () ) );				
		
		err = file.Open(fs, fileName, EFileShareReadersOnly);
		}
	if (err != KErrNone)
		{
		User::LeaveIfError(err);
		}

	CleanupClosePushL(file);
	TInt fileSize = 0;
	file.Size(fileSize);

	buf.Create(fileSize);

	err = file.Read(buf, fileSize);
	aServiceRegisterParamSet.SetServiceDescriptionL ( buf );

	CleanupStack::PopAndDestroy(2 );
	buf.Close();
	_LIT(KInfoLogFile, "CRControlChannelObserver::ExtractServiceDescriptionL End.... \n");
	INFO_PRINTF1(KInfoLogFile);
	}
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:49,代码来源:testrcontrolchannel.cpp

示例12: authenticatedPluginListL

void CSmfCredMgrClientSymbian::authenticatedPluginListL(
		QString RegistrationToken, QStringList& List)
	{
	CSmfPluginIDListParams* fetchPluginListParams =
			new (ELeave) CSmfPluginIDListParams;
	CleanupStack::PushL(fetchPluginListParams);

	//fill input params
	fetchPluginListParams->iRegistrationToken = qt_QString2HBufC(
			RegistrationToken);

	//create buffer to serialize data
	CBufFlat* buf = CBufFlat::NewL(KMinBufSize);
	CleanupStack::PushL(buf);
	RBufWriteStream stream(*buf);
	CleanupClosePushL(stream);

	fetchPluginListParams->ExternalizeL(stream);
	stream.CommitL();

	TPtr8 bufPtr1 = buf->Ptr(0);
	TIpcArgs args;
	args.Set(0, &bufPtr1);

	// to get the data from server, we create a space.
	HBufC8* retBuf = HBufC8::NewL(KMaxBufSize);
	CleanupStack::PushL(retBuf);

	TPtr8 outputptr = retBuf->Des();
	args.Set(1, &outputptr);

	iSession.RequestService(ESendPluginIDList, args);

	//create buffer to read data received
	RBuf8 dataBuf;
	CleanupClosePushL(dataBuf);
	dataBuf.Create(outputptr);

	fetchPluginListParams->InternalizeL(dataBuf);

	smfcredmgrclientutil::convertToQStringList(
			fetchPluginListParams->iPluginList, List);

	CleanupStack::PopAndDestroy(&dataBuf);
	CleanupStack::PopAndDestroy(retBuf);
	CleanupStack::PopAndDestroy(&stream);
	CleanupStack::PopAndDestroy(buf);
	CleanupStack::PopAndDestroy(fetchPluginListParams);
	}
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:49,代码来源:smfcredmgrclient_p.cpp

示例13: Completed

// The client application has signaled that all attributes have been returned so 
// response can now be sent
EXPORT_C void CRemConMediaInformationTarget::Completed()
	{
	if (!iInProgress)
		{
		return;
		}
	// Finalise response; update number of attributes returned
	iResponse->iNumberAttributes = iResponse->iAttributes.Count();

	//Check the bound of the number of attributes, zero is not permitted
	if (iResponse->iNumberAttributes == 0)
		{
		return SendError(KErrAvrcpMetadataInternalError);
		}
	
	// Allocate a buffer for the formatted message
	RBuf8 messageBuffer;
	if ( messageBuffer.Create(iResponse->Size()) != KErrNone )
		{
		// On OOM drop the message
		iResponse->Close();
		return;
		}
		
	// send the result back to the CT
	TInt error = KErrNone;
	TRAP(error, iResponse->WriteL(messageBuffer));
	if (error == KErrNone)
		{
		InterfaceSelector().SendUnreliable(TUid::Uid(KRemConMediaInformationApiUid),
								EGetElementAttributes, ERemConResponse, messageBuffer);
		}
	
	// Make sure attribute list is reset for next time
	iResponse->Close();
	messageBuffer.Close();
	
	iInProgress = EFalse;
	if (!iMsgQueue.IsEmpty())
		{
		iNextMessageCallBack->CallBack();
		}
	
	}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:46,代码来源:mediainformationapi.cpp

示例14: SendError

// from MRemConInterfaceIf
void CRemConMediaInformationTarget::SendError(TInt aError)
	{
	RBuf8 outBuf;
	if (outBuf.Create(KAVCFrameMaxLength) != KErrNone)
		{
		// On OOM drop the message
		return;
		}
	
	TInt error = 0;
	RAvrcpIPCError response;
	response.iError = aError;
	TRAP(error, response.WriteL(outBuf));   // Don't send error if OOM
	if (error == KErrNone)
		{
		InterfaceSelector().SendUnreliable(TUid::Uid(KRemConMediaInformationApiUid),
							EGetElementAttributes, ERemConResponse, outBuf);
		}
	outBuf.Close();
	}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:21,代码来源:mediainformationapi.cpp

示例15: ILibSocketWrapper_recvfrom

int ILibSocketWrapper_recvfrom(int socketObject, char *buffer, int bufferLength, struct sockaddr *src)
{
	RSocket *s = (RSocket*)SocketArray[socketObject];
	TRequestStatus status;
	TInetAddr addr;
	int RetVal=0;
	RBuf8 *buf = new RBuf8();
	
	if(buf->Create(bufferLength)==KErrNone)
	{
		TProtocolDesc aProtocol;
		
		s->Info(aProtocol);
		if(aProtocol.iSockType==KSockStream)
		{
			s->RemoteName(addr);
			((struct in_addr*)src->sa_data)->s_addr = ntohl(addr.Address());
			src->sa_port = htons(addr.Port());
			RetVal = ILibSocketWrapper_recv(socketObject, buffer, bufferLength);
		}
		else
		{
			s->RecvFrom(*buf,addr,(unsigned int)0,status);
			User::WaitForRequest(status);
			if(status!=KErrNone)
			{
				RetVal = 0;
			}
			else
			{
				((struct in_addr*)src->sa_data)->s_addr = ntohl(addr.Address());
				src->sa_port = htons(addr.Port());
				Mem::Copy(buffer,buf->Ptr(),buf->Length());
				RetVal = buf->Length();
			}
		}
	}
	buf->Close();
	delete buf;
	return(RetVal);
}
开发者ID:GufCab,项目名称:Semester-Projekt---Test-Kode,代码行数:41,代码来源:ILibSocketWrapper.cpp


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