|
1 /* |
|
2 * Copyright (c) 2002 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: |
|
15 * Reqisters Mce to LogEng to get notification about log DB changes. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 |
|
23 #include <coemain.h> |
|
24 #include <logview.h> |
|
25 #include <logcli.h> |
|
26 #include "MceLogNotify.h" |
|
27 #include "MceLogEngine.h" |
|
28 |
|
29 // ================= MEMBER FUNCTIONS ======================= |
|
30 |
|
31 CMceLogNotify::CMceLogNotify( |
|
32 CMceLogEngine* aObserver, |
|
33 TTimeIntervalMicroSeconds32 aDelay ) |
|
34 : CActive(EPriorityStandard), |
|
35 iObserver(aObserver), |
|
36 iDelay(aDelay) |
|
37 { |
|
38 } |
|
39 |
|
40 CMceLogNotify* CMceLogNotify::NewL( |
|
41 CMceLogEngine* aObserver, // Pointer to model |
|
42 TTimeIntervalMicroSeconds32 aDelay) |
|
43 { |
|
44 CMceLogNotify* self = new (ELeave) CMceLogNotify( aObserver, aDelay ); |
|
45 CleanupStack::PushL(self); |
|
46 self->ConstructL(); |
|
47 CleanupStack::Pop( ); // self |
|
48 return self; |
|
49 } |
|
50 |
|
51 void CMceLogNotify::ConstructL() |
|
52 { |
|
53 User::LeaveIfError(iFsSession.Connect()); |
|
54 iLogClient = CLogClient::NewL(iFsSession); |
|
55 |
|
56 CActiveScheduler::Add(this); |
|
57 } |
|
58 |
|
59 CMceLogNotify::~CMceLogNotify() |
|
60 { |
|
61 if( iLogClient ) |
|
62 { |
|
63 iLogClient->NotifyChangeCancel(); |
|
64 } |
|
65 Cancel(); |
|
66 |
|
67 delete iLogClient; |
|
68 iFsSession.Close(); |
|
69 |
|
70 iObserver = NULL; |
|
71 } |
|
72 |
|
73 void CMceLogNotify::IssueNotifyRequest() |
|
74 { |
|
75 iLogClient->NotifyChange( iDelay, iStatus); |
|
76 SetActive(); |
|
77 } |
|
78 |
|
79 void CMceLogNotify::DoCancel() |
|
80 { |
|
81 iLogClient->NotifyChangeCancel(); |
|
82 } |
|
83 |
|
84 void CMceLogNotify::RunL() |
|
85 { |
|
86 iObserver->NotifyDbChangedL(); |
|
87 } |
|
88 |
|
89 // End of file |