51
|
1 |
/*
|
|
2 |
* Copyright (c) 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: Implementation of DM Device Dialogs
|
|
15 |
*/
|
|
16 |
|
|
17 |
#ifndef __DMDEVDIALOGSERVER_H__
|
|
18 |
#define __DMDEVDIALOGSERVER_H__
|
|
19 |
|
|
20 |
#include <e32base.h>
|
|
21 |
#include <e32std.h>
|
|
22 |
#include <hbdevicedialogsymbian.h>
|
|
23 |
#include <hbindicatorsymbian.h>
|
|
24 |
#include <hbsymbianvariant.h>
|
|
25 |
#include <SyncMLObservers.h>
|
|
26 |
#include <SyncMLClient.h>
|
|
27 |
#include <SyncMLClientDM.h>
|
|
28 |
#include "dmdevdialogclientserver.h"
|
|
29 |
#include "dmdevicedialogdebug.h"
|
|
30 |
|
|
31 |
class CDmDeviceDialogSession;
|
|
32 |
class CDmDeviceDialogServer;
|
|
33 |
class CHbIndicatorSymbian;
|
|
34 |
|
|
35 |
|
|
36 |
_LIT(KDeviceDialogType,"com.nokia.hb.devicemanagementdialog/1.0");
|
|
37 |
_LIT(KNotifierType, "syncmlfw");
|
|
38 |
_LIT(KProfileId, "profileid");
|
|
39 |
_LIT(KUImode, "uimode");
|
|
40 |
_LIT(KServerdisplayname, "serverdisplayname");
|
|
41 |
_LIT(KDMJobId, "jobid");
|
|
42 |
_LIT(KServerpushalertInfo, "serverpushinformative");
|
|
43 |
_LIT(KServerpushalertConfirm, "serverpushconfirmative");
|
|
44 |
_LIT(KDMProgressIndicatorType, "com.nokia.devicemanagement.progressindicatorplugin/1.0");
|
|
45 |
_LIT(KFotaDefaultProfile, "fotadefaultprofile");
|
|
46 |
_LIT(KPkgZeroTimeout, "pkgzerotimeout");
|
|
47 |
|
|
48 |
|
|
49 |
const TInt KRequestTriggerWaitTime(1000000);
|
|
50 |
|
|
51 |
const TInt KDefaultNotifierId = 1000000;
|
|
52 |
const TInt KConnectNotifierId = 1000001;
|
|
53 |
// Device manager key UID
|
|
54 |
const TUid KCRUidNSmlDMSyncApp = {0x101f6de5};
|
|
55 |
// CenRep keys for default dm profile used in the
|
|
56 |
// firmware update over the air.
|
|
57 |
const TUint32 KNSmlDMDefaultFotaProfileKey = 0x00000002;
|
|
58 |
|
|
59 |
#define KSosServerUid 0x101f99fb
|
|
60 |
#define KFotaServerUid 0x102072C4
|
|
61 |
#define KScomoServerUid 0x200267FB
|
|
62 |
|
|
63 |
|
|
64 |
|
|
65 |
class CDmDeviceDialogServer : public CServer2,
|
|
66 |
public MHbDeviceDialogObserver,
|
|
67 |
public MSyncMLEventObserver,
|
|
68 |
public MHbIndicatorSymbianObserver
|
|
69 |
{
|
|
70 |
friend class CDmDeviceDialogSession;
|
|
71 |
|
|
72 |
public:
|
|
73 |
enum TNoteType
|
|
74 |
{
|
|
75 |
EPkgZeroNote,
|
|
76 |
EConnectNote,
|
|
77 |
EInformativeAlertNote,
|
|
78 |
EConfirmationAlertNote
|
|
79 |
};
|
|
80 |
|
|
81 |
enum TSyncMLSANSupport
|
|
82 |
{
|
|
83 |
ESANNotSpecified,
|
|
84 |
ESANSilent,
|
|
85 |
ESANUserInformative,
|
|
86 |
ESANUserInteractive
|
|
87 |
};
|
|
88 |
/**
|
|
89 |
* Destructor
|
|
90 |
*/
|
|
91 |
virtual ~CDmDeviceDialogServer();
|
|
92 |
|
|
93 |
/**
|
|
94 |
* Static method which creates the server instance
|
|
95 |
* @param None
|
|
96 |
* @return CServer2*
|
|
97 |
*/
|
|
98 |
static CServer2* NewLC();
|
|
99 |
|
|
100 |
/**
|
|
101 |
* Stops the session and closes the server
|
|
102 |
* @param None
|
|
103 |
* @return None
|
|
104 |
*/
|
|
105 |
void CloseServer();
|
|
106 |
|
|
107 |
/**
|
|
108 |
* For asynchronous network request to be
|
|
109 |
* logged on active object, using CPeriodic
|
|
110 |
* @param None
|
|
111 |
* @return None
|
|
112 |
*/
|
|
113 |
void PeriodicServerCloseL();
|
|
114 |
|
|
115 |
/**
|
|
116 |
* Launches package zero device dialog
|
|
117 |
* @param aProfileId, ProfileId of the DM server
|
|
118 |
* @param ajobId, Id of the DM job created due to package zero
|
|
119 |
* @param aUimode, Server alert ui mode type
|
|
120 |
* @param aReplySlot, Response to Sos server
|
|
121 |
* @param aMessage, reference to RMessage2 of current session.
|
|
122 |
* @return None.
|
|
123 |
*/
|
|
124 |
void LaunchPkgZeroNoteL(TInt &aProfileId, TInt &aJobId,
|
|
125 |
const TInt &aReplySlot, TInt &aUimode,
|
|
126 |
const RMessage2& aMessage);
|
|
127 |
|
|
128 |
/**
|
|
129 |
* Launches display alert specific device dialog
|
|
130 |
* @param aAlertText, Text to be dsiplayed on display alert
|
|
131 |
* @param aMessage, reference to RMessage2 of current session.
|
|
132 |
* @return None.
|
|
133 |
*/
|
|
134 |
void ShowDisplayalertL(const TDesC &aAlertText,
|
|
135 |
const RMessage2& aMessage);
|
|
136 |
|
|
137 |
/**
|
|
138 |
* Launches Confirmation(1101) alert dialog
|
|
139 |
* @param aTimeout, Timeout of the dialog.
|
|
140 |
* @param aNoteDisplayText, Text to be displayed on the note
|
|
141 |
* @param aNoteHeader, Text to be displayed as dialog header
|
|
142 |
* @param aMessage, reference to RMessage2 of current session.
|
|
143 |
* @return None.
|
|
144 |
*/
|
|
145 |
void ShowConfirmationalertL(const TInt& aTimeOut, const TDesC& aHeader,
|
|
146 |
const TDesC& aText, const RMessage2& aMessage);
|
|
147 |
|
|
148 |
/**
|
|
149 |
* Keeps track of number of asynchronous requests
|
|
150 |
* @param None.
|
|
151 |
* @return None.
|
|
152 |
*/
|
|
153 |
void NewAsyncRequest();
|
|
154 |
|
|
155 |
/**
|
|
156 |
* Tells any request pending or not
|
|
157 |
* @param None.
|
|
158 |
* @return None.
|
|
159 |
*/
|
|
160 |
TBool RequestPending();
|
|
161 |
|
|
162 |
/**
|
|
163 |
* Cancels the earlier requested server shutdown
|
|
164 |
* annd serves for the incoming request.
|
|
165 |
* @param None.
|
|
166 |
* @return None.
|
|
167 |
*/
|
|
168 |
void CancelServerCloseRequest();
|
|
169 |
|
|
170 |
/**
|
|
171 |
* Callback method from Device dialog plugin for user action.
|
|
172 |
* @param aData, User response to the device dialog note
|
|
173 |
* @return None.
|
|
174 |
*/
|
|
175 |
virtual void DataReceived(CHbSymbianVariantMap& aData);
|
|
176 |
|
|
177 |
/**
|
|
178 |
* Callback method from Device dialog plugin when dialog gets closed.
|
|
179 |
* @param aCompletionCode, Error code.
|
|
180 |
* @return None.
|
|
181 |
*/
|
|
182 |
virtual void DeviceDialogClosed(TInt aCompletionCode);
|
|
183 |
|
|
184 |
/**
|
|
185 |
* From MSyncMLEventObserver
|
|
186 |
* Called when SyncML session events oocur.
|
|
187 |
* @param aEvent Sync event
|
|
188 |
* @param aIdentifier Identifier for the sync event
|
|
189 |
* @param aError Synce event error
|
|
190 |
* @param aAdditionalData.
|
|
191 |
* @return None.
|
|
192 |
*/
|
|
193 |
virtual void OnSyncMLSessionEvent(TEvent aEvent, TInt aIdentifier,
|
|
194 |
TInt aError, TInt aAdditionalData);
|
|
195 |
|
|
196 |
/**
|
|
197 |
* Tells whether package zero query is currently shown or not.
|
|
198 |
* @param None.
|
|
199 |
* @return TBool, status of package zero note display.
|
|
200 |
*/
|
|
201 |
TBool IsPkgZeroNoteDisplaying();
|
|
202 |
|
|
203 |
/**
|
|
204 |
* Cancels outstanding package zero request.
|
|
205 |
* @param None.
|
|
206 |
* @return None.
|
|
207 |
*/
|
|
208 |
void CancelPendingServerAlert();
|
|
209 |
|
|
210 |
/**
|
|
211 |
* Callback method from Device dialog Indicator when user taps on Indicator.
|
|
212 |
* @param aType - Type of the indicator that user interacted with.
|
|
213 |
* @param aData - Data sent by the indicator.
|
|
214 |
* @return None.
|
|
215 |
*/
|
|
216 |
virtual void IndicatorUserActivated (const TDesC &aType,
|
|
217 |
CHbSymbianVariantMap &aData);
|
|
218 |
|
|
219 |
private:
|
|
220 |
|
|
221 |
/**
|
|
222 |
* second phase constructor
|
|
223 |
* @param None
|
|
224 |
*/
|
|
225 |
void ConstructL();
|
|
226 |
|
|
227 |
/**
|
|
228 |
* Default constructor
|
|
229 |
* @param None
|
|
230 |
*/
|
|
231 |
CDmDeviceDialogServer();
|
|
232 |
|
|
233 |
/**
|
|
234 |
* Called to close the server.
|
|
235 |
* @param None.
|
|
236 |
* @return None.
|
|
237 |
*/
|
|
238 |
void StopServer();
|
|
239 |
|
|
240 |
/**
|
|
241 |
* Dsimisses the Connect device dialog
|
|
242 |
* @param None.
|
|
243 |
* @return None.
|
|
244 |
*/
|
|
245 |
void DismissDialog();
|
|
246 |
|
|
247 |
/**
|
|
248 |
* Starts DM Job after user accepted the package zero message.
|
|
249 |
* @param None.
|
|
250 |
* @return None.
|
|
251 |
*/
|
|
252 |
void GetDMJobStatusL();
|
|
253 |
|
|
254 |
/**
|
|
255 |
* Tells whether connect dialog is currently shown or not.
|
|
256 |
* @param None.
|
|
257 |
* @return boolean, status of the connect dialog.
|
|
258 |
*/
|
|
259 |
TBool IsConenctDialogDisplaying();
|
|
260 |
|
|
261 |
/**
|
|
262 |
* Display connect dialog, if dismissed earlier.
|
|
263 |
* @param None.
|
|
264 |
* @return None.
|
|
265 |
*/
|
|
266 |
void ShowConnectDialogAgainL();
|
|
267 |
|
|
268 |
/**
|
|
269 |
* Called to process the response of user action on specified Device dialog
|
|
270 |
* @param aData, User response to the device dialog note
|
|
271 |
* @return None.
|
|
272 |
*/
|
|
273 |
void DevDialogResponseL(CHbSymbianVariantMap& aData);
|
|
274 |
|
|
275 |
protected:
|
|
276 |
|
|
277 |
/**
|
|
278 |
* Calls when a New session is getting created
|
|
279 |
* @param aVersion
|
|
280 |
* @param aMessage
|
|
281 |
* @return CSession2*
|
|
282 |
*/
|
|
283 |
CSession2* NewSessionL(const TVersion& aVersion,
|
|
284 |
const RMessage2& aMessage) const;
|
|
285 |
|
|
286 |
private:
|
|
287 |
//Periodic timer used while shutting down the server
|
|
288 |
CPeriodic* iServerCloseRequest;
|
|
289 |
|
|
290 |
//DM Server Profile Id
|
|
291 |
TInt iProfileId;
|
|
292 |
|
|
293 |
//Current Dm Session Job Id
|
|
294 |
TInt iJobId;
|
|
295 |
|
|
296 |
//Server alert type of package zero message
|
|
297 |
TUint iUimode;
|
|
298 |
|
|
299 |
//Pointer to Device dialog server
|
|
300 |
CHbDeviceDialogSymbian* iDevDialog;
|
|
301 |
|
|
302 |
//Reference to Indicator framework
|
|
303 |
CHbIndicatorSymbian* iDmIndicator;
|
|
304 |
|
|
305 |
//Status variable to identify the status of Connecting note
|
|
306 |
TBool iPkgZeroConnectionNoteShown;
|
|
307 |
|
|
308 |
//User response of device dialog note
|
|
309 |
TInt iResponse;
|
|
310 |
|
|
311 |
//RMessage reference used to notify the caller
|
|
312 |
RMessage2 iMessage;
|
|
313 |
|
|
314 |
//Status variable to know whether server can be stopped or not
|
|
315 |
TBool iStopServer;
|
|
316 |
|
|
317 |
// SyncML Session
|
|
318 |
RSyncMLSession iSyncMLSession;
|
|
319 |
|
|
320 |
// Job id after starting DM Job
|
|
321 |
TInt iSyncJobId;
|
|
322 |
|
|
323 |
// DM job
|
|
324 |
RSyncMLDevManJob iSyncJob;
|
|
325 |
|
|
326 |
//Status variable to know whether a DM Job is ongoing or not
|
|
327 |
TBool iJobongoing;
|
|
328 |
|
|
329 |
//Status variable to know currently any device dialog is displayed or not
|
|
330 |
TBool iAnyDialogDisplaying;
|
|
331 |
|
|
332 |
//Status variable to know whether an Indicator is launched or not
|
|
333 |
TBool iIndicatorLaunched;
|
|
334 |
|
|
335 |
//Identifies the number of requests pending
|
|
336 |
TInt iSessionCount;
|
|
337 |
|
|
338 |
//Identifies whether package zero note is displaying or not
|
|
339 |
TBool iPkgZeroQueryNoteDisplaying;
|
|
340 |
|
|
341 |
//Response slot to write the result
|
|
342 |
TInt iReplySlot;
|
|
343 |
};
|
|
344 |
|
|
345 |
#endif
|