当前位置: 首页>>代码示例>>C++>>正文


C++ TTime::MicroSecondsFrom方法代码示例

本文整理汇总了C++中TTime::MicroSecondsFrom方法的典型用法代码示例。如果您正苦于以下问题:C++ TTime::MicroSecondsFrom方法的具体用法?C++ TTime::MicroSecondsFrom怎么用?C++ TTime::MicroSecondsFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TTime的用法示例。


在下文中一共展示了TTime::MicroSecondsFrom方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: UpdateTime

void CHuiStatic::UpdateTime(TTlsData* aData)
    {
    ASSERT( aData );
    // Updates the toolkit's time counters. This includes the toolkit's
    // realtime clock, the internal absolute clock (which is affected by the
    // time factor), the amount of elapsed time since last UpdateTime()
    // invocation, and the amount of elapsed time since the first UpdateTime()
    // invocation (which was done in the beginning of the first refresh).

    if(aData->iIsFirstUpdateTime)
        {
        aData->iIsFirstUpdateTime = EFalse;
        aData->iFirstUpdateTime.UniversalTime();
        aData->iUniversalTime = aData->iFirstUpdateTime;
        aData->iRealUniversalTime = aData->iUniversalTime;
        return;
        }

    TTime now;
    now.UniversalTime();

    // Advance the toolkit's internal clock, applying the time factor.
    if(!aData->iTimePaused)
        {
        aData->iInternalElapsed = now.MicroSecondsFrom(aData->iRealUniversalTime).Int64();
        aData->iInternalElapsed = (TInt64)((TReal32)aData->iInternalElapsed * aData->iTimeFactor);
        aData->iUniversalTime += TTimeIntervalMicroSeconds(aData->iInternalElapsed);
        }
    else
        {
        aData->iInternalElapsed = aData->iInternalElapsedBeforePausing;
        aData->iInternalElapsedBeforePausing = 0;        
        }

    aData->iRealUniversalTime = now;      
    }
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:36,代码来源:HuiStatic_stubs.cpp

示例2: DoHandleStateChangeL

// -----------------------------------------------------------------------------
// CMPXAutoResumeHandler::DoHandleStateChangeL
// -----------------------------------------------------------------------------
//
void CMPXAutoResumeHandler::DoHandleStateChangeL()
    {
    MPX_FUNC("CMPXAutoResumeHandler::DoHandleStateChangeL()");
    MPX_DEBUG2("CMPXAutoResumeHandler::DoHandleStateChangeL(): iPausedForCall = %d", iPausedForCall);
    MPX_DEBUG2("CMPXAutoResumeHandler::DoHandleStateChangeL(): engineState = %d", iEngine.State());
    // if autoresume is disabled, do nothing
    if ( !iAutoResume )
        {
        return;
        }
    
    TBool shouldPause = ShouldPause();
    if (shouldPause &&
        !iPausedForCall &&
        iEngine.State() == EPbStatePlaying)
        {
        iEngine.HandleCommandL(EPbCmdPause);
        iPausedForCall = ETrue;
        }
    else if ( shouldPause &&
            !iPausedForCall &&
            ( iEngine.State() == EPbStateSeekingForward ||
            iEngine.State() == EPbStateSeekingBackward ) )
        {
        iEngine.HandleCommandL( EPbCmdStopSeeking );
        if ( iEngine.State() == EPbStatePlaying )
            {
            iEngine.HandleCommandL( EPbCmdPause );
            iPausedForCall = ETrue;
            }
        }
    else if(!shouldPause &&
            iPausedForCall &&
            iEngine.State() == EPbStatePaused)
        {
        MPX_DEBUG1("CMPXAutoResumeHandler::DoHandleStateChangeL(): starting resume timer");
        if ( iResumeTimer->IsActive() )
            iResumeTimer->Cancel();
        iResumeTimer->Start(
            KMPXResumeWaitTime,
            KMPXResumeWaitTime,
            TCallBack(ResumeTimerCallback, this) );
        iPausedForCall = EFalse;
        }
    else if ( shouldPause &&
             iEngine.State() == EPbStatePaused &&
             !iPausedForCall &&
             iKErrDiedTime.Int64())
        {
        // Check if we recently got a playcomplete with KErrDied,
        // it was most likely caused by an active call
        TTime now;
        now.HomeTime();
        TInt64 deltaTime = now.MicroSecondsFrom(iKErrDiedTime).Int64();
        if ( deltaTime > 0 &&
             deltaTime < KMPXErrDiedTimeout)
            {
            iResumeTimer->Cancel();
            iPausedForCall = ETrue;
            }
        }
    
    if ( shouldPause && iVoiceCmdResumeOngoing )
        {
        // Resume timer has been started after a voice command, cancel it now
        // so that playback is not resumed while calling
        if ( iResumeTimer->IsActive() )
            {
            iResumeTimer->Cancel();
            }
        iVoiceCmdResumeOngoing = EFalse;
        iPausedForCall = ETrue; // resume playback once call has been ended
        }
    
    MPX_DEBUG2("CMPXAutoResumeHandler::DoHandleStateChangeL(): iPausedForCall = %d", iPausedForCall);
    }
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:80,代码来源:mpxautoresumehandler.cpp

示例3: RunL


