|
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 "cmtpbluetoothcontroller.h" |
|
24 |
|
25 __FLOG_STMT( _LIT8( KComponent, "mtpbtcontroller" ); ) |
|
26 LOCAL_D const TUid KMTPBtTransportUid = { 0x10286FCB }; |
|
27 |
|
28 CMTPBluetoothController* CMTPBluetoothController::NewL( CMTPBearerMonitor& aMon ) |
|
29 { |
|
30 CMTPBluetoothController* self = new( ELeave ) CMTPBluetoothController( aMon ); |
|
31 return self; |
|
32 } |
|
33 |
|
34 CMTPBluetoothController::~CMTPBluetoothController() |
|
35 { |
|
36 delete iMTPOperator; |
|
37 __FLOG( _L8("+/-Dtor") ); |
|
38 __FLOG_CLOSE; |
|
39 } |
|
40 |
|
41 void CMTPBluetoothController::ManageService( TBool aStatus ) |
|
42 { |
|
43 __FLOG_1( _L8("+/-ManageService( %d )"), aStatus ); |
|
44 iStat = aStatus; |
|
45 TInt err = KErrNone; |
|
46 if ( !iMTPOperator ) |
|
47 { |
|
48 TRAP( err, iMTPOperator = CMTPOperator::NewL( *this ) ); |
|
49 } |
|
50 if ( KErrNone != err ) |
|
51 { |
|
52 Monitor().ManageServiceCompleted( Bearer(), iStat, err ); |
|
53 return; |
|
54 } |
|
55 |
|
56 if ( aStatus ) |
|
57 { |
|
58 iMTPOperator->StartTransport( KMTPBtTransportUid ); |
|
59 } |
|
60 else |
|
61 { |
|
62 iMTPOperator->StopTransport( KMTPBtTransportUid ); |
|
63 } |
|
64 } |
|
65 |
|
66 void CMTPBluetoothController::HandleStartTrasnportCompleteL( TInt aError ) |
|
67 { |
|
68 __FLOG_1( _L8("+HandleStartTrasnportCompleteL( %d )"), aError ); |
|
69 switch( aError ) |
|
70 { |
|
71 case KErrServerBusy:// Another transport is running, keep observing the status of the transport bearer |
|
72 aError = KErrNone; |
|
73 break; |
|
74 default: |
|
75 break; |
|
76 } |
|
77 Monitor().ManageServiceCompleted( Bearer(), iStat, aError ); |
|
78 __FLOG( _L8("-HandleStartTrasnportCompleteL") ); |
|
79 } |
|
80 |
|
81 void CMTPBluetoothController::HandleStopTrasnportCompleteL( TInt aError ) |
|
82 { |
|
83 __FLOG_1( _L8("+HandleStopTrasnportCompleteL( %d )"), aError ); |
|
84 Monitor().ManageServiceCompleted( Bearer(), iStat, aError ); |
|
85 __FLOG( _L8("-HandleStopTrasnportCompleteL") ); |
|
86 } |
|
87 |
|
88 CMTPBluetoothController::CMTPBluetoothController( CMTPBearerMonitor& aMon ): |
|
89 CMTPControllerBase( aMon, ELocodBearerBT ), |
|
90 iStat( EFalse ) |
|
91 { |
|
92 __FLOG_OPEN( KMTPSubsystem, KComponent ); |
|
93 __FLOG( _L8("+/-Ctor") ); |
|
94 } |
|
95 |