|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalComponent |
|
21 */ |
|
22 |
|
23 #include "cmtpbearermonitor.h" |
|
24 #include <locodservicepluginobserver.h> |
|
25 |
|
26 #include "cmtpbluetoothcontroller.h" |
|
27 |
|
28 __FLOG_STMT( _LIT8( KComponent, "mtpbearermonitor" ); ) |
|
29 |
|
30 CMTPBearerMonitor* CMTPBearerMonitor::NewL( TLocodServicePluginParams& aParams ) |
|
31 { |
|
32 CMTPBearerMonitor* self = new( ELeave ) CMTPBearerMonitor( aParams ); |
|
33 CleanupStack::PushL( self ); |
|
34 self->ConstructL(); |
|
35 CleanupStack::Pop( self ); |
|
36 return self; |
|
37 } |
|
38 |
|
39 CMTPBearerMonitor::~CMTPBearerMonitor() |
|
40 { |
|
41 iMTPControllers.ResetAndDestroy(); |
|
42 iMTPControllers.Close(); |
|
43 __FLOG( _L8("+/-Dtor") ); |
|
44 __FLOG_CLOSE; |
|
45 } |
|
46 |
|
47 void CMTPBearerMonitor::ManageServiceCompleted( TLocodBearer aBearer, TBool aStatus, TInt aError ) |
|
48 { |
|
49 Observer().ManageServiceCompleted( aBearer, aStatus, ImplementationUid(), aError ); |
|
50 } |
|
51 |
|
52 void CMTPBearerMonitor::ManageService( TLocodBearer aBearer, TBool aStatus ) |
|
53 { |
|
54 __FLOG_2( _L8("+/-ManageService( 0x%08X, %d )"), aBearer, aStatus ); |
|
55 TInt count = iMTPControllers.Count(); |
|
56 TBool foundController = EFalse; |
|
57 for ( TInt i = 0; i < count; ++i ) |
|
58 { |
|
59 if ( aBearer == iMTPControllers[i]->Bearer() ) |
|
60 { |
|
61 iMTPControllers[i]->ManageService( aStatus ); |
|
62 foundController = ETrue; |
|
63 } |
|
64 } |
|
65 if ( !foundController ) |
|
66 { |
|
67 ManageServiceCompleted( aBearer, aStatus, KErrNone ); |
|
68 } |
|
69 } |
|
70 |
|
71 CMTPBearerMonitor::CMTPBearerMonitor( TLocodServicePluginParams& aParams ): |
|
72 CLocodServicePlugin( aParams ) |
|
73 { |
|
74 __FLOG_OPEN( KMTPSubsystem, KComponent ); |
|
75 __FLOG( _L8("+/-Ctor") ); |
|
76 } |
|
77 |
|
78 void CMTPBearerMonitor::ConstructL() |
|
79 { |
|
80 __FLOG( _L8("+ConstructL") ); |
|
81 |
|
82 CMTPBluetoothController* btController = CMTPBluetoothController::NewL( *this ); |
|
83 iMTPControllers.AppendL( btController ); |
|
84 |
|
85 __FLOG( _L8("-ConstructL") ); |
|
86 } |
|
87 |