mmserv/radioutility/radioserver/Server/Src/RadioServerMain.cpp
changeset 0 71ca22bcf22a
equal deleted inserted replaced
-1:000000000000 0:71ca22bcf22a
       
     1 /*
       
     2 * Copyright (c) 2002-2004 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:  Executable module to start the process and load the RadioServer.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include 	<e32base.h>
       
    22 #include    "RadioServer.h"
       
    23 #include	"RadioClientServer.h"
       
    24 
       
    25 // ============================= LOCAL FUNCTIONS ===============================
       
    26 
       
    27 // -----------------------------------------------------------------------------
       
    28 // RunServerL
       
    29 // Perform all server initialisation, in particular creation of the
       
    30 // scheduler and server and then run the scheduler
       
    31 // -----------------------------------------------------------------------------
       
    32 //
       
    33 static void RunServerL()
       
    34 	{
       
    35 	// Naming the server thread after the server helps to debug panics
       
    36 	User::LeaveIfError(User::RenameThread(KRadioServerName));
       
    37 
       
    38 	// Create and install the active scheduler we need
       
    39 	CActiveScheduler* scheduler = new(ELeave) CActiveScheduler;
       
    40 	CleanupStack::PushL(scheduler);
       
    41 	CActiveScheduler::Install(scheduler);
       
    42 
       
    43 	// Create the server (leave it on the cleanup stack)
       
    44 	CRadioServer* server = CRadioServer::NewL();
       
    45 	CleanupStack::PushL(server);
       
    46 	
       
    47 	// Initialisation complete, now signal the client
       
    48 	RProcess::Rendezvous(KErrNone);
       
    49 
       
    50 	// Start the scheduler and wait for client requests
       
    51 	CActiveScheduler::Start();
       
    52 
       
    53 	// Ready to exit.
       
    54 	// Cleanup the scheduler and server
       
    55 	CleanupStack::PopAndDestroy(2, scheduler);
       
    56 	
       
    57 	REComSession::FinalClose();
       
    58 	}
       
    59 
       
    60 // -----------------------------------------------------------------------------
       
    61 // E32Main
       
    62 // Entry point for the server
       
    63 // -----------------------------------------------------------------------------
       
    64 //
       
    65 TInt E32Main()
       
    66 	{
       
    67 	__UHEAP_MARK;
       
    68 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    69 	TInt r = KErrNoMemory;
       
    70 	if ( cleanup )
       
    71 		{
       
    72 		TRAP(r, RunServerL());
       
    73 		delete cleanup;
       
    74 		}
       
    75 	__UHEAP_MARKEND;
       
    76 	return r;
       
    77 	}
       
    78 
       
    79 //  End of File