wlanutilities/wlansniffer/wlansnifferkeepalive/src/main.cpp
branchRCL_3
changeset 25 f28ada11abbf
parent 24 63be7eb3fc78
equal deleted inserted replaced
24:63be7eb3fc78 25:f28ada11abbf
     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:
       
    15 * Wlan Sniffer Keepalive main function.
       
    16 */
       
    17 
       
    18 // System include files
       
    19 
       
    20 #include <e32base.h>
       
    21 #include <e32std.h>
       
    22 
       
    23 // User include files
       
    24 
       
    25 #include "wsfkeepalive.h"
       
    26 #include "OstTraceDefinitions.h"
       
    27 #ifdef OST_TRACE_COMPILER_IN_USE
       
    28 #include "mainTraces.h"
       
    29 #endif
       
    30 
       
    31 // External function prototypes
       
    32 
       
    33 // Local constants
       
    34 
       
    35 // ======== LOCAL FUNCTIONS ========
       
    36 
       
    37 // ---------------------------------------------------------------------------
       
    38 // Main implementation run in the active scheduler.
       
    39 // ---------------------------------------------------------------------------
       
    40 //
       
    41 LOCAL_C void MainL()
       
    42     {
       
    43     OstTraceFunctionEntry0( WSFKEEPALIVEMAINL_ENTRY );
       
    44     
       
    45     // Create the main implementation class and start monitoring events
       
    46     CWsfKeepalive* implementation = CWsfKeepalive::NewL();
       
    47     
       
    48     // Start active scheduler
       
    49     CActiveScheduler::Start();
       
    50     
       
    51     // All finished, cleanup
       
    52     delete implementation;
       
    53 
       
    54     OstTraceFunctionExit0( WSFKEEPALIVEMAINL_EXIT );
       
    55     }
       
    56 
       
    57 // ---------------------------------------------------------------------------
       
    58 // Starts main implementation.
       
    59 // ---------------------------------------------------------------------------
       
    60 //
       
    61 LOCAL_C void DoStartL()
       
    62     {
       
    63     OstTraceFunctionEntry0( WSFKEEPALIVEDOSTARTL_ENTRY );
       
    64     
       
    65     // Create active scheduler (to run active objects)
       
    66     CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
       
    67     CleanupStack::PushL( scheduler );
       
    68     CActiveScheduler::Install( scheduler );
       
    69 
       
    70     MainL();
       
    71 
       
    72     // Delete active scheduler
       
    73     CleanupStack::PopAndDestroy( scheduler );
       
    74 
       
    75     OstTraceFunctionExit0( WSFKEEPALIVEDOSTARTL_EXIT );
       
    76     }
       
    77 
       
    78 // ======== GLOBAL FUNCTIONS ========
       
    79 
       
    80 // ---------------------------------------------------------------------------
       
    81 // Main function of the application executable.
       
    82 // ---------------------------------------------------------------------------
       
    83 //
       
    84 GLDEF_C TInt E32Main()
       
    85     {
       
    86     OstTraceFunctionEntry0( WSFKEEPALIVEE32MAIN_ENTRY );
       
    87 
       
    88     // Create cleanup stack
       
    89     __UHEAP_MARK;
       
    90     CTrapCleanup* cleanup = CTrapCleanup::New();
       
    91 
       
    92     // Run application code inside TRAP harness
       
    93     TRAPD( mainError, DoStartL() );
       
    94     if ( mainError )
       
    95         {
       
    96         OstTrace1(
       
    97             TRACE_FATAL,
       
    98             _E32MAIN_ERROR,
       
    99             "::E32Main Error;mainError=%d",
       
   100             mainError );
       
   101         }
       
   102     
       
   103     delete cleanup;
       
   104     __UHEAP_MARKEND;
       
   105     
       
   106     OstTraceFunctionExit0( WSFKEEPALIVEE32MAIN_EXIT );
       
   107     return KErrNone;
       
   108     }