locationsystemui/locationsysui/posindicator/posindicatorhelperserver/src/posindicatorhelperserverstartup.cpp
branchRCL_3
changeset 44 2b4ea9893b66
equal deleted inserted replaced
42:02ba3f1733c6 44:2b4ea9893b66
       
     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: Position indicator server start up
       
    15 *
       
    16 */
       
    17 
       
    18 #include <e32base.h>
       
    19 #include <e32std.h>
       
    20 #include "posindicatorservercore.h"
       
    21 #include "posindicatorserverconst.h"
       
    22 #include "posindicatorlogger.h"
       
    23 
       
    24 // ---------------------------------------------------------------------------
       
    25 // Starts the server core
       
    26 // ---------------------------------------------------------------------------
       
    27 //
       
    28 void StartServerCoreL()
       
    29     {
       
    30     FUNC("StartServerCoreL");
       
    31     User::LeaveIfError(RThread().RenameMe(KPosIndHelperSrvName));
       
    32     
       
    33     // Install the scheduler and start the LBT server
       
    34     CActiveScheduler* scheduler = new ( ELeave ) CActiveScheduler;
       
    35     CleanupStack::PushL( scheduler );
       
    36     CActiveScheduler::Install( scheduler );
       
    37     
       
    38     CPosIndicatorServerCore* server = CPosIndicatorServerCore::NewLC();
       
    39     
       
    40     // This starts the position indicator server
       
    41     server->StartL(KPosIndHelperSrvName);
       
    42     
       
    43     // Finish rendezvous with launching process
       
    44     RProcess::Rendezvous( KErrNone );
       
    45     
       
    46     CActiveScheduler::Start();
       
    47     CleanupStack::PopAndDestroy( 2, scheduler );
       
    48     }
       
    49 
       
    50 
       
    51 GLDEF_C TInt E32Main()
       
    52     {
       
    53     FUNC("E32Main");
       
    54     __UHEAP_MARK;
       
    55 
       
    56     CTrapCleanup* cleanupStack = CTrapCleanup::New();
       
    57 
       
    58     // The ret is initialized to KErrNoMemory so that the function returns 
       
    59     // KErrNoMemory if the cleanupstack allocation fails.
       
    60     TInt ret = KErrNoMemory;
       
    61     if (cleanupStack)
       
    62         {
       
    63         TRAP(ret, StartServerCoreL());
       
    64         delete cleanupStack;
       
    65         }
       
    66         
       
    67     __UHEAP_MARKEND;
       
    68     return ret;
       
    69     }
       
    70