|
1 // Copyright (c) 2007-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 "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Name : sipprofilecsserverclosetimer.cpp |
|
15 // Part of : SIP Profile Server |
|
16 // implementation |
|
17 // Version : 1.0 |
|
18 // |
|
19 |
|
20 |
|
21 |
|
22 // INCLUDE FILES |
|
23 #include "SipProfileCSServerCloseTimer.h" |
|
24 |
|
25 // ----------------------------------------------------------------------------- |
|
26 // CSipProfileCSServerCloseTimer::NewL |
|
27 // ----------------------------------------------------------------------------- |
|
28 // |
|
29 CSipProfileCSServerCloseTimer* CSipProfileCSServerCloseTimer::NewL() |
|
30 { |
|
31 CSipProfileCSServerCloseTimer* self = |
|
32 CSipProfileCSServerCloseTimer::NewLC(); |
|
33 CleanupStack::Pop(self); |
|
34 return self; |
|
35 } |
|
36 |
|
37 // ----------------------------------------------------------------------------- |
|
38 // CSipProfileCSServerCloseTimer::NewLC |
|
39 // ----------------------------------------------------------------------------- |
|
40 // |
|
41 CSipProfileCSServerCloseTimer* CSipProfileCSServerCloseTimer::NewLC () |
|
42 { |
|
43 CSipProfileCSServerCloseTimer* self = |
|
44 new (ELeave) CSipProfileCSServerCloseTimer; |
|
45 CleanupStack::PushL(self); |
|
46 self->ConstructL(); |
|
47 return self; |
|
48 } |
|
49 |
|
50 // ----------------------------------------------------------------------------- |
|
51 // CSipProfileCSServerCloseTimer::ConstructL |
|
52 // ----------------------------------------------------------------------------- |
|
53 // |
|
54 void CSipProfileCSServerCloseTimer::ConstructL() |
|
55 { |
|
56 User::LeaveIfError(iTimer.CreateLocal()); |
|
57 } |
|
58 |
|
59 // ----------------------------------------------------------------------------- |
|
60 // CSipProfileCSServerCloseTimer::CSipProfileCSServerCloseTimer |
|
61 // ----------------------------------------------------------------------------- |
|
62 // |
|
63 CSipProfileCSServerCloseTimer::CSipProfileCSServerCloseTimer() : |
|
64 CActive(EPriorityStandard) |
|
65 { |
|
66 CActiveScheduler::Add(this); |
|
67 } |
|
68 |
|
69 // ----------------------------------------------------------------------------- |
|
70 // CSipProfileCSServerCloseTimer::~CSipProfileCSServerCloseTimer |
|
71 // ----------------------------------------------------------------------------- |
|
72 // |
|
73 CSipProfileCSServerCloseTimer::~CSipProfileCSServerCloseTimer() |
|
74 { |
|
75 CActive::Cancel(); |
|
76 iTimer.Close(); |
|
77 } |
|
78 |
|
79 // ----------------------------------------------------------------------------- |
|
80 // CSipProfileCSServerCloseTimer::StopActiveSchedulerAfter |
|
81 // ----------------------------------------------------------------------------- |
|
82 // |
|
83 void CSipProfileCSServerCloseTimer::StopActiveSchedulerAfter(TUint aSeconds) |
|
84 { |
|
85 if (!IsActive()) |
|
86 { |
|
87 const TUint KMicrosecsInSecond = 1000000; |
|
88 TTimeIntervalMicroSeconds32 timeInterval(KMicrosecsInSecond * aSeconds); |
|
89 iTimer.After(iStatus, timeInterval); |
|
90 SetActive(); |
|
91 } |
|
92 } |
|
93 |
|
94 // ----------------------------------------------------------------------------- |
|
95 // CSipProfileCSServerCloseTimer::RunL |
|
96 // ----------------------------------------------------------------------------- |
|
97 // |
|
98 void CSipProfileCSServerCloseTimer::RunL() |
|
99 { |
|
100 CActiveScheduler::Stop(); |
|
101 } |
|
102 |
|
103 // ----------------------------------------------------------------------------- |
|
104 // CSipProfileCSServerCloseTimer::DoCancel |
|
105 // ----------------------------------------------------------------------------- |
|
106 // |
|
107 void CSipProfileCSServerCloseTimer::DoCancel() |
|
108 { |
|
109 iTimer.Cancel(); |
|
110 } |