profilesservices/ProfileEngine/ProfileScheduleEventSrc/Main.cpp
changeset 0 8c5d936e5675
equal deleted inserted replaced
-1:000000000000 0:8c5d936e5675
       
     1 /*
       
     2 * Copyright (c) 2002 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:  The application gets instantiated starting from this class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include    <e32svr.h>
       
    22 #include    <e32base.h>
       
    23 #include    <e32std.h>
       
    24 #include    "CProfileChangeEvent.h"
       
    25 #include    "ProfilesDebug.h"
       
    26 
       
    27 // CONSTANTS
       
    28 _LIT( KProfileScheduleEvent, "ProfileScheduleEvent" );
       
    29 
       
    30 // ============================= LOCAL FUNCTIONS ===============================
       
    31 
       
    32 LOCAL_D TInt Execute( TFileName& /* aFileName */ )
       
    33     {
       
    34     __UHEAP_MARK;
       
    35     CTrapCleanup* tc = CTrapCleanup::New();
       
    36     if( !tc )
       
    37         {
       
    38         User::Panic( KProfileScheduleEvent, KErrNoMemory );
       
    39         }
       
    40 
       
    41     CActiveScheduler* scheduler = new CActiveScheduler; // CSI: 62 # scheduler tested for NULL below
       
    42     if (!scheduler)
       
    43         {
       
    44         PRODEBUG( "ERROR: couldn't create active scheduler!" );
       
    45         User::Panic( KProfileScheduleEvent, KErrNoMemory );
       
    46         }
       
    47     CActiveScheduler::Install(scheduler);
       
    48     
       
    49 	PRODEBUG( " ProfileSchedEvent:Execute before ExecuteL " );
       
    50     TRAPD( err, CProfileChangeEvent::ExecuteL( ) );
       
    51 	PRODEBUG( " ProfileSchedEvent:Execute after ExecuteL " );
       
    52 
       
    53     CActiveScheduler::Install( NULL );
       
    54     delete scheduler;
       
    55 
       
    56     delete tc;
       
    57     __UHEAP_MARKEND;
       
    58     return err;
       
    59     }
       
    60 
       
    61 GLDEF_C TInt E32Main()
       
    62     {
       
    63 	PRODEBUG( "ProfileSchedEvent:E32Main()" );
       
    64     TBuf< 0x100 > cmd;
       
    65     User::CommandLine( cmd );
       
    66     return Execute( cmd );
       
    67     }
       
    68 
       
    69 //  End of File
       
    70