watchdog/src/centrepmonitor.cpp
changeset 16 2729d20a0010
child 23 d4d56f5e7c55
equal deleted inserted replaced
14:8bd192d47aaa 16:2729d20a0010
       
     1 /*
       
     2 * Copyright (c) 2010 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 application is to monitor Harvester and Search Server
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 //  Include Files  
       
    20 #include "WatchDogCommon.h"
       
    21 #include "centrepmonitor.h"
       
    22 #include <centralrepository.h>
       
    23 #include <cpixwatchdogcommon.h>
       
    24 
       
    25 // -----------------------------------------------------------------------------
       
    26 // CentrepMonitor::NewL
       
    27 // -----------------------------------------------------------------------------
       
    28 //
       
    29 CentrepMonitor* CentrepMonitor::NewL( MCentrepHandler* aCentrepHandler, TUint32 aKey )
       
    30     {
       
    31     CentrepMonitor* self = CentrepMonitor::NewLC( aCentrepHandler, aKey );
       
    32     CleanupStack::Pop();
       
    33     return self;
       
    34     }
       
    35 	
       
    36 // -----------------------------------------------------------------------------
       
    37 // CentrepMonitor::NewLC
       
    38 // -----------------------------------------------------------------------------
       
    39 //
       
    40 CentrepMonitor* CentrepMonitor::NewLC( MCentrepHandler* aCentrepHandler, TUint32 aKey )
       
    41     {
       
    42     CentrepMonitor* self = new ( ELeave ) CentrepMonitor( );
       
    43     CleanupStack::PushL( self );
       
    44     self->ConstructL( aCentrepHandler, aKey );
       
    45     return self;
       
    46     }
       
    47 	
       
    48 // -----------------------------------------------------------------------------
       
    49 // CentrepMonitor::~CentrepMonitor()
       
    50 // -----------------------------------------------------------------------------
       
    51 //
       
    52 CentrepMonitor::~CentrepMonitor()
       
    53     {
       
    54     Cancel();
       
    55     delete aWDrepo;
       
    56     }
       
    57 	
       
    58 // -----------------------------------------------------------------------------
       
    59 // CentrepMonitor::CentrepMonitor()
       
    60 // -----------------------------------------------------------------------------
       
    61 //
       
    62 CentrepMonitor::CentrepMonitor( ): CActive( CActive::EPriorityStandard )                        
       
    63     {
       
    64     
       
    65     }
       
    66 	
       
    67 // -----------------------------------------------------------------------------
       
    68 // CentrepMonitor::ConstructL()
       
    69 // -----------------------------------------------------------------------------
       
    70 //
       
    71 void CentrepMonitor::ConstructL( MCentrepHandler* aCentrepHandler, TUint32 aKey )
       
    72     {
       
    73     CActiveScheduler::Add( this );
       
    74     iCentrepHandler = aCentrepHandler;
       
    75     iKey = aKey;
       
    76     aWDrepo = CRepository::NewL( KWDrepoUidMenu );
       
    77     }
       
    78 	
       
    79 // -----------------------------------------------------------------------------
       
    80 // CentrepMonitor::RunL()
       
    81 // -----------------------------------------------------------------------------
       
    82 //
       
    83 void CentrepMonitor::RunL()
       
    84     {   
       
    85     if ( iCentrepHandler )
       
    86        iCentrepHandler->HandlecentrepL( iKey );
       
    87     aWDrepo->NotifyRequest( iKey , iStatus );
       
    88     SetActive();
       
    89     }
       
    90 	
       
    91 // -----------------------------------------------------------------------------
       
    92 // CentrepMonitor::DoCancel()
       
    93 // -----------------------------------------------------------------------------
       
    94 //
       
    95 void CentrepMonitor::DoCancel()
       
    96     {  
       
    97     }
       
    98 
       
    99 // -----------------------------------------------------------------------------
       
   100 // CentrepMonitor::RunError()
       
   101 // -----------------------------------------------------------------------------
       
   102 //
       
   103 TInt CentrepMonitor::RunError( TInt )
       
   104     {                   
       
   105     return KErrNone;
       
   106     }
       
   107 
       
   108 // -----------------------------------------------------------------------------
       
   109 // CentrepMonitor::RunError()
       
   110 // -----------------------------------------------------------------------------
       
   111 //
       
   112 void CentrepMonitor::StartNotifier()
       
   113     {
       
   114     aWDrepo->NotifyRequest( iKey , iStatus );
       
   115        SetActive();
       
   116     }