sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
* Contains functionality for a callback timer
|
sl@0
|
16 |
*
|
sl@0
|
17 |
*/
|
sl@0
|
18 |
|
sl@0
|
19 |
|
sl@0
|
20 |
/**
|
sl@0
|
21 |
@file
|
sl@0
|
22 |
@publishedPartner
|
sl@0
|
23 |
@released
|
sl@0
|
24 |
*/
|
sl@0
|
25 |
|
sl@0
|
26 |
#ifndef __CALLBACKTIMER_H__
|
sl@0
|
27 |
#define __CALLBACKTIMER_H__
|
sl@0
|
28 |
|
sl@0
|
29 |
#include <e32base.h>
|
sl@0
|
30 |
|
sl@0
|
31 |
/**
|
sl@0
|
32 |
* Interface class for using the services of CCallbackTimer
|
sl@0
|
33 |
*/
|
sl@0
|
34 |
class MTimerObserver
|
sl@0
|
35 |
{
|
sl@0
|
36 |
public:
|
sl@0
|
37 |
virtual ~MTimerObserver() {};
|
sl@0
|
38 |
|
sl@0
|
39 |
/**
|
sl@0
|
40 |
* Call back function to handle the expiry of the timer
|
sl@0
|
41 |
* @param aError KErrNone if timer expired normally else any of the system-wide error codes to indicate a system error
|
sl@0
|
42 |
*/
|
sl@0
|
43 |
virtual void TimerRun(TInt aError) = 0;
|
sl@0
|
44 |
};
|
sl@0
|
45 |
|
sl@0
|
46 |
/**
|
sl@0
|
47 |
* A timer class that provides a call back on timer expiry
|
sl@0
|
48 |
*/
|
sl@0
|
49 |
class CCallbackTimer : public CTimer
|
sl@0
|
50 |
{
|
sl@0
|
51 |
public:
|
sl@0
|
52 |
|
sl@0
|
53 |
/**
|
sl@0
|
54 |
* Create and return a new instance of the CCallbackTimer. An ongoing timer operation can be cancelled by the client by calling the Cancel() method on this object.
|
sl@0
|
55 |
* @param aCallBackIf Callback interface that implements TimerRun() function
|
sl@0
|
56 |
* @param aEnableCancelCallback If ETrue cancel events (client initiated by calling Cancel() method) are notified. Default is EFalse
|
sl@0
|
57 |
*/
|
sl@0
|
58 |
IMPORT_C static CCallbackTimer* NewL(MTimerObserver& aCallBackIf, TBool aEnableCancelCallback = EFalse);
|
sl@0
|
59 |
|
sl@0
|
60 |
private:
|
sl@0
|
61 |
CCallbackTimer(MTimerObserver& aCallBackIf, TBool aEnableCancelCallback);
|
sl@0
|
62 |
|
sl@0
|
63 |
// Methods from CTimer/CActive
|
sl@0
|
64 |
void RunL();
|
sl@0
|
65 |
|
sl@0
|
66 |
private:
|
sl@0
|
67 |
MTimerObserver& iCallBackIf;
|
sl@0
|
68 |
TBool iEnableCancelCallback;
|
sl@0
|
69 |
};
|
sl@0
|
70 |
|
sl@0
|
71 |
#endif // __CALLBACKTIMER_H__
|