|
1 /* |
|
2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: not a public class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDES |
|
22 #include "senregistrationtimer.h" |
|
23 |
|
24 // CLASS DECLARATION |
|
25 CSenRegistrationTimer* CSenRegistrationTimer::NewL( MSenRegistrationActor& aActor, TInt aRegistrationTimeoutInSecs ) |
|
26 { |
|
27 CSenRegistrationTimer* pNew = CSenRegistrationTimer::NewLC( aActor, aRegistrationTimeoutInSecs ); |
|
28 CleanupStack::Pop( pNew ); |
|
29 return pNew; |
|
30 } |
|
31 |
|
32 CSenRegistrationTimer* CSenRegistrationTimer::NewLC( MSenRegistrationActor& aActor, TInt aRegistrationTimeoutInSecs ) |
|
33 { |
|
34 CSenRegistrationTimer* pNew = new (ELeave)CSenRegistrationTimer( aActor, aRegistrationTimeoutInSecs ); |
|
35 CleanupStack::PushL( pNew ); |
|
36 pNew->ConstructL(); |
|
37 return pNew; |
|
38 } |
|
39 |
|
40 CSenRegistrationTimer::CSenRegistrationTimer( MSenRegistrationActor& aActor, TInt aRegistrationTimeoutInSecs ) |
|
41 //:CTimer( EPriorityNormal ), iActor(aActor), iRegistrationTimeoutInSecs( aRegistrationTimeoutInSecs ), iRegisterFilesObserver(EFalse) |
|
42 :CActive( EPriorityNormal ), iActor(aActor), iRegistrationTimeoutInSecs( aRegistrationTimeoutInSecs ), iRegisterFilesObserver(EFalse) |
|
43 { |
|
44 } |
|
45 |
|
46 void CSenRegistrationTimer::ConstructL () |
|
47 { |
|
48 User::LeaveIfError (iTimer.CreateLocal()); |
|
49 CActiveScheduler::Add(this); |
|
50 } |
|
51 |
|
52 |
|
53 CSenRegistrationTimer::~CSenRegistrationTimer() |
|
54 { |
|
55 CActive::Cancel(); |
|
56 iTimer.Close(); |
|
57 } |
|
58 |
|
59 void CSenRegistrationTimer::IssueRegistrations( TBool aRegisterFilesObserver ) |
|
60 { |
|
61 iRegisterFilesObserver = aRegisterFilesObserver; |
|
62 // iRegisterMobilityObserver = aRegisterMobilityObserver; |
|
63 // iRegister<some>Observer = aRegister<some>Observer ; |
|
64 |
|
65 TInt interval( KErrNone ); |
|
66 if( iRegistrationTimeoutInSecs > 0 ) |
|
67 { |
|
68 interval = iRegistrationTimeoutInSecs * 1000 * 1000; |
|
69 } |
|
70 else // use the timeout value of 1 second (default) |
|
71 { |
|
72 interval = KSenDefaultRegistrationTimeout * 1000 * 1000; |
|
73 } |
|
74 if (!IsActive()) |
|
75 { |
|
76 iTimer.After( iStatus, interval ); |
|
77 SetActive(); |
|
78 } |
|
79 } |
|
80 |
|
81 // ----------------------------------------------------------------------------- |
|
82 // CSenRegistrationTimer::DoCancel |
|
83 // ----------------------------------------------------------------------------- |
|
84 // |
|
85 void CSenRegistrationTimer::DoCancel () |
|
86 { |
|
87 iRegisterFilesObserver = EFalse; |
|
88 iTimer.Cancel(); |
|
89 } |
|
90 |
|
91 void CSenRegistrationTimer::RunL() |
|
92 { |
|
93 if (iStatus.Int() == KErrNone) |
|
94 { |
|
95 if( iRegisterFilesObserver ) |
|
96 { |
|
97 /* TInt err = */ |
|
98 TRAP_IGNORE( iActor.RegisterAndSubscribeFileProgressObserversL(); ) |
|
99 // err = 0; // not used in release builds |
|
100 } |
|
101 // if ( iRegisterMobilityObserver ) {} ... |
|
102 // if ( iRegister<some>Observer ) {} ... |
|
103 } |
|
104 } |
|
105 |
|
106 //virtual TInt CSenRegistrationTimer::RunError(TInt aError) { ; } |
|
107 //void CSenRegistrationTimer::DoCancel() { ; } |
|
108 // End of File |