messagingapp/msgappfw/server/src/ccsstartup.cpp
changeset 31 ebfee66fde93
parent 23 238255e8b033
equal deleted inserted replaced
30:6a20128ce557 31:ebfee66fde93
       
     1 /*
       
     2 * Copyright (c) 2007 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:  CS Server Startup module
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <ccsdefs.h>
       
    21 
       
    22 #include "ccsdebug.h"
       
    23 #include "ccsserver.h"
       
    24 
       
    25 // ----------------------------------------------------------------------------
       
    26 // Initialize and run the server
       
    27 // ----------------------------------------------------------------------------
       
    28 static void RunTheServerL()
       
    29 {
       
    30     // creates log directory (Cs) and log file (CsServer.txt) on app startup.
       
    31     // prints starting banner...
       
    32            
       
    33     PRINT ( _L("Enter RunTheServerL") );
       
    34 
       
    35     // First create and install the active scheduler
       
    36     CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
       
    37     CleanupStack::PushL(scheduler);
       
    38     CActiveScheduler::Install(scheduler);
       
    39     CleanupStack::Pop(scheduler);
       
    40     
       
    41     // Create the server
       
    42     CCsServer* server = CCsServer::NewL();
       
    43   
       
    44     // Signal the client the startup is complete
       
    45     RProcess::Rendezvous(KErrNone);
       
    46 
       
    47     // Enter the wait loop
       
    48     CActiveScheduler::Start();
       
    49 
       
    50     // Exited cleanup scheduler and server
       
    51     delete server;
       
    52     delete scheduler;
       
    53 
       
    54     REComSession::FinalClose();
       
    55     
       
    56     PRINT ( _L("End RunTheServerL") );
       
    57 }
       
    58 
       
    59 
       
    60 // ----------------------------------------------------------------------------
       
    61 // Main entry-point for the server thread/process
       
    62 // ----------------------------------------------------------------------------
       
    63 static TInt RunTheServer()
       
    64 {
       
    65     PRINT ( _L("Enter RunTheServer") );
       
    66     
       
    67     CTrapCleanup* cleanup=CTrapCleanup::New();
       
    68     TInt r = KErrNoMemory;
       
    69     if (cleanup)
       
    70     {
       
    71 		TRAP(r,RunTheServerL());
       
    72 		delete cleanup;
       
    73     }
       
    74     
       
    75     PRINT ( _L("End RunTheServer") );
       
    76     
       
    77     return (r);
       
    78 }
       
    79 
       
    80 
       
    81 // ----------------------------------------------------------------------------
       
    82 // Process entry point 
       
    83 // ----------------------------------------------------------------------------
       
    84 TInt E32Main()
       
    85 {
       
    86     return RunTheServer();
       
    87 }