phoneengine/phonemodel/src/cpeactivestarter.cpp
changeset 0 5f000ab63145
child 21 92ab7f8d0eab
equal deleted inserted replaced
-1:000000000000 0:5f000ab63145
       
     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:  This module contains the implementation of CPEActiveStarter class 
       
    15                  member functions.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 //  INCLUDE FILES
       
    21 #include "cpeactivestarter.h"
       
    22 #include <talogger.h>
       
    23 
       
    24 // EXTERNAL DATA STRUCTURES
       
    25 //None
       
    26 
       
    27 // EXTERNAL FUNCTION PROTOTYPES  
       
    28 //None;
       
    29 
       
    30 // CONSTANTS
       
    31 //None
       
    32 
       
    33 // MACROS
       
    34 //None
       
    35 
       
    36 // LOCAL CONSTANTS AND MACROS
       
    37 //None
       
    38 
       
    39 // MODULE DATA STRUCTURES
       
    40 //None
       
    41 
       
    42 // LOCAL FUNCTION PROTOTYPES
       
    43 //None
       
    44 
       
    45 // FORWARD DECLARATIONS
       
    46 //None
       
    47 
       
    48 // ============================= LOCAL FUNCTIONS ===============================
       
    49 //None
       
    50 
       
    51 // ============================ MEMBER FUNCTIONS ===============================
       
    52 
       
    53 // -----------------------------------------------------------------------------
       
    54 // CPEActiveStarter::CPEActiveStarter
       
    55 // C++ default constructor can NOT contain any code, that
       
    56 // might leave.
       
    57 // -----------------------------------------------------------------------------
       
    58 //
       
    59 CPEActiveStarter::CPEActiveStarter(
       
    60     MPEActiveStarter* aActiveStarter ) 
       
    61     : CActive( CActive::EPriorityStandard ), 
       
    62       iActiveStarter ( aActiveStarter )
       
    63     {
       
    64     	
       
    65     CActiveScheduler::Add( this );
       
    66     
       
    67     }
       
    68 
       
    69 // -----------------------------------------------------------------------------
       
    70 // CPEActiveStarter::NewL
       
    71 // Two-phased constructor.
       
    72 // -----------------------------------------------------------------------------
       
    73 //
       
    74 CPEActiveStarter* CPEActiveStarter::NewL( 
       
    75     MPEActiveStarter* aActiveStarter )
       
    76 	{
       
    77 		
       
    78     return new( ELeave ) CPEActiveStarter( aActiveStarter );
       
    79     
       
    80     }
       
    81 
       
    82 // Destructor
       
    83 CPEActiveStarter::~CPEActiveStarter()
       
    84     {
       
    85     Cancel();
       
    86     }
       
    87 
       
    88 // -----------------------------------------------------------------------------
       
    89 // CPEActiveStarter::StartUp
       
    90 // Starts the Phone Engine modules asynchronically.
       
    91 // -----------------------------------------------------------------------------
       
    92 //
       
    93 void CPEActiveStarter::StartUp()
       
    94     {
       
    95     SetActive();
       
    96     TRequestStatus* status = &iStatus;
       
    97     User::RequestComplete( status, KErrNone ); // complete request.
       
    98     }
       
    99 
       
   100 // -----------------------------------------------------------------------------
       
   101 // CPEActiveStarter::DoCancel
       
   102 // Method cancels asynchronous request.
       
   103 // -----------------------------------------------------------------------------
       
   104 //
       
   105 void CPEActiveStarter::DoCancel()
       
   106     {
       
   107     }
       
   108 
       
   109 // -----------------------------------------------------------------------------
       
   110 // CPEActiveStarter::RunError
       
   111 // Method recalls Phone Engine module starts.
       
   112 // -----------------------------------------------------------------------------
       
   113 //
       
   114 TInt CPEActiveStarter::RunError( TInt aError )
       
   115     {
       
   116     TEFLOGSTRING2( KTAOBJECT, "CPEActiveStarter::RunError(): Leave %d in step.", aError );
       
   117     aError = aError; // for compiler warning
       
   118     iActiveStarter->RecallSteps();
       
   119 
       
   120     delete this; // ugly suicide thingie so don't implement any new code that reserver anything after this
       
   121     return KErrNone;
       
   122     }
       
   123 
       
   124 // -----------------------------------------------------------------------------
       
   125 // CPEActiveStarter::RunL
       
   126 // Starts all Phone Engine modules asynchronically.
       
   127 // -----------------------------------------------------------------------------
       
   128 //
       
   129 void CPEActiveStarter::RunL()
       
   130     { 
       
   131     // Protocol specific step.
       
   132     TEFLOGSTRING( KTAOBJECT, "CPEActiveStarter::RunL(): Starting step." );
       
   133 
       
   134     TBool continueStep = iActiveStarter->StepL( );
       
   135 
       
   136     TEFLOGSTRING( KTAOBJECT, "CPEActiveStarter::RunL(): Completed step." );
       
   137     if ( continueStep ) 
       
   138         {
       
   139         // Start the next module.
       
   140         SetActive();
       
   141         TRequestStatus* status = &iStatus;
       
   142         User::RequestComplete( status, KErrNone );
       
   143         }
       
   144     else
       
   145         {
       
   146         delete this;// ugly suicide thingie so don't implement any new code that reserver anything after this
       
   147         }
       
   148     }
       
   149     
       
   150 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   151 //None    
       
   152 
       
   153 
       
   154 //  End of File