|
1 /* |
|
2 * Copyright (c) 2008-2009 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: The main header file of background timer |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef IAUPDATEBGREFRESHTIMER_H |
|
20 #define IAUPDATEBGREFRESHTIMER_H |
|
21 |
|
22 // INCLUDE FILES |
|
23 |
|
24 #include <cenrepnotifyhandler.h> |
|
25 #include <centralrepository.h> |
|
26 #include <iaupdateobserver.h> |
|
27 #include <barsc.h> |
|
28 |
|
29 #include "iaupdatebgremindertimer.h" |
|
30 #include "iaupdatebgcontrollerfile.h" |
|
31 #include "iaupdatebgsoftnotification.h" |
|
32 #include "iaupdatebgcheckermode.h" |
|
33 |
|
34 // FORWARD DECLARATIONS |
|
35 class CIAUpdate; |
|
36 class CIAUpdateParameters; |
|
37 class CAknSoftNotifier; |
|
38 class CInternalFileHandler; |
|
39 class CIdleObserver; |
|
40 |
|
41 // CLASS DECLARATION |
|
42 /** |
|
43 * Main class for background timer |
|
44 * |
|
45 * @lib |
|
46 * @since |
|
47 */ |
|
48 |
|
49 class CIAUpdateBGTimer : public CTimer, |
|
50 public MIAUpdateObserver, |
|
51 public MCenRepNotifyHandlerCallback, |
|
52 public MIAUpdateBGSoftNotificationCallBack, |
|
53 public MIAUpdateBGReminderTimerCallBack |
|
54 |
|
55 { |
|
56 public: |
|
57 |
|
58 static CIAUpdateBGTimer* NewL(); |
|
59 |
|
60 virtual ~CIAUpdateBGTimer(); |
|
61 |
|
62 void StartProcessL(); |
|
63 |
|
64 public://MCenRepNotifyHandlerCallback |
|
65 |
|
66 void HandleNotifyGeneric( TUint32 aId ); |
|
67 |
|
68 |
|
69 public://MSoftNotificationCallBack |
|
70 |
|
71 void SoftNotificationCallBack( TBool aIsAccepted ); |
|
72 |
|
73 TIAUpdateBGMode CurrentMode(); |
|
74 |
|
75 public://MIAUpdateObserver |
|
76 |
|
77 void CheckUpdatesComplete( TInt aErrorCode, TInt aAvailableUpdates ); |
|
78 |
|
79 void UpdateComplete( TInt aErrorCode, CIAUpdateResult* aResult ); |
|
80 |
|
81 void UpdateQueryComplete( TInt aErrorCode, TBool aUpdateNow ); |
|
82 |
|
83 public: //MReminderTimerCallBack |
|
84 |
|
85 void ReminderTimerCallBack(); |
|
86 |
|
87 private: |
|
88 |
|
89 CIAUpdateBGTimer(); |
|
90 |
|
91 void ConstructL(); |
|
92 |
|
93 void RunL(); |
|
94 |
|
95 void DoCancel(); |
|
96 |
|
97 TInt RunError(TInt aError); |
|
98 |
|
99 void DoUpdatesCheckingL( const TBool& aFromServer ); |
|
100 |
|
101 TTimeIntervalMicroSeconds32 ConvertToMicroseconds( /*TTimeIntervalDays*/ TTimeIntervalMinutes aInterval ); |
|
102 |
|
103 TTime GetLastRefreshTimeL(); |
|
104 |
|
105 TInt SetLastRefreshTime(); |
|
106 |
|
107 TInt CheckingFrequencyInMinutesL(); |
|
108 |
|
109 TInt UpdateAvailableReminderIntervalInMinutesL(); |
|
110 |
|
111 TInt FirstTimeDialogDelayInMinutesL(); |
|
112 |
|
113 TInt FirstTimeDialogReminderIntervalInMinutesL(); |
|
114 |
|
115 TBool IsFirstTimeDialogDisabledL(); |
|
116 |
|
117 void StartL( TTimeIntervalMinutes aWaitTime ); |
|
118 |
|
119 TTimeIntervalMinutes TimeIntervalFromNextRefreshL(); |
|
120 |
|
121 TTimeIntervalMinutes TimeIntervalFromNextShowOfNewFeatureDialogL(); |
|
122 |
|
123 TBool IsAgreementAcceptedL(); |
|
124 |
|
125 TBool IsAskedAlreadyL(); |
|
126 |
|
127 void HandlerFirstTimeL(); |
|
128 |
|
129 TTime GetLastTimeShowNewFeatureDialogL(); |
|
130 |
|
131 TInt SetLastTimeShowNewFeatureDialogL( TTime aTime ); |
|
132 |
|
133 TBool GetUserDecisionL(); |
|
134 |
|
135 TInt SetUserDecisionL( TBool aDecision ); |
|
136 |
|
137 TBool ReminderOnL(); |
|
138 |
|
139 TInt SetReminderL( TBool aOn ); |
|
140 |
|
141 TTime NextRemindTimeL(); |
|
142 |
|
143 TInt SetNextRemindTimeL( TTime aTime ); |
|
144 |
|
145 TIAUpdateBGMode ModeL(); |
|
146 |
|
147 TInt SetModeL( TIAUpdateBGMode aMode ); |
|
148 |
|
149 TInt RetryTimesL(); |
|
150 |
|
151 TInt SetRetryTimesL( TInt aRetry ); |
|
152 |
|
153 HBufC* ReadResourceLC( TInt aResourceId ); |
|
154 |
|
155 void StartIaupdateL() const; |
|
156 |
|
157 void LaunchSoftNotificationL( const TInt& aResourceId, const TInt& SK1, const TInt& SK2 ); |
|
158 |
|
159 TBool IsAutoUpdateDisabledL(); |
|
160 |
|
161 void ListenAutoUpdateSettingsL(); |
|
162 |
|
163 void StopListeningAutoUpdateSettingsL(); |
|
164 |
|
165 void DoHandleNotifyGenericL( TUint32 aId ); |
|
166 |
|
167 void DoCheckUpdatesCompleteL( TInt aErrorCode, TInt aAvailableUpdates ); |
|
168 |
|
169 void DoSoftNotificationCallBackL( TBool aIsAccepted ); |
|
170 |
|
171 void DoReminderTimerCallBackL(); |
|
172 |
|
173 void StartUpdatesCheckingL(); |
|
174 |
|
175 HBufC8* LoadFileLC(const TDesC& aFile); |
|
176 |
|
177 TInt GetPrivatePathL( TFileName& aPath ); |
|
178 |
|
179 TInt SetSessionPrivatePathL( RFs& aFs, const TDesC& aPath ) const; |
|
180 |
|
181 void SetPrivateDriveL( RFs& aFs, const TDesC& aFileName ) const; |
|
182 |
|
183 TBool IAUpdateEnabledL() const; |
|
184 |
|
185 void Shutdown(); |
|
186 |
|
187 private: |
|
188 // Data |
|
189 CIAUpdate* iUpdate; |
|
190 CIAUpdateParameters* iParameters; |
|
191 CIAUpdateBGReminderTimer* iReminderTimer; |
|
192 CRepository* iIAUpdateCRSession; |
|
193 CCenRepNotifyHandler* iNotifyHandler; |
|
194 TInt iRuns; |
|
195 TInt iLastRunLength; |
|
196 CIAUpdateBGControllerFile* iControllerFile; |
|
197 CIAUpdateBGInternalFileHandler* iInternalFile; |
|
198 TIAUpdateBGMode iMode; |
|
199 CIAUpdateBGSoftNotification* iSoftNotification; |
|
200 RResourceFile iResourceFile; |
|
201 RFs iFs; |
|
202 }; |
|
203 |
|
204 #endif //IAUPDATEBGREFRESHTIMER_H |