|
1 /* |
|
2 * Copyright (c) 2010 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 * CMsgCenRepObserver implementation file |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 //#include <es_sock.h> |
|
23 #include <centralrepository.h> |
|
24 |
|
25 #include "msgerrorwatcher_p.h" |
|
26 #include "msgcenrepobserver.h" |
|
27 |
|
28 #include "MmsEngineInternalCRKeys.h" |
|
29 #include "debugtraces.h" |
|
30 |
|
31 // ================= MEMBER FUNCTIONS ======================= |
|
32 |
|
33 // --------------------------------------------------------- |
|
34 // C++ constructor |
|
35 // --------------------------------------------------------- |
|
36 // |
|
37 CMsgCenRepObserver::CMsgCenRepObserver(CMsgErrorWatcherPrivate& aWatcher) |
|
38 :CActive ( EPriorityStandard), |
|
39 iWatcher(aWatcher), |
|
40 iRepositoryUid( KCRUidMmsEngine ), |
|
41 iKey( KMmsAccesspointArrayBase/*KMmsEngineAccessPointCount*/ ) |
|
42 { |
|
43 QDEBUG_WRITE("CMsgCenRepObserver:CMsgCenRepObserver : Enter"); |
|
44 QDEBUG_WRITE("CMsgCenRepObserver:CMsgCenRepObserver : Exit"); |
|
45 } |
|
46 |
|
47 // --------------------------------------------------------- |
|
48 // ConstructL |
|
49 // --------------------------------------------------------- |
|
50 // |
|
51 void CMsgCenRepObserver::ConstructL() |
|
52 { |
|
53 QDEBUG_WRITE("CMsgCenRepObserver:ConstructL : Enter"); |
|
54 CActiveScheduler::Add( this ); |
|
55 |
|
56 // Connect CenRep |
|
57 TRAPD( err, iRepository = CRepository::NewL( iRepositoryUid ) ); |
|
58 if( err != KErrNone ) |
|
59 { |
|
60 |
|
61 QDEBUG_WRITE( "Error in connecting to CenRep!" ); |
|
62 |
|
63 return; |
|
64 } |
|
65 QDEBUG_WRITE("CMsgCenRepObserver:ConstructL : Exit"); |
|
66 } |
|
67 |
|
68 // --------------------------------------------------------- |
|
69 // Symbian two-phased constructor |
|
70 // --------------------------------------------------------- |
|
71 // |
|
72 CMsgCenRepObserver* CMsgCenRepObserver::NewL( CMsgErrorWatcherPrivate& aWatcher ) |
|
73 { |
|
74 QDEBUG_WRITE("CMsgCenRepObserver:NewL : Enter"); |
|
75 CMsgCenRepObserver* self = new ( ELeave ) CMsgCenRepObserver( aWatcher ); |
|
76 CleanupStack::PushL( self ); |
|
77 self->ConstructL(); |
|
78 CleanupStack::Pop( self ); |
|
79 QDEBUG_WRITE("CMsgCenRepObserver:NewL : Exit"); |
|
80 return self; |
|
81 } |
|
82 |
|
83 // --------------------------------------------------------- |
|
84 // Destructor |
|
85 // --------------------------------------------------------- |
|
86 // |
|
87 CMsgCenRepObserver::~CMsgCenRepObserver() |
|
88 { |
|
89 QDEBUG_WRITE("CMsgCenRepObserver:~CMsgCenRepObserver : Enter"); |
|
90 Cancel(); |
|
91 if( iRepository ) |
|
92 { |
|
93 delete iRepository; |
|
94 } |
|
95 QDEBUG_WRITE("CMsgCenRepObserver:~CMsgCenRepObserver : Exit"); |
|
96 } |
|
97 |
|
98 // --------------------------------------------------------- |
|
99 // SubscribeNotification |
|
100 // --------------------------------------------------------- |
|
101 // |
|
102 void CMsgCenRepObserver::SubscribeNotification( ) |
|
103 { |
|
104 QDEBUG_WRITE("CMsgCenRepObserver:SubscribeNotification : Enter"); |
|
105 // Subscribe |
|
106 iRepository->NotifyRequest( iKey, iStatus ); |
|
107 SetActive(); |
|
108 QDEBUG_WRITE("CMsgCenRepObserver:SubscribeNotification : Exit"); |
|
109 } |
|
110 |
|
111 // --------------------------------------------------------- |
|
112 // RunL |
|
113 // --------------------------------------------------------- |
|
114 // |
|
115 void CMsgCenRepObserver::RunL() |
|
116 { |
|
117 QDEBUG_WRITE("CMsgCenRepObserver:RunL : Enter"); |
|
118 iWatcher.HandleCenRepNotificationL(); |
|
119 QDEBUG_WRITE("CMsgCenRepObserver:RunL : Exit"); |
|
120 } |
|
121 |
|
122 // --------------------------------------------------------- |
|
123 // RunError |
|
124 // --------------------------------------------------------- |
|
125 // |
|
126 TInt CMsgCenRepObserver::RunError( TInt /*aError*/ ) |
|
127 { |
|
128 QDEBUG_WRITE("CMsgCenRepObserver:RunError : Enter"); |
|
129 QDEBUG_WRITE("CMsgCenRepObserver:RunError : Exit"); |
|
130 return KErrNone; |
|
131 } |
|
132 |
|
133 // --------------------------------------------------------- |
|
134 // DoCancel |
|
135 // --------------------------------------------------------- |
|
136 // |
|
137 void CMsgCenRepObserver::DoCancel() |
|
138 { |
|
139 QDEBUG_WRITE("CMsgCenRepObserver:DoCancel : Enter"); |
|
140 iRepository->NotifyCancel( iKey ); |
|
141 QDEBUG_WRITE("CMsgCenRepObserver:DoCancel : Exit"); |
|
142 } |
|
143 |
|
144 // ================= OTHER EXPORTED FUNCTIONS ============== |
|
145 |
|
146 // End of File |
|
147 |