mtpdataproviders/mtppictbridgedp/src/cptptimer.cpp
changeset 0 d0791faffa3f
equal deleted inserted replaced
-1:000000000000 0:d0791faffa3f
       
     1 // Copyright (c) 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 #include "cptptimer.h"
       
    18 #include "cmtppictbridgeprinter.h"
       
    19 #include "cptpsession.h"
       
    20 #include "cptpserver.h"
       
    21 #include "ptpdef.h"
       
    22 #include "mtppictbridgedpconst.h"
       
    23 
       
    24 // --------------------------------------------------------------------------
       
    25 // 
       
    26 // 
       
    27 // --------------------------------------------------------------------------
       
    28 //
       
    29 CPtpTimer* CPtpTimer::NewL(CPtpSession& aSession)
       
    30     {
       
    31     CPtpTimer* self = new(ELeave) CPtpTimer(aSession);
       
    32     CleanupStack::PushL(self);
       
    33 	self->ConstructL();
       
    34 	CleanupStack::Pop();
       
    35     return self;
       
    36     }
       
    37 
       
    38 // --------------------------------------------------------------------------
       
    39 // 
       
    40 // 
       
    41 // --------------------------------------------------------------------------
       
    42 //    
       
    43 CPtpTimer::CPtpTimer(CPtpSession& aSession) : CTimer(EPriorityStandard),
       
    44     iSession(aSession)
       
    45     {
       
    46     CActiveScheduler::Add(this);    
       
    47     }
       
    48     
       
    49 // --------------------------------------------------------------------------
       
    50 // 
       
    51 // 
       
    52 // --------------------------------------------------------------------------
       
    53 //
       
    54 void CPtpTimer::ConstructL()    
       
    55     {
       
    56     __FLOG_OPEN(KMTPSubsystem, KPtpServerLog);
       
    57     __FLOG(_L8("CPtpTimer::ConstructL"));        
       
    58     CTimer::ConstructL();
       
    59     }
       
    60 
       
    61 // --------------------------------------------------------------------------
       
    62 // 
       
    63 // 
       
    64 // --------------------------------------------------------------------------
       
    65 //
       
    66 CPtpTimer::~CPtpTimer()
       
    67     {
       
    68     __FLOG(_L8("CPtpTimer::~"));        
       
    69     Cancel();
       
    70     __FLOG_CLOSE;
       
    71     }
       
    72     
       
    73 // --------------------------------------------------------------------------
       
    74 // 
       
    75 // --------------------------------------------------------------------------
       
    76 //    
       
    77 void CPtpTimer::RunL()
       
    78     {
       
    79     __FLOG(_L8(">>>CPtpTimer::RunL"));
       
    80     if (iStatus.Int() == KErrNone)
       
    81         {
       
    82         __FLOG(_L8("--- timer expired, because of:"));
       
    83 
       
    84         if (iSession.ServerP()->Printer()->Status() == CMTPPictBridgePrinter::ENotConnected) // must be DPS discovery, since no other service is supported
       
    85             {
       
    86             __FLOG(_L8("--- Dps printer not available"));            
       
    87             iSession.ServerP()->Printer()->NoDpsDiscovery();
       
    88             iSession.IsDpsPrinterCompleted(EPrinterNotAvailable);
       
    89             }
       
    90         else if (iSession.ServerP()->Printer()->SendObjectPending())
       
    91             {
       
    92             __FLOG(_L8("---SendObject timeout"));
       
    93             iSession.ServerP()->Printer()->DpsFileSent(KErrTimedOut);
       
    94             }
       
    95         else 
       
    96             {
       
    97             __FLOG(_L8("---something else, do not care"));
       
    98             }    
       
    99         }
       
   100     else if (iStatus.Int() == KErrCancel)
       
   101         {
       
   102         __FLOG(_L8("--- RunL Cancelled."));
       
   103         }
       
   104     else 
       
   105         {
       
   106         __FLOG_VA((_L8("!!!Error: Err %d returned."), iStatus.Int()));
       
   107         }
       
   108     __FLOG(_L8("<<<CPtpTimer::RunL"));	
       
   109     }
       
   110 
       
   111 // --------------------------------------------------------------------------
       
   112 // 
       
   113 // --------------------------------------------------------------------------
       
   114 #ifdef __FLOG_ACTIVE
       
   115 TInt CPtpTimer::RunError(TInt aErr)
       
   116 #else
       
   117 TInt CPtpTimer::RunError(TInt /*aErr*/)
       
   118 #endif
       
   119     {
       
   120     __FLOG_VA((_L8(">>>CPtpTimer::RunError %d"), aErr));
       
   121     return KErrNone;
       
   122     }