convergedconnectionhandler/cchserver/src/cchphonestartupmonitor.cpp
changeset 0 a4daefaec16c
equal deleted inserted replaced
-1:000000000000 0:a4daefaec16c
       
     1 /*
       
     2 * Copyright (c) 2009 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:  CCchPhoneStartupMonitor implementation.
       
    15  *
       
    16 */
       
    17 
       
    18 #include "cchlogger.h"
       
    19 #include "cchuihandler.h"
       
    20 #include "cchphonestartupmonitor.h"
       
    21 
       
    22 #include <startupdomainpskeys.h>
       
    23 
       
    24 // ============================= LOCAL FUNCTIONS =============================
       
    25 
       
    26 // ============================ MEMBER FUNCTIONS =============================
       
    27 
       
    28 // ---------------------------------------------------------------------------
       
    29 // CCchPhoneStartupMonitor::CCchPhoneStartupMonitor
       
    30 // C++ default constructor can NOT contain any code, that might leave.
       
    31 // ---------------------------------------------------------------------------
       
    32 //
       
    33 CCchPhoneStartupMonitor::CCchPhoneStartupMonitor( 
       
    34     CCchUIHandler& aCchUIHandler ) :
       
    35     CActive( CActive::EPriorityStandard ),
       
    36     iCchUIHandler( aCchUIHandler )
       
    37     {
       
    38     CCHLOGSTRING( "CCchPhoneStartupMonitor::CCchPhoneStartupMonitor" );
       
    39     CActiveScheduler::Add( this );
       
    40     }
       
    41 
       
    42 // ---------------------------------------------------------------------------
       
    43 // CCchPhoneStartupMonitor::ConstructL
       
    44 // Symbian 2nd phase constructor can leave.
       
    45 // ---------------------------------------------------------------------------
       
    46 //
       
    47 void CCchPhoneStartupMonitor::ConstructL()
       
    48     {  
       
    49     CCHLOGSTRING( "CCchPhoneStartupMonitor::ConstructL - IN" );
       
    50     
       
    51     iStartupUiPhaseProperty.Attach( KPSUidStartup, KPSStartupUiPhase );
       
    52     MonitorPhoneStartupPhaseL();
       
    53     
       
    54     CCHLOGSTRING( "CCchPhoneStartupMonitor::ConstructL - OUT" );
       
    55     }
       
    56 
       
    57 // ---------------------------------------------------------------------------
       
    58 // CCchPhoneStartupMonitor::NewL
       
    59 // Two-phased constructor.
       
    60 // ---------------------------------------------------------------------------
       
    61 //
       
    62 CCchPhoneStartupMonitor* CCchPhoneStartupMonitor::NewL( 
       
    63     CCchUIHandler& aCchUIHandler )
       
    64     {
       
    65     CCHLOGSTRING( "CCchPhoneStartupMonitor::NewL" );
       
    66     CCchPhoneStartupMonitor* self = 
       
    67         CCchPhoneStartupMonitor::NewLC( aCchUIHandler );
       
    68     CleanupStack::Pop( self );
       
    69     return self;
       
    70     }
       
    71 
       
    72 // ---------------------------------------------------------------------------
       
    73 // CCchPhoneStartupMonitor::NewLC
       
    74 // Two-phased constructor.
       
    75 // ---------------------------------------------------------------------------
       
    76 //
       
    77 CCchPhoneStartupMonitor* CCchPhoneStartupMonitor::NewLC( 
       
    78     CCchUIHandler& aCchUIHandler )
       
    79     {
       
    80     CCHLOGSTRING( "CCchPhoneStartupMonitor::NewLC" );
       
    81     CCchPhoneStartupMonitor* self = 
       
    82         new (ELeave) CCchPhoneStartupMonitor( aCchUIHandler );
       
    83     CleanupStack::PushL( self );
       
    84     self->ConstructL();
       
    85     return self;
       
    86     }
       
    87 
       
    88 // ---------------------------------------------------------------------------
       
    89 // CCchPhoneStartupMonitor::~CCchPhoneStartupMonitor()
       
    90 // Destructor.
       
    91 // ---------------------------------------------------------------------------
       
    92 //
       
    93 CCchPhoneStartupMonitor::~CCchPhoneStartupMonitor()
       
    94     {   
       
    95     CCHLOGSTRING( "CCchPhoneStartupMonitor::~CCchPhoneStartupMonitor" );
       
    96     
       
    97     iStartupUiPhaseProperty.Cancel();
       
    98     Cancel();
       
    99     }
       
   100 
       
   101 // ----------------------------------------------------------------------------
       
   102 // CCchPhoneStartupMonitor::DoCancel()
       
   103 // ----------------------------------------------------------------------------
       
   104 void CCchPhoneStartupMonitor::DoCancel()
       
   105     {
       
   106     CCHLOGSTRING("CCchPhoneStartupMonitor::DoCancel()");   
       
   107     }
       
   108 
       
   109 // ----------------------------------------------------------------------------
       
   110 // CCchPhoneStartupMonitor::RunL()
       
   111 // ----------------------------------------------------------------------------
       
   112 void CCchPhoneStartupMonitor::RunL()
       
   113     {
       
   114     CCHLOGSTRING("CCchPhoneStartupMonitor::RunL() IN"); 
       
   115        
       
   116     MonitorPhoneStartupPhaseL();
       
   117     
       
   118     CCHLOGSTRING("CCchPhoneStartupMonitor::RunL() OUT"); 
       
   119     }
       
   120 
       
   121 // ----------------------------------------------------------------------------
       
   122 // CCchPhoneStartupMonitor::RunError()
       
   123 // ----------------------------------------------------------------------------
       
   124 TInt CCchPhoneStartupMonitor::RunError( TInt /*aError*/ )
       
   125     {
       
   126     return KErrNone;
       
   127     }
       
   128 
       
   129 // ----------------------------------------------------------------------------
       
   130 // CCchPhoneStartupMonitor::MonitorPhoneStartupPhaseL()
       
   131 // ----------------------------------------------------------------------------
       
   132 void CCchPhoneStartupMonitor::MonitorPhoneStartupPhaseL()
       
   133     {
       
   134     CCHLOGSTRING("CCchPhoneStartupMonitor::MonitorPhoneStartupPhaseL() IN"); 
       
   135     
       
   136     TInt status( 0 );   
       
   137     TInt err = iStartupUiPhaseProperty.Get( 
       
   138         KPSUidStartup,
       
   139         KPSStartupUiPhase,
       
   140         status );
       
   141     
       
   142     CCHLOGSTRING2(
       
   143         "CCchPhoneStartupMonitor::MonitorPhoneStartupPhaseL() ERR=%d", err );
       
   144     
       
   145     if ( !err )
       
   146         {
       
   147         TBool networkConnAllowed = iCchUIHandler.NetworkConnectionsAllowed();
       
   148 
       
   149         CCHLOGSTRING2( " --> status=%d", status );
       
   150         CCHLOGSTRING2( " --> networkConnAllowed=%d", networkConnAllowed ); 
       
   151         
       
   152         if ( EStartupUiPhaseAllDone == status && !networkConnAllowed )
       
   153             {
       
   154             iCchUIHandler.ShowEmergencyWarningNoteL( EFalse );
       
   155             Cancel();
       
   156             }
       
   157         else
       
   158             {
       
   159             iStartupUiPhaseProperty.Subscribe( iStatus );
       
   160             SetActive();
       
   161             }
       
   162         }
       
   163     
       
   164     CCHLOGSTRING("CCchPhoneStartupMonitor::MonitorPhoneStartupPhaseL() OUT"); 
       
   165     }
       
   166 
       
   167 // ========================== OTHER EXPORTED FUNCTIONS =======================
       
   168 
       
   169 //  End of File