|
1 /* |
|
2 * Copyright (c) 2009 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 { |
|
148 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::SaveL <=>" ); |
|
149 User::Leave( KErrNotSupported ); |
|
150 } |
|
151 |
|
152 // --------------------------------------------------------------------------- |
|
153 // CVmbxVoIpEngine::SaveProvisionedEntryL |
|
154 // Saves Provisioned voice mailbox number |
|
155 // --------------------------------------------------------------------------- |
|
156 // |
|
157 void CVmbxVoIpEngine::SaveProvisionedEntryL( |
|
158 const CVoiceMailboxEntry& /*aEntry*/ ) |
|
159 { |
|
160 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::SaveProvisionedEntryL <=>" ); |
|
161 User::Leave( KErrNotSupported ); |
|
162 } |
|
163 |
|
164 // ---------------------------------------------------------------------------- |
|
165 // CVmbxVoIpEngine::CheckConfiguration() |
|
166 // ---------------------------------------------------------------------------- |
|
167 // |
|
168 TBool CVmbxVoIpEngine::CheckConfiguration( |
|
169 const TVoiceMailboxParams& /*aParams*/, const TInt aFlags ) |
|
170 { |
|
171 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::CheckConfiguration: =>" ); |
|
172 TBool result( ETrue ); |
|
173 if ( EVmbxChangeNbrNotAllowedOnUi & aFlags ) |
|
174 { |
|
175 result = EFalse; |
|
176 } |
|
177 VMBLOGSTRING2( "VMBX: CVmbxVoIpEngine::CheckConfiguration: result%I <=", |
|
178 result ); |
|
179 return result; |
|
180 } |
|
181 |
|
182 // --------------------------------------------------------------------------- |
|
183 // CVmbxVoIpEngine::QueryDefineNumberL |
|
184 // |
|
185 // --------------------------------------------------------------------------- |
|
186 // |
|
187 void CVmbxVoIpEngine::QueryDefineNumberL( CVoiceMailboxEntry& /*aEntry*/ ) |
|
188 { |
|
189 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::QueryDefineNumberL <=>" ); |
|
190 User::Leave( KErrNotSupported ); |
|
191 } |
|
192 |
|
193 // ---------------------------------------------------------------------------- |
|
194 // CVmbxEngineBase::QueryChangeNumberL |
|
195 // |
|
196 // ---------------------------------------------------------------------------- |
|
197 // |
|
198 void CVmbxVoIpEngine::QueryChangeNumberL( CVoiceMailboxEntry& /*aEntry*/ ) |
|
199 { |
|
200 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::QueryChangeNumberL <=>" ); |
|
201 User::Leave( KErrNotSupported ); |
|
202 } |
|
203 |
|
204 // Commented out because branding is not supported yet. |
|
205 // --------------------------------------------------------------------------- |
|
206 // CVmbxVoIpEngine::GetVmbxImageL |
|
207 // |
|
208 // --------------------------------------------------------------------------- |
|
209 // |
|
210 /* CGulIcon* CVmbxVoIpEngine::GetVmbxImageL( const TVoiceMailboxParams& aParams ) |
|
211 { |
|
212 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::GetVmbxImageL =>" ); |
|
213 CGulIcon* guiIcon( NULL ); |
|
214 if ( IsVoIPProfilesFound() ) |
|
215 { |
|
216 TBuf8<KSPMaxDesLength> brandId( KNullDesC8 ); |
|
217 BrandIdL(aParams.iServiceId, brandId ); |
|
218 |
|
219 CFbsBitmap* brandedBitmap( NULL ); |
|
220 CFbsBitmap* brandedBitmapMask( NULL ); |
|
221 TRAPD( err, GetBrandedIconL( |
|
222 brandId, brandedBitmap, brandedBitmapMask ) ); |
|
223 |
|
224 if ( KErrNotFound == err ) |
|
225 { |
|
226 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::GetVmbxImageL: \ |
|
227 no found profiles<= " ); |
|
228 guiIcon = iProvider.VmbxUiUtilities().GetVmbxImageL( aParams ); |
|
229 } |
|
230 else if ( KErrNone == err ) |
|
231 { |
|
232 guiIcon = |
|
233 CGulIcon::NewL( brandedBitmap, brandedBitmapMask ); |
|
234 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::GetVmbxImageL: \ |
|
235 found profiles" ); |
|
236 } |
|
237 } |
|
238 else |
|
239 { |
|
240 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::GetVmbxImageL: use default " ); |
|
241 guiIcon = iProvider.VmbxUiUtilities().GetVmbxImageL( aParams ); |
|
242 } |
|
243 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::GetVmbxImageL <=" ); |
|
244 return guiIcon; |
|
245 } */ |
|
246 |
|
247 // --------------------------------------------------------------------------- |
|
248 // CVmbxVoIpEngine::IsVoIPProfilesFound |
|
249 // |
|
250 // --------------------------------------------------------------------------- |
|
251 // |
|
252 TBool CVmbxVoIpEngine::IsVoIPProfilesFound() |
|
253 { |
|
254 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::IsVoIPProfilesFound <=>" ); |
|
255 return iVmSpsHandler->IsVoIPProfilesFound(); |
|
256 } |
|
257 |
|
258 // --------------------------------------------------------------------------- |
|
259 // CVmbxVoIpEngine::GetServiceIds |
|
260 // |
|
261 // --------------------------------------------------------------------------- |
|
262 // |
|
263 void CVmbxVoIpEngine::GetServiceIdsL( RIdArray& aProfileIds ) |
|
264 { |
|
265 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::GetServiceIds: =>" ); |
|
266 if ( VmbxUtilities::VoIPSupported() && IsVoIPProfilesFound() ) |
|
267 { |
|
268 iVmSpsHandler->GetServiceIdsL( aProfileIds ); |
|
269 } |
|
270 else |
|
271 { |
|
272 User::Leave( KErrNotFound ); |
|
273 } |
|
274 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::GetServiceIds: <=" ); |
|
275 } |
|
276 |
|
277 // --------------------------------------------------------------------------- |
|
278 // CVmbxVoIpEngine::GetBrandedIconL |
|
279 // |
|
280 // --------------------------------------------------------------------------- |
|
281 // |
|
282 /* void CVmbxVoIpEngine::GetBrandedIconL( const TDesC8& aBrandingId, |
|
283 CFbsBitmap*& aBrandedBitmap, CFbsBitmap*& aBrandedBitmapMask ) |
|
284 { |
|
285 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::GetBrandedIconL: =>" ); |
|
286 |
|
287 iVmBsHandler->GetBrandedIconL( |
|
288 aBrandingId, aBrandedBitmap, aBrandedBitmapMask ); |
|
289 |
|
290 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::GetBrandedIconL: <=" ); |
|
291 } |
|
292 */ |
|
293 // --------------------------------------------------------------------------- |
|
294 // CVmbxVoIpEngine::BrandIdL |
|
295 // |
|
296 // --------------------------------------------------------------------------- |
|
297 // |
|
298 void CVmbxVoIpEngine::BrandIdL( TInt aServiceId, TDes8& aBrandId ) |
|
299 { |
|
300 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::BrandIdL: =>" ); |
|
301 |
|
302 if ( VmbxUtilities::VoIPSupported() ) |
|
303 { |
|
304 iVmSpsHandler->BrandIdL( aServiceId, aBrandId ); |
|
305 } |
|
306 |
|
307 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::BrandIdL: <=" ); |
|
308 } |
|
309 |
|
310 // --------------------------------------------------------------------------- |
|
311 // CVmbxVoIpEngine::GetServiceInfo |
|
312 // |
|
313 // --------------------------------------------------------------------------- |
|
314 // |
|
315 TInt CVmbxVoIpEngine::GetServiceInfo( TVmbxServiceInfo& aServiceInfo ) |
|
316 { |
|
317 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::GetServiceInfo: =>" ); |
|
318 TInt ret( KErrNotFound ); |
|
319 if ( VmbxUtilities::VoIPSupported() ) |
|
320 { |
|
321 ret = iVmSpsHandler->GetServiceInfo( aServiceInfo ); |
|
322 } |
|
323 VMBLOGSTRING( "VMBX: CVmbxVoIpEngine::GetServiceInfo: <=" ); |
|
324 return ret; |
|
325 } |
|
326 |
|
327 // End of file |