|
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: see class description. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "phonelogger.h" |
|
21 #include "phoneui.pan" |
|
22 |
|
23 #include "cphonecenrepeventhandler.h" |
|
24 #include "cphonecenrepproxy.h" |
|
25 |
|
26 // ========================== MEMBER FUNCTIONS ================================ |
|
27 |
|
28 // ---------------------------------------------------------------------------- |
|
29 // CPhoneCenRepEventHandler* CPhoneCenRepEventHandler::NewL() |
|
30 // ---------------------------------------------------------------------------- |
|
31 |
|
32 CPhoneCenRepEventHandler* CPhoneCenRepEventHandler::NewL( |
|
33 const TUid& aUid ) |
|
34 { |
|
35 CPhoneCenRepEventHandler* self = |
|
36 new ( ELeave ) CPhoneCenRepEventHandler( aUid ); |
|
37 |
|
38 CleanupStack::PushL( self ); |
|
39 self->ConstructL(); |
|
40 CleanupStack::Pop( self ); |
|
41 |
|
42 return self; |
|
43 } |
|
44 |
|
45 // ---------------------------------------------------------------------------- |
|
46 // CPhoneCenRepEventHandler::CPhoneCenRepEventHandler |
|
47 // ---------------------------------------------------------------------------- |
|
48 |
|
49 CPhoneCenRepEventHandler::CPhoneCenRepEventHandler( const TUid& aUid ) : |
|
50 iUid( aUid ) |
|
51 { |
|
52 } |
|
53 |
|
54 // ---------------------------------------------------------------------------- |
|
55 // CPhoneCenRepEventHandler::~CPhoneCenRepEventHandler |
|
56 // ---------------------------------------------------------------------------- |
|
57 |
|
58 CPhoneCenRepEventHandler::~CPhoneCenRepEventHandler() |
|
59 { |
|
60 if ( iCenRepNotifyHandler ) |
|
61 { |
|
62 iCenRepNotifyHandler->StopListening(); |
|
63 } |
|
64 delete iCenRepNotifyHandler; |
|
65 delete iRepository; |
|
66 } |
|
67 |
|
68 // ---------------------------------------------------------------------------- |
|
69 // CPhoneCenRepEventHandler::ConstructL |
|
70 // ---------------------------------------------------------------------------- |
|
71 |
|
72 void CPhoneCenRepEventHandler::ConstructL() |
|
73 { |
|
74 __PHONELOG1( |
|
75 EBasic, |
|
76 EPhonePhoneapp, |
|
77 "CPhoneCenRepEventHandler::ConstructL: uid=%d", |
|
78 iUid ); |
|
79 |
|
80 iRepository = CRepository::NewL( iUid ); |
|
81 |
|
82 iCenRepNotifyHandler = CCenRepNotifyHandler::NewL( |
|
83 *this, |
|
84 *iRepository ); |
|
85 |
|
86 iCenRepNotifyHandler->StartListeningL(); |
|
87 } |
|
88 |
|
89 // ---------------------------------------------------------------------------- |
|
90 // CPhoneCenRepEventHandler::HandleNotifyGeneric |
|
91 // ---------------------------------------------------------------------------- |
|
92 void CPhoneCenRepEventHandler::HandleNotifyGeneric( TUint32 aId ) |
|
93 { |
|
94 |
|
95 __PHONELOG2( |
|
96 EBasic, |
|
97 EPhonePhoneapp, |
|
98 "CPhoneCenRepEventHandler::HandleNotifyGeneric: uid=%d, id=%d", |
|
99 iUid, |
|
100 aId ); |
|
101 |
|
102 CPhoneCenRepProxy::Instance()->HandleNotify( iUid, aId ); |
|
103 } |
|
104 |
|
105 // ---------------------------------------------------------------------------- |
|
106 // CPhoneCenRepEventHandler::HandleNotifyError |
|
107 // ---------------------------------------------------------------------------- |
|
108 void CPhoneCenRepEventHandler::HandleNotifyError( |
|
109 TUint32 /*aId*/, |
|
110 TInt error, |
|
111 CCenRepNotifyHandler* /*aHandler*/ ) |
|
112 { |
|
113 if ( error ) |
|
114 { |
|
115 __PHONELOG2( |
|
116 EBasic, |
|
117 EPhonePhoneapp, |
|
118 "CPhoneCenRepEventHandler::HandleNotifyError: uid=%d, error = %d", |
|
119 iUid, |
|
120 error ); |
|
121 } |
|
122 |
|
123 // Resume listening |
|
124 TRAPD( err, iCenRepNotifyHandler->StartListeningL() ); |
|
125 if ( KErrNone != err ) |
|
126 { |
|
127 Panic( err ); |
|
128 } |
|
129 } |
|
130 |
|
131 // End of File |
|
132 |