本文整理汇总了C++中TDes8::Ptr方法的典型用法代码示例。如果您正苦于以下问题:C++ TDes8::Ptr方法的具体用法?C++ TDes8::Ptr怎么用?C++ TDes8::Ptr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDes8
的用法示例。
在下文中一共展示了TDes8::Ptr方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Send
TInt DISIRouter::Send(
TDes8& aMessage,
const TUint8 aObjId
)
{
C_TRACE( ( _T( "DISIRouter::Send 0x%x 0x%x>" ), &aMessage, aObjId ) );
if( ( ( aObjId == EIscNokiaUsbPhonetLink ) && ( GET_SENDER_DEV( aMessage.Ptr() ) == PN_DEV_PC ) ) ||
( aObjId == PN_OBJ_ROUTING_REQ ) ||
( aObjId == PN_OBJ_EVENT_MULTICAST ) ||
( aObjId == ROUTER_OBJECT_IDENTIFIER ) ||
( aObjId == PIPEHANDLER_OBJECT_IDENTIFIER ) )
{
// No need to update sender dev and obj id
C_TRACE( ( _T( "DISIRouter::Send message tx address not needed to updata 0x%x 0x%x>" ), aObjId, GET_SENDER_DEV( aMessage.Ptr() ) ) );
}
else
{
TUint8* messageBlockPtr( const_cast<TUint8*>( aMessage.Ptr() ) );
SET_SENDER_DEV( messageBlockPtr, PN_DEV_OWN );
SET_SENDER_OBJ( messageBlockPtr, aObjId );
}
TInt error = iShCLTransceiver->RouteISIMessage( aMessage );
C_TRACE( ( _T( "DISIRouter::Send 0x%x 0x%x<" ), &aMessage, aObjId ) );
return error;
}
示例2: if
// -----------------------------------------------------------------------------
// CG711PayloadFormatRead::DecodePayload
// Decodes all audio frames from the received RTP payload buffer. Decoded
// audio frames are saved to the internal array so that audio frames can be
// requested one at a time with GetNextFrame() -method.
// No assumption about frame count in RTP packet is done.
// -----------------------------------------------------------------------------
//
TInt CG711PayloadFormatRead::DecodePayload( TDes8& aSourceBuffer )
{
DP_G711_READ2( "CG711PayloadFormatRead::DecodePayload SourceBufSize: %d",
aSourceBuffer.Size() );
DP_G711_READ2( "CG711PayloadFormatRead::DecodePayload SourceBufLength: %d",
aSourceBuffer.Length() );
iFrameIndex = 0;
const TUint8* framePtr = aSourceBuffer.Ptr();
const TUint8* endPtr = aSourceBuffer.Ptr() + aSourceBuffer.Size();
TInt frames = aSourceBuffer.Size() / TInt( iCInfo.iFrameSize );
DP_G711_READ2( "CG711PayloadFormatRead::DecodePayload FrameSize: %d",
iCInfo.iFrameSize );
DP_G711_READ2( "CG711PayloadFormatRead::DecodePayload Frames: %d",
frames );
// Construct pointers to frames in payload if not in CN mode
if ( !iCnFrame )
{
while ( frames-- )
{
const TPtr8 bufPtr( const_cast<TUint8*>( framePtr ),
iCInfo.iFrameSize, iCInfo.iFrameSize );
iFrameArray.Append( bufPtr );
framePtr += iCInfo.iFrameSize;
if ( framePtr >= endPtr )
{
frames = 0;
}
}
}
else if ( aSourceBuffer.Size() && iCnFrame )
{
// If it is a CN frame, then we must do special handling. This is
// because e.g Cisco kit sends 1 byte CN frames, thus we need to
// expand the source buffer with zeroes.
TInt targetLen = iCInfo.iFrameSize;
targetLen = targetLen - aSourceBuffer.Size();
DP_G711_READ2( "CG711PayloadFormatRead::DecodePayload CN frame size adjust: %d",
targetLen );
const TChar zero( '0' );
aSourceBuffer.AppendFill( zero, targetLen );
const TPtr8 bufPtr( const_cast<TUint8*>( framePtr ),
iCInfo.iFrameSize, iCInfo.iFrameSize );
iFrameArray.Append( bufPtr );
}
return iFrameArray.Count();
}
示例3: HandlePDPCreate
TInt CNifPDPContextTNif::HandlePDPCreate(TDes8& aConfig)
{
RPacketContext::TProtocolType pdpType;
iNif->FirstExistingPDPContext()->ContextPDPType(pdpType);
// Context creation is synchronous call.
const TDesC8& contextName=CfgFile()->ItemValue(KContextName, KDefaultName);
iContextName.Copy(contextName);
RPacketContext::TGSNAddress name;
iNif->FirstExistingPDPContext()->ContextAPNName(name);
// Update the return data.
TContextParameters& opt = *(TContextParameters*)aConfig.Ptr();
opt.iContextConfig.SetPdpType(pdpType);
opt.iContextType=ESecondaryContext;
opt.iContextConfig.SetAccessPointName(name);
opt.iReasonCode = KErrNone; // we need to set this to success IDO
// Update the local data copy.
iParameter.iContextConfig.SetPdpType(pdpType);
iParameter.iContextType=ESecondaryContext;
iParameter.iContextConfig.SetAccessPointName(name);
//TODO: We need to start a timer as well to simulate the creation
// if telephony decides the creation is Asyn call.
// Start Timer to new PDP .
TimerCancel();
TimerAfter(2000*1000);
return KErrNone;
};
示例4: HandleContextActivate
TInt CNifPDPContextTNif::HandleContextActivate(TDes8& aConfig)
{
TContextParameters& opt = *(TContextParameters*)aConfig.Ptr();
if (iParameter.iContextInfo.iStatus == RPacketContext::EStatusActivating)
{
opt.iReasonCode = KErrInUse; // we need to set this to success
return KErrGeneral;
}
else if(iParameter.iContextInfo.iStatus == RPacketContext::EStatusActive)
{
opt.iReasonCode = KErrInUse;
return KErrGeneral;
}
// Get the Activation Duration.
TInt activateDuration;
const CTestConfigItem* item = CfgFile()->Item(KContextActivateEntry);
TInt err=CTestConfig::GetElement(item->Value(), KStdDelimiter, 1, activateDuration); // The 3rd parameter (3) represents the index of the variable on the config file line
if (err!=KErrNone)
activateDuration=KDefaultActivationTime;
// Start Timer to activate the PDP context.
TimerCancel();
TimerAfter(activateDuration*1000);
// Update the return data.
opt.iReasonCode = KErrNone; // we need to set this to success IDO
opt.iContextInfo.iStatus = RPacketContext::EStatusActivating;
// Update the local data copy.
iParameter.iReasonCode = KErrNone;
return KErrNone;
};
示例5: HandleQosSet
TInt CNifPDPContextTNif::HandleQosSet(TDes8& aConfig)
{
// Update local record.
TContextParameters& opt = *(TContextParameters*)aConfig.Ptr();
CopyQosReqParameter(opt);
// Get the Qos Profile Name.
const TDesC8& name=CfgFile()->ItemValue(KQosProfileName, KDefaultName);
iQosProfileName.Copy(name);
// Get the Qos Setting Duration.
TInt qosDuration;
const CTestConfigItem* item = CfgFile()->Item(KContextQosSetEntry);
TInt err=CTestConfig::GetElement(item->Value(), KStdDelimiter, 1, qosDuration); // The 3rd parameter (3) represents the index of the variable on the config file line
if (err!=KErrNone)
qosDuration=KDefaultQosSettingTime;
// Start Timer to set Qos.
TimerCancel();
TimerAfter(qosDuration*1000);
// Update the return data.
opt.iReasonCode = KErrNone; // we need to set this to success
// Update the local data copy.
iParameter.iReasonCode = KErrNone;
return KErrNone;
};
示例6: TranslateCrLf
LOCAL_C TInt TranslateCrLf(TDes8 &aDes)
//
// Search for CR/LF characters in a string and replace them with
// '\r' '\n' format. Also replaces unprintable characters with "?"
//
{
TText8 buf[KBlockSize];
TText8 *pS=(TText8*)aDes.Ptr();
TText8 *pSE=pS+aDes.Size();
TText8 *pT=&buf[0];
TText8 *pTMax=pT+(KBlockSize-1);
for (; pS<pSE; pS++,pT++)
{
if (pT>=pTMax)
return(KErrTooBig);
if (*pS=='\xD'||*pS=='\xA')
{
*pT++='\\';
*pT=(*pS=='\xD')?'r':'n';
}
else if (((TChar)*pS).IsPrint())
*pT=*pS;
else
*pT='\?';
}
*pT=0;
if ((pT-&buf[0])>aDes.MaxLength())
return(KErrTooBig);
aDes.Copy(&buf[0]);
return(KErrNone);
}
示例7: Receive
TBool DISIRouter::Receive( TDes8& aMessage, const TUint8 aObjId )
{
C_TRACE( ( _T( "DISIRouter::Receive 0x%x 0x%x>" ), &aMessage, aObjId ) );
TBool error( EFalse );
TUint8* messageBlockPtr( const_cast<TUint8*>( aMessage.Ptr() ) );
NKern::FMWait( iClientTableFastMutex );
if( iClientTable[ aObjId ] )
{
NKern::FMSignal( iClientTableFastMutex );
( iClientTable[ aObjId ]->iChannel )->Receive( aMessage ); //may not be safe, consider receive/delete sync
C_TRACE( ( _T( "DISIRouter::Receive ok 0x%x 0x%x" ), &aMessage, aObjId ) );
error = ETrue;
}
else
{
NKern::FMSignal( iClientTableFastMutex );
C_TRACE( ( _T( "DISIRouter::Receive failed 0x%x 0x%x" ), &aMessage, aObjId ) );
error = EFalse;
}
C_TRACE( ( _T( "DISIRouter::Receive 0x%x 0x%x %d<" ), &aMessage, aObjId, error ) );
return error;
}
示例8: GetFlow
TInt CIPv6Binder::DeleteContext(TDes8& aContextParameters)
/**
* Deletes a context. As the NIF is responsible for one primary context,
* this is equivalent to closing down the NIF.
*
* @param aContextParameters Parameters of the context to delete
* @return KErrArgument if an incorrect structure is passed, otherwise KErrNone
*/
{
OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CIPV6BINDER_DELETECONTEXT_1, "CIPv6Binder::DeleteContext");
if (aContextParameters.Length() != sizeof(TContextParameters))
{
return KErrArgument;
}
TUint8* ptr = CONST_CAST(TUint8*, aContextParameters.Ptr());
TContextParameters* params = REINTERPRET_CAST(TContextParameters*, ptr);
if (params->iContextInfo.iContextId !=
STATIC_CAST(TInt8, GetFlow().GetBcaController()->Nsapi()))
{
params->iReasonCode = KErrBadName;
}
else
{
params->iReasonCode = KErrNone;
GetFlow().Stop(KErrNone, MNifIfNotify::EDisconnect);
}
return KErrNone;
}
示例9: if
EXPORT_C int Tbuf8ToWchar(TDes8& aSrc, wchar_t* aDes, int& n_size)
{
int retval = ESuccess;
unsigned int ilen = aSrc.Length();
int minusone = -1;
if(0 == ilen)
{
return EDescriptorNoData;
}
else if(!aDes)
{
return EInvalidPointer;
}
else if(n_size < ilen+1)
{
n_size = ilen+1;
return EInvalidSize;
}
if(minusone != mbstowcs(aDes, (const char*)aSrc.Ptr(), ilen))
{
*(aDes + ilen) = L'\0';
}
else
{
retval = EInvalidMBSSequence;
}
return retval;
}
示例10: ValidateISIMessage
// KErrBadDescriptor, if message length too small
// KErrUnderFlow, if message length too big.
// KErrCouldNotConnect, if receiver object is out of scope.
TInt DISICLTransceiver::ValidateISIMessage(
TDes8& aMessage
)
{
C_TRACE( ( _T( "DISICLTransceiver::ValidateISIMessage 0x%x>" ), &aMessage ) );
const TUint16 descLength( aMessage.Length() );
TInt msgOk( KErrNone );
msgOk = ( ISI_HEADER_OFFSET_MESSAGEID >= descLength ) ? KErrBadDescriptor : msgOk;
TRACE_ASSERT_INFO( msgOk == KErrNone, msgOk );
// Get ISI message length after known that the descriptor is big enough.
const TUint8* msgPtr( aMessage.Ptr() );
const TUint16 isiMsgLength( GET_LENGTH( msgPtr ) + PN_HEADER_SIZE );
// If the descriptor length is less than ISI message length.
msgOk = ( ( msgOk == KErrNone && isiMsgLength > descLength ) ? KErrUnderflow : msgOk );
TRACE_ASSERT_INFO( msgOk == KErrNone, msgOk );
// If the ISI message length is bigger that the largest supported.
msgOk = ( ( msgOk == KErrNone && isiMsgLength > KMaxISIMsgSize ) ? KErrUnderflow : msgOk );
TRACE_ASSERT_INFO( msgOk == KErrNone, msgOk );
// If the ISI message length with PN_HEADER_SIZE is less or equal than ISI_HEADER_OFFSET_MESSAGEID.
msgOk = ( ( msgOk == KErrNone && isiMsgLength <= ISI_HEADER_OFFSET_MESSAGEID ) ? KErrUnderflow : msgOk );
TRACE_ASSERT_INFO( msgOk == KErrNone, msgOk );
TRACE_ASSERT_INFO( msgOk == KErrNone, isiMsgLength );
TRACE_ASSERT_INFO( msgOk == KErrNone, descLength );
C_TRACE( ( _T( "DISICLTransceiver::ValidateISIMessage %d<" ), msgOk ) );
return msgOk;
}
开发者ID:wannaphongcom,项目名称:symbian-incubation-projects.fcl-modemadaptation,代码行数:30,代码来源:isicltransceiver.cpp
示例11: RecvLine
TInt RecvLine(RTest &aTest, TDes8 &aBuf, RSocket &aSock)
{
TInt offset=0;
TText ch=0;
do
{
TPtr8 ptr(NULL, 0);
TSockXfrLength len;
TRequestStatus stat;
ptr.Set((TUint8 *)aBuf.Ptr()+offset, aBuf.Length()-offset, aBuf.Length()-offset);
aSock.RecvOneOrMore(ptr,0,stat,len);
User::WaitForRequest(stat);
aTest(stat==KErrNone);
TInt length=len();
TInt n=0;
while (length--)
{
ch = *(ptr.Ptr()+n);
if (ch=='\r' || ch=='\n')
break;
++offset;
++n;
}
}
while (ch!='\r' && ch!='\n' );
aBuf.SetLength(offset);
return offset;
}
示例12: SaveReadStatus
EXPORT_C void CRtpHandlerBase::SaveReadStatus(TDes8& aClientBuf)
{
__RTP_LOG1(_L("CRtpHandlerBase [0x%x]::SaveClientStatus"), this);
__RTP_LOG2(_L("\taClientBuffer at 0x%x, of Length %d"), aClientBuf.Ptr(), aClientBuf.Length());
ASSERT(iDataObserver); //With out DataObserver the app shouldnot attempt a read
iClientDataPtr = &aClientBuf;
}
示例13:
TInt CWsGceCscBase::DebugInfo(TWsDebugInfoFunc aFunction,
TInt aParam,
TDes8& aHostBuffer,
const void*&aReturnedObject,
TInt aObjectSize)const
{
TInt reqSize=iSession.DebugInfo(aFunction,aHostBuffer,aParam);
aReturnedObject=NULL;
if (reqSize<0)
{
if ((reqSize%aObjectSize)!=0)
{
return KErrCorrupt;
}
else
{
return reqSize;
}
}
if (reqSize>aHostBuffer.MaxLength())
{
return reqSize/aObjectSize;
}
if (reqSize==0)
{
reqSize=aHostBuffer.MaxLength();
}
if ((reqSize%aObjectSize)!=0)
{
return KErrCorrupt;
}
aReturnedObject=(const void*)aHostBuffer.Ptr();
reqSize/=aObjectSize;
return reqSize;
}
示例14: DoReadL
/** Reads data from the stream buffer into the specified descriptor.
This function is called by ReadL(TDes8&,TInt,TRequestStatus&).
This implementation deals with the request synchronously, and completes the
request with KErrNone. Other implementations may choose to deal with this
in a true asynchronous manner.
In addition, the read operation itself uses the DoReadL(TAny*,TInt) variant.
@param aDes The target descriptor for the data read from the stream buffer.
On return, the length of the descriptor is set to the number of bytes read
from the stream buffer.
@param aMaxLength The maximum number of bytes to be read. This value must not
be greater than the maximum length of the descriptor, otherwise the function
raises a STORE-Stream 2 panic.
@param aStatus The request status that indicates the completion status of this
asynchronous request.
@return The maximum number of bytes to be read, as used in this request. This
implementation uses, and returns, the value supplied in aMaxLength. Other
implementations may choose to use a different value.
@see MStreamBuf::ReadL() */
EXPORT_C TInt MStreamBuf::DoReadL(TDes8& aDes,TInt aMaxLength,TRequestStatus& aStatus)
{
__ASSERT_DEBUG(aMaxLength<=aDes.MaxLength(),Panic(EStreamReadBeyondEnd));
aDes.SetLength(DoReadL((TUint8*)aDes.Ptr(),aMaxLength));
TRequestStatus* stat=&aStatus;
User::RequestComplete(stat,KErrNone);
return aMaxLength;
}
示例15: SendCommIsaEntityNotReachableResp
TInt DISICLTransceiver::SendCommIsaEntityNotReachableResp(
TDes8& aNotDeliveredMessage
)
{
C_TRACE( ( _T( "DISICLTransceiver::SendCommIsaEntityNotReachableResp 0x%x>" ), &aNotDeliveredMessage ) );
const TUint8* notDeliveredMsgPtr( aNotDeliveredMessage.Ptr() );
TInt error = KErrAlreadyExists;
// Avoid COMM_ISA_ENTITY_NOT_REACHABLE_RESP loop.
if( ( notDeliveredMsgPtr[ ISI_HEADER_OFFSET_MESSAGEID ] == COMMON_MESSAGE ) &&
( ( notDeliveredMsgPtr[ ISI_HEADER_OFFSET_SUBMESSAGEID ] == COMM_ISA_ENTITY_NOT_REACHABLE_RESP ) ||
( notDeliveredMsgPtr[ ISI_HEADER_OFFSET_SUBMESSAGEID ] == COMM_SERVICE_NOT_IDENTIFIED_RESP ) ) )
{
C_TRACE( ( _T( "DISICLTransceiver Not sending another CommIsaEntityNotReachableResp 0x%x 0x%x" ), &aNotDeliveredMessage, notDeliveredMsgPtr[ ISI_HEADER_OFFSET_SUBMESSAGEID ] ) );
}
else
{
// Follows COMM specification: 000.031
TUint8 length( ISI_HEADER_SIZE + SIZE_COMMON_MESSAGE_COMM_ISA_ENTITY_NOT_REACHABLE_RESP );
TDes8& respMsg = MemApi::AllocBlock( length );
ASSERT_RESET_ALWAYS( length > ISI_HEADER_OFFSET_MESSAGEID, ( EISICLTransceiverOverTheLimits | EDISICLTransceiverTraceId << KClassIdentifierShift ) );
TUint8* respMsgPtr = const_cast<TUint8*>( respMsg.Ptr() );
// We start to append from transaction id.
respMsg.SetLength( ISI_HEADER_OFFSET_TRANSID );
// Get the header until messageid from prev. message.
// Just turn receiver and sender device and object vice versa.
respMsgPtr[ ISI_HEADER_OFFSET_MEDIA ] = notDeliveredMsgPtr[ ISI_HEADER_OFFSET_MEDIA ];
SET_RECEIVER_DEV( respMsgPtr, GET_SENDER_DEV( aNotDeliveredMessage ) );
SET_SENDER_DEV ( respMsgPtr, GET_RECEIVER_DEV( aNotDeliveredMessage ) );
respMsgPtr[ ISI_HEADER_OFFSET_RESOURCEID ] = notDeliveredMsgPtr[ ISI_HEADER_OFFSET_RESOURCEID ];
SET_LENGTH( respMsgPtr, ( length - PN_HEADER_SIZE ) );
SET_RECEIVER_OBJ( respMsgPtr, GET_SENDER_OBJ( aNotDeliveredMessage ) );
SET_SENDER_OBJ( respMsgPtr, GET_RECEIVER_OBJ( aNotDeliveredMessage ) );
// Set from undelivered message
respMsg.Append( notDeliveredMsgPtr[ ISI_HEADER_OFFSET_TRANSID ] );
// Message Identifier
respMsg.Append( COMMON_MESSAGE );
// Sub message Identifier.
respMsg.Append( COMM_ISA_ENTITY_NOT_REACHABLE_RESP );
// Not Delivered Message from original message.
respMsg.Append( notDeliveredMsgPtr[ ISI_HEADER_OFFSET_MESSAGEID ] );
// Status
respMsg.Append( COMM_ISA_ENTITY_NOT_AVAILABLE );// different status in a case of device not existing
// Filler
const TUint8 KFiller( 0x00 );
respMsg.Append( KFiller );
// Filler
respMsg.Append( KFiller );
// Filler
respMsg.Append( KFiller );
error = RouteISIMessage( respMsg, EFalse );
// Programming error in this function if below assert is raised
ASSERT_RESET_ALWAYS( KErrNone == error, ( EISICLTransceiverCommIsaEntityNotReachableResp | EDISICLTransceiverTraceId << KClassIdentifierShift ) );
}
MemApi::DeallocBlock( aNotDeliveredMessage );
C_TRACE( ( _T( "DISICLTransceiver::SendCommIsaEntityNotReachableResp 0x%x<" ), &aNotDeliveredMessage ) );
return error;
}
开发者ID:wannaphongcom,项目名称:symbian-incubation-projects.fcl-modemadaptation,代码行数:58,代码来源:isicltransceiver.cpp