sl@0: // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @internalComponent sl@0: */ sl@0: sl@0: #include sl@0: #include "mmcameraserver.h" sl@0: sl@0: // Perform all server initialisation, in particular creation of the sl@0: // scheduler and server and then run the scheduler sl@0: static void RunServerL() sl@0: { sl@0: User::LeaveIfError(User::RenameProcess(KMMCameraServerName)); sl@0: sl@0: // create and install the active scheduler we need sl@0: CActiveScheduler* activeScheduler = new(ELeave) CActiveScheduler; sl@0: CleanupStack::PushL(activeScheduler); sl@0: CActiveScheduler::Install(activeScheduler); sl@0: sl@0: // Create the server, leaving it on the cleanup stack. sl@0: CMMCameraServer::NewLC(); sl@0: sl@0: // Initialisation complete, now signal the client sl@0: RProcess::Rendezvous(KErrNone); sl@0: sl@0: // Ready to run sl@0: CActiveScheduler::Start(); sl@0: sl@0: // Cleanup the server and scheduler sl@0: CleanupStack::PopAndDestroy(2, activeScheduler); sl@0: } sl@0: sl@0: /** sl@0: * Program entry point. sl@0: * Symbian OS will call this method when the server process is started. sl@0: */ sl@0: GLDEF_C TInt E32Main() sl@0: { sl@0: __UHEAP_MARK; sl@0: CTrapCleanup* cleanup = CTrapCleanup::New(); sl@0: TInt err = KErrNoMemory; sl@0: sl@0: if (cleanup) sl@0: { sl@0: TRAP(err,RunServerL()); sl@0: delete cleanup; sl@0: } sl@0: sl@0: REComSession::FinalClose(); sl@0: __UHEAP_MARKEND; sl@0: return err; sl@0: }