本文整理汇总了C++中RBuf8::Close方法的典型用法代码示例。如果您正苦于以下问题:C++ RBuf8::Close方法的具体用法?C++ RBuf8::Close怎么用?C++ RBuf8::Close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RBuf8
的用法示例。
在下文中一共展示了RBuf8::Close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void CTcpServerTestUPnP23::RecvComplete ( RMBufChain& aData )
{
RBuf8 responseBuf;
responseBuf.CreateMax ( aData.Length () );
aData.CopyOut ( responseBuf );
aData.Free ();
if ( responseBuf.FindF ( KExpectedResponse ) != KErrNotFound )
{
iSocketHandler.Recv ();
responseBuf.Close ();
return;
}
if ( responseBuf.FindF ( KResponseData ) == KErrNotFound )
{
iResponse = EFail; // test case failed
}
else
{
iResponse = EPass; // test case passed
}
responseBuf.Close ();
CompleteSelf ( KErrNone );
}
示例2: DriverCreateConferenceCallL
void CCTsyCallControlMultipartyFUNegative::DriverCreateConferenceCallL(RMobilePhone::TMobileService aMobileService, TInt aCallId1, TInt aCallId2)
{
RBuf8 data;
CleanupClosePushL(data);
DriverDialAndHoldFirstCallDialSecondCallL(aMobileService, aCallId1, aCallId2);
TMockLtsyData2<TInt, TInt> createConfData(aCallId1, aCallId2);
createConfData.SerialiseL(data);
iMockLTSY.ExpectL(MLtsyDispatchCallControlMultipartyCreateConference::KLtsyDispatchCallControlMultipartyCreateConferenceApiId, data);
RMobileCall::TMobileCallStatus callStatus = RMobileCall::EStatusConnected;
TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockCallData(
aCallId1, RMobilePhone::EServiceUnspecified, callStatus);
data.Close();
mockCallData.SerialiseL(data);
iMockLTSY.CompleteL(KMockLtsyDispatchCallControlNotifyCallStatusChangeIndId, KErrNone, data);
TMockLtsyCallData1<RMobileCall::TMobileCallStatus> mockCallData2(
aCallId2, RMobilePhone::EServiceUnspecified, callStatus);
data.Close();
mockCallData2.SerialiseL(data);
iMockLTSY.CompleteL(KMockLtsyDispatchCallControlNotifyCallStatusChangeIndId, KErrNone, data);
CleanupStack::PopAndDestroy(1, &data);
} // CCTsyCallControlMultipartyFUNegative::DriverCreateConferenceCallL
示例3: QueueProcessedEventL
void CMockPowerEngine::QueueProcessedEventL(const TInt aCommandId, const TUint8 aTransId, TDesC8& aData)
{
// Request
RBuf8 buffer;
// Request
FurtherProcessEventL(aCommandId, aData);
TMockHwrmPluginData reqData(aTransId,aData);
reqData.SerialiseL(buffer);
// copy serialised data to a HBufC8 pointer
HBufC8* req = HBufC8::New(buffer.Length());
TPtr8 reqPtr = req->Des();
reqPtr = buffer;
// queue that as expected request (take ownership of req)
CMockSYEngine::DoQueueEventL(TMockSYEvent::EMessage,aCommandId,req,KErrNone,EFalse,0);
buffer.Close();
QueueProcessedCompletionL(aCommandId, aTransId, buffer, aData);
// copy serialised data to a HBufC8 pointer
HBufC8* resp = HBufC8::New(buffer.Length());
TPtr8 respPtr = resp->Des();
respPtr = buffer;
// queue that as response (take ownership of req)
CMockSYEngine::DoQueueEventL(TMockSYEvent::ECompletion,aCommandId,resp,KErrNone,EFalse,1);
buffer.Close();
}
示例4:
void CTcpServerTestUPnP40::RecvComplete ( RMBufChain& aData )
{
RBuf8 responseBuf;
responseBuf.CreateMax ( aData.Length () );
aData.CopyOut ( responseBuf );
aData.Free ();
if ( responseBuf.FindF ( KExpectedResponse3 ) != KErrNotFound )
{
iSocketHandler.Recv ();
responseBuf.Close ();
return;
}
if ( responseBuf.FindF ( KResponseData ) != KErrNotFound )
{
TRAP_IGNORE(iSendChain.CreateL ( KData32 ));
iSocketHandler.Send ( iSendChain );
responseBuf.Close ();
return;
}
if ( responseBuf.FindF ( KExpectedResponse32 ) != KErrNotFound )
{
iResponse = EPass; // test case Passed
}
else
{
iResponse = EFail; // test case failed
}
responseBuf.Close ();
CompleteSelf ( KErrNone );
}
示例5:
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 );
}
}
示例6: 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);
}
示例7: printMessage
void SymbianLog::printMessage(const char* level, const char* msg, PLATFORM_VA_LIST argList)
{
iSemaphore.Wait();
StringBuffer currentTime = createCurrentTime(true);
TInt err = file.Open(fsSession, iLogName, EFileWrite|EFileShareAny);
TInt pos = 0;
if (err == KErrNotFound)
{
// First time: file does not exist. Create it.
err = file.Create(fsSession, iLogName, EFileWrite|EFileShareAny);
if (err != KErrNone) {
setErrorF(err, "SymbianLog: could not open log file (code %d)", err);
goto finally;
}
StringBuffer header = createHeader();
RBuf8 data;
data.Assign(stringBufferToNewBuf8(header));
file.Write(data);
data.Close();
}
else
{
err = file.Seek(ESeekEnd, pos);
if (err != KErrNone) {
setErrorF(err, "SymbianLog: seek error on log file (code %d)", err);
goto finally;
}
}
{
// Write the data
StringBuffer line, data;
line.sprintf("%s -%s- %s", currentTime.c_str(), level, msg);
data.vsprintf(line.c_str(), argList);
data.append("\n");
RBuf8 buf;
buf.Assign(stringBufferToNewBuf8(data));
file.Write(buf);
buf.Close();
}
finally:
file.Close();
// we need closed file to operate on it
if ( LogSize() > SYMBIAN_LOG_SIZE ){
// roll log file
RollLogFile();
}
iSemaphore.Signal();
}
示例8: 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);
}
示例9: SetClientProfileActionL
// -------------------------------------------------------------------------------------
// CUpnpTmClientProfileService::SetClientProfileActionL
// @param aAction Pointer to UPnP action object
// @return Returns upnp error code
// ---------------------------------------------------------------------------------
//
TUpnpErrorCode CUpnpTmClientProfileService::SetClientProfileActionL( CUpnpAction* aAction )
{
OstTraceFunctionEntry0( CUPNPTMCLIENTPROFILESERVICE_SETCLIENTPROFILEACTIONL_ENTRY );
TUint profileIdInt;
// Fetch the value for profile ID argument
TLex8 lex( aAction->ArgumentValue(KProfileId) );
lex.Val(profileIdInt);
OstTrace1( TRACE_ERROR, CUPNPTMCLIENTPROFILESERVICE_SETCLIENTPROFILEACTIONL, "CUpnpTmClientProfileService::SetClientProfileActionL;profileIdInt=%d", profileIdInt );
// Fetch the value for client profile argument
const TDesC8& clientProfile = aAction->ArgumentValue(KClientProfile);
RBuf8 resultProfileBuf;
TTerminalModeErrorCode ret = iTmServerImpl.SetClientProfile( profileIdInt,clientProfile,resultProfileBuf );
if ( ret != ETerminalModeSuccess )
{
resultProfileBuf.Close();
OstTrace0( TRACE_ERROR, DUP1_CUPNPTMCLIENTPROFILESERVICE_SETCLIENTPROFILEACTIONL, "CUpnpTmClientProfileService::SetClientProfileActionL" );
return TUpnpErrorCode( ret );
}
CleanupClosePushL(resultProfileBuf);
aAction->SetArgumentL( KResultProfile , resultProfileBuf );
CleanupStack::PopAndDestroy(&resultProfileBuf);
OstTraceFunctionExit0( CUPNPTMCLIENTPROFILESERVICE_SETCLIENTPROFILEACTIONL_EXIT );
return EHttpOk;
}
示例10: WriteL
/** This user-side method uses the RFile Session methods to find the end of the file described by iCSVFile.
It then appends performance data metrics by element from the passed array, with each element separated by a comma character.
@param aPerformanceData is the constant array of performance data stored as TDesC
@return KErrNone if command was prepared correctly and a system wide error code otherwise.
*/
void CUptCsvGenerator::WriteL(const RArray<TPtrC8>& aPerformanceConfig)
{
// find end of this file, and append the passed data from here.
TInt filesize;
iCsvFile.Size(filesize);
iCsvFile.Seek(ESeekStart, filesize);
RBuf8 buf;
CleanupClosePushL(buf);
//create a buf large enough to contain the passed data and comma separators
TInt numbytes = 5*aPerformanceConfig.Count()*sizeof(TPtrC8);
buf.CreateL(numbytes);
//for the number of elements in the passed array:- append each element, separated by a comma, to the buffer
for(TInt i=0; i!=aPerformanceConfig.Count(); i++) //could replace aPerformance.Count() with structure paramter Parameter.Count
{
buf.Append(aPerformanceConfig[i]);
//may reimplement this
if(i!=aPerformanceConfig.Count())
buf.Append(KCsvComma);
}
//write the buffer to the given file
User::LeaveIfError(iCsvFile.Write(buf));
//close and cleanup the heap objects
buf.Close();
CleanupStack::PopAndDestroy(&buf);
}
示例11: GetDataL
// ---------------------------------------------------------------------------
// Data request from CatalogsPCConnectivityPlugin
// First ask the size from server, then give correct size CBufFlat
// ---------------------------------------------------------------------------
//
void RCatalogsPCConnectivityClient::GetDataL(
TDataType& aMimeType, CBufFlat& aData )
{
TPckgBuf<TInt> pckgSize;
TPckgBuf<TDataType> pckgMIME;
User::LeaveIfError( SendReceive(
ECatalogsPCConnectivityGetSize,
TIpcArgs( &pckgMIME, &pckgSize ) ) );
TInt size = pckgSize();
aMimeType = pckgMIME();
RBuf8 desData;
desData.CreateL( size );
desData.CleanupClosePushL();
User::LeaveIfError( SendReceive(
ECatalogsPCConnectivityGetData,
TIpcArgs( &desData ) ) );
aData.Reset();
aData.ExpandL( 0, size );
aData.Write( 0, desData, size );
CleanupStack::Pop(); //desData
desData.Close();
}
示例12: if
void CTcpClientTestUPnP1::ReceivedL ( const TRuntimeCtxId& /*aSender*/, const TNodeId& /*aRecipient*/, TSignatureBase& aMessage )
{
if ( aMessage.IsMessage<TCFFactory::TPeerFoundOrCreated> () )
{
const TCFFactory::TPeerFoundOrCreated& msg = message_cast < const TCFFactory::TPeerFoundOrCreated > ( aMessage );
iClientId = msg.iNodeId;
CompleteSelf ( KErrNone );
}
else if ( aMessage.IsMessage<TUpnpMessage::TResponse > () )
{
TUpnpMessage::TResponse& msg = message_cast< TUpnpMessage::TResponse >(aMessage);
RBuf8 responseBodyData;
responseBodyData.CreateMax ( msg.iBodyData.Length () );
responseBodyData.FillZ ( msg.iBodyData.Length () );
msg.iBodyData.CopyOut ( responseBodyData );
responseBodyData.Close ();
msg.iBodyData.Free ();
CompleteSelf(EPass);
}
else if ( aMessage.IsMessage<TEBase::TError > () )
{
iLogger.WriteFormat(_L("<i>TEBase::TError..... </i>"));
CompleteSelf(EFail);
}
}
示例13: WriteApiNameL
void CUptCsvGenerator::WriteApiNameL(const TInt aApiEnum)
{
// find end of this file, and append the passed data from here.
TInt filesize;
iCsvFile.Size(filesize);
iCsvFile.Seek(ESeekStart, filesize);
RBuf8 buf;
CleanupClosePushL(buf);
//create a buf large enough to contain the passed data and comma separators
TInt numbytes = 1024;//2*sizeof(TPtrC8);
buf.CreateL(numbytes);
//read the APIenum (which is the same as the first element of aPerformanceData)
//use this enum value to write the name of the API being tested
TApiNames getApiName;
buf.Append(getApiName.GetApiIdString(aApiEnum));
buf.Append(KCsvComma);
//write the buffer to the given file
User::LeaveIfError(iCsvFile.Write(buf));
//close and cleanup the heap objects
buf.Close();
CleanupStack::PopAndDestroy(&buf);
}
示例14: 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();
}
示例15: LaunchAppActionL
// ---------------------------------------------------------------------------------
// CUpnpTmAppServerService::LaunchAppActionL
// @param aAction pointer to upnp action object
// @return Returns upnp error code
// ---------------------------------------------------------------------------------
//
TUpnpErrorCode CUpnpTmAppServerService::LaunchAppActionL( CUpnpAction* aAction )
{
OstTraceFunctionEntry0( CUPNPTMAPPSERVERSERVICE_LAUNCHAPPACTIONL_ENTRY );
TUint appIdInt;
TUint profileIdInt;
// Validates the input parameters
if ( ( ConvertDescriptorToInt( aAction->ArgumentValue(KAppId), appIdInt ) != KErrNone )
|| ( ConvertDescriptorToInt( aAction->ArgumentValue(KProfileId), profileIdInt ) != KErrNone ))
{
OstTraceExt2( TRACE_ERROR, CUPNPTMAPPSERVERSERVICE_LAUNCHAPPACTIONL, "CUpnpTmAppServerService::LaunchAppActionL;appIdInt=%u;profileIdInt=%u", appIdInt, profileIdInt );
return EInvalidArgs; // either invalid app ID or invalid profile ID
}
RBuf8 launchUrl;
TTerminalModeErrorCode ret = iTmServerImpl.LaunchApp( appIdInt,profileIdInt,launchUrl );
if ( ret != ETerminalModeSuccess )
{
// Error is returned
launchUrl.Close();
OstTrace0( TRACE_ERROR, DUP1_CUPNPTMAPPSERVERSERVICE_LAUNCHAPPACTIONL, "CUpnpTmAppServerService::LaunchAppActionL" );
return TUpnpErrorCode( ret );
}
CleanupClosePushL(launchUrl);
aAction->SetArgumentL( KAppLaunchUri , launchUrl );
CleanupStack::PopAndDestroy(&launchUrl);
OstTraceFunctionExit0( CUPNPTMAPPSERVERSERVICE_LAUNCHAPPACTIONL_EXIT );
return EHttpOk;
}