mtptransports/mtpcontroller/src/cmtpbluetoothcontroller.cpp
changeset 47 63cf70d3ecd8
parent 0 d0791faffa3f
equal deleted inserted replaced
44:a5deb6b96675 47:63cf70d3ecd8
    19  @file
    19  @file
    20  @internalComponent
    20  @internalComponent
    21 */
    21 */
    22 
    22 
    23 #include "cmtpbluetoothcontroller.h"
    23 #include "cmtpbluetoothcontroller.h"
       
    24 #include "OstTraceDefinitions.h"
       
    25 #ifdef OST_TRACE_COMPILER_IN_USE
       
    26 #include "cmtpbluetoothcontrollerTraces.h"
       
    27 #endif
    24 
    28 
    25 __FLOG_STMT( _LIT8( KComponent, "mtpbtcontroller" ); )
       
    26 LOCAL_D const TUid KMTPBtTransportUid = { 0x10286FCB };
    29 LOCAL_D const TUid KMTPBtTransportUid = { 0x10286FCB };
    27 
    30 
    28 CMTPBluetoothController* CMTPBluetoothController::NewL( CMTPBearerMonitor& aMon )
    31 CMTPBluetoothController* CMTPBluetoothController::NewL( CMTPBearerMonitor& aMon )
    29     {
    32     {
    30     CMTPBluetoothController* self = new( ELeave ) CMTPBluetoothController( aMon );
    33     CMTPBluetoothController* self = new( ELeave ) CMTPBluetoothController( aMon );
    31     return self;
    34     return self;
    32     }
    35     }
    33 
    36 
    34 CMTPBluetoothController::~CMTPBluetoothController()
    37 CMTPBluetoothController::~CMTPBluetoothController()
    35     {
    38     {
       
    39     OstTraceFunctionEntry0( CMTPBLUETOOTHCONTROLLER_DES_ENTRY );
    36     delete iMTPOperator;
    40     delete iMTPOperator;
    37     __FLOG( _L8("+/-Dtor") );
    41     OstTraceFunctionExit0( CMTPBLUETOOTHCONTROLLER_DES_EXIT );
    38     __FLOG_CLOSE;
       
    39     }
    42     }
    40 
    43 
    41 void CMTPBluetoothController::ManageService( TBool aStatus )
    44 void CMTPBluetoothController::ManageService( TBool aStatus )
    42     {
    45     {
    43     __FLOG_1( _L8("+/-ManageService( %d )"), aStatus );
    46     OstTraceFunctionEntry0( CMTPBLUETOOTHCONTROLLER_MANAGESERVICE_ENTRY );
       
    47     OstTrace1( TRACE_NORMAL, CMTPBLUETOOTHCONTROLLER_MANAGESERVICE, "The status is %d", aStatus );
    44     iStat = aStatus;
    48     iStat = aStatus;
    45     TInt err = KErrNone;
    49     TInt err = KErrNone;
    46     if ( !iMTPOperator )
    50     if ( !iMTPOperator )
    47         {
    51         {
    48         TRAP( err, iMTPOperator = CMTPOperator::NewL( *this ) );
    52         TRAP( err, iMTPOperator = CMTPOperator::NewL( *this ) );
    49         }
    53         }
    50     if ( KErrNone != err )
    54     if ( KErrNone != err )
    51         {
    55         {
    52         Monitor().ManageServiceCompleted( Bearer(), iStat, err );
    56         Monitor().ManageServiceCompleted( Bearer(), iStat, err );
       
    57         OstTraceFunctionExit0( CMTPBLUETOOTHCONTROLLER_MANAGESERVICE_EXIT );
    53         return;
    58         return;
    54         }
    59         }
    55     
    60     
    56     if ( aStatus )
    61     if ( aStatus )
    57         {
    62         {
    59         }
    64         }
    60     else
    65     else
    61         {
    66         {
    62         iMTPOperator->StopTransport( KMTPBtTransportUid );
    67         iMTPOperator->StopTransport( KMTPBtTransportUid );
    63         }
    68         }
       
    69     OstTraceFunctionExit0( DUP1_CMTPBLUETOOTHCONTROLLER_MANAGESERVICE_EXIT );
    64     }
    70     }
    65 
    71 
    66 void CMTPBluetoothController::HandleStartTrasnportCompleteL( TInt aError )
    72 void CMTPBluetoothController::HandleStartTrasnportCompleteL( TInt aError )
    67     {
    73     {
    68     __FLOG_1( _L8("+HandleStartTrasnportCompleteL( %d )"), aError );
    74     OstTraceFunctionEntry0( CMTPBLUETOOTHCONTROLLER_HANDLESTARTTRASNPORTCOMPLETEL_ENTRY );
       
    75     OstTrace1( TRACE_NORMAL, CMTPBLUETOOTHCONTROLLER_HANDLESTARTTRASNPORTCOMPLETEL, "The error is %d", aError );
    69     switch( aError )
    76     switch( aError )
    70         {
    77         {
    71         case KErrServerBusy:// Another transport is running, keep observing the status of the transport bearer
    78         case KErrServerBusy:// Another transport is running, keep observing the status of the transport bearer
    72             aError = KErrNone;
    79             aError = KErrNone;
    73             break;
    80             break;
    74         default:
    81         default:
    75             break;
    82             break;
    76         }
    83         }
    77     Monitor().ManageServiceCompleted( Bearer(), iStat, aError );
    84     Monitor().ManageServiceCompleted( Bearer(), iStat, aError );
    78     __FLOG( _L8("-HandleStartTrasnportCompleteL") );
    85     OstTraceFunctionExit0( CMTPBLUETOOTHCONTROLLER_HANDLESTARTTRASNPORTCOMPLETEL_EXIT );
    79     }
    86     }
    80 
    87 
    81 void CMTPBluetoothController::HandleStopTrasnportCompleteL( TInt aError )
    88 void CMTPBluetoothController::HandleStopTrasnportCompleteL( TInt aError )
    82     {
    89     {
    83     __FLOG_1( _L8("+HandleStopTrasnportCompleteL( %d )"), aError );
    90     OstTraceFunctionEntry0( CMTPBLUETOOTHCONTROLLER_HANDLESTOPTRASNPORTCOMPLETEL_ENTRY );
       
    91     OstTrace1( TRACE_NORMAL, CMTPBLUETOOTHCONTROLLER_HANDLESTOPTRASNPORTCOMPLETEL, "The error is %d", aError );
    84     Monitor().ManageServiceCompleted( Bearer(), iStat, aError );
    92     Monitor().ManageServiceCompleted( Bearer(), iStat, aError );
    85     __FLOG( _L8("-HandleStopTrasnportCompleteL") );
    93     OstTraceFunctionExit0( CMTPBLUETOOTHCONTROLLER_HANDLESTOPTRASNPORTCOMPLETEL_EXIT );
    86     }
    94     }
    87 
    95 
    88 CMTPBluetoothController::CMTPBluetoothController( CMTPBearerMonitor& aMon ):
    96 CMTPBluetoothController::CMTPBluetoothController( CMTPBearerMonitor& aMon ):
    89     CMTPControllerBase( aMon, ELocodBearerBT ),
    97     CMTPControllerBase( aMon, ELocodBearerBT ),
    90     iStat( EFalse )
    98     iStat( EFalse )
    91     {
    99     {
    92     __FLOG_OPEN( KMTPSubsystem, KComponent );
   100     OstTraceFunctionEntry0( CMTPBLUETOOTHCONTROLLER_CONS_ENTRY );
    93     __FLOG( _L8("+/-Ctor") );
   101     OstTraceFunctionExit0( CMTPBLUETOOTHCONTROLLER_CONS_EXIT );
    94     }
   102     }
    95 
   103