예제 #1
0
// -----------------------------------------------------------------------------
// CMccCodecRed::SetRedCodecs
// Set the payload types used in redundancy
// -----------------------------------------------------------------------------
//
void CMccCodecRed::SetRedPayloadsL( RArray<TUint>& aRedPayloads )
    {
    iRedPayloads.Reset();
    TInt i;
    for( i = 0; i < aRedPayloads.Count(); i++ )
        {
        iRedPayloads.AppendL( aRedPayloads[ i ] );  
        }
    
    // Convert parsed payload formats back to string and set
    // the iFmtpAttr variable
    const TInt KCharsPerPayload( 4 );
    delete iFmtpAttr;
    iFmtpAttr = NULL;
    iFmtpAttr = HBufC8::NewL( iRedPayloads.Count() * KCharsPerPayload );
    
    TPtr8 descPtr = iFmtpAttr->Des();
    for( i = 0; i < iRedPayloads.Count(); i++ )
        {
        descPtr.AppendNum( static_cast<TUint64>( iRedPayloads[i] ), EDecimal );
        descPtr.Append( KCharSlash );       
        }   
    
    // Remove the last slash character
    descPtr.SetLength( descPtr.Length() - 1 );  
    }
// ---------------------------------------------------------------------------
// Provides default implementation required for cancellation of testing
// ---------------------------------------------------------------------------
//
void COMASuplPosTesterCategory::TestingCancelled(const TDesC8& aInfo)
	{
	if(iCallBack)
		{
		HBufC8* infoBuf = NULL;
		TRAPD(err, infoBuf = HBufC8::NewL(aInfo.Length() + KExtraBuffer));
		if(err != KErrNone)
			{
			iCallBack->TestingCancelled(aInfo);
			}
		else
			{
			TPtr8 info = infoBuf->Des();
			info.Copy(aInfo);
			info.Append(KSessionId);
			info.AppendNum(iTestNo);
			iCallBack->TestingComplete(info);
			}
		delete infoBuf;
		iCallBack->UpdateSessionTestSummary(iInfo, iWarning, iError);
		}
	else
		{
		Cancel();
		iTestHandler->Cancel();
		iTestingStatus = ETestCancelled;
		CActiveScheduler::Stop();
		iInfo++;
		iLogger->WriteLine(aInfo, iTestNo);
		}
	
	}
// ---------------------------------------------------------------------------
//Provides implementation required for aborting testing
// ---------------------------------------------------------------------------
//
void COMASuplPositionVelocityTest::TestingAborted(const TDesC8& /*aInfo*/)
{
    if(iCallBack)
    {
        HBufC8* infoBuf = NULL;
        TRAPD(err, infoBuf = HBufC8::NewL(KPositionVelocityTestAborted().Length() + KExtraBuffer));
        if(err != KErrNone)
        {
            iCallBack->TestingAborted(KPositionVelocityTestAborted);
        }
        else
        {
            TPtr8 info = infoBuf->Des();
            info.Copy(KPositionVelocityTestAborted);
            info.Append(KSessionId);
            info.AppendNum(iTestNo);
            iCallBack->TestingAborted(info);
        }
        delete infoBuf;
        iCallBack->UpdateSessionTestSummary(iInfo, iWarning, iError);
    }
    else
    {
        Cancel();
        iTestHandler->Cancel();
        iTestingStatus = ETestAborted;
        CActiveScheduler::Stop();
        iError++;
        iLogger->WriteLine(KPositionVelocityTestAborted, iTestNo);
    }
}
예제 #4
0
// -----------------------------------------------------------------------------
// TSnapshotItem::CreateHashL
// Create hash value from group content
// -----------------------------------------------------------------------------
void TSnapshotItem::CreateHashL( CContactGroup& aGroup )
    {
    CMessageDigest* hash = CMessageDigestFactory::NewDigestLC( CMessageDigest::EMD5 );
    
    if ( aGroup.HasItemLabelField() )
        {
        TPtrC label = aGroup.GetGroupLabelL();
        HBufC8* tempBuf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( label );
        CleanupStack::PushL( tempBuf );
        hash->Update( tempBuf->Des() );
        CleanupStack::PopAndDestroy( tempBuf );
        }
    
    // Create text field from items on group
    CContactIdArray* contactsIdArray = aGroup.ItemsContainedLC();
    const TInt idBufferMaxSize( 400 );
    HBufC8* tempIdBuf = HBufC8::NewLC( idBufferMaxSize );
    TPtr8 tempId = tempIdBuf->Des();
    const TInt KMaxNumLength(5);
    if ( contactsIdArray ) // this is NULL if there are no objects
        {
        tempId.AppendNum( contactsIdArray->Count(), EHex );
        for (TInt i=0; i< contactsIdArray->Count(); i++ )
            {
            if ( tempId.Length()+KMaxNumLength > tempId.MaxLength() )
                {
                // buffer is almost full, don't add any new items
                LOGGER_WRITE("buffer full");
                break;
                }
            // add item id
            tempId.AppendNum( (*contactsIdArray)[i] , EHex );
            }
        }
    else
        {
        tempId.AppendNum( 0 );
        }
    // update hash
    hash->Update( tempId );
    
    iHash.Copy( hash->Final() );
    
    CleanupStack::PopAndDestroy( tempIdBuf );
    CleanupStack::PopAndDestroy( contactsIdArray );
    CleanupStack::PopAndDestroy( hash );
    }
