serviceproviders/sapi_sysinfo/sysinfoservice/inc/sysinfoservice.h
changeset 19 989d2f495d90
child 22 fc9cf246af83
equal deleted inserted replaced
14:a36b1e19a461 19:989d2f495d90
       
     1 /*
       
     2 * Copyright (c) 2005-2006 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 the License "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:  CSysInfoService class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __CSYSINFOSERVICE_H__
       
    20 #define __CSYSINFOSERVICE_H__
       
    21 
       
    22 //  INCLUDES
       
    23 #include "sysinfo.h"
       
    24 #include "sysrequest.h"
       
    25 
       
    26 // FORWORD CLASS DECLARATION
       
    27 class CSysData;
       
    28 class CDeviceInfo;
       
    29 
       
    30 /**
       
    31 *   @ref ISystemObserver
       
    32 *   Client Observer interface to handle response from Asynchronous system requests.
       
    33 *
       
    34 *   @param aResponse
       
    35 */
       
    36 
       
    37 class ISystemObserver
       
    38     {
       
    39     public:
       
    40     /**
       
    41     * HandleResponseL ()
       
    42     * Callback function to be implimented by client in order to handle asynchronous
       
    43     * response.
       
    44     * @param aEntity        Entity
       
    45     * 
       
    46     * @param aKey           Key
       
    47     *
       
    48     * @param aOutput        client owns output data.
       
    49     *
       
    50     * @param aTransID       TransactionID associated with request.
       
    51     *
       
    52     * @param aType          Asynchronous Response type.
       
    53     *
       
    54     * @param aError         If any error occured in process of generating response.
       
    55     *
       
    56     */		
       
    57     virtual void HandleResponseL(const TDesC& aEntity,const TDesC& aKey, 
       
    58                                 CSysData* aOutput, TInt32 aTransID, 
       
    59                                 TSysRequest::TRequestType aType,
       
    60                                 TInt aError=KErrNone) = 0;
       
    61     };
       
    62 
       
    63 
       
    64 /**
       
    65 *   @ref CSysInfoService is used to read and modify and system information
       
    66 *
       
    67 *   @lib sysinfoservice
       
    68 *   @since S60 3.2
       
    69 *   @version $Revision: 1.0 $
       
    70 */
       
    71 
       
    72 NONSHARABLE_CLASS(CSysInfoService) : public CBase
       
    73     {
       
    74     public:  // Constructors and destructor
       
    75 
       
    76     /**
       
    77     * NewL()
       
    78     * Two-phased constructor.
       
    79     * Create a CSysInfoService object.
       
    80     * @return A pointer to the created instance of CSysInfoService.
       
    81     */
       
    82     IMPORT_C static CSysInfoService* NewL();
       
    83 
       
    84     /**
       
    85     * Destructor.
       
    86     */
       
    87     ~CSysInfoService();
       
    88 
       
    89     private:
       
    90 
       
    91     /**
       
    92     * C++ default constructor.
       
    93     */
       
    94     CSysInfoService();
       
    95 
       
    96     public:	
       
    97 
       
    98     /**
       
    99     * GetInfoL ()
       
   100     * Retrieves specified SA value synchronously.
       
   101     * User will provide SA and any input by aRequest argument.
       
   102     *
       
   103     * @param aEntity    Entity of an system attribute.
       
   104     *
       
   105     * @param aKey       Key of an system attribute.
       
   106     *
       
   107     * @param aOutput    Retrived system attribute value.
       
   108     *
       
   109     * @param aInput     Optional input data.
       
   110     *
       
   111     * @error @p KErrArgument    if specified input SystemData is not associated with 
       
   112     *                           system attribute.
       
   113     * @error @p KErrNotFound
       
   114     *                       if specified system attribute not found.
       
   115     *                       if Specified SA doesn't support this kind of operation
       
   116     *                       i.e request type. 
       
   117     */
       
   118 
       
   119     IMPORT_C void GetInfoL( const TDesC& aEntity, const TDesC& aKey, 
       
   120                             CSysData*& aOutput, const CSysData* aInput=NULL );
       
   121 
       
   122     /**
       
   123     * GetInfoL ()
       
   124     * Retrieves specified SA value asynchronously.
       
   125     * User will provide SA and any input thru aRequest argument.
       
   126     *
       
   127     * @param aEntity        Entity of an system attribute.
       
   128     *
       
   129     * @param aKey           Key of an system attribute.
       
   130     *
       
   131     * @param aTransID       TransactionID for async operation.
       
   132     *
       
   133     * @param aCallback      Observer for handling async response.
       
   134     *
       
   135     * @param aInput         Optional input data.
       
   136     *
       
   137     * @error @p KErrArgument 	
       
   138     *                       if specified input SystemData is not associated with 
       
   139     *                       system attribute.
       
   140     * @error @p KErrNotFound
       
   141     *                   if specified system attribute not found.
       
   142     *                   if Specified SA doesn't support this kind of operation
       
   143     *                   i.e request type. 
       
   144     * @error @p KErrAlreadyExists	
       
   145     *                       if Transaction ID specified already exists.
       
   146     */
       
   147 
       
   148     IMPORT_C void GetInfoL( const TDesC& aEntity, const TDesC& aKey, 
       
   149                             TInt32 aTransID, ISystemObserver* aCallback, 
       
   150                             const CSysData* aInput=NULL );
       
   151 
       
   152     /**
       
   153     * GetNotificationL ()
       
   154     * Registers for notifications for a given SA.
       
   155     * User will provide SA and any input thru aRequest argument.
       
   156     *
       
   157     * @param aEntity        Entity of an system attribute.
       
   158     *
       
   159     * @param aKey           Key of an system attribute.
       
   160     *
       
   161     * @param aTransID       TransactionID for async operation.
       
   162     *
       
   163     * @param aCallback      Observer for handling async response.
       
   164     * 
       
   165     * @param aInput         Optional input data.
       
   166     *
       
   167     * @error @p KErrArgument 	
       
   168     *                       if specified input SystemData is not associated with 
       
   169     *                       system attribute.
       
   170     * @error @p KErrNotFound
       
   171     *                       if specified system attribute not found.
       
   172     *                       if Specified SA doesn't support this kind of operation
       
   173     *                       i.e request type. 
       
   174     * @error @p KErrAlreadyExists	
       
   175     *                       if Transaction ID specified already exists.
       
   176     */
       
   177 
       
   178     IMPORT_C void GetNotificationL( const TDesC& aEntity, const TDesC& aKey, 
       
   179                                 TInt32 aTransID, ISystemObserver* aCallback, 
       
   180                                 const CSysData* aInput=NULL  );
       
   181     /**
       
   182     * SetInfoL()
       
   183     * Modifies system attribute value.
       
   184     * This API can be used to change system attribute value 
       
   185     * synchronously/asynchronously, based on attribute specification.
       
   186     *
       
   187     * @param aEntity        Entity of an system attribute.
       
   188     *
       
   189     * @param aKey           Key of an system attribute.
       
   190     *
       
   191     * @param aInput         Input data.
       
   192     *
       
   193     * @error @p KErrArgument
       
   194     *                       if specified input SystemData is not associated with 
       
   195     *                       system attribute.
       
   196     * @error @p KErrNotFound
       
   197     *               if specified system attribute not found.
       
   198     *               if Specified SA doesn't support this kind of operation
       
   199     *               i.e request type. 
       
   200     * @error @p KErrAlreadyExists
       
   201     *               if Transaction ID specified already exists for async requests.
       
   202     */
       
   203 
       
   204     IMPORT_C void SetInfoL( const TDesC& aEntity, const TDesC& aKey, 
       
   205                                                 const CSysData* aInput );
       
   206 
       
   207     /**
       
   208     * Cancel()
       
   209     * Cancels any outstanding requests and releases resources owned by them.
       
   210     *
       
   211     */
       
   212 
       
   213     IMPORT_C void Cancel(TInt32 aTransID);
       
   214 
       
   215     private:
       
   216     /*
       
   217     *   Modifies General Entity attribute value.
       
   218     */
       
   219     void SetGeneralInfoL(const TDesC& aKey, const CSysData* aInput);
       
   220 
       
   221     /*
       
   222     *	Modifies General Entity attribute value.
       
   223     */
       
   224     void SetDisplayInfoL(const TDesC& aKey, const CSysData* aInput);
       
   225 
       
   226     /*
       
   227     *	Modifies Connectivity Entity attribute value.
       
   228     */
       
   229     void SetConnectivityInfoL(const TDesC& aKey, const CSysData* aInput);
       
   230 
       
   231     /*
       
   232     *	Retrieves Network Entity attribute value.
       
   233     */
       
   234     void GetNetworkInfoL(TPtrC aKey,CSysData*& aSysData);
       
   235 
       
   236     /*
       
   237     *	Retrieves Battery Entity attribute value.
       
   238     */
       
   239     void GetBatteryInfoL(TPtrC aKey,CSysData*& aSysData);
       
   240 
       
   241     /*
       
   242     *	Retrieves General Entity attribute value.
       
   243     */
       
   244     void GetGeneralInfoL(TPtrC aKey,CSysData*& aSysData);
       
   245 
       
   246     /*
       
   247     *	Retrieves Display Entity attribute value.
       
   248     */
       
   249     void GetDisplayInfoL(TPtrC aKey,CSysData*& aSysData);
       
   250 
       
   251     /*
       
   252     *	Retrieves available/supported usb modes.
       
   253     */
       
   254     void GetAvailableUsbModesL(CSysData*& aSysData);
       
   255 
       
   256     /*
       
   257     *	Retrieves Connectivity Entity attribute value.
       
   258     */
       
   259     void GetConnectivittyInfoL(TPtrC aKey,CSysData*& aSysData);
       
   260 
       
   261     /*
       
   262     *	Retrieves Memory Entity attribute value.
       
   263     */
       
   264     void GetMemoryInfoL(const TDesC& aKey, const CSysData* aInput,
       
   265                                                 CSysData*& aOutput);
       
   266 
       
   267     /*
       
   268     *	Retrieves Feature Entity attribute value.
       
   269     */
       
   270     void GetFeatureInfoL(TPtrC aKey,CSysData*& aSysData);
       
   271     /*
       
   272     *	Retrieves Device Entity attribute values.
       
   273     */
       
   274     void GetDeviceInfoL(TPtrC aKey,CSysData*& aSysData);
       
   275 
       
   276     private: //DATA
       
   277 
       
   278     /**
       
   279     * status member to identify feature manager initialization state.
       
   280     */       
       
   281     TBool           iFeatureManagerInitialized;
       
   282 
       
   283     /**
       
   284     * class to read static device properties.
       
   285     */       
       
   286     CDeviceInfo*    iDeviceInfo;
       
   287     };
       
   288 
       
   289 
       
   290 #endif __CSYSINFOSERVICE_H__
       
   291