1 /* |
|
2 * Copyright (c) 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: Server alerts for Data Sync and Device Management engines. |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef CSYNCMLAPPLAUNCHNOTIFIER_H |
|
22 #define CSYNCMLAPPLAUNCHNOTIFIER_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <SyncMLClient.h> |
|
26 |
|
27 #include <SyncMLNotifierParams.h> |
|
28 #include "SyncMLNotifierBase.h" // Base class |
|
29 #include <SyncService.h> |
|
30 #include <centralrepository.h> |
|
31 #include <e32property.h> |
|
32 // CONSTANTS |
|
33 // From S60\SyncMLFota |
|
34 const TUid KUidNSmlMediumTypeInternet = { 0x101F99F0 }; |
|
35 _LIT8( KNSmlIAPId, "NSmlIapId" ); |
|
36 _LIT8( KNSmlAlwaysAsk, "-1" ); |
|
37 const TInt KDefaultTimeoutforNotes ( 30 ); |
|
38 const TUid KDisclaimerProperty = {0x101F8769}; |
|
39 const TUint32 KDisclaimerInteger = 0x00000001; |
|
40 |
|
41 const TUid KCRUidNSmlDSApp = { 0x101F9A1D }; |
|
42 // CLASS DECLARATION |
|
43 |
|
44 class CDMDisclaimerObserver; |
|
45 /** |
|
46 * Notifier for launching SyncML applications |
|
47 * |
|
48 * @lib SyncMLNotifier |
|
49 * @since Series 60 3.0 |
|
50 */ |
|
51 NONSHARABLE_CLASS( CSyncMLAppLaunchNotifier ) : public CSyncMLNotifierBase |
|
52 { |
|
53 public: // Constructors and destructor |
|
54 enum TSanSupport |
|
55 { |
|
56 EOff,EON |
|
57 }; |
|
58 /** |
|
59 * Two-phased constructor. |
|
60 */ |
|
61 static CSyncMLAppLaunchNotifier* NewL(); |
|
62 |
|
63 /** |
|
64 * Destructor. |
|
65 */ |
|
66 virtual ~CSyncMLAppLaunchNotifier(); |
|
67 |
|
68 public: |
|
69 /** |
|
70 * Returns correct SyncService depending on the Service Id |
|
71 * @param aServiceId |
|
72 * @return CSyncService* |
|
73 */ |
|
74 CSyncService* SyncServiceL( TUint aServiceId ); |
|
75 |
|
76 /** |
|
77 * Called to complete the message |
|
78 * @param aDisclaimerAccepted |
|
79 */ |
|
80 void CompleteMessageL(TInt aDisclaimerAccepted); |
|
81 |
|
82 private: // New functions |
|
83 |
|
84 /** |
|
85 * Retrieves required parameters for the note and launching of the |
|
86 * synchronization application. |
|
87 * @param aParam Parameter structure that is forwarded to syncservice |
|
88 * @param aServerName Returns the clear-text name of the corresponding server. |
|
89 * @param aUserInteraction Returns the profile setting of whether the user |
|
90 * acceptance should be queried. |
|
91 * @return None |
|
92 */ |
|
93 void RetrieveSyncParamsL( TSyncServiceParam& aParam, |
|
94 TDes& aServerName, |
|
95 TSmlServerAlertedAction& aUserInteraction ); |
|
96 |
|
97 /** |
|
98 * Retrieves required parameters for the note and launching of the |
|
99 * device management application. |
|
100 * @param aParam Parameter structure that is forwarded to syncservice |
|
101 * @param aServerName Returns the clear-text name of the corresponding server. |
|
102 * @param aUserInteraction Returns the profile setting of whether the user |
|
103 * acceptance should be queried. |
|
104 * @return None |
|
105 */ |
|
106 void RetrieveMgmtParamsL( TSyncServiceParam& aParam, |
|
107 TDes& aServerName, |
|
108 TSmlServerAlertedAction& aUserInteraction ); |
|
109 |
|
110 /** |
|
111 * Checks if the user and/or parameters have defined that the session |
|
112 * should be accepted without querying the user. |
|
113 * @param aUserInteraction Sync profile interaction enumeration. |
|
114 * @return True, if the session is accepted automatically. |
|
115 */ |
|
116 TBool IsSilent( TSmlServerAlertedAction& aUserInteraction ); |
|
117 |
|
118 private: // Functions from base classes |
|
119 |
|
120 /** |
|
121 * From CSyncMLNotifierBase Called when a notifier is first loaded. |
|
122 * @param None. |
|
123 * @return A structure containing priority and channel info. |
|
124 */ |
|
125 TNotifierInfo RegisterL(); |
|
126 |
|
127 /** |
|
128 * From CSyncMLNotifierBase The notifier has been deactivated |
|
129 * so resources can be freed and outstanding messages completed. |
|
130 * @param None. |
|
131 * @return None. |
|
132 */ |
|
133 void Cancel(); |
|
134 |
|
135 /** |
|
136 * From CSyncMLNotifierBase Used in asynchronous notifier launch to |
|
137 * store received parameters into members variables and |
|
138 * make needed initializations. |
|
139 * @param aBuffer A buffer containing received parameters |
|
140 * @param aReturnVal The return value to be passed back. |
|
141 * @param aMessage Should be completed when the notifier is deactivated. |
|
142 * @return None. |
|
143 */ |
|
144 void GetParamsL( const TDesC8& aBuffer, |
|
145 TInt aReplySlot, |
|
146 const RMessagePtr2& aMessage ); |
|
147 |
|
148 /** |
|
149 * From CSyncMLNotifierBase Gets called when a request completes. |
|
150 * @param None. |
|
151 * @return None. |
|
152 */ |
|
153 void RunL(); |
|
154 /** |
|
155 * From CSyncMLNotifierBase Gets called when RunL leaves. |
|
156 * @param aError. |
|
157 * @return TInt. |
|
158 */ |
|
159 TInt RunError(TInt aError); |
|
160 /** |
|
161 * From RConnectionMonitor gets the staus of roaming . |
|
162 * If roaming returns true else returns false |
|
163 * @param ret |
|
164 * @return None. |
|
165 */ |
|
166 void IsRoamingL(TBool& ret); |
|
167 /** |
|
168 * HandleDMSession |
|
169 * @param ret |
|
170 * @return TBool |
|
171 */ |
|
172 TBool HandleDMSessionL(); |
|
173 /** |
|
174 * HandleCompleteMessage |
|
175 * @param TInt &keypress, TBool &silent, TInt &SanSupport, TInt &Timeout, TInt &CustomNotes |
|
176 * @return None. |
|
177 */ |
|
178 void HandleCompleteMessageL(TInt &keypress, TBool &silent, TInt &SanSupport, TInt &Timeout, TInt &CustomNotes); |
|
179 /** |
|
180 * IsLanguageSupported |
|
181 * @param ret |
|
182 * @return True if the language is supported. |
|
183 */ |
|
184 TBool IsLanguageSupportedL(); |
|
185 |
|
186 void ReadRepositoryL(TInt aKey, TInt& aValue); |
|
187 |
|
188 void ShowRoamingMessageL(TInt keypress, TUint profileId); |
|
189 |
|
190 private: |
|
191 |
|
192 /** |
|
193 * C++ default constructor. |
|
194 */ |
|
195 CSyncMLAppLaunchNotifier(); |
|
196 |
|
197 private: // Data |
|
198 // Type of session queried |
|
199 TSyncMLSessionTypes iSmlProtocol; |
|
200 CDMDisclaimerObserver* iObserver; |
|
201 |
|
202 // Job identifier from the parameters |
|
203 TInt iJobId; |
|
204 |
|
205 // Identifier of the used SyncML profile from the parameters |
|
206 TInt iProfileId; |
|
207 |
|
208 // Sync Service for Data Sync |
|
209 CSyncService* iDSSyncService; |
|
210 // Sync Service for Device Management |
|
211 CSyncService* iDMSyncService; |
|
212 // Is always ask selected as accesspoint for current profile |
|
213 TBool iAlwaysAsk; |
|
214 // Alert mode |
|
215 TInt iUimode; |
|
216 // DM Sync Server |
|
217 TBuf<KSyncMLMaxProfileNameLength> DMSyncServerName; |
|
218 // UI behaviour |
|
219 TSmlServerAlertedAction uiAction; |
|
220 // Sync Service param |
|
221 TSyncServiceParam param; |
|
222 // Stringholder |
|
223 HBufC* stringholder; |
|
224 // Central Respository |
|
225 CRepository* centrep; |
|
226 // To store the bearer type |
|
227 TInt iBearerType; |
|
228 }; |
|
229 |
|
230 /** |
|
231 * CDMDisclaimerObserver class |
|
232 * |
|
233 */ |
|
234 class CDMDisclaimerObserver : public CActive |
|
235 { |
|
236 public: |
|
237 CDMDisclaimerObserver(); |
|
238 ~CDMDisclaimerObserver(); |
|
239 void WaitOnDisclaimerL(CSyncMLAppLaunchNotifier* aPtr); |
|
240 protected: |
|
241 void DoCancel(); |
|
242 void RunL(); |
|
243 TInt RunError(TInt aError); |
|
244 private: |
|
245 TInt iPropertyVal; |
|
246 RProperty iDisclaimerProperty; |
|
247 CSyncMLAppLaunchNotifier* iNot; |
|
248 }; |
|
249 |
|
250 #endif // CSYNCMLAPPLAUNCHNOTIFIER_H |
|
251 |
|
252 // End of File |
|