locationcentre/lcserver/src/lcserverstartup.cpp
branchRCL_3
changeset 16 4721bd00d3da
parent 14 3a25f69541ff
child 21 e15b7f06eba6
equal deleted inserted replaced
14:3a25f69541ff 16:4721bd00d3da
     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:  Location Centre Server start up.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // SYSTEM INCLUDES
       
    20 
       
    21 // USER INCLUDES
       
    22 #include "lcserverstartup.h"
       
    23 #include "lcserverinterface.h"
       
    24 #include "lcserver.h"
       
    25 
       
    26 // ----- Member funtions for LcServerStartup ---------------------------------
       
    27 
       
    28 // ---------------------------------------------------------------------------
       
    29 // TInt LcServerStartup::StartLocationCentreServer
       
    30 // ---------------------------------------------------------------------------
       
    31 //
       
    32 TInt LcServerStartup::StartLocationCentreServer()
       
    33     {
       
    34     __UHEAP_MARK;
       
    35 
       
    36     CTrapCleanup* cleanupStack = CTrapCleanup::New();
       
    37 
       
    38     TInt ret = KErrNoMemory;
       
    39     if ( cleanupStack )
       
    40         {
       
    41         TRAP(ret, StartLocationCentreServerL());
       
    42         delete cleanupStack;
       
    43         }
       
    44 
       
    45     __UHEAP_MARKEND;
       
    46 
       
    47     return ret;
       
    48     }
       
    49 
       
    50 // ---------------------------------------------------------------------------
       
    51 // void LcServerStartup::StartLocationCentreServer
       
    52 // ---------------------------------------------------------------------------
       
    53 //
       
    54 void LcServerStartup::StartLocationCentreServerL()
       
    55     {
       
    56     // Rename thread to aid debugging
       
    57     User::LeaveIfError( User::RenameThread( KLocationCentreServerName ));
       
    58 
       
    59     // Start Active scheduler and Server
       
    60     CActiveScheduler* scheduler = new( ELeave ) CActiveScheduler;
       
    61     CleanupStack::PushL( scheduler );
       
    62     CActiveScheduler::Install( scheduler );
       
    63 
       
    64     CLcServer* server = CLcServer::NewL();
       
    65     CleanupStack::PushL( server );
       
    66 
       
    67     CleanupStack::Pop(2, scheduler); // server
       
    68 
       
    69     RProcess::Rendezvous( KErrNone );
       
    70 
       
    71     CActiveScheduler::Start();
       
    72 
       
    73     delete server;
       
    74     delete scheduler;    
       
    75     }
       
    76     
       
    77 // -----------------------------------------------------------------------------
       
    78 // TInt E32Main
       
    79 // Server process entry-point
       
    80 // -----------------------------------------------------------------------------
       
    81 //
       
    82 TInt E32Main()
       
    83     {
       
    84     return LcServerStartup::StartLocationCentreServer();
       
    85     }    
       
    86                                                                
       
    87 // End of File
       
    88