|
1 // Copyright (c) 2005-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 : CSipCSServerCloseTimer.cpp |
|
15 // Part of : SIPServerCore |
|
16 // Version : SIP/4.0 |
|
17 // |
|
18 |
|
19 |
|
20 |
|
21 #include "CSipCSServerCloseTimer.h" |
|
22 |
|
23 const TUint KMicroSecondsInMilliSecond = 1000; |
|
24 |
|
25 |
|
26 // ----------------------------------------------------------------------------- |
|
27 // CSipCSServerCloseTimer::NewL |
|
28 // ----------------------------------------------------------------------------- |
|
29 // |
|
30 CSipCSServerCloseTimer* CSipCSServerCloseTimer::NewL () |
|
31 { |
|
32 CSipCSServerCloseTimer* self = CSipCSServerCloseTimer::NewLC (); |
|
33 CleanupStack::Pop(self); |
|
34 return self; |
|
35 } |
|
36 |
|
37 // ----------------------------------------------------------------------------- |
|
38 // CSipCSServerCloseTimer::NewLC |
|
39 // ----------------------------------------------------------------------------- |
|
40 // |
|
41 CSipCSServerCloseTimer* CSipCSServerCloseTimer::NewLC () |
|
42 { |
|
43 CSipCSServerCloseTimer* self = new (ELeave) CSipCSServerCloseTimer; |
|
44 CleanupStack::PushL (self); |
|
45 self->ConstructL (); |
|
46 return self; |
|
47 } |
|
48 |
|
49 // ----------------------------------------------------------------------------- |
|
50 // CSipCSServerCloseTimer::ConstructL |
|
51 // ----------------------------------------------------------------------------- |
|
52 // |
|
53 void CSipCSServerCloseTimer::ConstructL () |
|
54 { |
|
55 User::LeaveIfError (iTimer.CreateLocal()); |
|
56 } |
|
57 |
|
58 // ----------------------------------------------------------------------------- |
|
59 // CSipCSServerCloseTimer::CSipCSServerCloseTimer |
|
60 // ----------------------------------------------------------------------------- |
|
61 // |
|
62 CSipCSServerCloseTimer::CSipCSServerCloseTimer () |
|
63 : CActive(EPriorityStandard) |
|
64 { |
|
65 CActiveScheduler::Add(this); |
|
66 } |
|
67 |
|
68 // ----------------------------------------------------------------------------- |
|
69 // CSipCSServerCloseTimer::~CSipCSServerCloseTimer |
|
70 // ----------------------------------------------------------------------------- |
|
71 // |
|
72 CSipCSServerCloseTimer::~CSipCSServerCloseTimer () |
|
73 { |
|
74 CActive::Cancel(); |
|
75 iTimer.Close(); |
|
76 } |
|
77 |
|
78 // ----------------------------------------------------------------------------- |
|
79 // CSipCSServerCloseTimer::StopActiveSchedulerAfter |
|
80 // ----------------------------------------------------------------------------- |
|
81 // |
|
82 void CSipCSServerCloseTimer::StopActiveSchedulerAfter (TUint aMilliSeconds) |
|
83 { |
|
84 TTimeIntervalMicroSeconds32 value(KMicroSecondsInMilliSecond*aMilliSeconds); |
|
85 if (!IsActive()) |
|
86 { |
|
87 iTimer.After(iStatus,value); |
|
88 SetActive (); |
|
89 } |
|
90 } |
|
91 |
|
92 // ----------------------------------------------------------------------------- |
|
93 // CSipCSServerCloseTimer::RunL |
|
94 // ----------------------------------------------------------------------------- |
|
95 // |
|
96 void CSipCSServerCloseTimer::RunL () |
|
97 { |
|
98 CActiveScheduler::Stop(); |
|
99 } |
|
100 |
|
101 // ----------------------------------------------------------------------------- |
|
102 // CSipCSServerCloseTimer::DoCancel |
|
103 // ----------------------------------------------------------------------------- |
|
104 // |
|
105 void CSipCSServerCloseTimer::DoCancel () |
|
106 { |
|
107 iTimer.Cancel(); |
|
108 } |