sysstatemgmt/systemstatemgr/inc/ssmcustomcommand.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 __SSMCUSTOMCOMMAND_H__
       
    17 #define __SSMCUSTOMCOMMAND_H__
       
    18 
       
    19 #include <e32base.h>
       
    20 class RFs;
       
    21 
       
    22 /**
       
    23 Provides an environment to pass to the custom command dll during initialisation.
       
    24 
       
    25 @publishedPartner
       
    26 @released
       
    27 */
       
    28 
       
    29 NONSHARABLE_CLASS (CSsmCustomCommandEnv) : public CBase
       
    30 	{
       
    31 public:
       
    32 	/**
       
    33 	 * Creates a custom command environment.
       
    34 	 * 
       
    35 	 * This should never be called by implementations of MSsmCustomCommand as
       
    36 	 * the lifetime of the environment is managed by the command framework which 
       
    37 	 * uses the MSsmCustomCommand implementation. 
       
    38 	 * 
       
    39 	 * @internalTechnology
       
    40 	 */
       
    41 	static CSsmCustomCommandEnv* NewL(RFs& aRfs);
       
    42 	
       
    43 	
       
    44 	/**
       
    45 	 * Reference to an RFs handle for use by the custom command
       
    46 	 * 
       
    47 	 * @publishedPartner
       
    48 	 * @released
       
    49 
       
    50 
       
    51 	 */
       
    52 	IMPORT_C virtual const RFs& Rfs() const;
       
    53 	
       
    54 	/**
       
    55 	 * Destructor for custom command environment.
       
    56 	 * 
       
    57 	 * This should never be called by implementations of MSsmCustomCommand as
       
    58 	 * the lifetime of the environment is managed by the command framework which 
       
    59 	 * uses the MSsmCustomCommand implementation. 
       
    60 	 * 
       
    61 	 * @internalTechnology
       
    62 	 */
       
    63 	~CSsmCustomCommandEnv();
       
    64 
       
    65 private:
       
    66 	// don't allow objects to be copied or assigned
       
    67 	CSsmCustomCommandEnv(RFs& aRfs);
       
    68 	CSsmCustomCommandEnv(const CSsmCustomCommandEnv& aEnv);
       
    69 	CSsmCustomCommandEnv& operator= (const CSsmCustomCommandEnv& aEnv);
       
    70 
       
    71 private:
       
    72 	RFs& iFs;
       
    73 	};
       
    74 
       
    75 
       
    76 /** 
       
    77 Abstract interface to a custom command.
       
    78 All custom command objects should derive from this interface.
       
    79 
       
    80 @publishedPartner
       
    81 @released
       
    82 */
       
    83 class MSsmCustomCommand
       
    84 	{
       
    85 public:
       
    86 	/**
       
    87 	 * Initializes this custom command.
       
    88 	 * 
       
    89 	 * @param aCmdEnv A environment for use by the custom command. This pointer will be valid until
       
    90 	 *                Release is called on this custom command.
       
    91 	 * 
       
    92 	 * @return KErrNone on success, otherwise one of the system wide error codes.
       
    93 	 * 
       
    94 	 * @publishedPartner
       
    95 	 * @released
       
    96 	 */
       
    97 	virtual TInt Initialize(CSsmCustomCommandEnv* aCmdEnv) = 0;
       
    98 	
       
    99 	/**
       
   100 	 * Executes this custom command.
       
   101 	 * 
       
   102 	 * @param aParams The extra information data for this instance of the custom command. If this
       
   103 	 *                custom command was created from a resource file struct, this will be the 
       
   104 	 *                resource pointed to by dll_info.
       
   105 	 * @param aRequest Request object completed with KErrNone when the command has successfully
       
   106 	 * 					finished execution, otherwise one of the system wide error codes.
       
   107 	 * 
       
   108 	 * @publishedPartner
       
   109 	 * @released
       
   110 	 */
       
   111 	virtual void Execute(const TDesC8& aParams, TRequestStatus& aRequest) = 0;
       
   112 	
       
   113 	/**
       
   114 	 * Closes resources initialized in a previous call to Initialize.
       
   115 	 * 
       
   116 	 * @publishedPartner
       
   117 	 * @released
       
   118 	 */
       
   119 	virtual void Close() = 0;
       
   120 
       
   121 	/**
       
   122 	 * Releases memory associated with the Custom Command (deletes the MSsmCustomCommand object)
       
   123 	 * 
       
   124 	 * @publishedPartner
       
   125 	 * @released
       
   126 	 */
       
   127 	virtual void Release() = 0;
       
   128 
       
   129 	/**
       
   130 	 * Cancels current execution of this custom command.
       
   131 	 * 
       
   132 	 * @publishedPartner
       
   133 	 * @released
       
   134 	 */
       
   135 	virtual void ExecuteCancel() = 0;
       
   136 	};
       
   137 
       
   138 #endif // __SSMCUSTOMCOMMAND_H__