mtptransports/mtpcontroller/src/cmtpcontrollertimer.cpp
changeset 47 63cf70d3ecd8
parent 38 48c22c726cf9
child 60 841f70763fbe
equal deleted inserted replaced
44:a5deb6b96675 47:63cf70d3ecd8
    20  @internalComponent
    20  @internalComponent
    21 */
    21 */
    22 
    22 
    23 #include "cmtpcontrollertimer.h"
    23 #include "cmtpcontrollertimer.h"
    24 #include "cmtpoperator.h"
    24 #include "cmtpoperator.h"
       
    25 #include "mtpdebug.h"
       
    26 #include "OstTraceDefinitions.h"
       
    27 #ifdef OST_TRACE_COMPILER_IN_USE
       
    28 #include "cmtpcontrollertimerTraces.h"
       
    29 #endif
    25 
    30 
    26 __FLOG_STMT( _LIT8( KComponent, "mtpConTimer" ); )
       
    27 
    31 
    28 const TUid KMTPBtTransportUid = { 0x10286FCB };
    32 const TUid KMTPBtTransportUid = { 0x10286FCB };
    29 const TInt KStartMTPSeconds = 7;
    33 const TInt KStartMTPSeconds = 7;
    30 
    34 
    31 CMTPControllerTimer* CMTPControllerTimer::NewLC( RMTPClient& aMTPClient, CMTPOperator & aMTPOperator )
    35 CMTPControllerTimer* CMTPControllerTimer::NewLC( RMTPClient& aMTPClient, CMTPOperator & aMTPOperator )
    53     return iStopTransport;
    57     return iStopTransport;
    54     }
    58     }
    55 
    59 
    56 CMTPControllerTimer::~CMTPControllerTimer()
    60 CMTPControllerTimer::~CMTPControllerTimer()
    57     {
    61     {
    58     __FLOG( _L8("CMPTControllerTimer destruction") );
    62     OstTraceFunctionEntry0( CMTPCONTROLLERTIMER_DES_ENTRY );
    59     __FLOG_CLOSE;
    63     OstTraceFunctionExit0( CMTPCONTROLLERTIMER_DES_EXIT );
    60     }
    64     }
    61 
    65 
    62 CMTPControllerTimer::CMTPControllerTimer( RMTPClient& aMTPClient, CMTPOperator& aMTPOperator ):
    66 CMTPControllerTimer::CMTPControllerTimer( RMTPClient& aMTPClient, CMTPOperator& aMTPOperator ):
    63     CTimer( CActive::EPriorityStandard ), iMTPClient(aMTPClient)
    67     CTimer( CActive::EPriorityStandard ), iMTPClient(aMTPClient)
    64     {
    68     {
    65     __FLOG_OPEN( KMTPSubsystem, KComponent );
       
    66     iMTPOperator = &aMTPOperator;
    69     iMTPOperator = &aMTPOperator;
    67     }
    70     }
    68 
    71 
    69 void CMTPControllerTimer::ConstructL()
    72 void CMTPControllerTimer::ConstructL()
    70     {
    73     {
       
    74     OstTraceFunctionEntry0( CMTPCONTROLLERTIMER_CONSTRUCTL_ENTRY );
    71     CTimer::ConstructL();
    75     CTimer::ConstructL();
    72     CActiveScheduler::Add( this );
    76     CActiveScheduler::Add( this );
    73     iStopTransport = EFalse;
    77     iStopTransport = EFalse;
    74     __FLOG( _L8("CMPTControllerTimer construction") );
    78     OstTraceFunctionExit0( CMTPCONTROLLERTIMER_CONSTRUCTL_EXIT );
    75     }
    79     }
    76 
    80 
    77 void CMTPControllerTimer::RunL()
    81 void CMTPControllerTimer::RunL()
    78     {
    82     {
       
    83     OstTraceFunctionEntry0( CMTPCONTROLLERTIMER_RUNL_ENTRY );
    79     if (KErrNone == iMTPClient.IsProcessRunning() && !iStopTransport)
    84     if (KErrNone == iMTPClient.IsProcessRunning() && !iStopTransport)
    80         {
    85         {
    81         __FLOG( _L8("Stop transport to shut down mtp server") );
    86          OstTrace0( TRACE_NORMAL, CMTPCONTROLLERTIMER_RUNL, "Stop transport to shut down mtp server" );
    82         TInt error = iMTPClient.StopTransport(KMTPBtTransportUid);
    87         TInt error = iMTPClient.StopTransport(KMTPBtTransportUid);
    83         iMTPClient.Close();
    88         iMTPClient.Close();
    84         iStopTransport = ETrue;
    89         iStopTransport = ETrue;
    85         __FLOG_1( _L8("The return value of stop transport is: %d"), error );
    90         OstTrace1( TRACE_NORMAL, DUP1_CMTPCONTROLLERTIMER_RUNL, "The return value of stop transport is: %d", error );
    86         iMTPOperator->StartTimer(KStartMTPSeconds);
    91         iMTPOperator->StartTimer(KStartMTPSeconds);
    87         }
    92         }
    88     else
    93     else
    89         {
    94         {
    90         __FLOG( _L8("Start transport to launch mtp server") );
    95         OstTrace0( TRACE_NORMAL, DUP2_CMTPCONTROLLERTIMER_RUNL, "Start transport to launch mtp server" );
    91         
    96         
    92         User::LeaveIfError(iMTPClient.Connect());
    97         LEAVEIFERROR(iMTPClient.Connect(),
       
    98 				OstTrace1( TRACE_NORMAL, DUP3_CMTPCONTROLLERTIMER_RUNL, "connect to mtp server failed! error code %d", munged_err ));
    93         iMTPClient.StartTransport(KMTPBtTransportUid);
    99         iMTPClient.StartTransport(KMTPBtTransportUid);
    94         iStopTransport = EFalse;
   100         iStopTransport = EFalse;
    95         iMTPOperator->SubscribeConnState();
   101         iMTPOperator->SubscribeConnState();
    96         }
   102         }
       
   103     OstTraceFunctionExit0( CMTPCONTROLLERTIMER_RUNL_EXIT );
    97     }
   104     }