dbgsrv/coredumpserver/interface/datasave/crashdatasave.h
changeset 0 c6b0df440bee
equal deleted inserted replaced
-1:000000000000 0:c6b0df440bee
       
     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 // Defines the ECOM Core Dump Writer interface.
       
    15 //
       
    16 
       
    17 /**
       
    18  @file
       
    19  @publishedPartner
       
    20  @released
       
    21 */
       
    22 
       
    23 #ifndef CRASH_DATA_SAVE_H
       
    24 #define CRASH_DATA_SAVE_H
       
    25 
       
    26 #include <e32std.h>
       
    27 #include <ecom.h>
       
    28 
       
    29 #include <ImplementationInformation.h>
       
    30 
       
    31 /**
       
    32 This is the ECOM interface UID that all Writer ECOM plugins supporting this interface
       
    33 must implement. This must match with the implementation_uid field of the rss file.
       
    34 */
       
    35 const TUid KCCrashDataSaveUid = {0x102831e3};
       
    36 
       
    37 class COptionConfig;
       
    38 
       
    39 /**
       
    40 Class that defines the ECOM interface of a Core Dump Writer ECOM plugin.
       
    41 The responsibility of a writer plugin is to be a repository or channel for a
       
    42 formatter's crash data.
       
    43 The class is intended for derivation by implementations of the interface.
       
    44 */
       
    45 class CCrashDataSave : public CBase
       
    46 {
       
    47 public:
       
    48 
       
    49     /** Interface for passing initialisation parameters
       
    50     to the derived class constructor. Standard ECOM implementation.
       
    51 	*/
       
    52     struct TExampleInterfaceInitParams
       
    53         {
       
    54 		/** Integer cue */
       
    55         TInt integer;
       
    56 		/** Descriptor cue */
       
    57         const TDesC* descriptor;
       
    58         };
       
    59 
       
    60 	// mandatory ECOM functions
       
    61 	static CCrashDataSave* NewL();
       
    62 	static CCrashDataSave* NewL( const TDesC8 & aCue );
       
    63 	static CCrashDataSave* NewL(const TUid& aUid);
       
    64 	static void ListAllImplementationsL( RImplInfoPtrArray & aImplInfoArray );
       
    65 
       
    66 	/**
       
    67 	Obtain a description of the plugin.
       
    68 	*/
       
    69 	virtual void GetDescription( TDes & aPluginDescription ) = 0;
       
    70 
       
    71     /**
       
    72 	Return the number of configuration parameters implemented by the plugin.
       
    73 	*/
       
    74 	virtual TInt GetNumberConfigParametersL( ) = 0;
       
    75 
       
    76 	/**
       
    77 	Return the configuration parameter with ordinal aIndex.
       
    78 	@param  aIndex Parameter ordinal
       
    79 	*/
       
    80 	virtual COptionConfig * GetConfigParameterL( const TInt aIndex ) = 0;
       
    81 
       
    82 	/**
       
    83 	Change the configuration parameter with ordinal aIndex to the given values.
       
    84 	The plugin interprets and validates the values. Depending on the type of
       
    85 	parameter, the plugin may use the integer parameter aValue or the
       
    86 	descriptor parameter aDescValue
       
    87 	@param  aIndex Parameter ordinal
       
    88 	@param  aValue Integer value
       
    89 	@param  aDescValue Descriptor value
       
    90 	*/
       
    91 	virtual void SetConfigParameterL( const TInt aIndex, const TInt32 & aValue, const TDesC & aDescValue ) = 0;
       
    92 
       
    93 	// Writer interface
       
    94 
       
    95 	/**
       
    96 	Used to start the saving of data.
       
    97 	@param aParam The interpretation of aParam is specific to the plugin.
       
    98 	*/
       
    99 	virtual void OpenL( const TDesC& aParam ) = 0;
       
   100 
       
   101 	/**
       
   102 	Used to start the saving of data.
       
   103 	@param aParam The interpretation of aParam is specific to the plugin.
       
   104 	*/
       
   105 	virtual TInt Open( const TDesC& aParam ) = 0;
       
   106 
       
   107 	/**
       
   108 	End the data save operation.
       
   109 	@pre Must have called Open or OpenL
       
   110 	*/
       
   111 	virtual void CloseL() = 0;
       
   112 
       
   113 	/**
       
   114 	End the data save operation.
       
   115 	@pre Must have called Open or OpenL
       
   116 	*/
       
   117 	virtual TInt Close() = 0;
       
   118 
       
   119 	/**
       
   120 	Save data.
       
   121 	@param aData TDesC8 with data to be saved.
       
   122 	@pre Must have called Open or OpenL
       
   123 	*/
       
   124 	virtual void WriteL( const TDesC8& aData ) = 0;
       
   125 
       
   126 	/**
       
   127 	Save data.
       
   128 	@param aData TDesC8 with data to be saved.
       
   129 	@pre Must have called Open or OpenL
       
   130 	*/
       
   131 	virtual TInt Write( const TDesC8& aData ) = 0;
       
   132 
       
   133 	/**
       
   134 	Save data from a pointer given the data size.
       
   135 	@param aData Pointer to data to be saved.
       
   136 	@param aSize Length of data to be saved in bytes
       
   137 	@pre Must have called Open or OpenL
       
   138 	*/
       
   139 	virtual void WriteL( TAny* aData, TUint aSize ) = 0;
       
   140 
       
   141 	/**
       
   142 	Save data from a pointer given the data size.
       
   143 	@param aData Pointer to data to be saved.
       
   144 	@param aSize Length of data to be saved in bytes
       
   145 	@pre Must have called Open or OpenL
       
   146 	*/
       
   147 	virtual TInt Write( TAny* aData, TUint aSize ) = 0;
       
   148 
       
   149 	/**
       
   150 	Save aData at the specific position.
       
   151 	@param aPos The interpretation of aPos is specific to the plugin.
       
   152 	@param aData TDesC8 with data to be saved.
       
   153 	@pre Must have called Open or OpenL
       
   154 	*/
       
   155 	virtual void WriteL( TInt aPos, const TDesC8& aData ) = 0;
       
   156 
       
   157 	/**
       
   158 	Save aData at the specific position.
       
   159 	@param aPos The interpretation of aPos is specific to the plugin.
       
   160 	@param aData TDesC8 with data to be saved.
       
   161 	@pre Must have called Open or OpenL
       
   162 	*/
       
   163 	virtual TInt Write( TInt aPos, const TDesC8& aData ) = 0;
       
   164 
       
   165 	/**
       
   166 	Save aData at the specific position.
       
   167 	@param aPos The interpretation of aPos is specific to the plugin.
       
   168 	@param aData Pointer to data to be saved.
       
   169 	@param aSize Length of data to be saved in bytes
       
   170 	@pre Must have called Open or OpenL
       
   171 	*/
       
   172 	virtual void WriteL( TInt aPos, TAny* aData, TUint aSize ) = 0;
       
   173 
       
   174 	/**
       
   175 	Save aData at the specific position.
       
   176 	@param aPos The interpretation of aPos is specific to the plugin.
       
   177 	@param aData Pointer to data to be saved.
       
   178 	@param aSize Length of data to be saved in bytes
       
   179 	@pre Must have called Open or OpenL
       
   180 	*/
       
   181 	virtual TInt Write( TInt aPos, TAny* aData, TUint aSize ) = 0;
       
   182 
       
   183 	/**
       
   184 	Returns the media specific name that will be used to save this object
       
   185     @return const reference to a descriptor describing the media name
       
   186 	*/
       
   187 	virtual const TDesC& GetMediaName() = 0;
       
   188 
       
   189     //dtor
       
   190 public:
       
   191     virtual ~CCrashDataSave();
       
   192 
       
   193     /**
       
   194 	Writer plugin base configuration parameter identifiers.
       
   195 	Identifiers for derived interfaces should start where this enum ends.
       
   196 	*/
       
   197 	enum TDataSaveParams
       
   198 		{
       
   199 		/** This parameter is a root identifier for core dumps. Its use depends on the
       
   200 		writer plugin and potentially the formatters. For example for an email data save
       
   201 		plugin this parameter could be an the email address. For a file writer it could be
       
   202 		a file name or a directory path. */
       
   203 		ECoreFilePath,
       
   204 		EDataSaveLastParam
       
   205 		};
       
   206 
       
   207 protected:
       
   208 
       
   209 	/** Define the container for the plugin's configuration parameters */
       
   210 	typedef RPointerArray<COptionConfig>	RConfigParameterList;
       
   211 
       
   212 	/**
       
   213 	List of COptionConfig configuration parameters implemented by the plugin.
       
   214 	*/
       
   215 	RConfigParameterList	 iConfigList;
       
   216 
       
   217 private:
       
   218 	TUid iDtor_ID_Key;
       
   219 
       
   220 	TUint32 iSpare1;
       
   221 	TUint32 iSpare2;
       
   222 };
       
   223 
       
   224 #include <crashdatasave.inl>
       
   225 
       
   226 #endif