/** * * Do the test step. * Each test step must supply an implementation for DoTestStepL. * * @return "TVerdict" * The result of the test step * * @xxxx * */ TVerdict CTestStepToneCancelPrepare::DoTestStepL() { iTestStepResult = EPass; INFO_PRINTF1(_L("Calling PrepareToPlayTone()")); iTone->PrepareToPlayTone(400,TTimeIntervalMicroSeconds(500)); // Cancel prepare INFO_PRINTF1(_L("Calling CancelPrepare()")); iTone->CancelPrepare(); if (iTone->State() == EMdaAudioToneUtilityPrepared) { INFO_PRINTF2(_L("iTone->State() == %d"), iTone->State()); return EFail; } // Call PrepareToPlayTone() Again. INFO_PRINTF1(_L("Calling PrepareToPlayTone()")); iTone->PrepareToPlayTone(400,TTimeIntervalMicroSeconds(500)); INFO_PRINTF1(_L("finished with this test step")); // test steps return a result return iTestStepResult; }
/** * * Do the test step. * Each test step must supply an implementation for DoTestStepL. * * @return "TVerdict" * The result of the test step * * @xxxx * */ TVerdict CTestStepToneSetVolumeRamp::DoTestStepL() { iTestStepResult = EPass; TInt ramp = 0; for (ramp=0; ramp<=1000000; ramp+=1000) { iTone->SetVolumeRamp(TTimeIntervalMicroSeconds(ramp)); // no way to check directly since its a SoundDev property which is on the server side // out of scope to check the SoundDev //if (static_cast<CMMFMdaAudioToneUtility*>(iTone)->iDevSound->iRampDuration != TTimeIntervalMicroSeconds(ramp) ) // { // iTestStepResult = EFail; // } //checked manualy the CMMFSoundDev and Set seems to work OK } // Try also with prepared Tone utility iTone->PrepareToPlayTone(400,TTimeIntervalMicroSeconds(500000)); CActiveScheduler::Start(); if ( iError != KErrNone || iTone->State() != EMdaAudioToneUtilityPrepared ) return EInconclusive; for (ramp=0; ramp<=1000000; ramp+=1000) { iTone->SetVolumeRamp(TTimeIntervalMicroSeconds(ramp)); //checked manualy the CMMFSoundDev and Set seems to work OK } INFO_PRINTF1(_L("finished with this test step")); // test steps return a result return iTestStepResult; }
////////////////////////////////////////////////////////////// // Sets the interval for getting the regular notification // // the time interval set is in milli seconds // ////////////////////////////////////////////////////////////// int CQMLBackendAO::setUpdateInterval(int aMilliSec) { #if !defined QT_NO_DEBUG qDebug() << "CQMLBackendAO::setUpdateInterval\n" ; #endif int minimumUpdateInterval = 0; TInt64 mUpdateInterval = 0 ; if (mRequester) minimumUpdateInterval = mRequester->minimumUpdateInterval(); else minimumUpdateInterval = mRequesterSatellite->minimumUpdateInterval(); if (minimumUpdateInterval < 0) minimumUpdateInterval = 100; // if the current requesttype is regular updates // then set the updateinterval otherwise ignore //if(mRequestType != REQ_REG_UPDATE) // return; TPositionUpdateOptions aPosOption; TInt error = mPositioner.GetUpdateOptions(aPosOption); // TTimeIntervalMicroSeconds is converted seconds TInt currentUpdateInterval = aPosOption.UpdateInterval().Int64() / 1000; // If msec is not 0 and is less than the value returned by minimumUpdateInterval(), // the interval will be set to the minimum interval. // if (aMilliSec != 0 && aMilliSec <= minimumUpdateInterval) { // workaround, not accepting zero as value, see QTMOBILITY-995 if (aMilliSec <= minimumUpdateInterval) { mUpdateInterval = minimumUpdateInterval; } else { mUpdateInterval = aMilliSec; } // if the same value is being set then just ignore it. if (currentUpdateInterval == mUpdateInterval) { return mUpdateInterval; } // will set Either zero, minimum or +ve value // seconds converted to TTimeIntervalMicroSeconds aPosOption.SetUpdateInterval(TTimeIntervalMicroSeconds(mUpdateInterval * 1000)); // set the timeout to the smaller of 150% of interval or update interval + 10 seconds TInt64 mUpdateTimeout = (mUpdateInterval * 3) / 2; if (mUpdateTimeout > mUpdateInterval + 10000) mUpdateTimeout = mUpdateInterval + 10000; if (aMilliSec > 0) aPosOption.SetUpdateTimeOut(TTimeIntervalMicroSeconds(mUpdateTimeout * 1000)); error = mPositioner.SetUpdateOptions(aPosOption); return mUpdateInterval; }
// helper function: calculates time between frames void CMMFRawFormatRead::CalculateFrameTimeInterval() { if ((iFrameSize) && (iSampleRate) && (iBitsPerSample) && (iChannels)) { iFrameTimeInterval = TTimeIntervalMicroSeconds((iFrameSize*KOneSecondInMicroSeconds)/iSampleRate); iFrameTimeInterval = TTimeIntervalMicroSeconds(iFrameTimeInterval.Int64()/(iBitsPerSample*iChannels)); iFrameTimeInterval = TTimeIntervalMicroSeconds(iFrameTimeInterval.Int64()*8); } }
void CMMFTestVideoDecodeHwDevice::SetPosition(const TTimeIntervalMicroSeconds& aPlaybackPosition) { if (aPlaybackPosition == TTimeIntervalMicroSeconds(KTestPositionFatal)) { iProxy->MdvppFatalError(this, KErrDied); } else { __ASSERT_ALWAYS(aPlaybackPosition == TTimeIntervalMicroSeconds(KTestPosition), DevVideoDecoderPanic(EDecoderPanicSetPosition)); } }
// --------------------------------------------------------------------------- // CDTMFPayloadFormatWrite::FrameTimeInterval // Gets audio frame size in milliseconds. // --------------------------------------------------------------------------- // TTimeIntervalMicroSeconds CDTMFPayloadFormatWrite::FrameTimeInterval( TMediaId aMediaType ) const { DP_DTMF_WRITE( _L("CDTMFPayloadFormatWrite::FrameTimeInterval") ); if ( KUidMediaTypeAudio == aMediaType.iMediaType ) { return TTimeIntervalMicroSeconds( TInt64( 0 ) ); } else { return TTimeIntervalMicroSeconds( TInt64( 0 ) ); } }
// returns the duration of the source clip TTimeIntervalMicroSeconds CMMFRawFormatRead::Duration(TMediaId aMediaId) const { if ((aMediaId.iMediaType == KUidMediaTypeAudio) && (iClipLength) && (iSampleRate) && (iBitsPerSample) && (iChannels)) {//we have enough values to calculate the duration TInt64 clipLength(iClipLength); clipLength*=KOneSecondInMicroSeconds; TTimeIntervalMicroSeconds duration = TTimeIntervalMicroSeconds(clipLength/iSampleRate); duration = TTimeIntervalMicroSeconds(duration.Int64()/(iBitsPerSample*iChannels)); duration = TTimeIntervalMicroSeconds(duration.Int64()*8); return duration; } else return TTimeIntervalMicroSeconds(0); }
// ----------------------------------------------------------------------------- // CAdvancedAudioRecordController::PositionL // ----------------------------------------------------------------------------- // EXPORT_C TTimeIntervalMicroSeconds CAdvancedAudioRecordController::PositionL() const { #ifdef _DEBUG RDebug::Print(_L("CAdvancedAudioRecordController::PositionL")); #endif if ( iState == ERecording ) { return TTimeIntervalMicroSeconds(iTimePositionInMicroSecs + iAudioInput->CalculateAudioInputPositionL()); } else { return TTimeIntervalMicroSeconds(iTimePositionInMicroSecs); } }
// --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // void CAlfExAnalogDialerFeedback::Start( TInt aDurationMilliSeconds, TInt aIntervalMilliSeconds) { iDuration = KFeedbackDefault; iInterval = KFeedbackMinimumInterval; // 1000: convert millis to micros if (iFeedback) { iFeedback->InstantFeedback(ETouchFeedbackBasic); } if ( aIntervalMilliSeconds > KFeedbackMinimumInterval ) { iInterval = 1000*aIntervalMilliSeconds; } if (aDurationMilliSeconds >= KFeedbackMinimumDuration) { iDuration = 1000*aDurationMilliSeconds; iDurationStop.HomeTime(); iDurationStop += TTimeIntervalMicroSeconds(TInt64(iDuration)); iClock->Cancel(); iClock->Start( iInterval, iInterval, TCallBack( HandleInterval, this )); } }
// --------------------------------------------------------------------------- // CDTMFPayloadFormatWrite::Duration // Gets the duration of the sink clip for the specified media ID. // --------------------------------------------------------------------------- // TTimeIntervalMicroSeconds CDTMFPayloadFormatWrite::Duration( TMediaId /*aMediaType*/ ) const { DP_DTMF_WRITE( _L("CDTMFPayloadFormatWrite::Duration") ); return TTimeIntervalMicroSeconds( TInt64( KDurationNotApplicable ) ); }
/** Verify CMMFPtrBuffer status checking * Use case: N/A * @test Req. under test PREQ 10 */ TVerdict CTestStep_MMF_BASECL_U_0157::DoTestStepL( void ) { TVerdict verdict = EPass; const TInt KMMFTestTime = 1234567890; CMMFPtrBuffer* ptrBuffer = CMMFPtrBuffer::NewL(); //create descriptor buffer //check that the initial time to play is 0 if (ptrBuffer->TimeToPlay() != TTimeIntervalMicroSeconds(0)) verdict = EFail; //assign a timestamp and check it is set correctly ptrBuffer->SetTimeToPlay(TTimeIntervalMicroSeconds(KMMFTestTime)); if (ptrBuffer->TimeToPlay() != TTimeIntervalMicroSeconds(KMMFTestTime)) verdict = EFail; delete ptrBuffer; return verdict; }
// --------------------------------------------------------- // CT_LbsClientPosTp194::StartL // // (other items were commented in a header). // --------------------------------------------------------- // void CT_LbsClientPosTp194::StartL() { SetupPsyL(iUidMultiPsy); TInt numberOfRuns = 100; TTimeIntervalMicroSeconds interval5 = TTimeIntervalMicroSeconds(4000000); TUid uid = iUidMultiPsy; CT_LbsClientPeriodicTester* periodicTester1 = CT_LbsClientPeriodicTester::NewL(interval5, KServiceName1, iLog, uid, numberOfRuns); CleanupStack::PushL(periodicTester1); CT_LbsClientPeriodicTester* periodicTester2 = CT_LbsClientPeriodicTester::NewL(interval5, KServiceName2, iLog, uid, numberOfRuns); CleanupStack::PushL(periodicTester2); periodicTester1->RequestNotification(); periodicTester2->RequestNotification(); // Active scheduler is stopped two times. CActiveScheduler::Start(); CActiveScheduler::Start(); //check for errors TBool test1 = periodicTester1 -> IsCompletedOK(); TBool test2 = periodicTester2 -> IsCompletedOK(); CleanupStack::PopAndDestroy(2,periodicTester1); if (!test1 || !test2) { _LIT(KError, "Test did not complete with no error, check log file"); LogErrorAndLeaveL(KError); } }
void CPositionRequest::CompleteRequest(TInt aReason) { // Return fix to the client if (aReason == KErrNone || aReason == KPositionPartialUpdate) { TInt err = PackPositionData(); // err - client cannot receive result data CompleteClient((err != KErrNone) ? err : aReason); // Save current fix to LastKnownPosition handler // partial updates are not stored if ( aReason == KErrNone ) { SaveAsLastKnownPosition(); } } else { CompleteClient(aReason); } // If the request is not tracking mode, deactivate the indicator // Tracking mode check and the last check for the error scenarios other than // KErrNone and KPositionPartialUpdate. if( ( ( iTrackingState == EPosFirstTrackingRequest || iTrackingState == EPosTracking ) && iTrackingUpdateInterval > KIndFlickerTresholdTracking ) || iTrackingUpdateInterval == TTimeIntervalMicroSeconds ( 0 ) || !( aReason == KErrNone || aReason == KPositionPartialUpdate ) ) { DeActivatePositioningStatusIfNeeded(); } }
// --------------------------------------------------------------------------- // TEST CASE: Start timer with After (64 bit) without connecting first // --------------------------------------------------------------------------- // TInt CTestRFlexTimer::After64WithoutConnect( TTestResult& aResult, CTestFlexTimer* aCallback ) { TRequestStatus status; // Test should panic with // Category: "KERN-EXEC" // Reason: 0 aCallback->TestModuleIf().SetExitReason( CTestModuleIf::EPanic, 0 ); // Do the actual test //----------------------------------------------------- RFlexTimer timer; timer.After( status, TTimeIntervalMicroSeconds( 1000000 ) ); User::WaitForRequest( status ); // PANIC timer.Close(); //----------------------------------------------------- // No panic, change result back to normal aCallback->TestModuleIf().SetExitReason( CTestModuleIf::ENormal, KErrNone ); aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") ); return KErrNone; }
// --------------------------------------------------------------------------- // TEST CASE: Configure (32 bit) timer without connecting first // --------------------------------------------------------------------------- // TInt CTestRFlexTimer::Configure64WithoutConnect( TTestResult& aResult, CTestFlexTimer* aCallback ) { // Test should panic with // Category: "KERN-EXEC" // Reason: 0 aCallback->TestModuleIf().SetExitReason( CTestModuleIf::EPanic, 0 ); // Do the actual test //----------------------------------------------------- RFlexTimer timer; timer.Configure( TTimeIntervalMicroSeconds( 1000000 ) ); // PANIC // Configure is synchronous command. No need to wait. timer.Close(); //----------------------------------------------------- // No panic, change result back to normal aCallback->TestModuleIf().SetExitReason( CTestModuleIf::ENormal, KErrNone ); aResult.SetResult( KErrGeneral, _L("Test case failed. No panic.") ); return KErrNone; }
void SetAbsoluteTimeout(RTimer& aTimer, TUint aUs, TRequestStatus& aStatus) { TTime wakeup; wakeup.HomeTime(); wakeup += TTimeIntervalMicroSeconds(aUs); aTimer.At(aStatus, wakeup); }
/** * Implementation of the MMdaAudioPlayerCallback interface functions **/ void CTestStepPlayerAllocFailOpenFile::MapcInitComplete(TInt aErrorcCode, const TTimeIntervalMicroSeconds &/*aDuration*/) { #ifdef __WINS__ iKErrGeneralIgnored = EFalse; if ( aErrorcCode == KErrGeneral ) iKErrGeneralIgnored = ETrue; //Ignore KErrGeneral on EMULATOR #endif if ( aErrorcCode == KErrNone || aErrorcCode == KErrNoMemory ) { iAllocOK = ETrue; if ( aErrorcCode == KErrNone && iPlayer->Duration() > TTimeIntervalMicroSeconds(0) ) { iResultOK = ETrue; } } else { INFO_PRINTF2(_L("Unexpected error %d seen"), aErrorcCode); iAllocOK = EFalse; } CActiveScheduler::Stop(); }
//requestUpdate : request for position update once void CQMLBackendAO::requestUpdate(int aTimeout) { #if !defined QT_NO_DEBUG qDebug() << "CQMLBackendAO::requestUpdate\n" ; #endif TPositionUpdateOptions aPosOption; mPositioner.GetUpdateOptions(aPosOption); aPosOption.SetUpdateInterval(TTimeIntervalMicroSeconds(0)); aPosOption.SetUpdateTimeOut(TTimeIntervalMicroSeconds(aTimeout * 1000)); mPositioner.SetUpdateOptions(aPosOption); startUpdates(); }
void CPosition::ConstructL() { User::LeaveIfError(iServer.Connect()); User::LeaveIfError(iPositioner.Open(iServer)); _LIT(KRequestor, "OpenMAR" ); User::LeaveIfError(iPositioner.SetRequestor(CRequestor::ERequestorService, CRequestor::EFormatApplication, KRequestor)); const TInt KSecond = 1000000; TPositionUpdateOptions updateOptions; updateOptions.SetUpdateInterval(TTimeIntervalMicroSeconds(10 * KSecond)); updateOptions.SetUpdateTimeOut(TTimeIntervalMicroSeconds(30 * KSecond)); updateOptions.SetMaxUpdateAge(TTimeIntervalMicroSeconds(1 * KSecond)); updateOptions.SetAcceptPartialUpdates(EFalse); User::LeaveIfError(iPositioner.SetUpdateOptions(updateOptions)); }
// called by MDataSource to pass back full buffer to the sink void CMMFRawFormatRead::BufferFilledL(CMMFBuffer* aBuffer) { //set position TTimeIntervalMicroSeconds position = //assumes frame numbers begin at frame 1 TTimeIntervalMicroSeconds(TInt64(aBuffer->FrameNumber()-1)*iFrameTimeInterval.Int64()); aBuffer->SetTimeToPlay(position); iDataPath->BufferFilledL(aBuffer); }
EXPORT_C TTimeIntervalMicroSeconds FrameTimeIntervalCalculation( TUint aFrameSize, TUint aAvgBytesPerSecond) { return(TTimeIntervalMicroSeconds( TInt64(aFrameSize) * TInt64(KOneSecondInMicroSeconds) / TInt64(aAvgBytesPerSecond))); }
void CCxxPositioner::ConstructL() { LEAVE_IF_ERROR_OR_SET_SESSION_OPEN(iPositionServer, iPositionServer.Connect()); LEAVE_IF_ERROR_OR_SET_SESSION_OPEN(iPositioner, iPositioner.Open(iPositionServer, iModuleId)); _LIT(KRequestor, "pytwink"); User::LeaveIfError(iPositioner.SetRequestor(CRequestor::ERequestorService, CRequestor::EFormatApplication, KRequestor)); TPositionUpdateOptions updateOptions; updateOptions.SetAcceptPartialUpdates(EFalse); updateOptions.SetUpdateInterval(TTimeIntervalMicroSeconds(0)); // not periodic updateOptions.SetUpdateTimeOut(TTimeIntervalMicroSeconds(iUpdateTimeOut)); updateOptions.SetMaxUpdateAge(TTimeIntervalMicroSeconds(iMaxUpdateAge)); User::LeaveIfError(iPositioner.SetUpdateOptions(updateOptions)); }
void MsgAudioPreview::SetToneRingingType( TInt aRingingType ) { const TInt KToneInterval = 1000000; // 1 second pause between tones const TInt KAscendingVolumeInterval = 3000000; // 3 seconds if ( !iTonePlayer ) { return; } TInt ringingVolume = RingingVolume(); switch( aRingingType ) { case ERingingTypeRinging: case ERingingTypeSilent: { iTonePlayer->SetRepeats( KMdaAudioToneRepeatForever, TTimeIntervalMicroSeconds( KToneInterval ) ); break; } case ERingingTypeAscending: { iTonePlayer->SetRepeats( KMdaAudioToneRepeatForever, TTimeIntervalMicroSeconds( KToneInterval ) ); TInt volRamp = KAscendingVolumeInterval * ringingVolume; iTonePlayer->SetVolumeRamp( TTimeIntervalMicroSeconds( volRamp ) ); break; } case ERingingTypeRingOnce: case ERingingTypeBeepOnce: { iTonePlayer->SetRepeats( 0, TTimeIntervalMicroSeconds( KToneInterval ) ); break; } default: { break; } } }
// --------------------------------------------------------- // CT_LbsClientPosTp272::SetPeriodicUpdateL // // (other items were commented in a header). // --------------------------------------------------------- // void CT_LbsClientPosTp272::SetPeriodicUpdateL(const TInt& aUpdateInterval) { _LIT(KUpdateErr, "Error when setting update interval, %d"); TPositionUpdateOptions updateOptions; updateOptions.SetUpdateInterval(TTimeIntervalMicroSeconds(aUpdateInterval)); TInt err = iPositioner.SetUpdateOptions(updateOptions); AssertTrueL(err == KErrNone, KUpdateErr, err); }
/** Verify CMMFTransferBuffer time to play * Use case: N/A * @test Req. under test REQ172.7.25 */ TVerdict CTestStep_MMF_BASECL_U_0108::DoTestStepL( void ) { TVerdict verdict = EPass; const TInt KMMFTestTime = 1234567890; CMMFTransferBuffer* mmfTransferBuffer; mmfTransferBuffer = CMMFTransferBuffer::NewL(iTransferWindow); //check that the initial time to play is 0 if (mmfTransferBuffer->TimeToPlay() != TTimeIntervalMicroSeconds(0)) verdict = EFail; //assign a timestamp and check it is set correctly mmfTransferBuffer->SetTimeToPlay(TTimeIntervalMicroSeconds(KMMFTestTime)); if (mmfTransferBuffer->TimeToPlay() != TTimeIntervalMicroSeconds(KMMFTestTime)) verdict = EFail; delete mmfTransferBuffer; return verdict; }
XQLocation::Error CPositionerObserver::SetUpdateInterval(TInt aUpdateInterval) { iUpdateInterval = aUpdateInterval; iPositionUpdateOptions.SetUpdateInterval(TTimeIntervalMicroSeconds(iUpdateInterval * 1000)); iPositionUpdateOptions.SetAcceptPartialUpdates(ETrue); if (iPositioner.SetUpdateOptions(iPositionUpdateOptions) != KErrNone) { return XQLocation::InvalidUpdateIntervalError; } return XQLocation::NoError; }
TTimeIntervalMicroSeconds CWsSpriteManager::CalculateTimeToNextFlash(TTimeIntervalMicroSeconds aTime) const { TInt64 nextStateChange; if(aTime<KFlashHalfSecond) nextStateChange=KFlashHalfSecond-aTime.Int64(); else nextStateChange=KFlashHalfSecond - (aTime.Int64() - KFlashHalfSecond); ASSERT(nextStateChange > 0); return TTimeIntervalMicroSeconds(nextStateChange); }
// ----------------------------------------------------------------------------- // COpenMAXALTestModule::AddExpectedEvent // Add an event to the expected events' list // ----------------------------------------------------------------------------- void COpenMAXALTestModule::AddExpectedEvent(TOMXExpectedEvent event, TInt ms) { iLog->Log(_L("COpenMAXALTestModule::AddExpectedEvent")); iExpectedEvents.Append(event); TPtrC eventName = EventName(event); iLog->Log(_L("Adding expected event:(0x%02x)%S Total=%d"), event, &eventName, iExpectedEvents.Count() ); if ( iTimeoutController && !iTimeoutController->IsActive() ) { if (ms > 0) { iTimeoutController->Start( TTimeIntervalMicroSeconds(ms * 1000) ); } else { iLog->Log(_L("Timeout with default value (1s)")); iTimeoutController->Start( TTimeIntervalMicroSeconds(1000000) ); } } }
// ----------------------------------------------------------------------------- // CG711DecoderIntfcTestClass::AddExpectedEvent // Add an event to the expected events' list // ----------------------------------------------------------------------------- void CG711DecoderIntfcTestClass::AddExpectedEvent(TG711ExpectedEvent event, TInt ms) { FTRACE(FPrint(_L("CG711DecoderIntfcTestClass::AddExpectedEvent"))); iExpectedEvents.Append(event); TPtrC eventName = EventName(event); iLog->Log(_L("Adding expected event:(0x%02x)%S Total=%d"), event, &eventName, iExpectedEvents.Count() ); if ( iTimeoutController && !iTimeoutController->IsActive() ) { if (ms > 0) { iTimeoutController->Start( TTimeIntervalMicroSeconds(ms * 1000) ); } else { iLog->Log(_L("Timeout with default value (1s)")); iTimeoutController->Start( TTimeIntervalMicroSeconds(1000000) ); } } }
// ----------------------------------------------------------------------------- // CG711PayloadFormatRead::FrameTimeInterval // Return the frame time interval for the given media // ----------------------------------------------------------------------------- // TTimeIntervalMicroSeconds CG711PayloadFormatRead::FrameTimeInterval( TMediaId aMediaId ) const { if ( KUidMediaTypeAudio == aMediaId.iMediaType ) { return iFrameTimeInterval; } else { return TTimeIntervalMicroSeconds( TInt64( 0 ) ); } }