|
1 /* |
|
2 * Copyright (c) 2007 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: Location Centre Server object. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // SYSTEM INCLUDES |
|
20 |
|
21 // USER INCLUDES |
|
22 #include "lcregistryupdate.h" |
|
23 #include "lcregistrationupdatenotifier.h" |
|
24 #include "lcdebug.h" |
|
25 |
|
26 // CONSTANT DEFINTIONS |
|
27 _LIT(KFileName,"?:\\private\\10283138\\import\\"); |
|
28 |
|
29 const TInt KLCUpdateDelay = 2000000; |
|
30 |
|
31 |
|
32 // ============================ MEMBER FUNCTIONS ============================== |
|
33 // ---------------------------------------------------------------------------- |
|
34 // CLcRegistryUpdate::CLcRegistryUpdate |
|
35 // C++ default constructor can NOT contain any code, that |
|
36 // might leave. |
|
37 // ---------------------------------------------------------------------------- |
|
38 // |
|
39 CLcRegistryUpdate::CLcRegistryUpdate(MLcRegistryUpdateNotifier& aFileNotifier, |
|
40 RFs& aFs) |
|
41 :CActive(EPriorityStandard), |
|
42 iFileNotifier( aFileNotifier ), |
|
43 iFs( aFs ) |
|
44 { |
|
45 TInt err = iTimer.CreateLocal(); |
|
46 CActiveScheduler::Add( this ); |
|
47 } |
|
48 |
|
49 // ---------------------------------------------------------------------------- |
|
50 // CLcRegistryUpdate::NewL |
|
51 // Two-phased constructor. |
|
52 // ---------------------------------------------------------------------------- |
|
53 // |
|
54 CLcRegistryUpdate* CLcRegistryUpdate::NewL(MLcRegistryUpdateNotifier& aFileNotifier, |
|
55 RFs& aFs) |
|
56 { |
|
57 CLcRegistryUpdate* self = new( ELeave ) CLcRegistryUpdate( aFileNotifier, aFs ); |
|
58 return self; |
|
59 } |
|
60 |
|
61 |
|
62 // ---------------------------------------------------------------------------- |
|
63 // CLcRegistryUpdate::~CLcRegistryUpdate |
|
64 // ---------------------------------------------------------------------------- |
|
65 // |
|
66 CLcRegistryUpdate::~CLcRegistryUpdate() |
|
67 { |
|
68 Cancel(); |
|
69 } |
|
70 |
|
71 // ---------------------------------------------------------------------------- |
|
72 // CLcRegistryUpdate::ConstructL |
|
73 // ---------------------------------------------------------------------------- |
|
74 // |
|
75 void CLcRegistryUpdate::ConstructL() |
|
76 { |
|
77 } |
|
78 |
|
79 // ---------------------------------------------------------------------------- |
|
80 // CLcRegistryUpdate::RunL |
|
81 // ---------------------------------------------------------------------------- |
|
82 // |
|
83 void CLcRegistryUpdate::RunL() |
|
84 { |
|
85 if ( iFileNotifyPending ) |
|
86 { |
|
87 StartFileNotifation(); |
|
88 iFileNotifier.HandleDynamicRegistrationL(); |
|
89 iFileNotifyPending = EFalse; |
|
90 } |
|
91 else |
|
92 { |
|
93 iTimer.After( iStatus, KLCUpdateDelay ); |
|
94 SetActive(); |
|
95 iFileNotifyPending = ETrue; |
|
96 } |
|
97 } |
|
98 |
|
99 |
|
100 // ---------------------------------------------------------------------------- |
|
101 // CLcRegistryUpdate::DoCancel |
|
102 // ---------------------------------------------------------------------------- |
|
103 // |
|
104 void CLcRegistryUpdate::DoCancel() |
|
105 { |
|
106 iTimer.Cancel(); |
|
107 iFs.NotifyChangeCancel(); |
|
108 } |
|
109 |
|
110 // --------------------------------------------------------------------------- |
|
111 // CLcRegistryUpdate::RunError |
|
112 // --------------------------------------------------------------------------- |
|
113 // |
|
114 TInt CLcRegistryUpdate::RunError( TInt aError ) |
|
115 { |
|
116 return aError; |
|
117 } |
|
118 |
|
119 |
|
120 // ---------------------------------------------------------------------------- |
|
121 // CLcRegistryUpdate::StartFileNotifation |
|
122 // ---------------------------------------------------------------------------- |
|
123 // |
|
124 void CLcRegistryUpdate::StartFileNotifation() |
|
125 { |
|
126 SetActive(); |
|
127 iFs.NotifyChange(ENotifyEntry,iStatus,KFileName); |
|
128 } |
|
129 |
|
130 //End of File |