nwnotifier/src/nwnotifier.cpp
branchRCL_3
changeset 20 987c9837762f
parent 3 a4a774cb6ea7
equal deleted inserted replaced
19:7d48bed6ce0c 20:987c9837762f
       
     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 module contains the implementation of CNWNotifier 
       
    15 *              class member functions.
       
    16 *
       
    17 */
       
    18 
       
    19 // SYSTEM INCLUDE FILES
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include "nwregistrationstatusmonitor.h" 
       
    23 
       
    24 //  Global Variables
       
    25 
       
    26 // CONSTANTS
       
    27 _LIT( KNWNotifierThreadName,"NWNotifierThread" ); 
       
    28 
       
    29 //  Local Functions
       
    30 
       
    31 // -----------------------------------------------------------------------------
       
    32 // DoStartL()
       
    33 // 
       
    34 // -----------------------------------------------------------------------------
       
    35 //
       
    36 LOCAL_C void DoStartL()
       
    37     {
       
    38     // Rename thread as 
       
    39     User::RenameThread( KNWNotifierThreadName );  
       
    40     
       
    41     // Create active scheduler (to run active objects)
       
    42     CActiveScheduler* threadScheduler = new (ELeave) CActiveScheduler;
       
    43     CleanupStack::PushL( threadScheduler );
       
    44     CActiveScheduler::Install( threadScheduler );
       
    45 
       
    46     // Create an instance of status monitoring component. Start monitoring instantly.
       
    47     CNWRegistrationStatusMonitor* statusMonitor = CNWRegistrationStatusMonitor::NewL();
       
    48     
       
    49     //Starts the scheduler. Thread remains in this loop until this process is terminated.
       
    50     CActiveScheduler::Start();
       
    51     
       
    52     delete statusMonitor;
       
    53     
       
    54     // Delete active scheduler
       
    55     CleanupStack::PopAndDestroy( threadScheduler );
       
    56     }
       
    57 
       
    58 //  Global Functions
       
    59 
       
    60 // -----------------------------------------------------------------------------
       
    61 // E32Main()
       
    62 // Provides the API for the operating system to start the executable.
       
    63 // Returns the address of the function to be called.
       
    64 // -----------------------------------------------------------------------------
       
    65 //
       
    66 GLDEF_C TInt E32Main()
       
    67     {
       
    68     // Create cleanup stack
       
    69     __UHEAP_MARK;
       
    70     CTrapCleanup* cleanup = CTrapCleanup::New();
       
    71     
       
    72     if( !cleanup )
       
    73         {
       
    74         return KErrNoMemory;
       
    75         }
       
    76     
       
    77     // Run application code inside TRAP harness
       
    78     TRAPD( mainErr, DoStartL() );
       
    79         
       
    80     delete cleanup;
       
    81     __UHEAP_MARKEND;
       
    82     
       
    83     return mainErr;
       
    84     }
       
    85 
       
    86 // End of File