os/ossrv/genericservices/systemagent/src/client/sysagt2cli.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
#include "SaCls.h"
sl@0
    17
#include "SaPrivate.h"
sl@0
    18
sl@0
    19
/** 
sl@0
    20
The function starts SysAgt2 server.
sl@0
    21
sl@0
    22
SysAgt2 server does not offer any functionality other than registering system 
sl@0
    23
software P&S properties. This method is redundant and not used by system 
sl@0
    24
software, hence it is deprecated and will be removed in a future release. It 
sl@0
    25
should also be considered an internal API not for use outside of Symbian even 
sl@0
    26
though it is classified as publishedAll. Its interface access scope was 
sl@0
    27
incorrectly set when introduced. 
sl@0
    28
sl@0
    29
@return KErrNone The server was started successfully. <BR>
sl@0
    30
        KErrAlreadyExists An instance of the server already exists. <BR>
sl@0
    31
        KErrGeneral The server panicked at the startup. <BR>
sl@0
    32
        Some other system-wide error codes.
sl@0
    33
@publishedAll
sl@0
    34
@deprecated Redundant method no longer used by system software 
sl@0
    35
*/
sl@0
    36
EXPORT_C TInt StartSysAgt2()
sl@0
    37
	{
sl@0
    38
	// SysAgt2Svr uid
sl@0
    39
	const TUid KSystemAgentExeUid = {0x10204FC5}; 
sl@0
    40
	const TUidType serverUid(KNullUid, KNullUid, KSystemAgentExeUid);
sl@0
    41
	RProcess server;
sl@0
    42
	TInt err = server.Create(KSystemAgentServerImageName, KNullDesC, serverUid);
sl@0
    43
	if(err != KErrNone)
sl@0
    44
        {
sl@0
    45
		return err;
sl@0
    46
        }
sl@0
    47
	TRequestStatus stat;
sl@0
    48
	server.Rendezvous(stat);
sl@0
    49
	if(stat != KRequestPending)
sl@0
    50
        {
sl@0
    51
		server.Kill(0);		// abort startup
sl@0
    52
        }
sl@0
    53
	else
sl@0
    54
        {
sl@0
    55
		server.Resume();	// logon OK - start the server
sl@0
    56
        }
sl@0
    57
	User::WaitForRequest(stat);		// wait for start or death
sl@0
    58
	// we can't use the 'exit reason' if the server panicked as this
sl@0
    59
	// is the panic 'reason' and may be '0' which cannot be distinguished
sl@0
    60
	// from KErrNone
sl@0
    61
	err = server.ExitType() == EExitPanic ? KErrGeneral : stat.Int();
sl@0
    62
	server.Close();
sl@0
    63
	return err;
sl@0
    64
	}