本文整理汇总了C++中TDes8::MaxSize方法的典型用法代码示例。如果您正苦于以下问题:C++ TDes8::MaxSize方法的具体用法?C++ TDes8::MaxSize怎么用?C++ TDes8::MaxSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDes8
的用法示例。
在下文中一共展示了TDes8::MaxSize方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetData
/**
* Get the data from the transaction
*
* Return the minimum of client buffer size and amount left to read
*/
TInt CDummyWSPCOTrans::GetData(TDes8& aBuffer, RWSPCOTrans::TDataType aDataType, TInt* aSizeLeft) const
{
__ASSERT_DEBUG(aBuffer.MaxSize()>0, User::Panic(_L("Client buffer not allocated"),0));
//const TDesC8* requestedData=*iDataArray[aDataType];
const TDesC8* requestedData= iDataArray[aDataType];
TInt bufferSize = aBuffer.MaxSize();
TInt reqSize = requestedData->Size();
TInt* offset = iOffsetArray.At(aDataType);
TInt retSize = Min(bufferSize, (reqSize - *offset));
aBuffer.Zero();
aBuffer.Append(requestedData->Mid(*offset, retSize));
*offset += retSize;
if (*offset==reqSize)
{
*aSizeLeft = 0;
*offset = 0;
return KErrNone;
}
else
{
*aSizeLeft = reqSize-*offset;
return RWAPConn::EMoreData;
}
}
示例2: Compensate
// ---------------------------------------------------------------------------
// CSensorDataCompensatorAxisDataHandler::Compensate
// ---------------------------------------------------------------------------
//
TInt CSensorDataCompensatorAxisDataHandler::Compensate( TDes8& aData )
{
FUNC_LOG;
TInt err( KErrNone );
TInt x( 0 );
TInt y( 0 );
TInt z( 0 );
TRACE_MATRIX( "Axis data compensation matrix", iMatrix );
if ( KSensrvChannelTypeIdMagnetometerXYZAxisData == iDataType )
{
INFO( "Compensating magnetometer data" );
TPckgBuf<TSensrvMagnetometerAxisData> pckg;
if ( aData.MaxSize() == pckg.MaxSize() )
{
pckg.Copy( aData );
iMatrix.Transform( x, y, z, pckg().iAxisXRaw, pckg().iAxisYRaw, pckg().iAxisZRaw );
INFO_3( "Compensated data Magnetometer raw [X: %d], [Y: %d], [Z: %d]", x, y, z );
pckg().iAxisXRaw = x;
pckg().iAxisYRaw = y;
pckg().iAxisZRaw = z;
iMatrix.Transform( x, y, z, pckg().iAxisXCalibrated, pckg().iAxisYCalibrated, pckg().iAxisZCalibrated );
INFO_3( "Compensated data Magnetometer calib [X: %d], [Y: %d], [Z: %d]", x, y, z );
pckg().iAxisXCalibrated = x;
pckg().iAxisYCalibrated = y;
pckg().iAxisZCalibrated = z;
aData.Copy( pckg );
}
else
{
err = KErrArgument;
}
}
else
{
INFO( "Compensating accelerometer data" );
TPckgBuf<TSensrvAccelerometerAxisData> pckg;
if ( aData.MaxSize() == pckg.MaxSize() )
{
pckg.Copy( aData );
iMatrix.Transform( x, y, z, pckg().iAxisX, pckg().iAxisY, pckg().iAxisZ );
INFO_3( "Compensated data accelerometer[X: %d], [Y: %d], [Z: %d]", x, y, z );
pckg().iAxisX = x;
pckg().iAxisY = y;
pckg().iAxisZ = z;
aData.Copy( pckg );
}
else
{
err = KErrArgument;
}
}
ERROR( err, "Axis data compensation error" );
return err;
}
示例3: ValidatePositionClassBufferL
/**
* Checks that buffer size from client's message is the same
* as position data class size specified in the class.
*
* @param aClass Position data class.
* @param aBuffer Buffer containing position data class.
* Leaves with KErrArgument if buffer is wrong.
*/
void Global::ValidatePositionClassBufferL(const TPositionClassTypeBase& aClass, const TDes8& aBuffer)
{
DEBUG_TRACE("ValidatePositionClassBufferL in", __LINE__);
LeaveIfFalseL(aBuffer.MaxSize() >= sizeof(TPositionClassTypeBase), KErrArgument);
LeaveIfFalseL(aBuffer.MaxSize() >= aClass.PositionClassSize(), KErrArgument);
DEBUG_TRACE("ValidatePositionClassBufferL out", __LINE__);
}
示例4: Store
EXPORT_C TInt TRuntimeCtxId::Store(TDes8& aDes) const
{
if (Size() > aDes.MaxSize())
{
return KErrOverflow;
}
aDes.Append((TUint8*)this, Size());
return KErrNone;
}
示例5: FillBuffer
void CABDataOwnerCallbackImplementation::FillBuffer(TDes8& aDes, TBool& aFinished)
{
TInt bytesToAdd;
TChar fillChar(iFillChar);
if ((iOffset + aDes.MaxSize()) < iSourceSize)
{
aFinished = EFalse;
bytesToAdd = aDes.MaxSize();
}
else
{
aFinished = ETrue;
bytesToAdd = iSourceSize - iOffset;
}
aDes.Fill(fillChar, bytesToAdd);
iOffset += bytesToAdd;
}
示例6: UnitWaitPushL
void CDummyWSPCLConn::UnitWaitPushL(TDes8& aBody,TDes8& aHeaders,TPushID& aID,TRequestStatus& aStatus)
{
__ASSERT_DEBUG(aBody.MaxSize()>0, User::Panic(_L("Msg Body Buffer Not Allocated"),0));
__ASSERT_DEBUG(aHeaders.MaxSize()>0, User::Panic(_L("Msg Header Buffer Not Allocated"),0));
aStatus=KRequestPending;
//point to the Msg Buffers
iClientBody=&aBody;
iClientHeaders=&aHeaders;
iID = &aID;
iStatus=(&aStatus);
//Initialise Buffers to zero Before Appending
iClientBody->Zero();
iClientHeaders->Zero();
*iID =0;
//Invoke the dummy Observer UnitWaitPush
STATIC_CAST(CDummyWapStack* , Dll::Tls())->Observer().DWSOUnitWaitPushL(*this);
}
示例7: GetL
// ---------------------------------------------------------------------------
// Copies descriptor from internal buffer to aData buffer.
// Size of the data to be copied is read from the buffer.
// Leaves if target descriptor cannot accept descriptor in buffer.
// ---------------------------------------------------------------------------
//
void CPosReadBufStorage::GetL( TDes8& aData )
{
TInt size;
GetL( size );
if ( size >= 0 &&
aData.MaxSize() >= size &&
iPointer + size <= iBoundary )
{
aData = TPtrC8( (TUint8*) iPointer, size );
iPointer += size;
}
else
{
User::Leave( KErrCorrupt );
}
}
示例8: Receive
// -----------------------------------------------------------------------------
// RPhCltMessenger::Receive
//
// Receive message.
// -----------------------------------------------------------------------------
//
void RPhCltMessenger::Receive(
TRequestStatus& aStatus,
TInt& aMessageSize,
TDes8& aMessagePayload )
{
__ASSERT_ALWAYS(
SubSessionHandle(), User::Panic(
KPhClientPanicCategory, EPhCltClientSidePanicNullHandle ) );
// Set message size variables to be byte descriptor.
iReceiveMessageSize.Set( ( TUint8* )&aMessageSize, 0, sizeof( TInt ) ) ;
iMessengerParameters.iReceiveMessageSizePtr = &iReceiveMessageSize;
iMessengerParameters.iReceiveBufferMaxSize = aMessagePayload.MaxSize();
SendReceive(
EPhoneServerMessengerSubSessionReceive,
TIpcArgs(
&iMesParPckg,
&aMessagePayload,
&iReceiveMessageSize ),
aStatus );
}