|
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: Implements fundamental services interface. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "CCAImpsFundClient.h" |
|
22 #include "TCAInterfaceSignaller.h" |
|
23 |
|
24 // ============================ MEMBER FUNCTIONS =============================== |
|
25 |
|
26 // ----------------------------------------------------------------------------- |
|
27 // CCAImpsFundClient::CCAImpsFundClient |
|
28 // C++ default constructor can NOT contain any code, that |
|
29 // might leave. |
|
30 // ----------------------------------------------------------------------------- |
|
31 // |
|
32 CCAImpsFundClient::CCAImpsFundClient( RImpsEng& aImpsEng ) |
|
33 : iImpsEng( aImpsEng ) |
|
34 { |
|
35 } |
|
36 |
|
37 // ----------------------------------------------------------------------------- |
|
38 // CCAImpsFundClient::NewL |
|
39 // Two-phased constructor. |
|
40 // ----------------------------------------------------------------------------- |
|
41 // |
|
42 CCAImpsFundClient* CCAImpsFundClient::NewL( RImpsEng& aImpsEng ) |
|
43 { |
|
44 CCAImpsFundClient* self = new( ELeave ) CCAImpsFundClient( aImpsEng ); |
|
45 return self; |
|
46 } |
|
47 |
|
48 // Destructor |
|
49 CCAImpsFundClient::~CCAImpsFundClient() |
|
50 { |
|
51 } |
|
52 |
|
53 // ----------------------------------------------------------------------------- |
|
54 // CCAImpsFundClient::InterfaceL |
|
55 // Returns registered WV Engine interface. Implements lazy initialization. |
|
56 // (other items were commented in a header). |
|
57 // ----------------------------------------------------------------------------- |
|
58 // |
|
59 RImpsFundClient2* CCAImpsFundClient::InterfaceL() |
|
60 { |
|
61 if ( iLazyInitialization ) |
|
62 { |
|
63 // Connect to IMPS engine (server) |
|
64 TCAInterfaceSignaller::ConnectL(); |
|
65 |
|
66 iClient.RegisterL( iImpsEng, iSearchHandler, iInviteHandler, KNullDesC, |
|
67 ETrue, iPriority ); |
|
68 iLazyInitialization = EFalse; |
|
69 iRegistered = ETrue; |
|
70 if ( iErrorHandler ) |
|
71 { |
|
72 iClient.RegisterErrorObserverL( *iErrorHandler ); |
|
73 } |
|
74 if ( iStatusHandler ) |
|
75 { |
|
76 iClient.RegisterStatusObserverL( iStatusHandler ); |
|
77 } |
|
78 } |
|
79 return &iClient; |
|
80 } |
|
81 |
|
82 // ----------------------------------------------------------------------------- |
|
83 // CCAImpsFundClient::RegisterL |
|
84 // Stores values for later registration. Implements lazy initialization. |
|
85 // (other items were commented in a header). |
|
86 // ----------------------------------------------------------------------------- |
|
87 // |
|
88 void CCAImpsFundClient::RegisterL( MImpsSearchHandler2* aSearchObs, |
|
89 MImpsInviteHandler2* aInviteObs, TInt aPriority /* = 0 */ ) |
|
90 { |
|
91 iPriority = aPriority; |
|
92 iSearchHandler = aSearchObs; |
|
93 iInviteHandler = aInviteObs; |
|
94 iLazyInitialization = ETrue; |
|
95 } |
|
96 |
|
97 // ----------------------------------------------------------------------------- |
|
98 // CCAImpsFundClient::Unregister |
|
99 // Unregisters if registered. Clears member variables. |
|
100 // (other items were commented in a header). |
|
101 // ----------------------------------------------------------------------------- |
|
102 // |
|
103 void CCAImpsFundClient::Unregister() |
|
104 { |
|
105 if ( iRegistered ) |
|
106 { |
|
107 iClient.Unregister(); |
|
108 } |
|
109 iLazyInitialization = ETrue; |
|
110 iRegistered = EFalse; |
|
111 } |
|
112 |
|
113 // ----------------------------------------------------------------------------- |
|
114 // CCAImpsFundClient::GetServicesL |
|
115 // Forwards the call to WV Engine. |
|
116 // (other items were commented in a header). |
|
117 // ----------------------------------------------------------------------------- |
|
118 // |
|
119 void CCAImpsFundClient::GetServicesL( TImpsServices& aServices ) |
|
120 { |
|
121 InterfaceL()->GetServicesL( aServices ); |
|
122 } |
|
123 |
|
124 // ----------------------------------------------------------------------------- |
|
125 // CCAImpsFundClient::SearchFirstL |
|
126 // Forwards the call to WV Engine. |
|
127 // (other items were commented in a header). |
|
128 // ----------------------------------------------------------------------------- |
|
129 // |
|
130 TInt CCAImpsFundClient::SearchFirstL( const CSearchPairs& aPairs, |
|
131 TInt aSearchLimit ) |
|
132 { |
|
133 return InterfaceL()->SearchFirstL( aPairs, aSearchLimit ); |
|
134 } |
|
135 |
|
136 // ----------------------------------------------------------------------------- |
|
137 // CCAImpsFundClient::SearchNextL |
|
138 // Forwards the call to WV Engine. |
|
139 // (other items were commented in a header). |
|
140 // ----------------------------------------------------------------------------- |
|
141 // |
|
142 TInt CCAImpsFundClient::SearchNextL( TInt aSearchID, TInt aIndex ) |
|
143 { |
|
144 return InterfaceL()->SearchNextL( aSearchID, aIndex ); |
|
145 } |
|
146 |
|
147 // ----------------------------------------------------------------------------- |
|
148 // CCAImpsFundClient::StopSearchL |
|
149 // Forwards the call to WV Engine. |
|
150 // (other items were commented in a header). |
|
151 // ----------------------------------------------------------------------------- |
|
152 // |
|
153 TInt CCAImpsFundClient::StopSearchL( TInt aSearchID ) |
|
154 { |
|
155 return InterfaceL()->StopSearchL( aSearchID ); |
|
156 } |
|
157 |
|
158 // ----------------------------------------------------------------------------- |
|
159 // CCAImpsFundClient::InviteGroupRequestL |
|
160 // Forwards the call to WV Engine. |
|
161 // (other items were commented in a header). |
|
162 // ----------------------------------------------------------------------------- |
|
163 // |
|
164 TInt CCAImpsFundClient::InviteGroupRequestL( const TDesC& aInviteID, |
|
165 const MDesCArray* aUserID, const MDesCArray* aScreenName, |
|
166 const MDesCArray* aGroupName, const TDesC& aInviteGroup, |
|
167 const TDesC& aOwnScreenName, const TDesC& aOwnGroupName, |
|
168 const TDesC& aInviteReason, const TInt aValidityPeriod ) |
|
169 { |
|
170 return InterfaceL()->GroupInviteL( aInviteID, |
|
171 aUserID, |
|
172 aScreenName, |
|
173 aGroupName, |
|
174 aInviteGroup, |
|
175 aOwnScreenName, |
|
176 aOwnGroupName, |
|
177 aInviteReason, |
|
178 aValidityPeriod ); |
|
179 } |
|
180 |
|
181 // ----------------------------------------------------------------------------- |
|
182 // CCAImpsFundClient::CancelGroupInviteRequestL |
|
183 // Forwards the call to WV Engine. |
|
184 // (other items were commented in a header). |
|
185 // ----------------------------------------------------------------------------- |
|
186 // |
|
187 TInt CCAImpsFundClient::CancelGroupInviteRequestL( const TDesC& aInviteId, |
|
188 const MDesCArray* aUserId, const MDesCArray* aScreenName, |
|
189 const MDesCArray* aGroupName, const TDesC& aCancelReason, |
|
190 const TDesC& aOwnScreenName, const TDesC& aOwnGroupName ) |
|
191 { |
|
192 return InterfaceL()->CancelInviteL( aInviteId, aUserId, aScreenName, |
|
193 aGroupName, aCancelReason, aOwnScreenName, aOwnGroupName ); |
|
194 } |
|
195 |
|
196 // ----------------------------------------------------------------------------- |
|
197 // CCAImpsFundClient::GroupInviteUserResponseL |
|
198 // Forwards the call to WV Engine. |
|
199 // (other items were commented in a header). |
|
200 // ----------------------------------------------------------------------------- |
|
201 // |
|
202 TInt CCAImpsFundClient::GroupInviteUserResponseL( const TDesC& aInviteId, |
|
203 TBool aAcceptance, const TDesC& aInviteResponse, |
|
204 const TDesC& aOwnScreenName, const TDesC& aOwnGroupName ) |
|
205 { |
|
206 return InterfaceL()->InviteResponseL( aInviteId, aAcceptance, |
|
207 aInviteResponse, aOwnScreenName, aOwnGroupName ); |
|
208 } |
|
209 |
|
210 // ----------------------------------------------------------------------------- |
|
211 // CCAImpsFundClient::RegisterErrorObserverL |
|
212 // Calls WV Engine if registered. |
|
213 // (other items were commented in a header). |
|
214 // ----------------------------------------------------------------------------- |
|
215 // |
|
216 void CCAImpsFundClient::RegisterErrorObserverL( MImpsErrorHandler2 &aObs ) |
|
217 { |
|
218 iErrorHandler = &aObs; |
|
219 if ( iRegistered ) |
|
220 { |
|
221 InterfaceL()->RegisterErrorObserverL( *iErrorHandler ); |
|
222 } |
|
223 } |
|
224 |
|
225 // ----------------------------------------------------------------------------- |
|
226 // CCAImpsFundClient::UnregisterErrorObserverL |
|
227 // Calls WV Engine always. |
|
228 // (other items were commented in a header). |
|
229 // ----------------------------------------------------------------------------- |
|
230 // |
|
231 void CCAImpsFundClient::UnregisterErrorObserverL() |
|
232 { |
|
233 iClient.UnregisterErrorObserverL(); |
|
234 } |
|
235 |
|
236 // ----------------------------------------------------------------------------- |
|
237 // CCAImpsFundClient::RegisterStatusObserverL |
|
238 // Calls WV Engine if registered. |
|
239 // (other items were commented in a header). |
|
240 // ----------------------------------------------------------------------------- |
|
241 // |
|
242 void CCAImpsFundClient::RegisterStatusObserverL( MImpsStatusHandler2 *aObs ) |
|
243 { |
|
244 iStatusHandler = aObs; |
|
245 if ( iRegistered ) |
|
246 { |
|
247 InterfaceL()->RegisterStatusObserverL( iStatusHandler ); |
|
248 } |
|
249 } |
|
250 |
|
251 // ----------------------------------------------------------------------------- |
|
252 // CCAImpsFundClient::UnregisterStatusObserverL |
|
253 // Calls WV Engine always. |
|
254 // (other items were commented in a header). |
|
255 // ----------------------------------------------------------------------------- |
|
256 // |
|
257 void CCAImpsFundClient::UnregisterStatusObserverL() |
|
258 { |
|
259 iClient.UnregisterStatusObserverL(); |
|
260 } |
|
261 |
|
262 // ----------------------------------------------------------------------------- |
|
263 // CCAImpsFundClient::StatusHandler |
|
264 // Returns current status handler. |
|
265 // (other items were commented in a header). |
|
266 // ----------------------------------------------------------------------------- |
|
267 // |
|
268 MImpsStatusHandler2* CCAImpsFundClient::StatusHandler() const |
|
269 { |
|
270 return iStatusHandler; |
|
271 } |
|
272 |
|
273 // ----------------------------------------------------------------------------- |
|
274 // CCAImpsFundClient::ErrorHandler |
|
275 // Returns current error handler. |
|
276 // (other items were commented in a header). |
|
277 // ----------------------------------------------------------------------------- |
|
278 // |
|
279 MImpsErrorHandler2* CCAImpsFundClient::ErrorHandler() const |
|
280 { |
|
281 return iErrorHandler; |
|
282 } |
|
283 |
|
284 // End of File |