DirectPrint/DirectPrintServer/src/main.cpp
changeset 19 2275db202402
parent 11 613a5ff70823
equal deleted inserted replaced
2:acc370d7f2f6 19:2275db202402
       
     1 /*
       
     2 * Copyright (c) 2010 Kanrikogaku Kenkyusho, Ltd.
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "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 * Kanrikogaku Kenkyusho, Ltd. - Initial contribution
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <e32base.h>
       
    20 
       
    21 #include "directprintclientserver.h"
       
    22 #include "directprintserver.h"
       
    23 #include "directprintscheduler.h"
       
    24 #include "clog.h"
       
    25 
       
    26 // init and run the server
       
    27 static void RunTheServerL()
       
    28 	{
       
    29 #ifndef __SECURE_API__
       
    30 	User::LeaveIfError( RThread().Rename( KDirectPrintServerName ) );  //Deprecated! Replace this with the line below as soon as possible
       
    31 #else
       
    32 	User::LeaveIfError( RThread().RenameMe( KDirectPrintServerName ) );
       
    33 #endif
       
    34 
       
    35 	CActiveScheduler* scheduler = new (ELeave) CDirectPrintScheduler;
       
    36 	CleanupStack::PushL( scheduler );
       
    37 	CActiveScheduler::Install( scheduler );
       
    38 
       
    39 	CDirectPrintServer::NewLC();
       
    40 	
       
    41 	RProcess::Rendezvous( KErrNone );
       
    42 
       
    43 	CActiveScheduler::Start();
       
    44 	CleanupStack::PopAndDestroy( 2 );	// CDirectPrintServer, scheduler
       
    45 	}
       
    46 
       
    47 // Server process entry-point
       
    48 TInt E32Main()
       
    49 	{	
       
    50 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    51 	TInt r( KErrNoMemory );
       
    52 	if( cleanup )
       
    53 		{
       
    54 		TRAP( r, RunTheServerL() );
       
    55 		delete cleanup;
       
    56 		}
       
    57 	return r;
       
    58 	}
       
    59 
       
    60 //  End of File