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 |
|
|
18 |
#include <hbtextresolversymbian.h>
|
|
19 |
#include <centralrepository.h>
|
|
20 |
#include <DevManInternalCRKeys.h>
|
|
21 |
#include "dmdevicedialogserver.h"
|
|
22 |
#include "dmdevdialogclientserver.h"
|
|
23 |
#include "dmdevicedialogsession.h"
|
|
24 |
//#include <devicedialogconsts.h>
|
|
25 |
// ----------------------------------------------------------------------------------------
|
|
26 |
// Server startup code
|
|
27 |
// ----------------------------------------------------------------------------------------
|
|
28 |
static void RunServerL()
|
|
29 |
{
|
|
30 |
// naming the server thread after the server helps to debug panics
|
|
31 |
User::LeaveIfError(User::RenameThread(KDMDEVDIALOGSERVER));
|
|
32 |
|
|
33 |
// create and install the active scheduler
|
|
34 |
CActiveScheduler* s = new (ELeave) CActiveScheduler;
|
|
35 |
CleanupStack::PushL(s);
|
|
36 |
CActiveScheduler::Install(s);
|
|
37 |
|
|
38 |
// create the server (leave it on the cleanup stack)
|
|
39 |
CDmDeviceDialogServer::NewLC();
|
|
40 |
|
|
41 |
// Initialisation complete, now signal the client
|
|
42 |
RProcess::Rendezvous(KErrNone);
|
|
43 |
|
|
44 |
// Ready to run
|
|
45 |
CActiveScheduler::Start();
|
|
46 |
|
|
47 |
// Cleanup the server and scheduler
|
|
48 |
CleanupStack::PopAndDestroy(2);
|
|
49 |
}
|
|
50 |
|
|
51 |
// ----------------------------------------------------------------------------------------
|
|
52 |
// static method ShutDownL() called to submit async n/w request
|
|
53 |
// ----------------------------------------------------------------------------------------
|
|
54 |
static TInt ShutDownL(TAny* aPtr)
|
|
55 |
{
|
|
56 |
CDmDeviceDialogServer* ptr = (CDmDeviceDialogServer*) aPtr;
|
|
57 |
FLOG(_L("static ShutDownL:-Begin"));
|
|
58 |
TRAPD(err, ptr->CloseServer());
|
|
59 |
FLOG(_L("closing the server"));
|
|
60 |
ptr->CancelServerCloseRequest();
|
|
61 |
FLOG(_L("closing the server:-end"));
|
|
62 |
return err;
|
|
63 |
}
|
|
64 |
|
|
65 |
// ----------------------------------------------------------------------------------------
|
|
66 |
// Server process entry-point
|
|
67 |
// ----------------------------------------------------------------------------------------
|
|
68 |
TInt E32Main()
|
|
69 |
{
|
|
70 |
__UHEAP_MARK;
|
|
71 |
CTrapCleanup* cleanup = CTrapCleanup::New();
|
|
72 |
TInt r = KErrNoMemory;
|
|
73 |
if (cleanup)
|
|
74 |
{
|
|
75 |
TRAP(r,RunServerL());
|
|
76 |
delete cleanup;
|
|
77 |
}
|
|
78 |
__UHEAP_MARKEND;
|
|
79 |
return r;
|
|
80 |
}
|
|
81 |
|
|
82 |
// ----------------------------------------------------------------------------------------
|
|
83 |
// CDmDeviceDialogServer::NewLC
|
|
84 |
// ----------------------------------------------------------------------------------------
|
|
85 |
CServer2* CDmDeviceDialogServer::NewLC()
|
|
86 |
{
|
|
87 |
CDmDeviceDialogServer* self = new (ELeave) CDmDeviceDialogServer;
|
|
88 |
CleanupStack::PushL(self);
|
|
89 |
self->ConstructL();
|
|
90 |
return self;
|
|
91 |
}
|
|
92 |
|
|
93 |
// ----------------------------------------------------------------------------------------
|
|
94 |
// CDmDeviceDialogServer::ConstructL
|
|
95 |
// ----------------------------------------------------------------------------------------
|
|
96 |
void CDmDeviceDialogServer::ConstructL()
|
|
97 |
{
|
|
98 |
FLOG(_L("CDmDeviceDialogServer::ConstructL- begin"));
|
|
99 |
StartL( KDMDEVDIALOGSERVER);
|
|
100 |
iSyncMLSession.OpenL();
|
|
101 |
FLOG(_L("CDmDeviceDialogServer::ConstructL- end"));
|
|
102 |
}
|
|
103 |
|
|
104 |
// ----------------------------------------------------------------------------------------
|
|
105 |
// CDmDeviceDialogServer::CDmDeviceDialogServer()
|
|
106 |
// ----------------------------------------------------------------------------------------
|
|
107 |
CDmDeviceDialogServer::CDmDeviceDialogServer() :
|
|
108 |
CServer2(EPriorityStandard, EUnsharableSessions)
|
|
109 |
{
|
|
110 |
iSessionCount = 0;
|
|
111 |
iServerCloseRequest = NULL;
|
|
112 |
iProfileId = EFalse;
|
|
113 |
iJobId = EFalse;
|
|
114 |
iStopServer = EFalse;
|
|
115 |
iResponse = -1;
|
|
116 |
iPkgZeroConnectionNoteShown = EFalse;
|
|
117 |
iDmIndicator = NULL;
|
|
118 |
iDevDialog = NULL;
|
|
119 |
iAnyDialogDisplaying = EFalse;
|
|
120 |
iIndicatorLaunched = EFalse;
|
|
121 |
iPkgZeroQueryNoteDisplaying = EFalse;
|
|
122 |
}
|
|
123 |
|
|
124 |
// -----------------------------------------------------------------------------
|
|
125 |
// CDmDeviceDialogServer::CloseServer()
|
|
126 |
// -----------------------------------------------------------------------------
|
|
127 |
void CDmDeviceDialogServer::CloseServer()
|
|
128 |
{
|
|
129 |
iSessionCount = 0;
|
|
130 |
//Kill the server
|
|
131 |
CActiveScheduler::Stop();
|
|
132 |
}
|
|
133 |
|
|
134 |
// -----------------------------------------------------------------------------
|
|
135 |
// CDmDeviceDialogServer::DataReceived()
|
|
136 |
// -----------------------------------------------------------------------------
|
|
137 |
void CDmDeviceDialogServer::DataReceived(CHbSymbianVariantMap& aData)
|
|
138 |
{
|
|
139 |
FLOG(_L("CDmDeviceDialogServer::DataReceived>>"));
|
|
140 |
TRAP_IGNORE(DevDialogResponseL(aData));
|
|
141 |
FLOG(_L("CDmDeviceDialogServer::DataReceived<<"));
|
|
142 |
}
|
|
143 |
|
|
144 |
// -----------------------------------------------------------------------------
|
|
145 |
// CDmDeviceDialogServer::DevDialogResponseL()
|
|
146 |
// -----------------------------------------------------------------------------
|
|
147 |
void CDmDeviceDialogServer::DevDialogResponseL(CHbSymbianVariantMap& aData)
|
|
148 |
{
|
|
149 |
FLOG(_L("CDmDeviceDialogServer::DevDialogResponseL>>"));
|
|
150 |
_LIT(KNotifierReturnType, "notifiertype");
|
|
151 |
_LIT(KKeyPress, "keypress");
|
|
152 |
const CHbSymbianVariant* notifiertypevariant = aData.Get(KNotifierReturnType);
|
|
153 |
TInt *notifiertype = notifiertypevariant->Value<TInt> ();
|
|
154 |
const CHbSymbianVariant* returnkeyvariant = aData.Get(KKeyPress);
|
|
155 |
TInt *returnvalue = returnkeyvariant->Value<TInt> ();
|
|
156 |
iResponse = *returnvalue;
|
|
157 |
iDevDialog->Cancel();
|
|
158 |
iAnyDialogDisplaying = EFalse;
|
|
159 |
if (EPkgZeroNote == *notifiertype )//Server alert note
|
|
160 |
{
|
|
161 |
FLOG(_L("CDmDeviceDialogServer::DevDialogResponseL EPkgZeroNote \
|
|
162 |
response from user is %d"),iResponse);
|
|
163 |
if (iResponse == 0)
|
|
164 |
{
|
|
165 |
FLOG(_L("CDmDeviceDialogServer::DevDialogResponseL OK pressed"));
|
|
166 |
CHbSymbianVariantMap* varMap = CHbSymbianVariantMap::NewL();
|
|
167 |
CleanupStack::PushL(varMap);
|
|
168 |
TInt id = KConnectNotifierId;
|
|
169 |
HBufC* notifierid = HBufC::NewL(10);
|
|
170 |
CleanupStack::PushL(notifierid);
|
|
171 |
*notifierid = KNotifierType;
|
|
172 |
CHbSymbianVariant* notifieridvar = CHbSymbianVariant::NewL(&id,
|
|
173 |
CHbSymbianVariant::EInt);
|
|
174 |
varMap->Add(*notifierid, notifieridvar);
|
|
175 |
TInt err = iDevDialog->Show(KDeviceDialogType, *varMap, this);
|
|
176 |
FLOG(_L("CDmDeviceDialogServer::DevDialogResponseLconnect note \
|
|
177 |
launch error is %d"), err);
|
|
178 |
iAnyDialogDisplaying = ETrue;
|
|
179 |
iPkgZeroConnectionNoteShown = ETrue;
|
|
180 |
GetDMJobStatusL();
|
|
181 |
TPckgBuf<TInt> response(KDmDevDialogUid);
|
|
182 |
iMessage.WriteL(iReplySlot,response);
|
|
183 |
iMessage.Complete(KErrNone);
|
|
184 |
iSessionCount--;
|
|
185 |
CleanupStack::PopAndDestroy(2);
|
|
186 |
//GetDMJobStatusL();
|
|
187 |
FLOG(_L("CDmDeviceDialogServer::DevDialogResponseL DM Job \
|
|
188 |
started"));
|
|
189 |
}
|
|
190 |
else
|
|
191 |
{
|
|
192 |
FLOG(_L("CDmDeviceDialogServer::DevDialogResponseL user pressed \
|
|
193 |
cancel"));
|
|
194 |
iMessage.Complete(KErrCancel);
|
|
195 |
iSessionCount--;
|
|
196 |
StopServer();
|
|
197 |
FLOG(_L("CDmDeviceDialogServer::DevDialogResponseL stop \
|
|
198 |
server called"));
|
|
199 |
}
|
|
200 |
iPkgZeroQueryNoteDisplaying = EFalse;
|
|
201 |
}
|
|
202 |
else if (EInformativeAlertNote == *notifiertype )// Iformative alert
|
|
203 |
{
|
|
204 |
FLOG(_L("CDmDeviceDialogServer::DevDialogResponseL informative alert"));
|
|
205 |
iMessage.Complete(KErrNone);
|
|
206 |
iSessionCount--;
|
|
207 |
if (!iJobongoing)
|
|
208 |
StopServer();
|
|
209 |
else
|
|
210 |
ShowConnectDialogAgainL();
|
|
211 |
}
|
|
212 |
else if (EConfirmationAlertNote == *notifiertype)// conformative alert
|
|
213 |
{
|
|
214 |
FLOG(_L("CDmDeviceDialogServer::DevDialogResponseL conformative alert"));
|
|
215 |
iMessage.Complete(iResponse);
|
|
216 |
iSessionCount--;
|
|
217 |
if (!iJobongoing)
|
|
218 |
StopServer();
|
|
219 |
else
|
|
220 |
ShowConnectDialogAgainL();
|
|
221 |
}
|
|
222 |
else //connecting note
|
|
223 |
{
|
|
224 |
iPkgZeroConnectionNoteShown = EFalse;
|
|
225 |
FLOG(_L("CDmDeviceDialogServer::DevDialogResponseL connecting note"));
|
|
226 |
if (iResponse == KErrCancel)
|
|
227 |
{
|
|
228 |
FLOG(_L("CDmDeviceDialogServer::DevDialogResponseL user cancelled \
|
|
229 |
connection"));
|
|
230 |
if (iJobongoing)
|
|
231 |
{
|
|
232 |
FLOG(_L("CDmDeviceDialogServer::DevDialogResponseL job stop \
|
|
233 |
requested"));
|
|
234 |
iSyncJob.StopL();
|
|
235 |
FLOG(_L("CDmDeviceDialogServer::DevDialogResponseL job stop\
|
|
236 |
done"));
|
|
237 |
}
|
|
238 |
DismissDialog();
|
|
239 |
StopServer();
|
|
240 |
FLOG(_L("CDmDeviceDialogServer::DevDialogResponseL connecting note \
|
|
241 |
stopserver called"));
|
|
242 |
}
|
|
243 |
else // Launch indicator
|
|
244 |
{
|
|
245 |
FLOG(_L("CDmDeviceDialogServer::DevDialogResponseL Launch \
|
|
246 |
Indicator"));
|
|
247 |
//Send the text id
|
|
248 |
_LIT(KFileName, "deviceupdates_");
|
|
249 |
_LIT(KPath, "z:/resource/qt/translations/");
|
|
250 |
TBool result = HbTextResolverSymbian::Init(KFileName, KPath);
|
|
251 |
if(result)
|
|
252 |
{
|
|
253 |
if(iDmIndicator == NULL)
|
|
254 |
iDmIndicator = CHbIndicatorSymbian::NewL();
|
|
255 |
_LIT(KIndicatorTest,
|
|
256 |
"txt_deviceupdate_dblist_device_updates_val_connect_fota");
|
|
257 |
// returns the string "Text test"
|
|
258 |
HBufC* text = HbTextResolverSymbian::LoadL(KIndicatorTest);
|
|
259 |
CleanupStack::PushL(text);
|
|
260 |
TPtr textptr = text->Des();
|
|
261 |
CHbSymbianVariant* IndicatorText = CHbSymbianVariant::NewL(
|
|
262 |
&textptr, CHbSymbianVariant::EDes);
|
|
263 |
CleanupStack::PushL(IndicatorText);
|
|
264 |
FLOG(_L("CDmDeviceDialogServer::DevDialogResponseL Indicator activated"));
|
|
265 |
iDmIndicator->SetObserver(this);
|
|
266 |
FLOG(_L("CDmDeviceDialogServer::DevDialogResponseL indicator Observer set"));
|
|
267 |
iDmIndicator->Activate(KDMProgressIndicatorType,IndicatorText);
|
|
268 |
|
|
269 |
iIndicatorLaunched = ETrue;
|
|
270 |
CleanupStack::PopAndDestroy(2);
|
|
271 |
}
|
|
272 |
}
|
|
273 |
}
|
|
274 |
FLOG(_L("CDmDeviceDialogServer::DevDialogResponseL End"));
|
|
275 |
}
|
|
276 |
|
|
277 |
// -----------------------------------------------------------------------------
|
|
278 |
// CDmDeviceDialogServer::DeviceDialogClosed()
|
|
279 |
// -----------------------------------------------------------------------------
|
|
280 |
void CDmDeviceDialogServer::DeviceDialogClosed(TInt /*aError*/)
|
|
281 |
{
|
|
282 |
FLOG(_L("CDmDeviceDialogServer::DeviceDialogClosed "));
|
|
283 |
}
|
|
284 |
|
|
285 |
// ----------------------------------------------------------------------------------------
|
|
286 |
// CDmDeviceDialogServer::~CDmDeviceDialogServer()
|
|
287 |
// ----------------------------------------------------------------------------------------
|
|
288 |
CDmDeviceDialogServer::~CDmDeviceDialogServer()
|
|
289 |
{
|
|
290 |
FLOG(_L("CDmDeviceDialogServer::~CDmDeviceDialogServer()"));
|
|
291 |
if (iServerCloseRequest)
|
|
292 |
{
|
|
293 |
FLOG(_L("CDmDeviceDialogServer::~CDmDeviceDialogServer() \
|
|
294 |
iServerCloseRequest cancel)"));
|
|
295 |
iServerCloseRequest->Cancel();
|
|
296 |
delete iServerCloseRequest;
|
|
297 |
iServerCloseRequest = NULL;
|
|
298 |
}
|
|
299 |
if (iDevDialog)
|
|
300 |
{
|
|
301 |
FLOG(_L("CDmDeviceDialogServer::~CDmDeviceDialogServer():if loop)"));
|
|
302 |
iDevDialog->Cancel();
|
|
303 |
delete iDevDialog;
|
|
304 |
}
|
|
305 |
if (iDmIndicator)
|
|
306 |
{
|
|
307 |
iDmIndicator->Deactivate(KDMProgressIndicatorType);
|
|
308 |
delete iDmIndicator;
|
|
309 |
}
|
|
310 |
FLOG(_L("CDmDeviceDialogServer::~CDmDeviceDialogServer()job to close"));
|
|
311 |
if(iJobongoing)
|
|
312 |
iSyncJob.Close();
|
|
313 |
iSyncMLSession.Close();
|
|
314 |
FLOG(_L("CDmDeviceDialogServer::~CDmDeviceDialogServer() end"));
|
|
315 |
}
|
|
316 |
|
|
317 |
// ----------------------------------------------------------------------------------------
|
|
318 |
// CDmDeviceDialogServer::NewSessionL()
|
|
319 |
// ----------------------------------------------------------------------------------------
|
|
320 |
CSession2* CDmDeviceDialogServer::NewSessionL(const TVersion&,
|
|
321 |
const RMessage2&) const
|
|
322 |
{
|
|
323 |
return new (ELeave) CDmDeviceDialogSession();
|
|
324 |
}
|
|
325 |
|
|
326 |
// ----------------------------------------------------------------------------
|
|
327 |
// CDmDeviceDialogServer::PeriodicServerCloseL()
|
|
328 |
// ----------------------------------------------------------------------------
|
|
329 |
void CDmDeviceDialogServer::PeriodicServerCloseL()
|
|
330 |
{
|
|
331 |
if (iServerCloseRequest)
|
|
332 |
{
|
|
333 |
FLOG(_L("CDmDeviceDialogServer::PeriodicServerCloseL() \
|
|
334 |
:-iServerCloseRequest cancel "));
|
|
335 |
iServerCloseRequest->Cancel();
|
|
336 |
delete iServerCloseRequest;
|
|
337 |
iServerCloseRequest = NULL;
|
|
338 |
}
|
|
339 |
iServerCloseRequest = CPeriodic::NewL(EPriorityNormal);
|
|
340 |
iServerCloseRequest->Start(TTimeIntervalMicroSeconds32(
|
|
341 |
KRequestTriggerWaitTime * 5), TTimeIntervalMicroSeconds32(
|
|
342 |
KRequestTriggerWaitTime * 5), TCallBack(ShutDownL, this));
|
|
343 |
FLOG(_L("CDmDeviceDialogServer::PeriodicServerCloseL():-Request logged)"));
|
|
344 |
}
|
|
345 |
|
|
346 |
// -----------------------------------------------------------------------------
|
|
347 |
// CDmDeviceDialogServer::LaunchPkgZeroNoteL()
|
|
348 |
// -----------------------------------------------------------------------------
|
|
349 |
void CDmDeviceDialogServer::LaunchPkgZeroNoteL(TInt &aProfileId,
|
|
350 |
TInt &aJobId, const TInt &aReplySlot, TInt &aUimode,
|
|
351 |
const RMessage2& aMessage)
|
|
352 |
{
|
|
353 |
FLOG(_L("CDmDeviceDialogSession::LaunchPkgZeroNoteL \
|
|
354 |
called:"));
|
|
355 |
iProfileId = aProfileId;
|
|
356 |
iReplySlot = aReplySlot;
|
|
357 |
iJobId = aJobId;
|
|
358 |
iUimode = aUimode;
|
|
359 |
iMessage = aMessage;
|
|
360 |
CHbSymbianVariantMap* varMap = CHbSymbianVariantMap::NewL();
|
|
361 |
CleanupStack::PushL(varMap);
|
|
362 |
|
|
363 |
HBufC* notifierid = HBufC::NewL(10);
|
|
364 |
CleanupStack::PushL(notifierid);
|
|
365 |
*notifierid = KNotifierType;
|
|
366 |
|
|
367 |
HBufC* profileid = HBufC::NewL(10);
|
|
368 |
CleanupStack::PushL(profileid);
|
|
369 |
*profileid = KProfileId;
|
|
370 |
|
|
371 |
HBufC* uimode = HBufC::NewL(10);
|
|
372 |
CleanupStack::PushL(uimode);
|
|
373 |
*uimode = KUImode;
|
|
374 |
|
|
375 |
HBufC* serverdisplay = HBufC::NewL(20);
|
|
376 |
CleanupStack::PushL(serverdisplay);
|
|
377 |
*serverdisplay = KServerdisplayname;
|
|
378 |
|
|
379 |
HBufC* defaultprofile = HBufC::NewL(20);
|
|
380 |
CleanupStack::PushL(defaultprofile);
|
|
381 |
*defaultprofile = KFotaDefaultProfile;
|
|
382 |
|
|
383 |
HBufC* timeout = HBufC::NewL(20);
|
|
384 |
CleanupStack::PushL(timeout);
|
|
385 |
*timeout = KPkgZeroTimeout;
|
|
386 |
|
|
387 |
TInt profileId( KErrNotFound );
|
|
388 |
TBool Isdefault = EFalse;
|
|
389 |
CRepository* centrep = NULL;
|
|
390 |
TRAPD( err, centrep = CRepository::NewL( KCRUidNSmlDMSyncApp ) );
|
|
391 |
if (err == KErrNone)
|
|
392 |
{
|
|
393 |
centrep->Get(KNSmlDMDefaultFotaProfileKey, profileId);
|
|
394 |
delete centrep;
|
|
395 |
centrep = NULL;
|
|
396 |
if (aProfileId == profileId)
|
|
397 |
Isdefault = ETrue;
|
|
398 |
}
|
|
399 |
TRAP( err, centrep = CRepository::NewL( KCRUidDeviceManagementInternalKeys) );
|
|
400 |
TInt Timeout(KErrNone);
|
|
401 |
if (err == KErrNone)
|
|
402 |
{
|
|
403 |
centrep->Get(KDevManServerAlertTimeout, Timeout);
|
|
404 |
//Timeout has minutes, convert to milli second
|
|
405 |
Timeout = Timeout * 60 * 1000;
|
|
406 |
delete centrep;
|
|
407 |
centrep = NULL;
|
|
408 |
}
|
|
409 |
|
|
410 |
TInt id = KDefaultNotifierId;
|
|
411 |
CHbSymbianVariant* notifieridvar = CHbSymbianVariant::NewL(&id,
|
|
412 |
CHbSymbianVariant::EInt);
|
|
413 |
CleanupStack::PushL(notifieridvar);
|
|
414 |
CHbSymbianVariant* infoprofileid = CHbSymbianVariant::NewL(&iProfileId,
|
|
415 |
CHbSymbianVariant::EInt);
|
|
416 |
CleanupStack::PushL(infoprofileid);
|
|
417 |
CHbSymbianVariant* infouimode = CHbSymbianVariant::NewL(&iUimode,
|
|
418 |
CHbSymbianVariant::EInt);
|
|
419 |
CleanupStack::PushL(infouimode);
|
|
420 |
RSyncMLDevManProfile DmProfile;
|
|
421 |
DmProfile.OpenL( iSyncMLSession, iProfileId, ESmlOpenRead );
|
|
422 |
TBuf<256> servername= DmProfile.DisplayName();
|
|
423 |
DmProfile.Close();
|
|
424 |
CHbSymbianVariant* serverdisplayname = CHbSymbianVariant::NewL(
|
|
425 |
&servername, CHbSymbianVariant::EDes);
|
|
426 |
CleanupStack::PushL(serverdisplayname);
|
|
427 |
CHbSymbianVariant* defaultprofilevalue = CHbSymbianVariant::NewL(
|
|
428 |
&Isdefault, CHbSymbianVariant::EBool);
|
|
429 |
CleanupStack::PushL(defaultprofilevalue);
|
|
430 |
|
|
431 |
CHbSymbianVariant* pkgzerotimeout = CHbSymbianVariant::NewL(
|
|
432 |
&Timeout, CHbSymbianVariant::EInt);
|
|
433 |
CleanupStack::PushL(pkgzerotimeout);
|
|
434 |
|
|
435 |
varMap->Add(*notifierid, notifieridvar);
|
|
436 |
varMap->Add(*profileid, infoprofileid);
|
|
437 |
varMap->Add(*uimode, infouimode);
|
|
438 |
varMap->Add(*serverdisplay, serverdisplayname);
|
|
439 |
varMap->Add(*defaultprofile, defaultprofilevalue);
|
|
440 |
varMap->Add(*timeout, pkgzerotimeout);
|
|
441 |
CleanupStack::Pop(6);
|
|
442 |
if (iDevDialog == NULL)
|
|
443 |
iDevDialog = CHbDeviceDialogSymbian::NewL();
|
|
444 |
else if (iAnyDialogDisplaying)
|
|
445 |
{
|
|
446 |
iDevDialog->Cancel();
|
|
447 |
iAnyDialogDisplaying = EFalse;
|
|
448 |
}
|
|
449 |
else
|
|
450 |
{
|
|
451 |
}
|
|
452 |
err =
|
|
453 |
iDevDialog->Show(KDeviceDialogType, *varMap, this);
|
|
454 |
iPkgZeroQueryNoteDisplaying = ETrue;
|
|
455 |
FLOG(_L("CDmDeviceDialogSession::LaunchPkgZeroNoteL \
|
|
456 |
err in devdialog is %d"), err);
|
|
457 |
iAnyDialogDisplaying = ETrue;
|
|
458 |
CleanupStack::PopAndDestroy(7);
|
|
459 |
FLOG(_L("CDmDeviceDialogSession::LaunchPkgZeroNoteL \
|
|
460 |
end:"));
|
|
461 |
}
|
|
462 |
|
|
463 |
// -----------------------------------------------------------------------------
|
|
464 |
// CDmDeviceDialogServer::StopServer()
|
|
465 |
// -----------------------------------------------------------------------------
|
|
466 |
void CDmDeviceDialogServer::StopServer()
|
|
467 |
{
|
|
468 |
FLOG(_L("CDmDeviceDialogServer::StopServer Begin"));
|
|
469 |
if(!iStopServer && !iJobongoing)
|
|
470 |
{
|
|
471 |
iPkgZeroConnectionNoteShown = EFalse;
|
|
472 |
iStopServer = ETrue;
|
|
473 |
FLOG(_L("CDmDeviceDialogServer::StopServer Requested to shut down"));
|
|
474 |
TRAP_IGNORE(PeriodicServerCloseL());
|
|
475 |
}
|
|
476 |
FLOG(_L("CDmDeviceDialogServer::StopServer Done"));
|
|
477 |
}
|
|
478 |
|
|
479 |
// -----------------------------------------------------------------------------
|
|
480 |
// CDmDeviceDialogServer::OnSyncMLSessionEvent()
|
|
481 |
// -----------------------------------------------------------------------------
|
|
482 |
void CDmDeviceDialogServer::OnSyncMLSessionEvent(TEvent aEvent,
|
|
483 |
TInt aIdentifier, TInt aError, TInt /*aAdditionalData*/)
|
|
484 |
{
|
|
485 |
FLOG(_L("[OMADM]\tDmDeviceDialogServer::OnSyncMLSessionEvent(),\
|
|
486 |
aEvent = %d, aIdentifier = %d, aError = %d"),
|
|
487 |
aEvent, aIdentifier, aError);
|
|
488 |
if (iSyncJobId == aIdentifier && (aEvent == EJobStop || aEvent
|
|
489 |
== EJobStartFailed || aEvent == EJobRejected))
|
|
490 |
{
|
|
491 |
FLOG(_L("[OMADM]\tDmDeviceDialogServer::OnSyncMLSessionEvent(), \
|
|
492 |
ajob stoping" ));
|
|
493 |
iSyncJob.Close();
|
|
494 |
iJobongoing = false;
|
|
495 |
//Stop the dialog
|
|
496 |
DismissDialog();
|
|
497 |
StopServer();
|
|
498 |
}
|
|
499 |
FLOG(_L( "[OMADM]\tDmDeviceDialogServer::OnSyncMLSessionEvent()end" ));
|
|
500 |
}
|
|
501 |
|
|
502 |
// -----------------------------------------------------------------------------
|
|
503 |
// CDmDeviceDialogServer::DismissDialog()
|
|
504 |
// -----------------------------------------------------------------------------
|
|
505 |
void CDmDeviceDialogServer::DismissDialog()
|
|
506 |
{
|
|
507 |
FLOG(_L("CDmDeviceDialogServer::dismissDialog "));
|
|
508 |
|
|
509 |
if (iDevDialog && iPkgZeroConnectionNoteShown && !iIndicatorLaunched)
|
|
510 |
{
|
|
511 |
FLOG(_L("CDmDeviceDialogServer::dismissDialog 3"));
|
|
512 |
iDevDialog->Cancel();
|
|
513 |
iAnyDialogDisplaying = EFalse;
|
|
514 |
iPkgZeroConnectionNoteShown = EFalse;
|
|
515 |
}
|
|
516 |
if (iIndicatorLaunched)
|
|
517 |
{
|
|
518 |
FLOG(
|
|
519 |
_L("CDmDeviceDialogServer::dismissDialog deactivating indicator"));
|
|
520 |
iDmIndicator->Deactivate(KDMProgressIndicatorType);
|
|
521 |
FLOG(
|
|
522 |
_L("CDmDeviceDialogServer::dismissDialog deactivating indicator done"));
|
|
523 |
iIndicatorLaunched = false;
|
|
524 |
}
|
|
525 |
}
|
|
526 |
|
|
527 |
// -----------------------------------------------------------------------------
|
|
528 |
// CDmDeviceDialogServer::GetDMJobStatusL()
|
|
529 |
// -----------------------------------------------------------------------------
|
|
530 |
void CDmDeviceDialogServer::GetDMJobStatusL()
|
|
531 |
{
|
|
532 |
FLOG(_L("CDmDeviceDialogServer::GetDMJobStatusL "));
|
|
533 |
iSyncJob.OpenL(iSyncMLSession, iJobId);
|
|
534 |
FLOG(_L("CDmDeviceDialogServer::GetDMJobStatusL Job started "));
|
|
535 |
iJobongoing = true;
|
|
536 |
iSyncJobId = iSyncJob.Identifier();
|
|
537 |
TInt err = KErrNone;
|
|
538 |
// for MSyncMLEventObserver events
|
|
539 |
TRAP( err, iSyncMLSession.RequestEventL(*this) );
|
|
540 |
FLOG(_L("CDmDeviceDialogServer::GetDMJobStatusL error %d"), err);
|
|
541 |
if (err != KErrNone)
|
|
542 |
{
|
|
543 |
iSyncJob.StopL();
|
|
544 |
iSyncJob.Close();
|
|
545 |
FLOG(_L("CDmDeviceDialogServer::GetDMJobStatusL leaving"));
|
|
546 |
User::Leave(err);
|
|
547 |
}
|
|
548 |
FLOG(_L("CDmDeviceDialogServer::GetDMJobStatusL end "));
|
|
549 |
}
|
|
550 |
|
|
551 |
// -----------------------------------------------------------------------------
|
|
552 |
// CDmDeviceDialogServer::IsConenctDialogDisplaying()
|
|
553 |
// -----------------------------------------------------------------------------
|
|
554 |
TBool CDmDeviceDialogServer::IsConenctDialogDisplaying()
|
|
555 |
{
|
|
556 |
return iPkgZeroConnectionNoteShown;
|
|
557 |
}
|
|
558 |
|
|
559 |
// -----------------------------------------------------------------------------
|
|
560 |
// CDmDeviceDialogServer::ShowConnectDialogAgainL()
|
|
561 |
// -----------------------------------------------------------------------------
|
|
562 |
void CDmDeviceDialogServer::ShowConnectDialogAgainL()
|
|
563 |
{
|
|
564 |
if (iJobongoing && !iIndicatorLaunched && !iPkgZeroConnectionNoteShown)
|
|
565 |
{
|
|
566 |
FLOG(_L("CDmDeviceDialogServer::ShowConnectDialogAgain 1"));
|
|
567 |
CHbSymbianVariantMap* varMap = CHbSymbianVariantMap::NewL();
|
|
568 |
CleanupStack::PushL(varMap);
|
|
569 |
TInt id = KConnectNotifierId;
|
|
570 |
HBufC* notifierid = HBufC::NewL(10);
|
|
571 |
CleanupStack::PushL(notifierid);
|
|
572 |
FLOG(_L("CDmDeviceDialogServer::ShowConnectDialogAgain 2"));
|
|
573 |
*notifierid = KNotifierType;
|
|
574 |
CHbSymbianVariant* notifieridvar = CHbSymbianVariant::NewL(&id,
|
|
575 |
CHbSymbianVariant::EInt);
|
|
576 |
FLOG(_L("CDmDeviceDialogServer::ShowConnectDialogAgain 3"));
|
|
577 |
varMap->Add(*notifierid, notifieridvar);
|
|
578 |
FLOG(_L("CDmDeviceDialogServer::ShowConnectDialogAgain 4"));
|
|
579 |
if (iDevDialog == NULL)
|
|
580 |
{
|
|
581 |
iDevDialog = CHbDeviceDialogSymbian::NewL();
|
|
582 |
FLOG(_L("CDmDeviceDialogServer::ShowConnectDialogAgain 5"));
|
|
583 |
}
|
|
584 |
else if (iAnyDialogDisplaying)
|
|
585 |
iDevDialog->Cancel();
|
|
586 |
else
|
|
587 |
{
|
|
588 |
}
|
|
589 |
iDevDialog->Show(KDeviceDialogType, *varMap, this);
|
|
590 |
iAnyDialogDisplaying = ETrue;
|
|
591 |
FLOG(_L("CDmDeviceDialogServer::ShowConnectDialogAgain 6"));
|
|
592 |
iPkgZeroConnectionNoteShown = ETrue;
|
|
593 |
CleanupStack::PopAndDestroy(2);
|
|
594 |
}
|
|
595 |
}
|
|
596 |
|
|
597 |
// -----------------------------------------------------------------------------
|
|
598 |
// CDmDeviceDialogServer::ShowDisplayalertL()
|
|
599 |
// -----------------------------------------------------------------------------
|
|
600 |
void CDmDeviceDialogServer::ShowDisplayalertL(const TDesC& aAlertText,
|
|
601 |
const RMessage2& aMessage)
|
|
602 |
{
|
|
603 |
FLOG(_L("CDmDeviceDialogServer::ShowDisplayalert "));
|
|
604 |
iMessage = aMessage;
|
|
605 |
CHbSymbianVariantMap* varMap = CHbSymbianVariantMap::NewL();
|
|
606 |
CleanupStack::PushL(varMap);
|
|
607 |
HBufC* keyBuf = HBufC::NewL(25);
|
|
608 |
CleanupStack::PushL(keyBuf);
|
|
609 |
*keyBuf = KNotifierType;
|
|
610 |
HBufC* servalertType = HBufC::NewL(25);
|
|
611 |
CleanupStack::PushL(servalertType);
|
|
612 |
*servalertType = KServerpushalertInfo;
|
|
613 |
TInt id = 0;
|
|
614 |
CHbSymbianVariant* notifierid = CHbSymbianVariant::NewL(&id,
|
|
615 |
CHbSymbianVariant::EInt);
|
|
616 |
varMap->Add(*keyBuf, notifierid);
|
|
617 |
CHbSymbianVariant* serveralertmsg = CHbSymbianVariant::NewL(&aAlertText,
|
|
618 |
CHbSymbianVariant::EDes);
|
|
619 |
varMap->Add(*servalertType, serveralertmsg); // takes ownership
|
|
620 |
FLOG(_L("CDmDeviceDialogServer::ShowDisplayalert before newl"));
|
|
621 |
if (iDevDialog == NULL)
|
|
622 |
iDevDialog = CHbDeviceDialogSymbian::NewL();
|
|
623 |
else if (iAnyDialogDisplaying)
|
|
624 |
{
|
|
625 |
iDevDialog->Cancel();
|
|
626 |
}
|
|
627 |
else
|
|
628 |
{
|
|
629 |
}
|
|
630 |
FLOG(_L("CDmDeviceDialogServer::ShowDisplayalert before show"));
|
|
631 |
iDevDialog->Show(KDeviceDialogType, *varMap, this);
|
|
632 |
iAnyDialogDisplaying = ETrue;
|
|
633 |
CleanupStack::PopAndDestroy(3);
|
|
634 |
}
|
|
635 |
|
|
636 |
// -----------------------------------------------------------------------------
|
|
637 |
// CDmDeviceDialogServer::ShowConfirmationalertL()
|
|
638 |
// -----------------------------------------------------------------------------
|
|
639 |
void CDmDeviceDialogServer::ShowConfirmationalertL(const TInt& /*aTimeOut*/,
|
|
640 |
const TDesC& /*aHeader*/, const TDesC& aText, const RMessage2& aMessage)
|
|
641 |
{
|
|
642 |
iMessage = aMessage;
|
|
643 |
CHbSymbianVariantMap* varMap = CHbSymbianVariantMap::NewL();
|
|
644 |
CleanupStack::PushL(varMap);
|
|
645 |
HBufC* keyBuf = HBufC::NewL(25);
|
|
646 |
CleanupStack::PushL(keyBuf);
|
|
647 |
*keyBuf = KNotifierType;
|
|
648 |
HBufC* servalertType = HBufC::NewL(25);
|
|
649 |
CleanupStack::PushL(servalertType);
|
|
650 |
*servalertType = KServerpushalertConfirm;
|
|
651 |
TInt id = 0;
|
|
652 |
CHbSymbianVariant* notifierid = CHbSymbianVariant::NewL(&id,
|
|
653 |
CHbSymbianVariant::EInt);
|
|
654 |
varMap->Add(*keyBuf, notifierid);
|
|
655 |
CHbSymbianVariant* serveralertmsg = CHbSymbianVariant::NewL(&aText,
|
|
656 |
CHbSymbianVariant::EDes);
|
|
657 |
varMap->Add(*servalertType, serveralertmsg); // takes ownership
|
|
658 |
if (iDevDialog == NULL)
|
|
659 |
iDevDialog = CHbDeviceDialogSymbian::NewL();
|
|
660 |
else if (iAnyDialogDisplaying)
|
|
661 |
iDevDialog->Cancel();
|
|
662 |
else
|
|
663 |
{
|
|
664 |
}
|
|
665 |
iDevDialog->Show(KDeviceDialogType, *varMap, this);
|
|
666 |
iAnyDialogDisplaying = ETrue;
|
|
667 |
CleanupStack::PopAndDestroy(3);
|
|
668 |
}
|
|
669 |
|
|
670 |
|
|
671 |
// ----------------------------------------------------------------------------------------
|
|
672 |
// CDmDeviceDialogServer::NewAsyncRequest()
|
|
673 |
// ----------------------------------------------------------------------------------------
|
|
674 |
void CDmDeviceDialogServer::NewAsyncRequest()
|
|
675 |
{
|
|
676 |
iSessionCount++;
|
|
677 |
}
|
|
678 |
// ----------------------------------------------------------------------------------------
|
|
679 |
// CDmDeviceDialogServer::RequestPending()
|
|
680 |
// Any request pending
|
|
681 |
// ----------------------------------------------------------------------------------------
|
|
682 |
TBool CDmDeviceDialogServer::RequestPending()
|
|
683 |
{
|
|
684 |
if( iSessionCount > 0 )
|
|
685 |
{
|
|
686 |
return ETrue;
|
|
687 |
}
|
|
688 |
return EFalse;
|
|
689 |
}
|
|
690 |
|
|
691 |
// ----------------------------------------------------------------------------------------
|
|
692 |
// CDmDeviceDialogServer::CancelServerCloseRequest()
|
|
693 |
// Cancels Server shutdown
|
|
694 |
// ----------------------------------------------------------------------------------------
|
|
695 |
void CDmDeviceDialogServer::CancelServerCloseRequest()
|
|
696 |
{
|
|
697 |
FLOG(_L("CDmDeviceDialogServer::CancelServerCloseRequest():-begin)"));
|
|
698 |
if(iServerCloseRequest)
|
|
699 |
{
|
|
700 |
FLOG(_L("CDmDeviceDialogServer::CancelServerCloseRequest():-iServerCloseRequest cancel)"));
|
|
701 |
iServerCloseRequest->Cancel();
|
|
702 |
delete iServerCloseRequest;
|
|
703 |
iServerCloseRequest = NULL;
|
|
704 |
}
|
|
705 |
FLOG(_L("CDmDeviceDialogServer::CancelServerCloseRequest():-end)"));
|
|
706 |
}
|
|
707 |
|
|
708 |
// ----------------------------------------------------------------------------------------
|
|
709 |
// CDmDeviceDialogServer::IsPkgZeroNoteDisplaying()
|
|
710 |
// ----------------------------------------------------------------------------------------
|
|
711 |
TBool CDmDeviceDialogServer::IsPkgZeroNoteDisplaying()
|
|
712 |
{
|
|
713 |
FLOG(_L("CDmDeviceDialogServer::IsPkgZeroNoteDisplaying())"));
|
|
714 |
return iPkgZeroQueryNoteDisplaying;
|
|
715 |
}
|
|
716 |
|
|
717 |
// ----------------------------------------------------------------------------------------
|
|
718 |
// CDmDeviceDialogServer::CancelPendingServerAlert()
|
|
719 |
// ----------------------------------------------------------------------------------------
|
|
720 |
void CDmDeviceDialogServer::CancelPendingServerAlert()
|
|
721 |
{
|
|
722 |
FLOG(_L("CDmDeviceDialogServer::CancelPendingServerAlert())"));
|
|
723 |
if(IsPkgZeroNoteDisplaying())
|
|
724 |
{
|
|
725 |
iSessionCount--;
|
|
726 |
iDevDialog->Cancel();
|
|
727 |
iPkgZeroQueryNoteDisplaying = EFalse;
|
|
728 |
iMessage.Complete(KErrCancel);
|
|
729 |
FLOG(_L("CDmDeviceDialogServer::CancelPendingServerAlert() cancelled"));
|
|
730 |
}
|
|
731 |
}
|
|
732 |
|
|
733 |
// ----------------------------------------------------------------------------------------
|
|
734 |
// CDmDeviceDialogServer::IndicatorUserActivated()
|
|
735 |
// ----------------------------------------------------------------------------------------
|
|
736 |
void CDmDeviceDialogServer::IndicatorUserActivated (const TDesC& /*aType*/,
|
|
737 |
CHbSymbianVariantMap& /*aData*/)
|
|
738 |
{
|
|
739 |
//Deactivate the indicator done by plugin
|
|
740 |
FLOG(_L("CDmDeviceDialogServer::IndicatorUserActivated()"));
|
|
741 |
if (iDmIndicator)
|
|
742 |
{
|
|
743 |
//Indicator deactivated on plugin side
|
|
744 |
FLOG(_L("CDmDeviceDialogServer::IndicatorUserActivated() Indicator \
|
|
745 |
deactivated"));
|
|
746 |
iIndicatorLaunched = EFalse;
|
|
747 |
FLOG(_L("CDmDeviceDialogServer::IndicatorUserActivated() connect \
|
|
748 |
dialog to be activated"));
|
|
749 |
TRAP_IGNORE(ShowConnectDialogAgainL());
|
|
750 |
FLOG(_L("CDmDeviceDialogServer::IndicatorUserActivated() connect \
|
|
751 |
dialog activated"));
|
|
752 |
}
|
|
753 |
FLOG(_L("CDmDeviceDialogServer::IndicatorUserActivated() end"));
|
|
754 |
}
|
|
755 |
//End of file
|