291 // CCchImpl::GetServicesL |
291 // CCchImpl::GetServicesL |
292 // --------------------------------------------------------------------------- |
292 // --------------------------------------------------------------------------- |
293 // |
293 // |
294 void CCchImpl::GetServicesL( TCCHSubserviceType aType, |
294 void CCchImpl::GetServicesL( TCCHSubserviceType aType, |
295 RPointerArray<CCchService>& aServices ) |
295 RPointerArray<CCchService>& aServices ) |
296 { |
296 { |
297 TInt error = KErrNone; |
297 TInt error = KErrNone; |
298 TServiceSelection selection( 0, aType, ECchInitial ); |
298 TServiceSelection selection( 0, aType, ECchInitial ); |
299 CCHLOGSTRING( "CCchImpl::GetServices: IN" ); |
299 CCHLOGSTRING( "CCchImpl::GetServices: IN" ); |
300 CCchServiceImpl* cchServiceImpl = NULL; |
300 CCchServiceImpl* cchServiceImpl = NULL; |
301 CArrayFixFlat<TCCHService>* cchServices; |
301 CArrayFixFlat<TCCHService>* cchServices; |
302 cchServices = new (ELeave) CArrayFixFlat<TCCHService>(1); |
302 cchServices = new (ELeave) CArrayFixFlat<TCCHService>(1); |
303 CleanupStack::PushL( cchServices ); |
303 CleanupStack::PushL( cchServices ); |
304 error = GetCchServicesL( 0, aType, *cchServices ); |
304 error = GetCchServicesL( 0, aType, *cchServices ); |
305 if( KErrNone == error ) |
305 if( KErrNone == error ) |
306 { |
306 { |
307 for ( TInt i = 0; i < cchServices->Count(); i++ ) |
307 for ( TInt i = 0; i < cchServices->Count(); i++ ) |
308 { |
308 { |
309 TCCHService service = cchServices->At( i ); |
309 TCCHService service = cchServices->At( i ); |
310 TInt idx =idx = FindService( service.iServiceId ); |
310 TInt idx = FindService( service.iServiceId ); |
311 if( idx == KErrNotFound ) |
311 if( idx == KErrNotFound ) |
312 { |
312 { |
313 cchServiceImpl = CCchServiceImpl::NewL( *this, service.iServiceId, |
313 cchServiceImpl = CCchServiceImpl::NewL( *this, service.iServiceId, |
314 *iCchUi ); |
314 *iCchUi ); |
315 error = iCchServiceImpls.Append( cchServiceImpl ); |
315 error = iCchServiceImpls.Append( cchServiceImpl ); |
316 if( error == KErrNone ) |
316 if( error == KErrNone ) |
317 { |
317 { |
318 cchServiceImpl = iCchServiceImpls[ iCchServiceImpls.Count() - 1 ]; |
318 cchServiceImpl = iCchServiceImpls[ iCchServiceImpls.Count() - 1 ]; |
319 } |
319 } |
320 else |
320 else |
321 { |
321 { |
322 delete cchServiceImpl; |
322 delete cchServiceImpl; |
323 cchServiceImpl = NULL; |
323 cchServiceImpl = NULL; |
324 } |
324 } |
325 } |
325 } |
326 else |
326 else |
327 { |
327 { |
328 cchServiceImpl = iCchServiceImpls[ idx ]; |
328 cchServiceImpl = iCchServiceImpls[ idx ]; |
329 } |
329 } |
330 error = aServices.Append( cchServiceImpl ); |
330 error = aServices.Append( cchServiceImpl ); |
331 if( error ) |
331 if( error ) |
332 { |
332 { |
333 delete cchServiceImpl; |
333 delete cchServiceImpl; |
334 cchServiceImpl = NULL; |
334 cchServiceImpl = NULL; |
335 } |
335 } |
336 } |
336 } |
337 } |
337 } |
338 cchServices->Reset(); |
338 cchServices->Reset(); |
339 CleanupStack::PopAndDestroy( cchServices ); |
339 CleanupStack::PopAndDestroy( cchServices ); |
340 CCHLOGSTRING( "CCchImpl::GetServices: OUT" ); |
340 CCHLOGSTRING( "CCchImpl::GetServices: OUT" ); |
341 User::LeaveIfError( error ); |
341 User::LeaveIfError( error ); |
342 } |
342 } |
343 |
343 |
344 // --------------------------------------------------------------------------- |
344 // --------------------------------------------------------------------------- |
345 // CCCHServiceHandler::FindService |
345 // CCCHServiceHandler::FindService |
346 // --------------------------------------------------------------------------- |
346 // --------------------------------------------------------------------------- |
347 // |
347 // |