remotemgmt_plat/scp_server_api/inc/SCPParamObject.h
changeset 0 b497e44ab2fc
child 25 b183ec05bd8c
equal deleted inserted replaced
-1:000000000000 0:b497e44ab2fc
       
     1 /*
       
     2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *       Defines a class that can be used to store a set of parameters and values
       
    16 *       and trasfer them in a packed format.
       
    17 *
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 #ifndef SCPPARAMOBJECT_H
       
    23 #define SCPPARAMOBJECT_H
       
    24 
       
    25 //  INCLUDES
       
    26 #include <e32base.h>
       
    27 #include <e32cmn.h>
       
    28 #include <bldvariant.hrh>
       
    29 
       
    30 class RFs;
       
    31 
       
    32 /**
       
    33 *  The definition for the parameter object class
       
    34 */
       
    35 class CSCPParamObject: public CBase
       
    36     {
       
    37 	public:  // Methods
       
    38 
       
    39         // Constructors and destructor                
       
    40         
       
    41         /**
       
    42         * Static constructor.
       
    43         */
       
    44    	    IMPORT_C static CSCPParamObject* NewL();
       
    45         
       
    46         /**
       
    47         * Static constructor, that leaves the pointer to the cleanup stack.
       
    48         */
       
    49         IMPORT_C static CSCPParamObject* NewLC();         
       
    50 
       
    51         
       
    52         /**
       
    53         * Destructor
       
    54         */        
       
    55         IMPORT_C virtual ~CSCPParamObject();  
       
    56         
       
    57         // New methods 
       
    58         
       
    59         /**
       
    60         * Get the value of an identified parameter stored in the object
       
    61         * @param aParamID The ID of the requested parameter.
       
    62         * @return A positive integer indicating the lenght, or an error code
       
    63         * <BR><B>Name of return value:</B> Operation status
       
    64         * <BR><B>Type of return value:</B> TInt
       
    65         * <BR><B>Range of return value:</B> The length or an error code
       
    66         * <BR><B>Contents of return value:</B> The status code of the operation.        
       
    67         */        
       
    68         IMPORT_C TInt GetParamLength( TInt aParamID );                       
       
    69         
       
    70         /**
       
    71         * Get the value of an identified parameter stored in the object
       
    72         * @param aParamID The ID of the requested parameter.
       
    73         * @param aValue Will contain a pointer to a descriptor containing the value
       
    74         * after a successful call. The client owns this pointer after the call.
       
    75         * @return The status, see below
       
    76         * <BR><B>Name of return value:</B> Operation status
       
    77         * <BR><B>Type of return value:</B> TInt
       
    78         * <BR><B>Range of return value:</B> A system wide error code
       
    79         * <BR><B>Contents of return value:</B> The status code of the operation.        
       
    80         */        
       
    81         IMPORT_C TInt Get( TInt aParamID, TDes& aValue ); 
       
    82         
       
    83         /**
       
    84         * Get the value of an identified parameter stored in the object
       
    85         * @param aParamID The ID of the requested parameter.
       
    86         * @param aValue Will contain the requested value converted to an integer
       
    87         * after a successful call. If the value cannot be converted, an error will
       
    88         * be returned.
       
    89         * @return The status, see below
       
    90         * <BR><B>Name of return value:</B> Operation status
       
    91         * <BR><B>Type of return value:</B> TInt
       
    92         * <BR><B>Range of return value:</B> A system wide error code
       
    93         * <BR><B>Contents of return value:</B> The status code of the operation.        
       
    94         */        
       
    95         IMPORT_C TInt Get( TInt aParamID, TInt& aValue ); 
       
    96         
       
    97         /**
       
    98         * Set the value of a parameter. Will replace an existing value, or add a
       
    99         * new one.
       
   100         * @param aParamID The ID of the parameter.
       
   101         * @param aValue The value to set.
       
   102         * @return The status, see below
       
   103         * <BR><B>Name of return value:</B> Operation status
       
   104         * <BR><B>Type of return value:</B> TInt
       
   105         * <BR><B>Range of return value:</B> A system wide error code
       
   106         * <BR><B>Contents of return value:</B> The status code of the operation.        
       
   107         */        
       
   108         IMPORT_C TInt Set( TInt aParamID, TDes& aValue ); 
       
   109         
       
   110         /**
       
   111         * Set the value of a parameter. Will replace an existing value, or add a
       
   112         * new one.
       
   113         * @param aParamID The ID of the parameter.
       
   114         * @param aValue The value to set, will be converted to a descriptor.
       
   115         * @return The status, see below
       
   116         * <BR><B>Name of return value:</B> Operation status
       
   117         * <BR><B>Type of return value:</B> TInt
       
   118         * <BR><B>Range of return value:</B> A system wide error code
       
   119         * <BR><B>Contents of return value:</B> The status code of the operation.        
       
   120         */        
       
   121         IMPORT_C TInt Set( TInt aParamID, TInt aValue ); 
       
   122         
       
   123         /**
       
   124         * Remove the identified parameter from the storage.
       
   125         * @param aParamID The ID of the parameter to remove.         
       
   126         * @return The status, see below
       
   127         * <BR><B>Name of return value:</B> Operation status
       
   128         * <BR><B>Type of return value:</B> TInt
       
   129         * <BR><B>Range of return value:</B> A system wide error code
       
   130         * <BR><B>Contents of return value:</B> The status code of the operation.
       
   131         */        
       
   132         IMPORT_C TInt Unset( TInt aParamID );         
       
   133         
       
   134         /**
       
   135         * Reset the object and remove all parameters.
       
   136         * @return The status, see below
       
   137         * <BR><B>Name of return value:</B> Operation status
       
   138         * <BR><B>Type of return value:</B> TInt
       
   139         * <BR><B>Range of return value:</B> A system wide error code
       
   140         * <BR><B>Contents of return value:</B> The status code of the operation.
       
   141         */        
       
   142         IMPORT_C TInt Reset();                 
       
   143         
       
   144         /**
       
   145         * Parse the given buffer, and add its contents to the object.
       
   146         * @param aBuffer The buffer that will be parsed.
       
   147         * @return The status, see below
       
   148         * <BR><B>Name of return value:</B> Operation status
       
   149         * <BR><B>Type of return value:</B> TInt
       
   150         * <BR><B>Range of return value:</B> A system wide error code
       
   151         * <BR><B>Contents of return value:</B> The status code of the operation.        
       
   152         */        
       
   153         IMPORT_C TInt Parse( TDes8& aBuffer ); 
       
   154         
       
   155         /**
       
   156         * Pack the stored parameters into a buffer.        
       
   157         * @param aValue Will contain a pointer to the packed buffer after
       
   158         * a successful call. The client owns the pointer after the call.
       
   159         * @return The status, see below
       
   160         * <BR><B>Name of return value:</B> Operation status
       
   161         * <BR><B>Type of return value:</B> TInt
       
   162         * <BR><B>Range of return value:</B> A system wide error code
       
   163         * <BR><B>Contents of return value:</B> The status code of the operation.        
       
   164         */        
       
   165         IMPORT_C TInt GetBuffer( HBufC8*& aBuffer ); 
       
   166         
       
   167         /**
       
   168         * Write the content to disk in the format returned by GetBuffer.
       
   169         * Leaves with a generic status code on error.
       
   170         * @param aFilename The name of the file to be written. An existing file will
       
   171         * be overwritten, or a new file will be created.
       
   172         * @param aRfs An optional pointer to a connected file server session. If this
       
   173         * pointer is not supplied a new RFs will be connected.
       
   174         */        
       
   175         IMPORT_C void WriteToFileL( TDesC& aFilename, RFs* aRfs = NULL ); 
       
   176         
       
   177         /**
       
   178         * Reset the content of this object and load new content from a file. 
       
   179         * Leaves with a generic status code on error.       
       
   180         * @param aFilename The file name to read the content from. This filename must
       
   181         * contain a buffer returned by GetBuffer.
       
   182         * @param aRfs An optional pointer to a connected file server session. If this
       
   183         * pointer is not supplied a new RFs will be connected.
       
   184         */        
       
   185         IMPORT_C void ReadFromFileL( TDesC& aFilename, RFs* aRfs = NULL );                 
       
   186                
       
   187                 
       
   188     protected:  // Methods
       
   189                         
       
   190         // Methods from base classes       
       
   191                 
       
   192         
       
   193     private: //Methods 
       
   194         
       
   195         // New Methods   
       
   196                            
       
   197         /**
       
   198         * C++ default constructor.
       
   199         */        
       
   200         CSCPParamObject();
       
   201         
       
   202         /**
       
   203         * Symbian second-phase constructor
       
   204         */
       
   205         void ConstructL();                                     
       
   206         
       
   207         
       
   208     private:   // Data 
       
   209         /** An array containing the IDs for the stored parameters */
       
   210         RArray<TInt> iParamIDs;
       
   211         /** An array containing the pointers to the parameter values */
       
   212         RPointerArray<HBufC> iParamValues;
       
   213     };
       
   214 
       
   215 #endif      // SCPPARAMOBJECT_H   
       
   216             
       
   217 // End of File