|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Core dump progress observer active object class implementation. |
|
15 // |
|
16 |
|
17 #include "coredumpuinotifier.h" |
|
18 |
|
19 CCrashNotifier* CCrashNotifier::NewL(CResourceView &aResourceView) |
|
20 { |
|
21 CCrashNotifier* self = new(ELeave) CCrashNotifier(aResourceView); |
|
22 CleanupStack::PushL(self); |
|
23 self->ConstructL(); |
|
24 CleanupStack::Pop(self); |
|
25 return self; |
|
26 } |
|
27 |
|
28 /** |
|
29 * Adds itself into the active scheduler. |
|
30 */ |
|
31 CCrashNotifier::CCrashNotifier(CResourceView &aResourceView) |
|
32 :CActive(EPriorityStandard), |
|
33 iResourceView(aResourceView) |
|
34 { |
|
35 CActiveScheduler::Add(this); |
|
36 } |
|
37 |
|
38 /** |
|
39 * Attaches to the core dump server crash progress property. And starts observation right away. |
|
40 */ |
|
41 void CCrashNotifier::ConstructL() |
|
42 { |
|
43 LOG_MSG3("CCrashNotifier::ConstrucL() - attach %d.%d", KCoreDumpServUid, ECrashProgress); |
|
44 User::LeaveIfError(iProperty.Attach(KCoreDumpServUid, ECrashProgress)); |
|
45 RunL(); //start watching |
|
46 } |
|
47 |
|
48 /** |
|
49 * Cancels the wait for outstanding request and closes handle to crash progress property. |
|
50 */ |
|
51 CCrashNotifier::~CCrashNotifier() |
|
52 { |
|
53 Cancel(); |
|
54 iProperty.Close(); |
|
55 } |
|
56 |
|
57 /** |
|
58 * Cancels subscription to the crash progress property. |
|
59 */ |
|
60 void CCrashNotifier::DoCancel() |
|
61 { |
|
62 iProperty.Cancel(); |
|
63 } |
|
64 |
|
65 /** |
|
66 * Handles completion of observation request, notifies the UI and reissues another observation request. |
|
67 */ |
|
68 void CCrashNotifier::RunL() |
|
69 { |
|
70 LOG_MSG( "CCrashNotifier::RunL()" ); |
|
71 User::LeaveIfError(iProperty.Get(iResourceView.CrashProgress())); |
|
72 iResourceView.UpdateCrashProgressL(); |
|
73 iProperty.Subscribe(iStatus); |
|
74 SetActive(); |
|
75 } |