sysstatemgmt/systemstatemgr/ssm/src/main.cpp
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include <e32base.h>
       
    17 #include <e32std.h>
       
    18 #include <domainmanager.h>
       
    19 #include <bacline.h> // for command line arguments
       
    20 
       
    21 #include "ssmserver.h"
       
    22 #include "ssmserverpanic.h"
       
    23 #include <ssm/ssmstates.hrh>
       
    24 
       
    25 
       
    26 static void MainL()
       
    27 	{
       
    28 	CActiveScheduler* sched = new(ELeave) CActiveScheduler;
       
    29 	CleanupStack::PushL(sched);	
       
    30 	CActiveScheduler::Install(sched);
       
    31 
       
    32 	// Add the system state domain hierarchy, named KDmHierarchyIdStartup for
       
    33 	// compatibility reasons.
       
    34 	// Domain manager has already been started by estart
       
    35 	TInt err = RDmDomainManager::AddDomainHierarchy(KDmHierarchyIdStartup);
       
    36 	if(KErrNone != err && KErrAlreadyExists != err)
       
    37 		{
       
    38 		PanicNow(KPanicSysStateMgr, EAddDomainHierarchyError);
       
    39 		}
       
    40 	
       
    41 	CSsmServer* server = CSsmServer::NewLC(ESsmStartup);
       
    42 	sched->Start();
       
    43 
       
    44 	CleanupStack::PopAndDestroy(server);
       
    45 	CleanupStack::PopAndDestroy(sched);
       
    46 	}
       
    47 
       
    48 /**
       
    49 This process entry point, is called by client using RProcess API
       
    50 @return - Standard Epoc error code on process exit
       
    51 */
       
    52 TInt E32Main() //lint -e765 -e714 Suppress 'not referenced' and 'could be static'
       
    53 	{
       
    54 	__UHEAP_MARK;
       
    55 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    56 	TInt err = KErrNoMemory;
       
    57 	if(cleanup)
       
    58 		{
       
    59 		TRAP(err, MainL());
       
    60 		delete cleanup;
       
    61 		}
       
    62 	
       
    63 	__UHEAP_MARKEND;
       
    64 	return err;
       
    65     }
       
    66