accessoryservices/accessoryserver/src/ASYProxy/ASYProxyLoaderTimer.cpp
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 /*
       
     2 * Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Timer for controlling asys loading
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "ASYProxyLoaderTimer.h"
       
    21 #include "ASYProxy.h"
       
    22 #include "ASYProxyAsyLoader.h"
       
    23 
       
    24 // EXTERNAL DATA STRUCTURES
       
    25 
       
    26 // EXTERNAL FUNCTION PROTOTYPES
       
    27 
       
    28 // CONSTANTS
       
    29 const TInt KASYLoadTimeOut = 5000000;
       
    30 
       
    31 // MACROS
       
    32 
       
    33 // LOCAL CONSTANTS AND MACROS
       
    34 
       
    35 // MODULE DATA STRUCTURES
       
    36 
       
    37 // LOCAL FUNCTION PROTOTYPES
       
    38 
       
    39 // FORWARD DECLARATIONS
       
    40 
       
    41 // ============================= LOCAL FUNCTIONS ===============================
       
    42 
       
    43 // ============================ MEMBER FUNCTIONS ===============================
       
    44 
       
    45 // -----------------------------------------------------------------------------
       
    46 // CASYProxyLoaderTimer::CASYProxyLoaderTimer
       
    47 // C++ default constructor can NOT contain any code, that
       
    48 // might leave.
       
    49 // -----------------------------------------------------------------------------
       
    50 //
       
    51 CASYProxyLoaderTimer::CASYProxyLoaderTimer( CASYProxyAsyLoader* aLoader )
       
    52     : CTimer( CActive::EPriorityHigh ),
       
    53       iLoader( aLoader )
       
    54     {
       
    55     COM_TRACE_( "[AccFW:AsyProxy] CASYProxyLoaderTimer::CASYProxyLoaderTimer()" );
       
    56 
       
    57     COM_TRACE_( "[AccFW:AsyProxy] CASYProxyLoaderTimer::CASYProxyLoaderTimer - return void" );
       
    58     }
       
    59 
       
    60 // -----------------------------------------------------------------------------
       
    61 // CASYProxyLoaderTimer::ConstructL
       
    62 // Symbian 2nd phase constructor can leave.
       
    63 // -----------------------------------------------------------------------------
       
    64 //
       
    65 void CASYProxyLoaderTimer::ConstructL()
       
    66     {
       
    67     COM_TRACE_( "[AccFW:AsyProxy] CASYProxyLoaderTimer::ConstructL()" );
       
    68 
       
    69     CTimer::ConstructL();
       
    70     CActiveScheduler::Add( this );
       
    71 
       
    72     COM_TRACE_( "[AccFW:AsyProxy] CASYProxyLoaderTimer::ConstructL - return void" );
       
    73     }
       
    74 
       
    75 // -----------------------------------------------------------------------------
       
    76 // CASYProxyLoaderTimer::NewL
       
    77 // Two-phased constructor.
       
    78 // -----------------------------------------------------------------------------
       
    79 //
       
    80 CASYProxyLoaderTimer* CASYProxyLoaderTimer::NewL( CASYProxyAsyLoader* aLoader )
       
    81     {
       
    82     COM_TRACE_( "[AccFW:AsyProxy] CASYProxyLoaderTimer::NewL()" );
       
    83 
       
    84     CASYProxyLoaderTimer* self = new (ELeave) CASYProxyLoaderTimer( aLoader );
       
    85     CleanupStack::PushL( self );
       
    86     self->ConstructL();
       
    87     CleanupStack::Pop( self );
       
    88 
       
    89     COM_TRACE_1( "[AccFW:AsyProxy] CASYProxyLoaderTimer::NewL - return 0x%x", self );
       
    90 
       
    91     return self;
       
    92     }
       
    93 
       
    94 // Destructor
       
    95 CASYProxyLoaderTimer::~CASYProxyLoaderTimer()
       
    96     {
       
    97     COM_TRACE_( "[AccFW:AsyProxy] CASYProxyLoaderTimer::~CASYProxyLoaderTimer()" );
       
    98 
       
    99     Cancel();
       
   100 
       
   101     COM_TRACE_( "[AccFW:AsyProxy] CASYProxyLoaderTimer::~CASYProxyLoaderTimer" );
       
   102     }
       
   103 
       
   104 // -----------------------------------------------------------------------------
       
   105 // CASYProxyLoaderTimer::RunL
       
   106 // Notifies ASYProxy that time out in ASY loading came up
       
   107 // (other items were commented in a header).
       
   108 // -----------------------------------------------------------------------------
       
   109 //
       
   110 void CASYProxyLoaderTimer::RunL()
       
   111     {
       
   112     COM_TRACE_( "[AccFW:AsyProxy] CASYProxyLoaderTimer::RunL()" );
       
   113 
       
   114     iLoader->iAsyProxy->LoadTimeOutL();
       
   115 
       
   116     COM_TRACE_( "[AccFW:AsyProxy] CASYProxyLoaderTimer::RunL - return void" );
       
   117     }
       
   118 
       
   119 // -----------------------------------------------------------------------------
       
   120 // CASYProxyLoaderTimer::RunError
       
   121 // Returns KErrNone
       
   122 // (other items were commented in a header).
       
   123 // -----------------------------------------------------------------------------
       
   124 //
       
   125 TInt CASYProxyLoaderTimer::RunError( TInt aError )
       
   126     {
       
   127     COM_TRACE_1( "[AccFW:AsyProxy] CASYProxyLoaderTimer::RunError(%d)", aError );
       
   128 
       
   129      // Avoid Panic in CActiveScheduler
       
   130     aError = KErrNone;
       
   131 
       
   132     COM_TRACE_( "[AccFW:AsyProxy] CASYProxyLoaderTimer::RunError - return KErrNone" );
       
   133 
       
   134     return aError;
       
   135     }
       
   136 
       
   137 // -----------------------------------------------------------------------------
       
   138 // CASYProxyLoaderTimer::StartTimer
       
   139 // Starts timer to control asy loading
       
   140 // (other items were commented in a header).
       
   141 // -----------------------------------------------------------------------------
       
   142 //
       
   143 void CASYProxyLoaderTimer::StartTimer()
       
   144     {
       
   145     COM_TRACE_( "[AccFW:AsyProxy] CASYProxyLoaderTimer::StartTimer()" );
       
   146 
       
   147     After( ( TTimeIntervalMicroSeconds32 ) KASYLoadTimeOut );
       
   148 
       
   149     COM_TRACE_( "[AccFW:AsyProxy] CASYProxyLoaderTimer::StartTimer - return void" );
       
   150     }
       
   151 
       
   152 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   153 
       
   154 // End of File