systemhealthmanagement/systemhealthmgr/inc/startupproperties.h
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 // Copyright (c) 2006-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 #ifndef __STARTUPPROPERTIES_H__
       
    17 #define __STARTUPPROPERTIES_H__
       
    18 
       
    19 
       
    20 #include <e32base.h>
       
    21 #include <startup.hrh>
       
    22 
       
    23 class TResourceReader;
       
    24 
       
    25 /** A parameter class containing application/process starter information that is shared among client 
       
    26 applications, system components and client/server processes. This class is used to pass multiple 
       
    27 different types of data to API's in only one parameter while ensuring proper data initialization, memory 
       
    28 allocation and serializing over IPC when required. 
       
    29 
       
    30 When an instance of this class is created it contains default values for all properties. The usage of this 
       
    31 class for different scenarios only requires calling setter functions to overrride parameters which has 
       
    32 non-default values. 
       
    33 
       
    34 @publishedPartner
       
    35 @deprecated Instead of this use CSsmStartupProperties
       
    36 */
       
    37 NONSHARABLE_CLASS (CStartupProperties) : public CBase
       
    38 	{
       
    39 public:
       
    40     IMPORT_C static CStartupProperties* NewL();
       
    41     IMPORT_C static CStartupProperties* NewLC();
       
    42     IMPORT_C static CStartupProperties* NewL(const TDesC& aFileName, const TDesC& aArgs);
       
    43     IMPORT_C static CStartupProperties* NewLC(const TDesC& aFileName, const TDesC& aArgs);
       
    44     IMPORT_C static CStartupProperties* NewL(TResourceReader& aSource);
       
    45     IMPORT_C static CStartupProperties* NewLC(TResourceReader& aSource);
       
    46 	IMPORT_C ~CStartupProperties();    
       
    47 
       
    48     IMPORT_C void SetFileParamsL(const TDesC& aFileName, const TDesC& aArgs);
       
    49     IMPORT_C void SetStartupType(TStartupType aType);
       
    50     IMPORT_C void SetStartMethod(TStartMethod aStartMethod);
       
    51     IMPORT_C void SetNoOfRetries(TInt aNumRetries);
       
    52     IMPORT_C void SetTimeout(TInt aTimeout);
       
    53     IMPORT_C void SetActionOnCommandFailure(TActionOnCommandFailure aActionOnCommandFailure);
       
    54     IMPORT_C void SetRecoveryParams(TRecoveryMethod aRecoveryMethod, TInt aRestartMode);    
       
    55     IMPORT_C void SetMonitored(TBool aMonitored);
       
    56     IMPORT_C void SetViewless(TBool aViewless);
       
    57     IMPORT_C void SetStartInBackground(TBool aStartInBackground);
       
    58 
       
    59     IMPORT_C TInt Version() const;
       
    60     IMPORT_C TPtrC FileName() const;
       
    61     IMPORT_C TPtrC Args() const;
       
    62     IMPORT_C TStartupType StartupType() const;
       
    63     IMPORT_C TStartMethod StartMethod() const;
       
    64     IMPORT_C TInt NoOfRetries() const;
       
    65     IMPORT_C TInt Timeout() const;
       
    66 	IMPORT_C TBool Monitored() const;    
       
    67 	IMPORT_C TActionOnCommandFailure ActionOnCommandFailure() const;
       
    68     IMPORT_C TRecoveryMethod RecoveryMethod() const;
       
    69 	IMPORT_C TInt RestartMode() const;
       
    70 	IMPORT_C TBool Viewless() const;
       
    71 	IMPORT_C TBool StartInBackground() const;
       
    72 
       
    73     IMPORT_C void ExternalizeL(CBufBase& aBufPtr) const;
       
    74     IMPORT_C void InternalizeL(const TPtrC8& aBufPtr);
       
    75     IMPORT_C TInt Size() const;
       
    76 
       
    77     IMPORT_C void Reset();
       
    78 private:
       
    79 	CStartupProperties();
       
    80 	void ConstructL();
       
    81 	void ConstructFromResourceL(TResourceReader& aSource);
       
    82 	void DoSanityCheck(TStartupCommandType aCommandType) const;
       
    83 	
       
    84 private:	
       
    85 	/** Internal datatype to store the fail_on_error/retry_failure_recovery_method
       
    86 	members from version 1 and version 2 of the resource structs. */
       
    87 	union TRecoveryPolicy
       
    88 		{
       
    89 		TActionOnCommandFailure iActionOnCommandFailure;
       
    90 		TRecoveryMethod iRecoveryMethod;
       
    91 		};
       
    92 	/** Internal version for the CStartupProperties object */
       
    93 	TInt iVersion;
       
    94 	/** Path to the application	*/
       
    95 	HBufC* iFileName; 	
       
    96 	/** Application arguments */
       
    97 	HBufC* iArgs; 
       
    98 	/** What to start, application or process. */
       
    99 	TStartupType iStartupType;		
       
   100 	/** Whether system starter should wait for application to signal completion
       
   101 	or use 'fire and forget' mode.
       
   102 	*/
       
   103 	TStartMethod iStartMethod;			
       
   104 	/** No of retries if the server/app/process fails to start */
       
   105 	TInt iNoOfRetries;
       
   106 	/** Whether to kill a process that's taking too long.
       
   107 	a value of zero means "do not time this process out".
       
   108 	*/
       
   109 	TInt iTimeout;
       
   110 	/** How to recover monitored application */
       
   111 	TRecoveryPolicy iRecoveryMethod;
       
   112 	/** Which startup mode to restart the OS if recovery mode is RestartOSWithMode */
       
   113 	TInt iRestartMode;
       
   114 	/** Whether the application should be monitored	*/
       
   115 	TBool iMonitored;
       
   116 	/** Whether the application should be started viewless.	*/
       
   117 	TBool iViewless;
       
   118 	/** Whether the application should be started in the background. */
       
   119 	TBool iStartInBackground;
       
   120 	};
       
   121 
       
   122 #endif