|
1 /* |
|
2 * Copyright (c) 2004 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: Connection settings notifier implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __CIMPSCONNUICONNECTIONSETTINGSNOTIFIERIMP_H |
|
19 #define __CIMPSCONNUICONNECTIONSETTINGSNOTIFIERIMP_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <E32Base.h> |
|
23 #include <impspresenceconnectionuiconstsng.h> |
|
24 #include "RGenericObserverArray.h" |
|
25 |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class MIMPSConnUiConnectionSettingsObserver; |
|
29 class CIMPSConnUiConnectionSettingsNotifier; |
|
30 class CIMPSConnUiConnectionSettingsNotifierImp; |
|
31 |
|
32 |
|
33 // CLASS DECLARATION |
|
34 /** |
|
35 * CIMPSConnUiConnectionSettingsNotifierImp. |
|
36 * Implements the event notifier features. |
|
37 * |
|
38 * @since 2.1 |
|
39 */ |
|
40 NONSHARABLE_CLASS( CIMPSConnUiConnectionSettingsNotifierImp ) : |
|
41 public CBase, |
|
42 public MGenObserverNotifyMediator < MIMPSConnUiConnectionSettingsObserver, |
|
43 TIMPSConnectionSettingsEvent > |
|
44 { |
|
45 public: // Two-phased constructor and destructor |
|
46 |
|
47 /** |
|
48 * Two-phased constructor. |
|
49 * Constructs client filtered version of |
|
50 * event notifier implementation. |
|
51 */ |
|
52 static CIMPSConnUiConnectionSettingsNotifierImp* NewL( |
|
53 CIMPSConnUiConnectionSettingsNotifier& aInterface, |
|
54 TIMPSConnectionClient aClient ); |
|
55 |
|
56 |
|
57 /** |
|
58 * Destructor. |
|
59 */ |
|
60 ~CIMPSConnUiConnectionSettingsNotifierImp(); |
|
61 |
|
62 |
|
63 private: |
|
64 |
|
65 /** |
|
66 * C++ constructor. |
|
67 */ |
|
68 CIMPSConnUiConnectionSettingsNotifierImp( |
|
69 CIMPSConnUiConnectionSettingsNotifier& aInterface, |
|
70 TIMPSConnectionClient aClient ); |
|
71 |
|
72 |
|
73 /** |
|
74 * Symbian OS constructor. |
|
75 */ |
|
76 void ConstructL(); |
|
77 |
|
78 |
|
79 public: //Implementation methods for public APIs |
|
80 |
|
81 /** |
|
82 * Implements notify start. |
|
83 * |
|
84 * @since 2.1 |
|
85 */ |
|
86 void StartL(); |
|
87 |
|
88 |
|
89 /** |
|
90 * Implements notify stop. |
|
91 * |
|
92 * @since 2.1 |
|
93 */ |
|
94 void Stop(); |
|
95 |
|
96 |
|
97 /** |
|
98 * Implements add observer. |
|
99 * |
|
100 * @since 2.1 |
|
101 * @param aObserver The observer to add. |
|
102 */ |
|
103 void AddObserverL( MIMPSConnUiConnectionSettingsObserver* aObserver ); |
|
104 |
|
105 |
|
106 /** |
|
107 * Implements remove observer. |
|
108 * |
|
109 * @since 2.1 |
|
110 * @param aObserver The observer to remove. |
|
111 * @return KErrNone if observer was found, else KErrNotFound. |
|
112 */ |
|
113 TInt RemoveObserver( MIMPSConnUiConnectionSettingsObserver* aObserver ); |
|
114 |
|
115 |
|
116 /** |
|
117 * Implements connection mode get. |
|
118 * |
|
119 * @since 2.1 |
|
120 * @return Current connection mode. |
|
121 */ |
|
122 TIMPSConnectionSettingsEvent ConnectionSettingByCategoryL( |
|
123 TIMPSConnectionSettingsEvent aModeEventCateqory ); |
|
124 |
|
125 |
|
126 public: //Observation method from MCnUiConnModeObserver |
|
127 |
|
128 |
|
129 /** |
|
130 * Observation method to get events from client |
|
131 * specific connection mode changes. |
|
132 * |
|
133 * Forwards events to registered |
|
134 * MIMPSConnUiConnectionSettingsObserver observers. |
|
135 * |
|
136 * @since 2.1 |
|
137 */ |
|
138 void HandleConnModeChange( TIMPSConnectionClient aRequestedClient, |
|
139 TIMPSConnectionSettingsEvent aConnMode ); |
|
140 |
|
141 |
|
142 private: // Helper methods |
|
143 |
|
144 /** |
|
145 * Helper method implementing |
|
146 * real notify start. |
|
147 * |
|
148 * @since 2.1 |
|
149 */ |
|
150 void DoStartL(); |
|
151 |
|
152 |
|
153 /** |
|
154 * Helper method to implementing |
|
155 * real notify stop. |
|
156 * |
|
157 * @since 2.1 |
|
158 */ |
|
159 void DoStop(); |
|
160 |
|
161 |
|
162 /** |
|
163 * Called in notifier destructor. |
|
164 * |
|
165 * Sets the dying flag on (prevents further starting the |
|
166 * notifier and error and event notifying) Stops the notifier |
|
167 * if running. |
|
168 * |
|
169 * @since 2.1 |
|
170 */ |
|
171 void Dying(); |
|
172 |
|
173 |
|
174 /** |
|
175 * Notifies registered observers from given presence event. |
|
176 * If notifier isn't running, |
|
177 * ignores given presence event. |
|
178 * |
|
179 * @since 2.1 |
|
180 * @param aEvent The event to notify. |
|
181 */ |
|
182 void NotifyObserversFromEvent( TIMPSConnectionSettingsEvent aEvent ); |
|
183 |
|
184 |
|
185 /** |
|
186 * Notifies registered observers from given error. |
|
187 * |
|
188 * If notifier isn't running, ignores given error. |
|
189 * |
|
190 * Before notifying the error, |
|
191 * the notifier is stopped. (Client can restart |
|
192 * the notifier in the error callback.) |
|
193 * |
|
194 * @since 2.1 |
|
195 * @param aError The error to report. |
|
196 */ |
|
197 void StopAndNotifyObserversFromError( TInt aError ); |
|
198 |
|
199 |
|
200 private: //Notify mediators from MGenObserverNotifyMediator |
|
201 |
|
202 /** |
|
203 * Implements the observer notification. |
|
204 * |
|
205 * @since 2.1 |
|
206 * @param The observer to notify. |
|
207 * @param aNotifyData The notify data. |
|
208 */ |
|
209 void MediateNotifyL( MIMPSConnUiConnectionSettingsObserver& aObserverToNotify, |
|
210 TIMPSConnectionSettingsEvent& aNotifyData ); |
|
211 |
|
212 |
|
213 /** |
|
214 * Observer notification from error. |
|
215 * |
|
216 * @since 2.1 |
|
217 * @param aObserverToNotify The notified observer which leaved. |
|
218 * @param aLeaveError The propagated leave code. |
|
219 */ |
|
220 void MediateNotifyError( MIMPSConnUiConnectionSettingsObserver& aObserverToNotify, |
|
221 TInt aLeaveError ); |
|
222 |
|
223 |
|
224 /** |
|
225 * Observer notification from error. |
|
226 * |
|
227 * @since 2.1 |
|
228 * @param aObserverToNotify The observer to notify. |
|
229 * @param aError The error. |
|
230 */ |
|
231 void MediateError( MIMPSConnUiConnectionSettingsObserver& aObserverToNotify, |
|
232 TInt aError ); |
|
233 |
|
234 |
|
235 |
|
236 private: //Data |
|
237 |
|
238 ///< Reference to owning interface, interface not owned |
|
239 CIMPSConnUiConnectionSettingsNotifier& iInterface; |
|
240 |
|
241 /// Client for which to deliver mode events, owned |
|
242 const TIMPSConnectionClient iClient; |
|
243 |
|
244 ///< Observer array, array owned, observers not |
|
245 RGenericObserverArray < MIMPSConnUiConnectionSettingsObserver, |
|
246 TIMPSConnectionSettingsEvent > iObserverArray; |
|
247 |
|
248 ///< Flags describing the notifier state, owned |
|
249 ///< Flag contents are either EFalse or ETrue |
|
250 TInt8 iStarted; |
|
251 TInt8 iDying; |
|
252 TInt8 iReserved1; |
|
253 TInt8 iReserved2; |
|
254 }; |
|
255 |
|
256 #endif //__CIMPSCONNUICONNECTIONSETTINGSNOTIFIERIMP_H |
|
257 // End of File |
|
258 |
|
259 |