sysstatemgmt/systemstatemgr/inc/ssmstartupproperties.h
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 #ifndef __SSMSTARTUPPROPERTIES_H__
       
    17 #define __SSMSTARTUPPROPERTIES_H__
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <ssm/ssmcmd.hrh>
       
    21 
       
    22 class CResourceFile;
       
    23 class RReadStream;
       
    24 class RWriteStream;
       
    25 class RResourceReader;
       
    26 
       
    27 /**
       
    28 Structure to store monitor information.
       
    29 @publishedPartner
       
    30 @released
       
    31 */
       
    32 struct TSsmMonitorInfo
       
    33 	{
       
    34 	TSsmRecoveryMethod iRestartPolicy;
       
    35 	TInt iRestartMode;
       
    36 	TInt32 iTimeout;
       
    37 	TInt iRetries;
       
    38 	};
       
    39 
       
    40 /** A parameter class containing application/process starter information that is shared among client 
       
    41 applications, system components and client/server processes. This class is used to pass multiple 
       
    42 different types of data to API's in only one parameter while ensuring proper data initialization, memory 
       
    43 allocation and serializing over IPC when required. 
       
    44 
       
    45 When an instance of this class is created it contains default values for all properties. The usage of this 
       
    46 class for different scenarios only requires calling setter functions to overrride parameters which has 
       
    47 non-default values. 
       
    48 
       
    49 @publishedPartner
       
    50 @released
       
    51 */
       
    52 NONSHARABLE_CLASS (CSsmStartupProperties) : public CBase
       
    53 	{
       
    54 public:
       
    55     IMPORT_C static CSsmStartupProperties* NewL();
       
    56     IMPORT_C static CSsmStartupProperties* NewLC();
       
    57 
       
    58     IMPORT_C static CSsmStartupProperties* NewL(const TDesC& aFileName, const TDesC& aArgs);
       
    59     IMPORT_C static CSsmStartupProperties* NewLC(const TDesC& aFileName, const TDesC& aArgs);
       
    60 
       
    61     IMPORT_C static CSsmStartupProperties* NewL(RResourceReader& aReader, CResourceFile* aResourceFile, TSsmCommandType aCommandType);
       
    62     IMPORT_C static CSsmStartupProperties* NewLC(RResourceReader& aReader, CResourceFile* aResourceFile, TSsmCommandType aCommandType);
       
    63     IMPORT_C static CSsmStartupProperties* NewL(const CSsmStartupProperties& aStartupProperties);
       
    64 	IMPORT_C ~CSsmStartupProperties();
       
    65 
       
    66 	//Setter functions for member variables
       
    67     IMPORT_C void SetFileParamsL(const TDesC& aFileName, const TDesC& aArgs);
       
    68     IMPORT_C void SetCommandTypeL(TSsmCommandType aCommandType);
       
    69     IMPORT_C void SetExecutionBehaviour(TSsmExecutionBehaviour aExecutionBehaviour);
       
    70     IMPORT_C void SetRetries(TInt aRetries);
       
    71     IMPORT_C void SetTimeout(TInt32 aTimeout);
       
    72     IMPORT_C void SetViewless(TBool aViewless);
       
    73     IMPORT_C void SetStartInBackground(TBool aStartInBackground);
       
    74 
       
    75 	IMPORT_C void SetMonitorInfoL(TSsmMonitorInfo aMonitorInfo);
       
    76 
       
    77     // getter functions
       
    78     IMPORT_C TPtrC FileName() const;
       
    79     IMPORT_C TPtrC Args() const;
       
    80     IMPORT_C TSsmCommandType CommandType() const;
       
    81     IMPORT_C TSsmExecutionBehaviour ExecutionBehaviour() const;
       
    82     IMPORT_C TInt Retries() const;
       
    83     IMPORT_C TInt32 Timeout() const;
       
    84 	IMPORT_C TBool IsMonitoringRequired() const;
       
    85 	IMPORT_C TBool Viewless() const;
       
    86 	IMPORT_C TBool StartInBackground() const;
       
    87 	IMPORT_C TSsmMonitorInfo MonitorInfo() const;
       
    88 
       
    89     IMPORT_C void ExternalizeL(RWriteStream& aWriteStream) const;
       
    90     IMPORT_C void InternalizeL(RReadStream& aReadStream);
       
    91 
       
    92     IMPORT_C void Reset();
       
    93 private:
       
    94 	CSsmStartupProperties();
       
    95 	CSsmStartupProperties(const CSsmStartupProperties& aStartupProperties);
       
    96 	void ConstructL(const CSsmStartupProperties& aStartupProperties);
       
    97 	void ConstructFromResourceL(RResourceReader& aReader, CResourceFile* aResourceFile, TSsmCommandType aCommandType);
       
    98 
       
    99 private:
       
   100 	TSsmCommandType iCommandType;
       
   101 	HBufC* iFileName;
       
   102 	HBufC* iArgs;
       
   103 	TSsmExecutionBehaviour iExecutionBehaviour;
       
   104 	TInt32 iTimeout;
       
   105 	TInt iRetries;
       
   106 	TBool iViewless;
       
   107 	TBool iStartInBackground;
       
   108 	TSsmMonitorInfo iMonitorInfo;
       
   109 	TBool iMonitoringRequired;
       
   110 
       
   111 	// for future use
       
   112 	TInt iReserved1;
       
   113 	TInt iReserved2;
       
   114 	TInt iReserved3;
       
   115 	};
       
   116 
       
   117 #endif	// __SSMSTARTUPPROPERTIES_H__
       
   118