예제 #5
0
// ---------------------------------------------------------------------------
// Allocates a free channel
// ---------------------------------------------------------------------------
//
void CDunBtPlugin::AllocateChannelL( TBool& aNoFreeChans,
                                     TBtCleanupInfo& aCleanupInfo )
    {
    FTRACE(FPrint(_L("CDunBtPlugin::AllocateChannelL()")));
    // iDataSocket has new data socket information so copy it to iBTPorts
    TBtPortEntity* foundEntity = NULL;
    TInt foundIndex = GetFirstFreePort( foundEntity );
    if ( !foundEntity )  // free not found so add new
        {
        TBtPortEntity newEntity;
        iBTPorts.AppendL( newEntity );
        aCleanupInfo.iNewEntity = ETrue;
        aCleanupInfo.iEntityIndex = iBTPorts.Count() - 1;
        foundEntity = &iBTPorts[ aCleanupInfo.iEntityIndex ];
        }
    else  // free found so change array
        {
        aCleanupInfo.iNewEntity = EFalse;
        aCleanupInfo.iEntityIndex = foundIndex;
        foundEntity = &iBTPorts[ foundIndex ];
        }
    foundEntity->iChannelNum = iEntity.iChannelNum;
    foundEntity->iBTPort = iEntity.iBTPort;
    RSocket* socket = &foundEntity->iBTPort;
    HBufC8* channelName = HBufC8::NewMaxLC( KBtChannelName().Length() +
                          KCharactersInTInt );
    TPtr8 channelNamePtr = channelName->Des();
    channelNamePtr.Copy( KBtChannelName );
    channelNamePtr.AppendNum( iEntity.iChannelNum );
    iTransporter->AllocateChannelL( socket,
                                    KDunBtPluginUid,
                                    channelNamePtr,
                                    EFalse,
                                    aNoFreeChans );
    iTransporter->AddConnMonCallbackL( socket,
                                       this,
                                       EDunReaderUpstream,
                                       EFalse );
    iTransporter->AddConnMonCallbackL( socket,
                                       this,
                                       EDunWriterUpstream,
                                       EFalse );
    iTransporter->AddConnMonCallbackL( socket,
                                       this,
                                       EDunReaderDownstream,
                                       ETrue );
    iTransporter->AddConnMonCallbackL( socket,
                                       this,
                                       EDunWriterDownstream,
                                       EFalse );
    iTransporter->IssueTransferRequestsL( socket );
    CleanupStack::PopAndDestroy( channelName );
    FTRACE(FPrint(_L("CDunBtPlugin::AllocateChannelL() complete")));
    }