connectionutilities/ConnectionDialogs/cconndlg/src/ActiveBase.cpp
branchRCL_3
changeset 58 83ca720e2b9a
parent 0 5a93021fdf25
equal deleted inserted replaced
57:05bc53fe583b 58:83ca720e2b9a
       
     1 /*
       
     2 * Copyright (c) 2002 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:  Implementation of base CActive class with a timer
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "ActiveBase.h"
       
    21 #include "ConnectionDialogsLogger.h"
       
    22 
       
    23 /*#include <FeatMgr.h>
       
    24 #include <StringLoader.h>
       
    25 #include <AknIconArray.h>
       
    26 #include <AknsUtils.h>
       
    27 #include <data_caging_path_literals.hrh>
       
    28 
       
    29 #include <cmdestinationext.h>
       
    30 #include <CmConnectionMethodDef.h>
       
    31 #include <cmpluginWlanDef.h>
       
    32 
       
    33 #include <cmmanager.mbg>
       
    34 #include <CConnDlgPlugin.rsg>
       
    35 */
       
    36 
       
    37 
       
    38 
       
    39 ///////////////////////////////////////////////////////////////////////////////
       
    40 
       
    41 // ---------------------------------------------------------
       
    42 // CActiveBase::CActiveBase()
       
    43 // ---------------------------------------------------------
       
    44 //
       
    45 CActiveBase::CActiveBase()
       
    46 : CActive( EPriorityUserInput )
       
    47     {
       
    48     }
       
    49 
       
    50     
       
    51 // ---------------------------------------------------------
       
    52 // CActiveBase* CActiveBase::NewL()
       
    53 // ---------------------------------------------------------
       
    54 //
       
    55 CActiveBase* CActiveBase::NewL()
       
    56     {
       
    57     CLOG_ENTERFN( "CActiveBase::NewL " );  
       
    58     
       
    59     CActiveBase* self = new ( ELeave ) CActiveBase();
       
    60     CleanupStack::PushL( self );
       
    61     self->ConstructL();
       
    62     CleanupStack::Pop( self );
       
    63     
       
    64     CLOG_LEAVEFN( "CActiveBase::NewL " );      
       
    65 
       
    66     return self;        
       
    67     }
       
    68 
       
    69 
       
    70 // ---------------------------------------------------------
       
    71 // CActiveBase::ConstructL()
       
    72 // ---------------------------------------------------------
       
    73 //
       
    74 void CActiveBase::ConstructL()
       
    75     {
       
    76     CActiveScheduler::Add( this );            
       
    77     iPeriodic = CPeriodic::NewL( CActive::EPriorityStandard );
       
    78     }
       
    79 
       
    80 
       
    81 // ---------------------------------------------------------
       
    82 // CActiveBase::~CActiveBase()
       
    83 // ---------------------------------------------------------
       
    84 //    
       
    85 CActiveBase::~CActiveBase()
       
    86     {
       
    87     Cancel();
       
    88     }
       
    89 
       
    90 
       
    91 // ---------------------------------------------------------
       
    92 // CActiveBase::Cancel()
       
    93 // ---------------------------------------------------------
       
    94 // 
       
    95 void CActiveBase::Cancel()
       
    96     {
       
    97     StopTimer();
       
    98     CActive::Cancel();
       
    99     }
       
   100 
       
   101 
       
   102 // ---------------------------------------------------------
       
   103 // CActiveBase::DoCancel()
       
   104 // ---------------------------------------------------------
       
   105 // 
       
   106 void CActiveBase::DoCancel()
       
   107     {
       
   108     }
       
   109 
       
   110     
       
   111 // ---------------------------------------------------------
       
   112 // CActiveBase::RunL()
       
   113 // ---------------------------------------------------------
       
   114 //     
       
   115 void CActiveBase::RunL()
       
   116     {
       
   117     }
       
   118 
       
   119     
       
   120 // ---------------------------------------------------------
       
   121 // CActiveBase::StartTimerL
       
   122 // ---------------------------------------------------------
       
   123 //    
       
   124 void CActiveBase::StartTimerL( TInt aTickInterval )
       
   125     {    
       
   126     CLOG_ENTERFN( "CActiveBase::StartTimerL " );
       
   127     
       
   128     if( !iPeriodic )
       
   129         {
       
   130         iPeriodic = CPeriodic::NewL( CActive::EPriorityStandard ); 
       
   131         }
       
   132         
       
   133     iPeriodic->Start( aTickInterval, aTickInterval, TCallBack( Tick, this ) );
       
   134     
       
   135     CLOG_LEAVEFN( "CActiveBase::StartTimerL " );
       
   136     }
       
   137 
       
   138 
       
   139 // ---------------------------------------------------------
       
   140 // CActiveBase::StopTimer
       
   141 // ---------------------------------------------------------
       
   142 //
       
   143 void CActiveBase::StopTimer()
       
   144     {
       
   145     CLOG_ENTERFN( "CActiveBase::StopTimer " );  
       
   146     
       
   147     if( iPeriodic )
       
   148         {
       
   149         CLOG_WRITE( "iPeriodic" );
       
   150         iPeriodic->Cancel();
       
   151         CLOG_WRITE( "Cancel" );
       
   152         
       
   153         delete iPeriodic;
       
   154         CLOG_WRITE( "delete" );
       
   155         
       
   156         iPeriodic = NULL;
       
   157         }        
       
   158     
       
   159     CLOG_LEAVEFN( "CActiveBase::StopTimer " );
       
   160     }
       
   161 
       
   162     
       
   163 // ---------------------------------------------------------
       
   164 // CActiveBase::Tick
       
   165 // ---------------------------------------------------------
       
   166 //
       
   167 TInt CActiveBase::Tick( TAny* aObject )
       
   168     {
       
   169     CLOG_ENTERFN( "CActiveBase::Tick " );  
       
   170     
       
   171     CActiveBase* myself = static_cast<CActiveBase*>( aObject );
       
   172 
       
   173     if ( myself->iStatus == KErrCancel )
       
   174         {
       
   175         CLOG_WRITE( "iStatus == KErrCancel" );        
       
   176         myself->StopTimer();            
       
   177         }
       
   178     else
       
   179         {
       
   180         CLOG_WRITE( "iStatus != KErrCancel" );    
       
   181                                                               
       
   182         myself->SetActive();
       
   183         myself->iClientStatus = &( myself->iStatus );  
       
   184         *( myself->iClientStatus ) = KRequestPending;  
       
   185 
       
   186         User::RequestComplete( myself->iClientStatus, KErrNone );         
       
   187         }
       
   188     
       
   189     CLOG_LEAVEFN( "CActiveBase::Tick " );      
       
   190     
       
   191     return 1;
       
   192     }        
       
   193 
       
   194 
       
   195 // End of File