|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Symbian Foundation License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // This is the Cpp file which contains the utility functions for the CTimer derived objects |
|
15 // |
|
16 // |
|
17 |
|
18 |
|
19 |
|
20 /** |
|
21 @file |
|
22 */ |
|
23 |
|
24 |
|
25 // user include |
|
26 #include <t_timerutils.h> |
|
27 |
|
28 |
|
29 const TInt KValue={1000000}; |
|
30 /** |
|
31 NewL() |
|
32 It performs the two phase construction and returns an object |
|
33 of type CT_MsgTimerUtils |
|
34 |
|
35 @leave KErrNoMemory |
|
36 @return |
|
37 Returns pointer to an object of CT_MsgTimerUtils |
|
38 */ |
|
39 EXPORT_C CT_MsgTimerUtils* CT_MsgTimerUtils::NewL() |
|
40 { |
|
41 CT_MsgTimerUtils* self = new (ELeave) CT_MsgTimerUtils(); |
|
42 CleanupStack::PushL(self); |
|
43 self->ConstructL(); |
|
44 CActiveScheduler::Add(self); |
|
45 CleanupStack::Pop(); |
|
46 return self; |
|
47 } |
|
48 |
|
49 |
|
50 |
|
51 /** |
|
52 CT_MsgTimerUtils() |
|
53 Constructor |
|
54 */ |
|
55 CT_MsgTimerUtils::CT_MsgTimerUtils() : CTimer(EPriorityHigh) |
|
56 { |
|
57 } |
|
58 |
|
59 |
|
60 |
|
61 /** |
|
62 ~CT_MsgTimerUtils() |
|
63 Destructor |
|
64 */ |
|
65 CT_MsgTimerUtils::~CT_MsgTimerUtils() |
|
66 { |
|
67 iRequestStatus = 0; //To Remove Lint Warning |
|
68 } |
|
69 |
|
70 |
|
71 /** |
|
72 After() |
|
73 Calls the After function CTimer for the given number of secs |
|
74 |
|
75 @param aSec |
|
76 No. of seconds |
|
77 |
|
78 @param aStatus |
|
79 Completion status of a request |
|
80 |
|
81 @see CTimer::After() |
|
82 */ |
|
83 EXPORT_C void CT_MsgTimerUtils::After(TInt aSec,TRequestStatus& aStatus) |
|
84 { |
|
85 iRequestStatus = &aStatus; |
|
86 aStatus = KRequestPending; |
|
87 TTimeIntervalMicroSeconds32 interval = aSec*KValue; |
|
88 CTimer::After(interval); |
|
89 } |
|
90 |
|
91 |
|
92 /** |
|
93 RunL() |
|
94 Gives the status of the operation |
|
95 */ |
|
96 void CT_MsgTimerUtils::RunL() |
|
97 { |
|
98 User::RequestComplete(iRequestStatus,iStatus.Int()); |
|
99 } |