1 /* |
|
2 * Copyright (c) 2009-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: Implementation of the CVmbxVoIpEngine class |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include <fbs.h> |
|
20 #include <cvoicemailboxentry.h> |
|
21 |
|
22 #include "vmbxenginebase.h" |
|
23 #include "vmbxlogger.h" |
|
24 #include "vmbxuiutilities.h" |
|
25 #include "vmbxutilities.h" |
|
26 #include "vmspshandler.h" |
|
27 #include "vmbshandler.h" |
|
28 #include "voicemailboxdefsinternal.h" |
|
29 #include "vmbxvoipengine.h" |
|
30 |
|
31 // ============================ MEMBER FUNCTIONS ============================= |
|
32 |
|
33 // --------------------------------------------------------------------------- |
|
34 // CVmbxVoIpEngine::CVmbxVoIpEngine |
|
35 // C++ default constructor can NOT contain any code, that |
|
36 // might leave. |
|
37 // --------------------------------------------------------------------------- |
|
38 // |
|
39 CVmbxVoIpEngine::CVmbxVoIpEngine( MVmbxResourceProvider& aProvider ) |
|
40 : CVmbxEngineBase( aProvider ) |
|
41 { |
|
42 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::CVmbxVoIpEngine =>" ); |
|
43 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::CVmbxVoIpEngine <=" ); |
|
44 } |
|
45 |
|
46 // --------------------------------------------------------------------------- |
|
47 // CVmbxVoIpEngine::~CVmbxVoIpEngine |
|
48 // Destructor. |
|
49 // --------------------------------------------------------------------------- |
|
50 // |
|
51 CVmbxVoIpEngine::~CVmbxVoIpEngine() |
|
52 { |
|
53 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::~CVmbxVoIpEngine =>" ); |
|
54 delete iVmSpsHandler; |
|
55 delete iVmBsHandler; |
|
56 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::~CVmbxVoIpEngine <=" ); |
|
57 } |
|
58 |
|
59 // --------------------------------------------------------------------------- |
|
60 // CVmbxVoIpEngine::NewL |
|
61 // Two-phased constructor. |
|
62 // --------------------------------------------------------------------------- |
|
63 // |
|
64 CVmbxVoIpEngine* CVmbxVoIpEngine::NewL( MVmbxResourceProvider& aProvider) |
|
65 { |
|
66 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::NewL =>" ); |
|
67 if ( !VmbxUtilities::VoIPSupported() ) |
|
68 { |
|
69 User::Leave( KErrNotSupported ); |
|
70 } |
|
71 |
|
72 CVmbxVoIpEngine* self = new( ELeave ) CVmbxVoIpEngine( aProvider ); |
|
73 CleanupStack::PushL( self ); |
|
74 self->ConstructL(); |
|
75 CleanupStack::Pop( self ); |
|
76 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::NewL <=" ); |
|
77 return self; |
|
78 } |
|
79 |
|
80 // --------------------------------------------------------------------------- |
|
81 // CVmbxVoIpEngine::ConstructL |
|
82 // Symbian 2nd phase constructor can leave. |
|
83 // --------------------------------------------------------------------------- |
|
84 // |
|
85 void CVmbxVoIpEngine::ConstructL() |
|
86 { |
|
87 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::ConstructL =>" ); |
|
88 if ( VmbxUtilities::VoIPSupported() ) |
|
89 { |
|
90 iVmSpsHandler = CVmSPSHandler::NewL(); |
|
91 } |
|
92 |
|
93 iVmBsHandler = CVmBSHandler::NewL(); |
|
94 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::ConstructL <=" ); |
|
95 } |
|
96 |
|
97 // --------------------------------------------------------------------------- |
|
98 // CVmbxVoIpEngine::GetL |
|
99 // Gets voice mailbox number |
|
100 // --------------------------------------------------------------------------- |
|
101 // |
|
102 void CVmbxVoIpEngine::GetL( CVoiceMailboxEntry*& aEntry ) |
|
103 { |
|
104 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::GetL =>" ); |
|
105 TInt result( KErrNone ); |
|
106 CVoiceMailboxEntry* vmbxEntry = CVoiceMailboxEntry::NewLC(); |
|
107 |
|
108 vmbxEntry->SetVoiceMailboxType( EVmbxVoip ); |
|
109 vmbxEntry->SetServiceId( iVmbxServiceId ); |
|
110 |
|
111 HBufC8* brandId = HBufC8::NewLC( KSPMaxDesLength ); |
|
112 TPtr8 ptr( brandId->Des() ); |
|
113 BrandIdL( iVmbxServiceId, ptr ); |
|
114 // set brand id |
|
115 result = vmbxEntry->SetBrandId( ptr ); |
|
116 CleanupStack::PopAndDestroy( brandId ); |
|
117 if ( KErrNone == result ) |
|
118 { |
|
119 TVmbxServiceInfo serviceInfo; |
|
120 serviceInfo.iServiceId = iVmbxServiceId; |
|
121 result = GetServiceInfo( serviceInfo ); |
|
122 if ( KErrNone == result ) |
|
123 { |
|
124 // set voip name |
|
125 result = vmbxEntry->SetVmbxName( serviceInfo.iName ); |
|
126 if ( KErrNone == result ) |
|
127 { |
|
128 // set voip address |
|
129 result = vmbxEntry->SetVmbxNumber( serviceInfo.iAddress ); |
|
130 } |
|
131 } |
|
132 } |
|
133 VMBLOGSTRING2( "VMBX: CVmbxVoIpEngine::GetL: result=%I", result ); |
|
134 User::LeaveIfError( result ); |
|
135 CleanupStack::Pop( vmbxEntry ); |
|
136 aEntry = vmbxEntry; |
|
137 vmbxEntry = NULL; |
|
138 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::GetL <=" ); |
|
139 } |
|
140 |
|
141 // --------------------------------------------------------------------------- |
|
142 // CVmbxVoIpEngine::SaveL |
|
143 // Saves voice mailbox number |
|
144 // --------------------------------------------------------------------------- |
|
145 // |
|
146 void CVmbxVoIpEngine::SaveL( const CVoiceMailboxEntry& /*aEntry*/, |
|
147 TBool /*aShowNotesAllowed*/ ) |
|
148 { |
|
149 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::SaveL <=>" ); |
|
150 User::Leave( KErrNotSupported ); |
|
151 } |
|
152 |
|
153 // --------------------------------------------------------------------------- |
|
154 // CVmbxVoIpEngine::SaveProvisionedEntryL |
|
155 // Saves Provisioned voice mailbox number |
|
156 // --------------------------------------------------------------------------- |
|
157 // |
|
158 void CVmbxVoIpEngine::SaveProvisionedEntryL( |
|
159 const CVoiceMailboxEntry& /*aEntry*/ ) |
|
160 { |
|
161 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::SaveProvisionedEntryL <=>" ); |
|
162 User::Leave( KErrNotSupported ); |
|
163 } |
|
164 |
|
165 // ---------------------------------------------------------------------------- |
|
166 // CVmbxVoIpEngine::CheckConfiguration() |
|
167 // ---------------------------------------------------------------------------- |
|
168 // |
|
169 TBool CVmbxVoIpEngine::CheckConfiguration( |
|
170 const TVoiceMailboxParams& aParams, const TInt aFlags ) |
|
171 { |
|
172 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::CheckConfiguration: =>" ); |
|
173 TBool result( EFalse ); |
|
174 result = CVmbxEngineBase::CheckConfiguration(aParams, aFlags); |
|
175 VMBLOGSTRING2( "VMBX: CVmbxVoIpEngine::CheckConfiguration: result%I <=", |
|
176 result ); |
|
177 return result; |
|
178 } |
|
179 |
|
180 // --------------------------------------------------------------------------- |
|
181 // CVmbxVoIpEngine::QueryDefineNumberL |
|
182 // |
|
183 // --------------------------------------------------------------------------- |
|
184 // |
|
185 void CVmbxVoIpEngine::QueryDefineNumberL( CVoiceMailboxEntry& /*aEntry*/ ) |
|
186 { |
|
187 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::QueryDefineNumberL <=>" ); |
|
188 User::Leave( KErrNotSupported ); |
|
189 } |
|
190 |
|
191 // ---------------------------------------------------------------------------- |
|
192 // CVmbxEngineBase::QueryChangeNumberL |
|
193 // |
|
194 // ---------------------------------------------------------------------------- |
|
195 // |
|
196 void CVmbxVoIpEngine::QueryChangeNumberL( CVoiceMailboxEntry& /*aEntry*/ ) |
|
197 { |
|
198 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::QueryChangeNumberL <=>" ); |
|
199 User::Leave( KErrNotSupported ); |
|
200 } |
|
201 |
|
202 // Commented out because branding is not supported yet. |
|
203 // --------------------------------------------------------------------------- |
|
204 // CVmbxVoIpEngine::GetVmbxImageL |
|
205 // |
|
206 // --------------------------------------------------------------------------- |
|
207 // |
|
208 /* CGulIcon* CVmbxVoIpEngine::GetVmbxImageL( const TVoiceMailboxParams& aParams ) |
|
209 { |
|
210 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::GetVmbxImageL =>" ); |
|
211 CGulIcon* guiIcon( NULL ); |
|
212 if ( IsVoIPProfilesFound() ) |
|
213 { |
|
214 TBuf8<KSPMaxDesLength> brandId( KNullDesC8 ); |
|
215 BrandIdL(aParams.iServiceId, brandId ); |
|
216 |
|
217 CFbsBitmap* brandedBitmap( NULL ); |
|
218 CFbsBitmap* brandedBitmapMask( NULL ); |
|
219 TRAPD( err, GetBrandedIconL( |
|
220 brandId, brandedBitmap, brandedBitmapMask ) ); |
|
221 |
|
222 if ( KErrNotFound == err ) |
|
223 { |
|
224 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::GetVmbxImageL: \ |
|
225 no found profiles<= " ); |
|
226 guiIcon = iProvider.VmbxUiUtilities().GetVmbxImageL( aParams ); |
|
227 } |
|
228 else if ( KErrNone == err ) |
|
229 { |
|
230 guiIcon = |
|
231 CGulIcon::NewL( brandedBitmap, brandedBitmapMask ); |
|
232 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::GetVmbxImageL: \ |
|
233 found profiles" ); |
|
234 } |
|
235 } |
|
236 else |
|
237 { |
|
238 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::GetVmbxImageL: use default " ); |
|
239 guiIcon = iProvider.VmbxUiUtilities().GetVmbxImageL( aParams ); |
|
240 } |
|
241 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::GetVmbxImageL <=" ); |
|
242 return guiIcon; |
|
243 } */ |
|
244 |
|
245 // --------------------------------------------------------------------------- |
|
246 // CVmbxVoIpEngine::IsVoIPProfilesFound |
|
247 // |
|
248 // --------------------------------------------------------------------------- |
|
249 // |
|
250 TBool CVmbxVoIpEngine::IsVoIPProfilesFound() |
|
251 { |
|
252 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::IsVoIPProfilesFound <=>" ); |
|
253 return iVmSpsHandler->IsVoIPProfilesFound(); |
|
254 } |
|
255 |
|
256 // --------------------------------------------------------------------------- |
|
257 // CVmbxVoIpEngine::GetServiceIds |
|
258 // |
|
259 // --------------------------------------------------------------------------- |
|
260 // |
|
261 void CVmbxVoIpEngine::GetServiceIdsL( RIdArray& aProfileIds ) |
|
262 { |
|
263 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::GetServiceIds: =>" ); |
|
264 if ( VmbxUtilities::VoIPSupported() && IsVoIPProfilesFound() ) |
|
265 { |
|
266 iVmSpsHandler->GetServiceIdsL( aProfileIds ); |
|
267 } |
|
268 else |
|
269 { |
|
270 User::Leave( KErrNotFound ); |
|
271 } |
|
272 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::GetServiceIds: <=" ); |
|
273 } |
|
274 |
|
275 // --------------------------------------------------------------------------- |
|
276 // CVmbxVoIpEngine::GetBrandedIconL |
|
277 // |
|
278 // --------------------------------------------------------------------------- |
|
279 // |
|
280 /* void CVmbxVoIpEngine::GetBrandedIconL( const TDesC8& aBrandingId, |
|
281 CFbsBitmap*& aBrandedBitmap, CFbsBitmap*& aBrandedBitmapMask ) |
|
282 { |
|
283 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::GetBrandedIconL: =>" ); |
|
284 |
|
285 iVmBsHandler->GetBrandedIconL( |
|
286 aBrandingId, aBrandedBitmap, aBrandedBitmapMask ); |
|
287 |
|
288 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::GetBrandedIconL: <=" ); |
|
289 } |
|
290 */ |
|
291 // --------------------------------------------------------------------------- |
|
292 // CVmbxVoIpEngine::BrandIdL |
|
293 // |
|
294 // --------------------------------------------------------------------------- |
|
295 // |
|
296 void CVmbxVoIpEngine::BrandIdL( TInt aServiceId, TDes8& aBrandId ) |
|
297 { |
|
298 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::BrandIdL: =>" ); |
|
299 |
|
300 if ( VmbxUtilities::VoIPSupported() ) |
|
301 { |
|
302 iVmSpsHandler->BrandIdL( aServiceId, aBrandId ); |
|
303 } |
|
304 |
|
305 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::BrandIdL: <=" ); |
|
306 } |
|
307 |
|
308 // --------------------------------------------------------------------------- |
|
309 // CVmbxVoIpEngine::GetServiceInfo |
|
310 // |
|
311 // --------------------------------------------------------------------------- |
|
312 // |
|
313 TInt CVmbxVoIpEngine::GetServiceInfo( TVmbxServiceInfo& aServiceInfo ) |
|
314 { |
|
315 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::GetServiceInfo: =>" ); |
|
316 TInt ret( KErrNotFound ); |
|
317 if ( VmbxUtilities::VoIPSupported() ) |
|
318 { |
|
319 ret = iVmSpsHandler->GetServiceInfo( aServiceInfo ); |
|
320 } |
|
321 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::GetServiceInfo: <=" ); |
|
322 return ret; |
|
323 } |
|
324 |
|
325 // End of file |
|