watchdog/src/watchdog.cpp
changeset 0 671dee74050a
equal deleted inserted replaced
-1:000000000000 0:671dee74050a
       
     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 <e32base.h>
       
    21 #include <e32std.h>
       
    22 #include "CWDMonitor.h"
       
    23 #include "WatchDog.h"
       
    24 
       
    25 //  Constants
       
    26 //  Global Variables
       
    27 //  Local Functions
       
    28 
       
    29 LOCAL_C void DoStartL()
       
    30     {
       
    31     // Create active scheduler (to run active objects)
       
    32     CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
       
    33     CleanupStack::PushL(scheduler);
       
    34     CActiveScheduler::Install(scheduler);
       
    35     //create the watch dog monitor
       
    36     CWDMonitor* monitor = CWDMonitor::NewLC();
       
    37     //Start monitoring the Harvester and Search server
       
    38     monitor->StartMonitor();
       
    39     
       
    40     // Start handling requests
       
    41     CActiveScheduler::Start();
       
    42     //Delete the watch dog monitor
       
    43     CleanupStack::PopAndDestroy(monitor);
       
    44     // Delete active scheduler
       
    45     CleanupStack::PopAndDestroy(scheduler);
       
    46     }
       
    47 
       
    48 //  Global Functions
       
    49 
       
    50 GLDEF_C TInt E32Main()
       
    51     {
       
    52     // Create cleanup stack
       
    53     __UHEAP_MARK;
       
    54     CTrapCleanup* cleanup = CTrapCleanup::New();
       
    55 
       
    56     // Run application code inside TRAP harness
       
    57     TRAPD(mainError, DoStartL());
       
    58     
       
    59     if( mainError != KErrNone)
       
    60         {
       
    61         //Handle the error    
       
    62         }
       
    63     
       
    64     delete cleanup;
       
    65     __UHEAP_MARKEND;
       
    66     return KErrNone;
       
    67     }
       
    68