diff -r 000000000000 -r 29b1cd4cb562 bluetooth/gavdp/test/tavsrcTimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bluetooth/gavdp/test/tavsrcTimer.h Fri Jan 15 08:13:17 2010 +0200 @@ -0,0 +1,62 @@ +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +#ifndef TAVSRCTIMER_H +#define TAVSRCTIMER_H + +#include + +class CAdaptiveHighResPeriodic; + +class MAdaptiveHighResPeriodicClient + { +public: + virtual void TimerEvent(CAdaptiveHighResPeriodic& aTimer)=0; + virtual void TimerError(CAdaptiveHighResPeriodic& aTimer, TInt aError)=0; + }; + +//adapts the callback to counter drift +class CAdaptiveHighResPeriodic : public CTimer + { +public: + static CAdaptiveHighResPeriodic* NewL(MAdaptiveHighResPeriodicClient& aClient); + ~CAdaptiveHighResPeriodic(); + void Start(TTimeIntervalMicroSeconds32 aPeriod); + + void SetInterval(TTimeIntervalMicroSeconds32 aInterval); + +private: + CAdaptiveHighResPeriodic(MAdaptiveHighResPeriodicClient& aClient); + void ConstructL(); + void RunL(); + TInt RunError(TInt aError); + void StartTimer(TTimeIntervalMicroSeconds32 aInterval); + +private: + MAdaptiveHighResPeriodicClient& iClient; + + // HAL stuff + TBool iFastCounterIncreases; + TInt iFastCounterFreq; + TReal iFastCounterFreqUs; + TReal iExtraCounts; + + // what the client asked for in musecs + TTimeIntervalMicroSeconds32 iInterval; + + TUint iIntendedCountOnCallback ; // the hoped for fast counter reading on callback + }; + +#endif // TAVSRCTIMER_H