genericservices/systemagent/src/client/sysagt2cli.cpp
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 // Copyright (c) 1997-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 "SaCls.h"
       
    17 #include "SaPrivate.h"
       
    18 
       
    19 /** 
       
    20 The function starts SysAgt2 server.
       
    21 
       
    22 SysAgt2 server does not offer any functionality other than registering system 
       
    23 software P&S properties. This method is redundant and not used by system 
       
    24 software, hence it is deprecated and will be removed in a future release. It 
       
    25 should also be considered an internal API not for use outside of Symbian even 
       
    26 though it is classified as publishedAll. Its interface access scope was 
       
    27 incorrectly set when introduced. 
       
    28 
       
    29 @return KErrNone The server was started successfully. <BR>
       
    30         KErrAlreadyExists An instance of the server already exists. <BR>
       
    31         KErrGeneral The server panicked at the startup. <BR>
       
    32         Some other system-wide error codes.
       
    33 @publishedAll
       
    34 @deprecated Redundant method no longer used by system software 
       
    35 */
       
    36 EXPORT_C TInt StartSysAgt2()
       
    37 	{
       
    38 	// SysAgt2Svr uid
       
    39 	const TUid KSystemAgentExeUid = {0x10204FC5}; 
       
    40 	const TUidType serverUid(KNullUid, KNullUid, KSystemAgentExeUid);
       
    41 	RProcess server;
       
    42 	TInt err = server.Create(KSystemAgentServerImageName, KNullDesC, serverUid);
       
    43 	if(err != KErrNone)
       
    44         {
       
    45 		return err;
       
    46         }
       
    47 	TRequestStatus stat;
       
    48 	server.Rendezvous(stat);
       
    49 	if(stat != KRequestPending)
       
    50         {
       
    51 		server.Kill(0);		// abort startup
       
    52         }
       
    53 	else
       
    54         {
       
    55 		server.Resume();	// logon OK - start the server
       
    56         }
       
    57 	User::WaitForRequest(stat);		// wait for start or death
       
    58 	// we can't use the 'exit reason' if the server panicked as this
       
    59 	// is the panic 'reason' and may be '0' which cannot be distinguished
       
    60 	// from KErrNone
       
    61 	err = server.ExitType() == EExitPanic ? KErrGeneral : stat.Int();
       
    62 	server.Close();
       
    63 	return err;
       
    64 	}