//.........这里部分代码省略.........
					SetActive();
					break;
					}
				default:
					{
					iStep.INFO_PRINTF2(_L("Network in state ENetworkProtocolProxyStepInitial received unexpected response: %d"), response);
					User::Leave(KErrNotSupported);
					}
				}
			break;
			}

		case ENetworkProtocolProxyStepSessionNrhRequestSent:
			{
			switch(response)
				{
				case ENetMsgRequestAssistanceData:
					{
					// >> RequestAssistanceData(0)
					iStep.INFO_PRINTF1(_L("NetworkProtocolProxy >> RequestAssistanceData(0)"));
					TLbsAsistanceDataGroup dataMask;
					TInt cleanupCnt = iProxy->GetArgsLC(ENetMsgRequestAssistanceData, &dataMask);
					iStep.TESTL(dataMask == EAssistanceDataNone);
					CleanupStack::PopAndDestroy(cleanupCnt);

					DecideWhatNetworkDoesntReceive();
					
					if(iNetworkExpectsMeasurments)
						{ // measurements should be sent to the network
						// Determine the value to take off the alpha2 value. This is required because we had to wait for the assistance data response.
						TTimeIntervalMicroSeconds microseconds;
						TTime stopTime;
						stopTime.HomeTime();
						microseconds = stopTime.MicroSecondsFrom(iAlpha2StartTime); 
						TInt64 timeElapsed = microseconds.Int64();

						// Test that we do not get response before alpha2 has expired:
						TInt timeOut = KAlphaTimer - timeElapsed - KDelta > 0 ? KAlphaTimer - timeElapsed - KDelta : 0;
						iNetworkProtocolProxyStep = ENetworkProtocolProxyStepSessionWaitingForFirstMeasurmentsTimeOut;
						iProxy->WaitForResponseL(timeOut, iStatus);
						SetActive();
						}
					else
						{
						iNetworkProtocolProxyStep = ENetworkProtocolProxyStepSessionMeasurmentsReceived;
						iProxy->WaitForResponseL(KTimeOut, iStatus);
						SetActive();
						}

					break;
					}
				case ENetMsgCancelSelfLocation:
					{
					// >> CancelSelfLocation()
					TLbsNetSessionId* sessionId = NULL;
					TInt cancelReason = KErrNone;
					TInt cleanupCnt;
					
					cleanupCnt = iProxy->GetArgsLC(ENetMsgCancelSelfLocation, &sessionId, &cancelReason);
					if(sessionId->SessionNum() == iSessionId.SessionNum())
						{ // should complete the session
						iStep.INFO_PRINTF1(_L("NetworkProtocolProxy >> CancelSelfLocation()"));
						CleanupStack::PopAndDestroy(cleanupCnt);
						
						// << ProcessSessionComplete()
						TInt reason = KErrNone;
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:67,代码来源:ctlbsnetprotocol.cpp

示例4: OpenClosePerformanceL

// -----------------------------------------------------------------------------
// CSensrvTest::OpenChannelL
// Parameters: Open-Close Count(TInt)
// 
// -----------------------------------------------------------------------------
//
TInt CSensrvTest::OpenClosePerformanceL( CStifItemParser& aItem )
    {
    RDebug::Print( _L("CSensrvTest::OpenClosePerformanceL") );
    
    // Get parameter
    TInt count;
    TInt err = aItem.GetNextInt( count );
    if( err )
        {
        RDebug::Print( _L("CSensrvTest::OpenClosePerformanceL: parameter error = %d"), err );
        return err;
        }
    
    TBufC8<1> nullBuf( KNullDesC8 );
    TSensrvChannelInfo channelInfo( 0, ESensrvContextNotdefined, ESensrvQuantityNotdefined, 0, nullBuf, nullBuf, 0 );
    iChannelInfoList.Reset();
    err = FindChannels( iChannelInfoList, channelInfo );
    if( err )
        {
        RDebug::Print( _L("CSensrvTest::OpenClosePerformanceL: FindChanels error: %d"), err );
        return err;
        }
    if( iChannelInfoList.Count == 0 )
        {
        RDebug::Print( _L("CSensrvTest::OpenClosePerformanceL: Channel not found" ) );
        return KErrNotFound;
        }
    if( !iSensorChannel )
        {
        RDebug::Print( _L("CSensrvTest::OpenClosePerformanceL - Create iSensorChannel...") );
        RDebug::Print( _L("CSensrvTest::OpenClosePerformanceL - ChannelId = %d "), iChannelInfoList[ 0 ].iChannelId );
        iSensorChannel = CSensrvSensorChannel::NewL( iChannelInfoList[ 0 ] );
        RDebug::Print( _L("CSensrvTest::OpenClosePerformanceL - iSensorChannel Created") );
        }
        
    TTime startTime;
    startTime.HomeTime();
    
    for( TInt i = 1; i <= count; ++i )
        {
        TRAP( err, iSensorChannel->OpenChannelL() );
        if( err )
            {
            //RDebug::Print( _L("CSensrvTest::OpenClosePerformanceL - Open channel error %d"), err );
            }
            
        TRAP( err, iSensorChannel->CloseChannelL() );
        if( err )
            {
            //RDebug::Print( _L("CSensrvTest::OpenClosePerformanceL - Close channel error %d"), err );
            }
        
        //RDebug::Print( _L("CSensrvTest::OpenClosePerformanceL - Open-Close [%d]"), i );
        
        }
        
    TTime endTime;
    endTime.HomeTime();  
    
    TTimeIntervalMicroSeconds overallTime =  endTime.MicroSecondsFrom( startTime );
    
    RDebug::Print( _L("CSensrvTest::OpenClosePerformanceL - Overall time %d micro seconds"), overallTime );
     
    
    return KErrNone;
    
    }
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:73,代码来源:SensrvTestChannel.cpp

示例5: TestAfterTicksWindowL

// ---------------------------------------------------------------------------
// TEST CASE: Timer window works correctly
// ---------------------------------------------------------------------------
//
TInt CTestRFlexTimer::TestAfterTicksWindowL(
    TTestResult& aResult, 
    CTestFlexTimer* /* aCallback */ )
    {

    // T1: expiration after 4-8 sec
    const TTimeIntervalMicroSeconds32 KTimerOneInterval( 8000000 );
    const TTimeIntervalMicroSeconds32 KTimerOneWindow( 4000000 );

    // T2: expiration after 9-10 sec
    // T2's interval must not overlap with T1's -- otherwise T1 will be 
    // delayed
    const TTimeIntervalMicroSeconds32 KTimerTwoInterval( 10000000 );
    const TTimeIntervalMicroSeconds32 KTimerTwoWindow( 1000000 );

    // T3: expiration after 5 secs
    const TTimeIntervalMicroSeconds KAfterTimerInterval( 5000000 );
    const TTimeIntervalMicroSeconds KAfterTimerWindow( 0 );

    // System tick: 1/64 sec
    const TTimeIntervalMicroSeconds32 KOneTick( 1000000 / 64 );
    const TTimeIntervalMicroSeconds KNoWindow( 0 );

    
    
    // Initialize case
    aResult.SetResult( KErrGeneral, _L("Test case leaved") );

    TTime startTime;
    startTime.UniversalTime();
    TRequestStatus oneStatus, twoStatus, afterStatus;
    
    // Do the actual test
    //-----------------------------------------------------

    RFlexTimer timerOne;
    User::LeaveIfError( timerOne.Connect() );
    timerOne.Configure( KTimerOneWindow );
    timerOne.AfterTicks( oneStatus, KTimerOneInterval.Int() / KOneTick.Int() );

    RFlexTimer timerTwo;
    User::LeaveIfError( timerTwo.Connect() );
    timerTwo.Configure( KTimerTwoWindow );
    timerTwo.AfterTicks( twoStatus, KTimerTwoInterval.Int() / KOneTick.Int() );
    
    RFlexTimer afterTimer;
    User::LeaveIfError( afterTimer.Connect() );
    afterTimer.Configure( KAfterTimerWindow );
    afterTimer.After( afterStatus, KAfterTimerInterval );
    
                                        //    //  ___     _____
    User::WaitForRequest( oneStatus ); // // // //_ // //  //
                                      //_//_// //  // //  //

    TTime oneEndTime;
    oneEndTime.UniversalTime();
                                        //    //  ___     _____
    User::WaitForRequest( twoStatus ); // // // //_ // //  //
                                      //_//_// //  // //  //

    TTime twoEndTime;
    twoEndTime.UniversalTime();
    
    timerOne.Close();
    timerTwo.Close();
    afterTimer.Close();

    //-----------------------------------------------------
    
    // Handle afterStatus too - to get rid of unhandled asynchronous message
    // error from STIF.
    User::WaitForRequest( afterStatus );
    
    aResult.SetResult( KErrNone, _L("Test case passed") );
    
    // T1 should be expired at the same time than T3 - check with T3's values
    if ( !IsDelayOk( oneEndTime.MicroSecondsFrom( startTime ), KAfterTimerInterval, KNoWindow ) )
        {
        aResult.SetResult( KErrGeneral, _L("Test case failed. Timer one wrong expiration.") );
        }
    // T2 should be expired at it's max window
    else if ( !IsDelayOk( twoEndTime.MicroSecondsFrom( startTime ), KTimerTwoInterval, KNoWindow ) )
        {
        aResult.SetResult( KErrGeneral, _L("Test case failed. Timer two wrong expiration.") );
        }
    
    __UHEAP_MARKEND;

    return KErrNone;
    }
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:94,代码来源:testrflextimer.cpp

示例6: doTestStepL

TVerdict CT_LbsHybridUEAssistedMTLRTimeout::doTestStepL()
	{
	INFO_PRINTF1(_L("CT_LbsHybridUEAssistedMTLRTimeout::doTestStepL()"));	
	// Stop the test if the preable failed
	TESTL(TestStepResult() == EPass);

	const TInt KTimeOut = 60*1000*1000;
	const TInt KAdviceSystemStatusTimeout = 40*1000*1000;

	// >> AdviceSystemStatus(0)
	TESTL(iProxy->WaitForResponse(KAdviceSystemStatusTimeout) == ENetMsgGetCurrentCapabilitiesResponse);
	CLbsNetworkProtocolBase::TLbsSystemStatus status;
	TInt cleanupCnt;
	cleanupCnt = iProxy->GetArgsLC(ENetMsgGetCurrentCapabilitiesResponse, &status); 
	TESTL(status == CLbsNetworkProtocolBase::ESystemStatusNone);
	CleanupStack::PopAndDestroy(cleanupCnt);

// Initiate MTLR Start
	// << ProcessStatusUpdate()
	MLbsNetworkProtocolObserver::TLbsNetProtocolServiceMask activeServiceMask = MLbsNetworkProtocolObserver::EServiceMobileTerminated;
	iProxy->CallL(ENetMsgProcessStatusUpdate, &activeServiceMask);

	// << ProcessPrivacyRequest()
	TBool emergency = ETrue;
	TLbsNetPosRequestPrivacy privacy    = ArgUtils::Privacy();
	TLbsExternalRequestInfo requestInfo = ArgUtils::RequestInfo();
	iProxy->CallL(ENetMsgProcessPrivacyRequest, &iSessionId, &emergency, &privacy, &requestInfo);

	// >> Callback from RespondNetworkLocationRequest(ERequestAccepted)
	CheckForObserverEventTestsL(KTimeOut, *this);
	
	// >> Respond Privacy Request
	TESTL(iProxy->WaitForResponse(KTimeOut) == ENetMsgRespondPrivacyRequest);
	TLbsNetSessionId* getSessionId = NULL;
	CLbsNetworkProtocolBase::TLbsPrivacyResponse getPrivacy;
	cleanupCnt = iProxy->GetArgsLC(ENetMsgRespondPrivacyRequest, &getSessionId, &getPrivacy);
	TESTL(getSessionId->SessionNum()==iSessionId.SessionNum());
	TESTL(getPrivacy==CLbsNetworkProtocolBase::EPrivacyResponseAccepted);
	CleanupStack::PopAndDestroy(cleanupCnt);
// Initiate MTLR End

// MTLR Reference Position Notification Start
	// << ProcessLocationUpdate()
	TPositionInfo positionInfo = ArgUtils::ReferencePositionInfo();
	iProxy->CallL(ENetMsgProcessLocationUpdate, &iSessionId, &positionInfo);
// MTLR Reference Position Notification Stop

// MTLR Assistance Data Notification Start
	// << ProcessAssistanceData()
	TLbsAsistanceDataGroup dataRequestMask = EAssistanceDataReferenceTime;
	RLbsAssistanceDataBuilderSet assistanceData;
	ArgUtils::PopulateLC(assistanceData);
	TInt reason = KErrNone;
	iProxy->CallL(ENetMsgProcessAssistanceData, &dataRequestMask, &assistanceData, &reason);
	CleanupStack::PopAndDestroy(); //assistanceData
// MTLR Assistance Data Notification Stop

// MTLR Network Location Request Start
	// << ProcessLocationRequest()
	MLbsNetworkProtocolObserver::TLbsNetProtocolService service = MLbsNetworkProtocolObserver::EServiceMobileTerminated;
	TLbsNetPosRequestQuality quality = ArgUtils::QualityAlpha2(); 
	TLbsNetPosRequestMethod method   = ArgUtils::RequestHybridMethod();
	iProxy->CallL(ENetMsgProcessLocationRequest, &iSessionId, &emergency, &service, &quality, &method);
// MTLR Network Location Request Stop

	//Start the timer
	TTime timerStart;
	timerStart.HomeTime();
	
	// >> Callback from ProcessNetworkPostionUpdate(refPosition)
	CheckForObserverEventTestsL(KTimeOut, *this);
	
// >> RequestAssistanceData(0)
	TESTL(iProxy->WaitForResponse(KTimeOut) == ENetMsgRequestAssistanceData); 
	TLbsAsistanceDataGroup dataGroup;
	cleanupCnt = iProxy->GetArgsLC(ENetMsgRequestAssistanceData, &dataGroup);
	TESTL(dataGroup == EAssistanceDataNone);
	CleanupStack::PopAndDestroy(cleanupCnt);

	//Find the time elapsed from timer
	TTimeIntervalMicroSeconds microseconds;
 	TTime timerStop;
 	timerStop.HomeTime();
 	microseconds = timerStop.MicroSecondsFrom(timerStart); 
	TInt64 timeElapsed = microseconds.Int64();
		
	// >> RespondLocationRequest()
	//Test that we do not get response before alpha2 has expired
	//At the moment, the test below fails and leaves since respond reaches us before alpha2 times out. We are not in hybrid mode.
	TESTL(iProxy->WaitForResponse(ArgUtils::Alpha2()-timeElapsed-KDelta) == ENetMsgTimeoutExpired); 
	TESTL(iProxy->WaitForResponse(2*KDelta) == ENetMsgRespondLocationRequest); 

	getSessionId = NULL;
	TInt getReason = KErrNone;
	TPositionSatelliteInfo* getPositionInfo = NULL;
	cleanupCnt = iProxy->GetArgsLC(ENetMsgRespondLocationRequest, &getSessionId, &getReason, &getPositionInfo);
	TESTL(getSessionId->SessionNum() == iSessionId.SessionNum());
	TESTL(getReason==KErrNone); 
	CleanupStack::PopAndDestroy(cleanupCnt);

//.........这里部分代码省略.........
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:101,代码来源:ctlbshybridueassistedmtlrtimeout.cpp

示例7: posOpts


//.........这里部分代码省略.........
	proxy->CallL(ENetMsgProcessAssistanceData, &dataMask, &assistanceData, &reason);
	CleanupStack::PopAndDestroy(); // assistanceData

	// << ProcessLocationRequest(SessionId, HybridMode, alpha2)
	TBool emergency = EFalse;
	MLbsNetworkProtocolObserver::TLbsNetProtocolService service = MLbsNetworkProtocolObserver::EServiceSelfLocation;
	TLbsNetPosRequestQuality quality = ArgUtils::Quality(); 
	quality.SetMaxFixTime(ArgUtils::Alpha2());
	TLbsNetPosRequestMethod method   = ArgUtils::RequestHybridMethod();
	proxy->CallL(ENetMsgProcessLocationRequest, &iSessionId, &emergency, &service, &quality, &method);

	// Now that the hybrid/alpha2 has been requested, record current time to verify alpha2 timer expires correctly.
	TTime startTime;
	startTime.HomeTime();

	// >> RequestAssistanceData(0)
	TESTL(proxy->WaitForResponse(KTimeOut) == ENetMsgRequestAssistanceData); 
	cleanupCnt = proxy->GetArgsLC(ENetMsgRequestAssistanceData, &dataMask);
	TESTL(dataMask == EAssistanceDataNone);
	CleanupStack::PopAndDestroy(cleanupCnt);

	// << NotifyPositionUpdate()
	pWatch->IssueNotifyPositionUpdate();

	// >> RequestAssistanceData(0)
	TESTL(proxy->WaitForResponse(KTimeOut) == ENetMsgRequestAssistanceData); 
	cleanupCnt = proxy->GetArgsLC(ENetMsgRequestAssistanceData, &dataMask);
	TESTL(dataMask == EAssistanceDataNone);
	CleanupStack::PopAndDestroy(cleanupCnt);
	// Determine the value to take off the alpha2 value. This is required because we had to wait for the assistance data response.
	TTimeIntervalMicroSeconds microseconds;
	TTime stopTime;
	stopTime.HomeTime();
	microseconds = stopTime.MicroSecondsFrom(startTime); 
	TInt64 timeElapsed = microseconds.Int64();
	TInt delta = 2 * 1000 * 1000; // 2 secs.

	// >> RespondLocationRequest()
	TESTL(proxy->WaitForResponse(ArgUtils::Alpha2() - timeElapsed - delta) == ENetMsgTimeoutExpired);

	// Wait for and process the response.
	TESTL(proxy->WaitForResponse(2 * delta) == ENetMsgRespondLocationRequest);		// DONT get because the measurement data bus has not been created...

	sessionId = NULL;
	TPositionGpsMeasurementInfo* measurementInfo = NULL;
	cleanupCnt = proxy->GetArgsLC(ENetMsgRespondLocationRequest, &sessionId, &reason, &measurementInfo);
	TESTL(sessionId->SessionNum() == iSessionId.SessionNum());
	TESTL(reason == KErrNone);
	CleanupStack::PopAndDestroy(cleanupCnt);//sessionId, measurementInfo

	// Recv -> RequestAssistanceData - we get an extra msg as the result of the A-GPS manager re-issueing a location request when it's
	//									max fix time timer expries.
	TESTL(proxy->WaitForResponse(KTimeOut) == ENetMsgRequestAssistanceData); 
	cleanupCnt = proxy->GetArgsLC(ENetMsgRequestAssistanceData, &dataMask);
	TESTL(dataMask == EAssistanceDataNone);
	CleanupStack::PopAndDestroy(cleanupCnt);

	const TInt t = 8 * 1000 * 1000; // 8 secs.
	quality.SetMaxFixTime(t);

	TPositionInfo* positionInfo = NULL;
	
	for (TInt i = 0; i < KN; i++)
		{
		// << ProcessLocationRequest(SessionId, HybridMode, t)
		proxy->CallL(ENetMsgProcessLocationRequest, &iSessionId, &emergency, &service, &quality, &method);
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:67,代码来源:ctlbsX3PIntByMoLr.cpp

示例8: RemoveDefaultDbL

// ---------------------------------------------------------
// CPosTp29::TestCriticalLevelL
//
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CPosTp29::TestCriticalLevelL()
    {

    TTime startTime;
    TTime stopTime;

    startTime.UniversalTime();

    RemoveDefaultDbL();

    iLog->Put(_L("CPosLandmarkDatabase::OpenL();"));
    iLandmarksDb = CPosLandmarkDatabase::OpenL();
    if (iLandmarksDb->IsInitializingNeeded())
       {
       iLog->Put(_L("iLandmarksDb->InitializeL"));
       ExecuteAndDeleteLD(iLandmarksDb->InitializeL());        
       }

    iLog->Put(_L("CPosLmCategoryManager::NewL;"));
    iCategoryManager = CPosLmCategoryManager::NewL(*iLandmarksDb);

    // Asynchronous
    iLog->Put(_L("DoOutOfDiskTestL Asynchronous"));
//    iSearchCallback=ETrue;
    DoOutOfDiskTestL(ETrue);
  //  iSearchCallback=EFalse;

    // Delete "out-of-disk" file
    iFile1.Close();
    iFileServer.Delete(KFile1);
    iFile2.Close();
    iFileServer.Delete(KFile2);
    TInt err = iFile1.Open(iFileServer, KFile1, EFileWrite);
    if (err == KErrNotFound)
        {
        err = iFile1.Create(iFileServer, KFile1, EFileWrite);
        }
    User::LeaveIfError(err);
    
    err = iFile2.Open(iFileServer, KFile2, EFileWrite);
    if (err == KErrNotFound)
        {
        err = iFile2.Create(iFileServer, KFile2, EFileWrite);
        }
    User::LeaveIfError(err);

    // Synchronous
    iLog->Put(_L("DoOutOfDiskTestL Synchronous"));
    DoOutOfDiskTestL(EFalse);

    stopTime.UniversalTime();
    TTimeIntervalMicroSeconds executionTime = 
        stopTime.MicroSecondsFrom(startTime);

    //TInt64 resse = executionTime.Int64()/1000000;

    TInt resse = executionTime.Int64()/1000000;

    TBuf<50> buf;
    buf.Zero();
    buf.Format(_L("TP29 took %d seconds"), resse);
    iLog->Put(buf);
    }
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:69,代码来源:FT_CPosTP29.cpp

示例9: doTestStepL


//.........这里部分代码省略.........

	// Send <-- ProcessAssistanceData.
	TLbsAsistanceDataGroup			dataMask = EAssistanceDataReferenceTime;
	RLbsAssistanceDataBuilderSet	data;
	TInt							reason = KErrNone;
	ArgUtils::PopulateLC(data);
	proxy->CallL(ENetMsgProcessAssistanceData, &dataMask, &data, &reason);
	CleanupStack::PopAndDestroy(); // data


	// Send <-- ProcessLocationRequest.
	TBool												emergency = EFalse;
	MLbsNetworkProtocolObserver::TLbsNetProtocolService	service = MLbsNetworkProtocolObserver::EServiceSelfLocation;
	TLbsNetPosRequestQuality							quality = ArgUtils::Quality();
	TLbsNetPosRequestMethod								method = ArgUtils::RequestTAPMethod();
	quality.SetMaxFixTime(ArgUtils::Alpha2());
	proxy->CallL(ENetMsgProcessLocationRequest, &iSessionId, &emergency, &service, &quality, &method);

	// Now that the hybrid/alpha2 has been requested, record current time to verify alpha2 timer expires correctly.
	TTime startTime;
	startTime.HomeTime();


	// Recv --> RequestAssistanceData.
	TESTL(proxy->WaitForResponse(KTimeOut) == ENetMsgRequestAssistanceData); 
	cleanupCnt = proxy->GetArgsLC(ENetMsgRequestAssistanceData, &dataMask);
	TESTL(dataMask == EAssistanceDataNone);
	CleanupStack::PopAndDestroy(cleanupCnt);

	// Determine the value to take off the alpha2 value. This is required because we had to wait for the assistance data response.
	TTimeIntervalMicroSeconds microseconds;
	TTime stopTime;
	stopTime.HomeTime();
	microseconds = stopTime.MicroSecondsFrom(startTime); 
	TInt64 timeElapsed = microseconds.Int64();


	// Recv --> RespondLocationRequest.
	// First ensure we don't recv response before Alpha2.
	TInt delta = 2 * 1000 * 1000; // 2 secs.
	TESTL(proxy->WaitForResponse(ArgUtils::Alpha2() - timeElapsed - delta) == ENetMsgTimeoutExpired);
	
	// Wait for and process the response.
	TESTL(proxy->WaitForResponse(2 * delta) == ENetMsgRespondLocationRequest);

	TPositionGpsMeasurementInfo* measurementInfo = NULL;
	cleanupCnt = proxy->GetArgsLC(ENetMsgRespondLocationRequest, &sessionId, &reason, &measurementInfo);
	TESTL(sessionId->SessionNum() == iSessionId.SessionNum());
	TESTL(reason == KErrNone);
	TESTL(measurementInfo->PositionClassType() == EPositionGpsMeasurementInfoClass);
	
	CleanupStack::PopAndDestroy(cleanupCnt);
	sessionId = NULL;
	measurementInfo = NULL;


	// Recv -> RequestAssistanceData - we get an extra msg as the result of the A-GPS manager re-issueing a location request when it's
	//									max fix time timer expries.
	TESTL(proxy->WaitForResponse(KTimeOut) == ENetMsgRequestAssistanceData); 
	cleanupCnt = proxy->GetArgsLC(ENetMsgRequestAssistanceData, &dataMask);
	TESTL(dataMask == EAssistanceDataNone);
	CleanupStack::PopAndDestroy(cleanupCnt);

	const TInt t = 8 * 1000 * 1000; // 8 secs.
	quality.SetMaxFixTime(t);
	
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:66,代码来源:ctlbataearlycomplete.cpp

示例10: HandlePointerEventL

void CBuddycloudListComponent::HandlePointerEventL(const TPointerEvent &aPointerEvent) {
	CCoeControl::HandlePointerEventL(aPointerEvent);
	
	if(aPointerEvent.iType == TPointerEvent::EButton1Up) {			
		if(iDraggingAllowed) {
			if(Abs(iDragVelocity) > 5.0) {
				TimerExpired(KDragTimerId);
			}
		}
		else {
			for(TInt i = 0; i < iListItems.Count(); i++) {
				if(iListItems[i].iRect.Contains(aPointerEvent.iPosition)) {
					// Provide feedback
					iTouchFeedback->InstantFeedback(ETouchFeedbackBasic);
					
					HandleItemSelection(iListItems[i].iId);			
					break;
				}
			}
		}
	}
	else if(aPointerEvent.iType == TPointerEvent::EButton1Down) {
		iDragTimer->Stop();
		iDragVelocity = 0.0;
		iDraggingAllowed = false;
		
		iStartDragPosition = aPointerEvent.iPosition.iY;
		iStartDragHandlePosition = iScrollbarHandlePosition;
		
		iLastDragTime.UniversalTime();
		iLastDragPosition = iStartDragPosition;
	}
	else if(aPointerEvent.iType == TPointerEvent::EDrag) {	
		if(!iDraggingAllowed && (aPointerEvent.iPosition.iY + 32 < iStartDragPosition || aPointerEvent.iPosition.iY - 32 > iStartDragPosition)) {
			iDraggingAllowed = true;			
			iSnapToItem = false;
		}
		
		if(iDraggingAllowed) {
			TTime aNow;			
			aNow.UniversalTime();
			
			iDragVelocity = TReal(TReal(iLastDragPosition - aPointerEvent.iPosition.iY) * (1000000.0 / TReal(aNow.MicroSecondsFrom(iLastDragTime).Int64()))) / 20.0;
			
			iLastDragTime.UniversalTime();
			iLastDragPosition = aPointerEvent.iPosition.iY;
			
			iScrollbarHandlePosition = iStartDragHandlePosition + (iStartDragPosition - aPointerEvent.iPosition.iY);
			
			CBuddycloudListComponent::RepositionItems(false);
			RenderScreen();
		}
	}
}
开发者ID:Persepoliss,项目名称:symbian-client,代码行数:54,代码来源:BuddycloudListComponent.cpp

示例11: longInterval

// ---------------------------------------------------------
// CT_LbsClientPosTp178::StartL
//
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CT_LbsClientPosTp178::StartL()
    {
    _LIT(KServiceAccept, "SAAA");
    
    SetupPsyL(iUidTestPsy3);
    
    RPositioner positioner;
    TPositionInfo info = TPositionInfo();
    
    ConnectL();
    
    User::LeaveIfError(positioner.Open(iPosServer,iUidTestPsy3));
    CleanupClosePushL(positioner);
    
    TInt Err = positioner.SetRequestor(CRequestor::ERequestorService,
        CRequestor::EFormatApplication, KServiceAccept);
    
    TPositionUpdateOptions updateOptionsLong, updateOptionsShort;
    
    TTimeIntervalMicroSeconds longInterval(7000000);
    
    updateOptionsLong.SetUpdateTimeOut(longInterval);
    Err = positioner.SetUpdateOptions(updateOptionsLong);
    
    TTimeIntervalMicroSeconds shortInterval(2000000);
    updateOptionsShort.SetUpdateTimeOut(shortInterval);
    
    TPositionUpdateOptions theUpdateOptions;
    Err = positioner.GetUpdateOptions(theUpdateOptions);
    
    if (theUpdateOptions.UpdateTimeOut() != updateOptionsLong.UpdateTimeOut() ||
        updateOptionsLong.UpdateTimeOut() != longInterval)
    {
        _LIT(KUpdateOptions, "The update option was not set correctly");
        LogErrorAndLeaveL(KUpdateOptions);
    }
    
    _LIT(KDelayMsg, "The successfull requests was completed within %d microsecs.");
    _LIT(KCancelMsg, "The canceled requests was completed within %d microsecs.");
    
    TRequestStatus status;
    
    for (TInt i = 0; i < 10; i++) // makes 10 test inorder to get some statistic
    {         
        
        positioner.SetUpdateOptions(updateOptionsLong);
        TTime requestStartTime;
        
        requestStartTime.UniversalTime();
        positioner.NotifyPositionUpdate(info, status);
        User::WaitForRequest(status);
        TTime requestStopTime;
        requestStopTime.UniversalTime();
        
        TTimeIntervalMicroSeconds durationMicro = requestStopTime.MicroSecondsFrom(requestStartTime);
        
        TInt duration = durationMicro.Int64();
        
        TBuf<100> timeMsg;
        timeMsg.Format(KDelayMsg, duration);
        INFO_PRINTF1(timeMsg);
        
        //check error status
        if (status != KErrNone)
        {
            _LIT(KErrPositionRequest, "error code returned from NotifyPositionUpdate, error code = %d");
            TBuf<100> buf;
            buf.Format(KErrPositionRequest, status.Int());
            LogErrorAndLeaveL(buf);
        }
        
        
        TTimeIntervalMicroSeconds shortInterval(2000000);
        updateOptionsShort.SetUpdateTimeOut(shortInterval);
        
        positioner.SetUpdateOptions(updateOptionsShort);
        
        requestStartTime.UniversalTime();
        positioner.NotifyPositionUpdate(info, status);
        User::WaitForRequest(status);
        requestStopTime.UniversalTime();
        
        durationMicro = requestStopTime.MicroSecondsFrom(requestStartTime);
        
        duration = durationMicro.Int64();
        
#ifdef __WINS__
        TTimeIntervalMicroSeconds winsFail(100000);
        durationMicro = TTimeIntervalMicroSeconds(durationMicro.Int64()+winsFail.Int64());
#endif
        
        timeMsg.Format(KCancelMsg, duration);
        INFO_PRINTF1(timeMsg);
        
//.........这里部分代码省略.........
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:101,代码来源:ctlbsclientpostp178.cpp

示例12: TestFileDelete

static void TestFileDelete()
//
//
//
{
    ClearSessionDirectory();
    test.Next(_L("Benchmark delete"));

    TInt64 total=0;
    TInt numberOfFiles=100;
    TInt cycles=1;

    TInt i=0;
    for (; i<cycles; i++)
    {
        //	Create many files
        CreateManyFiles(numberOfFiles);

        test.Next(_L("Time the delete"));
        //	Now delete them and time it
        TTime startTime;
        startTime.HomeTime();

        for (TInt index=0; index<numberOfFiles; index++)
        {
            TFileName baseName=_L("\\F32-TST\\BENCH_DELETE\\FILE");
            baseName.AppendNum(index);

            TInt r=TheFs.Delete(baseName);
            test_KErrNone(r);
        }

        TTime endTime;
        endTime.HomeTime();
        TTimeIntervalMicroSeconds timeTaken;
        timeTaken=endTime.MicroSecondsFrom(startTime);
        TInt64 time=timeTaken.Int64();
        total+=time;
    }
//	We deleted cycles*numberOfFiles files in total microseconds
    TInt64 fileDeleteTime=total/(numberOfFiles*cycles);
    test.Next(_L("Benchmarked RFs::Delete()"));
    test.Printf(_L("Delete time per file = %d microseconds\n"),fileDeleteTime);

    CFileMan* fMan=CFileMan::NewL(TheFs);
    total=0;
    numberOfFiles=100;
    cycles=1;
    i=0;
    for (; i<cycles; i++)
    {
        //	Create many files
        CreateManyFiles(numberOfFiles);

        test.Next(_L("Time the delete"));
        //	Now delete them and time it
        TTime startTime;
        startTime.HomeTime();

        for (TInt index=0; index<numberOfFiles; index++)
        {
            TInt r=fMan->Delete(_L("\\F32-TST\\BENCH_DELETE\\FILE*"));
            test_Value(r, r == KErrNone || r==KErrNotFound);
        }

        TTime endTime;
        endTime.HomeTime();
        TTimeIntervalMicroSeconds timeTaken;
        timeTaken=endTime.MicroSecondsFrom(startTime);
        TInt64 time=timeTaken.Int64();
        total+=time;
    }
//	We deleted cycles*numberOfFiles files in total microseconds
    fileDeleteTime=total/(numberOfFiles*cycles);
    test.Next(_L("Benchmarked CFileMan::Delete()"));
    test.Printf(_L("Delete time per file = %d microseconds\n"),fileDeleteTime);

    delete fMan;
}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:79,代码来源:t_fsysbm.cpp

示例13: TestLargeFileDelete

static void TestLargeFileDelete()
//
// This test require MMC/SD card size >=4GB-2 in size
//
{
    ClearSessionDirectory();
    test.Next(_L("Benchmark delete large file"));

    TInt64 total=0;

    TInt cycles=1;

    TInt i=0;

    //check Disk space and decide how many files to create
    TVolumeInfo volInfo;
    TInt r;

    r = TheFs.Volume(volInfo);
    test_KErrNone(r);

    TInt numberOfFiles = (TUint)(volInfo.iFree/(K4GB -2));
#ifdef __WINS__
    // Fix a maximum number of large files to create on the emulator
    if (numberOfFiles > 5)
        numberOfFiles = 5;
#endif
    test.Printf(_L("Number of large files =%d \n"),numberOfFiles);

    if(numberOfFiles<=0)
    {
        test.Printf(_L("Large File delete is skipped \n"));
        return;
    }

    for (; i<cycles; i++)
    {
        //	Create many files
        CreateManyLargFiles(numberOfFiles);

        test.Next(_L("Time the delete"));
        //	Now delete them and time it
        TTime startTime;
        startTime.HomeTime();

        for (TInt index=0; index<numberOfFiles; index++)
        {
            TFileName baseName=_L("\\F32-TST\\BENCH_DELETE\\FILE");
            baseName.AppendNum(index);

            TInt r=TheFs.Delete(baseName);
            test_KErrNone(r);
        }

        TTime endTime;
        endTime.HomeTime();
        TTimeIntervalMicroSeconds timeTaken;
        timeTaken=endTime.MicroSecondsFrom(startTime);
        TInt64 time=timeTaken.Int64();
        total+=time;
    }
//	We deleted cycles*numberOfFiles files in total microseconds
    TInt64 fileDeleteTime=total/(numberOfFiles*cycles);
    test.Next(_L("Benchmarked RFs::Delete()"));
    test.Printf(_L("Delete time per file = %d microseconds\n"),fileDeleteTime);

    CFileMan* fMan=CFileMan::NewL(TheFs);
    total=0;

    cycles=1;
    i=0;
    for (; i<cycles; i++)
    {
        //	Create many files
        CreateManyLargFiles(numberOfFiles);

        test.Next(_L("Time the delete"));
        //	Now delete them and time it
        TTime startTime;
        startTime.HomeTime();

        for (TInt index=0; index<numberOfFiles; index++)
        {
            TInt r=fMan->Delete(_L("\\F32-TST\\BENCH_DELETE\\FILE*"));
            test_Value(r, r == KErrNone || r==KErrNotFound);
        }

        TTime endTime;
        endTime.HomeTime();
        TTimeIntervalMicroSeconds timeTaken;
        timeTaken=endTime.MicroSecondsFrom(startTime);
        TInt64 time=timeTaken.Int64();
        total+=time;
    }
//	We deleted cycles*numberOfFiles files in total microseconds
    fileDeleteTime=total/(numberOfFiles*cycles);
    test.Next(_L("Benchmarked CFileMan::Delete()"));
    test.Printf(_L("Delete time per file = %d microseconds\n"),fileDeleteTime);

    delete fMan;
//.........这里部分代码省略.........
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:101,代码来源:t_fsysbm.cpp

示例14: DoTestFileWrite

static void DoTestFileWrite(TInt aBlockSize, TInt aFileSize = KMaxFileSize, TBool aUpdate = EFalse)
//
// Do Write benchmark
//
{
    DataBuf.SetLength(aBlockSize);
    const TInt maxWriteCount = aFileSize / aBlockSize;

    TFileName testDir(_L("?:\\F32-TST\\"));
    testDir[0] = (TText) gDriveToTest;
    TInt r = TheFs.MkDir(testDir);
    test_Value(r, r == KErrNone || r == KErrAlreadyExists);

    TFileName fileName;
    r = File.Temp(TheFs, testDir, fileName, EFileWrite | (gFileSequentialModeOn ? EFileSequential : 0)
                  | (gWriteCachingOn ? EFileWriteBuffered : EFileWriteDirectIO));
    test_KErrNone(r);

    if (aUpdate)
    {
        TInt r = File.SetSize(aFileSize);
        test_KErrNone(r);
    }

    TUint functionCalls = 0;

    TTime startTime;
    TTime endTime;
    TUint initTicks = 0;
    TUint finalTicks = 0;


    // we stop after the entire file has been written or after 10 seconds, whichever happens sooner
    RTimer timer;
    timer.CreateLocal();
    TRequestStatus reqStat;

    TInt pos = 0;
    File.Seek(ESeekStart, pos);

    timer.After(reqStat, 10000000); // After 10 secs

    startTime.HomeTime();
    initTicks = User::FastCounter();

    for (TInt i = 0 ; i<maxWriteCount && reqStat==KRequestPending; i++)
    {
        File.Write(pos, DataBuf, aBlockSize);

        pos += aBlockSize;
        if (pos > KMaxFileSize-aBlockSize)
            pos = 0;

        functionCalls++;
    }

    if (gFlushAfterWrite)
    {
        r = File.Flush();
        test_KErrNone(r)
    }

    // write file once only
    finalTicks = User::FastCounter();
    endTime.HomeTime();
//	TTimeIntervalMicroSeconds duration = endTime.MicroSecondsFrom(startTime);
    TTimeIntervalMicroSeconds duration = TInt64(finalTicks - initTicks) * TInt64(1000000) / TInt64(gFastCounterFreq) ;

    TInt dataTransferred = functionCalls * aBlockSize;
    TReal transferRate =
        TReal32(dataTransferred) /
        TReal(duration.Int64()) * TReal(1000000) / TReal(K1K); // KB/s
    test.Printf(_L("Write %7d bytes in %7d byte blocks:\t%11.3f KBytes/s (%d microsecs)\n"),
                dataTransferred, aBlockSize, transferRate, endTime.MicroSecondsFrom(startTime).Int64());

    timer.Close();

    File.Close();
    r = TheFs.Delete(fileName);
    test_KErrNone(r)

    return;
}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:83,代码来源:t_fsysbm.cpp

示例15: CreateContactsBatchL

void CPlPerformanceAPI::CreateContactsBatchL(TInt aSize)
	{
	test.Next(_L("->... Create"));

	RDebug::Print(_L("CreateContactsTestL(TInt aSize)"));
	TBool testFlag = EFalse;
	testFlag = iCntTestImpl.DefaultContactDatabaseExistsL();
	test.Printf(_L("CreateContactsBatchL_1, DefaultContactDatabaseExistsL:%d \n"),testFlag);
	
				
	TTime startTime;
	startTime.UniversalTime();
	
	for (int ii = 0; ii < aSize; ii+=nsPlPerformance::KBatchSize)
		{
		CreateContactsTestL(aSize<nsPlPerformance::KBatchSize ?
							aSize:nsPlPerformance::KBatchSize);
		if (ii >= nsPlPerformance::KBatchSize - 1)
			{
			iCntTestImpl.CompactL();		
			}
		}	

	TTime finishTime;			
	finishTime.UniversalTime();
	// Temporary required for ARMv5, adress of Int64() is taken in
	// parameter to Format method otherwise.
	TReal lapsed = (TReal) finishTime.MicroSecondsFrom(startTime).Int64();
	
	TBuf8<64> row;
	// _LIT8 gives an error - illegal implicit conversion from long 
	row.Format(_L8("Create,%d,%.4f\r\n"), aSize, lapsed/1000000);
	iCsvWriter->WriteNextLineL(row);
	
	// API Tests
	testFlag = iCntTestImpl.CompressRequired();
	test.Printf(_L("CreateContactsBatchL, CompressRequired:%d \n"),testFlag);	
	
	testFlag = iCntTestImpl.IsDamaged();
	test.Printf(_L("CreateContactsBatchL, IsDamaged:%d \n"),testFlag);
	
	testFlag = iCntTestImpl.DefaultContactDatabaseExistsL();
	test.Printf(_L("CreateContactsBatchL, DefaultContactDatabaseExistsL:%d \n"),testFlag);
		
	testFlag = iCntTestImpl.ContactDatabaseExistsL(KTestContactFileName);
	test.Printf(_L("CreateContactsBatchL, ContactDatabaseExistsL:%d \n"),testFlag);
	
	TInt theCount;
	theCount = iCntTestImpl.FileSize();
	test.Printf(_L("CreateContactsBatchL, FileSize:%d \n"),theCount);
	
	theCount = iCntTestImpl.WastedSpaceInBytes();
	test.Printf(_L("CreateContactsBatchL, WastedSpaceInBytes:%d \n"),theCount);	
	
	TBuf<190> defaultName;
	iCntTestImpl.GetDefaultNameL(defaultName);
	test.Printf(_L("CreateContactsBatchL, GetDefaultNameL: %s \n"),defaultName.PtrZ());	
	defaultName.Delete(0,defaultName.Size());
	
	TDriveUnit driveUnit;
	iCntTestImpl.DatabaseDrive(driveUnit);
	TBuf<190> driveName = driveUnit.Name();
	test.Printf(_L("CreateContactsBatchL, DatabaseDrive: %s \n"),driveName.PtrZ());		

	}
开发者ID:Esclapion,项目名称:qt-mobility,代码行数:65,代码来源:t_plperformanceapi.cpp


注:本文中的TTime::MicroSecondsFrom方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。