|
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: Synchronous client group notify mediator. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __CCNUICLIENTGROUPUINOTIFYMEDIATOR_H |
|
21 #define __CCNUICLIENTGROUPUINOTIFYMEDIATOR_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <E32Base.h> |
|
25 #include "CCnUiGroupChannel.h" |
|
26 #include "MCnUiGlobalNotificationUiFacade.h" |
|
27 |
|
28 |
|
29 // CLASS DECLARATION |
|
30 /** |
|
31 * Synchronous client group notify mediator. |
|
32 * |
|
33 * Client group notifications and queries return after |
|
34 * user remote selection or timeout. |
|
35 * |
|
36 * @since 2.1 |
|
37 */ |
|
38 NONSHARABLE_CLASS( CCnUiClientGroupUiNotifyMediator ) : public CTimer, |
|
39 public MCnUiGroupChannelListener |
|
40 { |
|
41 public: // Two-phased constructors and destructor |
|
42 |
|
43 /** |
|
44 * Two-phased constructor, constructs the |
|
45 * CCnUiClientGroupUiNotifyMediator object. |
|
46 * |
|
47 * @since 2.1 |
|
48 * @return is pointer to CCnUiClientGroupUiNotifyMediator object. |
|
49 */ |
|
50 static CCnUiClientGroupUiNotifyMediator* NewLC(); |
|
51 |
|
52 /** |
|
53 * Destructor. |
|
54 */ |
|
55 virtual ~CCnUiClientGroupUiNotifyMediator(); |
|
56 |
|
57 |
|
58 private: //Constructors |
|
59 |
|
60 /** |
|
61 * C++ default constructor. |
|
62 */ |
|
63 CCnUiClientGroupUiNotifyMediator(); |
|
64 |
|
65 /** |
|
66 * By default Symbian 2nd phase constructor is private. |
|
67 */ |
|
68 void ConstructL(); |
|
69 |
|
70 |
|
71 public://New methods |
|
72 |
|
73 |
|
74 /** |
|
75 * Executes active connection for scheduled |
|
76 * suppression remote query. |
|
77 * |
|
78 * @since 2.1 |
|
79 * @param aServerName The server name to establish the |
|
80 * scheduled connection. |
|
81 * @param aClientsToShow The clients in which to show |
|
82 * the query. |
|
83 * @return ETrue if current connection can be closed. |
|
84 * Else EFalse. |
|
85 */ |
|
86 TBool CGQActiveConnectionSuppressForScheduledConnectionL( |
|
87 const TDesC& aServerName, |
|
88 const TArray<TIMPSConnectionClient>& aClientsToShow ); |
|
89 |
|
90 |
|
91 /** |
|
92 * Executes active connection scheduled close query. |
|
93 * |
|
94 * @since 2.1 |
|
95 * @param aClientsToShow The clients in which to show |
|
96 * the query. |
|
97 * @return ETrue if current connection can be closed. |
|
98 * Else EFalse. |
|
99 */ |
|
100 TBool CGQActiveConnectionScheduledCloseL( |
|
101 const TArray<TIMPSConnectionClient>& aClientsToShow ); |
|
102 |
|
103 |
|
104 |
|
105 |
|
106 public: //from MCnUiGroupChannelListener |
|
107 |
|
108 /** |
|
109 * Callback method for channel events. |
|
110 * |
|
111 * @since 2.1 |
|
112 * @param aGroupId The originating channel group. |
|
113 * @param aChannelId The originating channel. |
|
114 * @param aChannelMsg The channel message. |
|
115 */ |
|
116 void HandleChannelMsg( TInt aGroupId, |
|
117 TGCChannelID aChannelId, |
|
118 TInt aChannelMsg ); |
|
119 |
|
120 |
|
121 |
|
122 |
|
123 protected: // Methods derived from CActive |
|
124 |
|
125 /** |
|
126 * From CActive. |
|
127 * @see CActive |
|
128 */ |
|
129 void RunL(); |
|
130 |
|
131 /** |
|
132 * From CActive. |
|
133 * @see CActive |
|
134 */ |
|
135 void DoCancel(); |
|
136 |
|
137 /** |
|
138 * From CActive. |
|
139 * @see CActive |
|
140 */ |
|
141 TInt RunError( TInt aError ); |
|
142 |
|
143 |
|
144 |
|
145 private: // New private helper methods |
|
146 |
|
147 /** |
|
148 * Sends the real query to the client and waits it completion |
|
149 * or timeout. Returns user selection. |
|
150 * |
|
151 * @since 2.1 |
|
152 * @param aQueryMessageId The query ID. See |
|
153 * CnUiCommon.hrh for available remote UI messages. |
|
154 * @param aDynamicInsertText The dynamic insert text |
|
155 * to use in note. |
|
156 * @param aQueryTimeout The query timeout. |
|
157 * @param aDefaultResult The default result for timeout cases. |
|
158 * @param aClientsToShow The clients in which to show the query. |
|
159 * @return ETrue if the query was accepted, else EFalse. |
|
160 */ |
|
161 TBool IssueTheQueryL( TInt aQueryMessageId, |
|
162 const TDesC& aDynamicInsertText, |
|
163 TTimeIntervalMicroSeconds32 aQueryTimeout, |
|
164 TBool aDefaultResult, |
|
165 const TArray<TIMPSConnectionClient>& aClientsToShow ); |
|
166 |
|
167 /** |
|
168 * Waits the started asynchronous steps |
|
169 * to complete using the CActiveSchedulerWait. |
|
170 * |
|
171 * @since 2.1 |
|
172 */ |
|
173 void WaitCompletion(); |
|
174 |
|
175 |
|
176 /** |
|
177 * Stops the previously started |
|
178 * CActiveSchedulerWait wait loop. |
|
179 * |
|
180 * @since 2.1 |
|
181 */ |
|
182 void Completed(); |
|
183 |
|
184 |
|
185 /** |
|
186 * Issues the message to given groups. |
|
187 * |
|
188 * @since 2.1 |
|
189 * @param aRemoteMessage The remote message to send. |
|
190 * @param aExtraData The remote message extra data. |
|
191 * @param aClientGroups The client groups which to send |
|
192 */ |
|
193 void IssueMessageToGroupsL( TInt aRemoteMessage, |
|
194 const TDesC& aExtraData, |
|
195 const TArray<TIMPSConnectionClient>& aClientGroups ); |
|
196 |
|
197 /** |
|
198 * Cancels the previously issued channel messages. |
|
199 * |
|
200 * @since 2.1 |
|
201 */ |
|
202 void CancelActiveChannels(); |
|
203 |
|
204 |
|
205 /** |
|
206 * Removes identified channel among the currently |
|
207 * active ones. If there is found several channels with |
|
208 * given id's, removes all. |
|
209 * |
|
210 * @since 2.1 |
|
211 */ |
|
212 void RemoveFromActiveChannels( TInt aGroupId, TGCChannelID aChannelId ); |
|
213 |
|
214 |
|
215 private: //data |
|
216 |
|
217 ///< Active Scheduler Wait, owned |
|
218 CActiveSchedulerWait iWait; |
|
219 |
|
220 ///< Active group channels, owned |
|
221 RPointerArray<CCnUiGroupChannel> iGroupChannels; |
|
222 |
|
223 ///<Query result, owned |
|
224 TBool iQueryResult; |
|
225 }; |
|
226 |
|
227 #endif //__CCNUICLIENTGROUPUINOTIFYMEDIATOR_H |
|
228 |
|
229 // End of File |
|
230 |