本文整理汇总了C++中TPckgBuf::MaxSize方法的典型用法代码示例。如果您正苦于以下问题:C++ TPckgBuf::MaxSize方法的具体用法?C++ TPckgBuf::MaxSize怎么用?C++ TPckgBuf::MaxSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPckgBuf
的用法示例。
在下文中一共展示了TPckgBuf::MaxSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: Update
// ---------------------------------------------------------------------------
// CSensorDataCompensatorAxisDataHandler::Update
// ---------------------------------------------------------------------------
//
TInt CSensorDataCompensatorAxisDataHandler::Update()
{
FUNC_LOG;
TInt err( KErrNone );
TInt count = iPlugin.GetCompensationItemCount();
INFO_1( "Axis compensation item count %d", count );
iMatrix.SetIdentity(); // Reset compensation
if ( count >= 0 )
{
// Calculate final compensation angles and create compensation matrix
TPckgBuf<TCompensationTypeAxisData> pckg;
TInt x( 0 );
TInt y( 0 );
TInt z( 0 );
TSensorDataCompensatorMatrix m;
TSensorDataCompensatorMatrix m2;
for ( TInt i( 0 ) ; i < count; i++ )
{
TPtrC8 data( iPlugin.GetCompensationItem( i ) );
if ( data.Size() == pckg.MaxSize() )
{
pckg.Copy( data );
x = pckg().iAxisX;
y = pckg().iAxisY;
z = pckg().iAxisZ;
}
else
{
err = KErrCorrupt;
break;
}
m.SetRotateX( x );
m2.SetRotateY( y );
m *= m2; // xy
m2.SetRotateZ( z );
m *= m2; // xy * z
iMatrix *= m;
}
if ( err != KErrNone )
{
iMatrix.SetIdentity();
}
}
else
{
// Error occured in plugin
err = count;
}
iCompensate = ( count > 0 ) && ( err == KErrNone ); // Ready to compensate
ERROR( err, "Axis update error" );
return err;
}