locationsystemui/locationsysui/privacyverifiernotifierui/locprivacyserver/src/locprivacyserverstartup.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:  Implementation for server startup .
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include "locprivacyserverstartup.h"
       
    20 #include "locprivacyserver.h"
       
    21 #include "locprivacycommon.h"
       
    22 #include "locutilsdebug.h"
       
    23 
       
    24 // ============================ MEMBER FUNCTIONS ===============================
       
    25 
       
    26 // -----------------------------------------------------------------------------
       
    27 // LocPrivacyServerStartup::StartServer
       
    28 //
       
    29 // (other items were commented in a header).
       
    30 // -----------------------------------------------------------------------------
       
    31 //
       
    32 TInt LocPrivacyServerStartup::StartServer()
       
    33     {
       
    34     LOCUTILSDEBUG( "+LocPrivacyServerStartup::StartServer" )
       
    35     __UHEAP_MARK;
       
    36 
       
    37     CTrapCleanup* cleanupStack = CTrapCleanup::New();
       
    38 
       
    39     TInt ret = KErrNoMemory;
       
    40 
       
    41     if (cleanupStack)
       
    42         {
       
    43         TRAP(ret, StartServerL());
       
    44         delete cleanupStack;
       
    45         }
       
    46 
       
    47     __UHEAP_MARKEND;
       
    48 
       
    49     LOCUTILSDEBUG( "-LocPrivacyServerStartup::StartServer" )
       
    50     return ret;
       
    51     }
       
    52 
       
    53 // -----------------------------------------------------------------------------
       
    54 // LocPrivacyServerStartup::StartServerL
       
    55 //
       
    56 // (other items were commented in a header).
       
    57 // -----------------------------------------------------------------------------
       
    58 //
       
    59 void LocPrivacyServerStartup::StartServerL()
       
    60     {
       
    61     LOCUTILSDEBUG( "+LocPrivacyServerStartup::StartServerL" )
       
    62     // Rename thread to aid debugging
       
    63     User::LeaveIfError(User::RenameThread(KLocPrivacyServerName));
       
    64 
       
    65     // start scheduler and server
       
    66     CActiveScheduler* scheduler = new(ELeave) CActiveScheduler;
       
    67     CleanupStack::PushL(scheduler);
       
    68     CActiveScheduler::Install(scheduler);
       
    69 
       
    70     CLocPrivacyServer* server = CLocPrivacyServer::NewL();
       
    71     CleanupStack::PushL(server);
       
    72 
       
    73     CleanupStack::Pop(2, scheduler); // server
       
    74 
       
    75     RProcess::Rendezvous(KErrNone);
       
    76 
       
    77     CActiveScheduler::Start();
       
    78 
       
    79     delete server;
       
    80     delete scheduler;
       
    81    LOCUTILSDEBUG( "-LocPrivacyServerStartup::StartServerL" )
       
    82     }
       
    83 
       
    84 // -----------------------------------------------------------------------------
       
    85 // E32Main
       
    86 // Server process entry-point
       
    87 // Recover the startup parameters and run the server
       
    88 // -----------------------------------------------------------------------------
       
    89 //
       
    90 TInt E32Main()
       
    91     {
       
    92     return LocPrivacyServerStartup::StartServer();
       
    93     }
       
    94 
       
    95 //  End of File