resourcemgmt/hwresourcesmgr/server/plugininc/HWRMPowerCommands.h
changeset 0 4e1aa6a622a0
child 70 653a8b91b95e
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 // Copyright (c) 2008-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 // This file contains the following sections:
       
    15 // - Command definitions for HWRM Power plugin API
       
    16 // - Command parameter definitions for HWRM Power plugin API
       
    17 // - Response parameter definitions for HWRM Power plugin API
       
    18 // 
       
    19 //
       
    20 
       
    21 /**
       
    22  @file
       
    23  @publishedPartner
       
    24  @released
       
    25 */
       
    26 
       
    27 #ifndef HWRMPOWERCOMMANDS_H_
       
    28 #define HWRMPOWERCOMMANDS_H_
       
    29 
       
    30 
       
    31 // Include plugin service so that including only this header is necessary to use Power plugin API.
       
    32 #include <hwrm/hwrmpluginservice.h>
       
    33 
       
    34 // CONSTANTS
       
    35 
       
    36 // Identifies the ECom implementation to be used.
       
    37 _LIT8(KHWRMPowerApiEComMatch, "HWRMPower");
       
    38 
       
    39 
       
    40 /**
       
    41 *  Plugin interface class just encapsulates the Power command enumerations.
       
    42 *  Responsible for defining the command IDs for each message.
       
    43 */
       
    44 namespace HWRMPowerCommand
       
    45     {
       
    46     /** typedef'd package of TInt containing the error code response. */
       
    47     typedef TPckgBuf<TInt> TErrorCodeResponsePackage;
       
    48 
       
    49     // Data packages for responses
       
    50     
       
    51     /**
       
    52 	*
       
    53 	* @publishedPartner
       
    54 	* @released
       
    55 	*/
       
    56 	struct TBatteryVoltageResponseData 
       
    57 		{
       
    58 		TInt iErrorCode;
       
    59 		TInt iRemainingVoltage;
       
    60 		TInt iMaximumVoltage;
       
    61 		TInt iMinimumVoltage;
       
    62 		};
       
    63 	 /** data response package for EGetBatteryVoltageInfoCmdId */
       
    64 	typedef TPckgBuf<TBatteryVoltageResponseData> TBatteryVoltageResponsePackage;
       
    65 		
       
    66     /**
       
    67 	*
       
    68 	* @publishedPartner
       
    69 	* @released
       
    70 	*/
       
    71 	struct TBatteryConsumptionResponseData 
       
    72 	 	{
       
    73 		TInt iErrorCode;
       
    74 	 	TInt iNominalCapacity;
       
    75 	 	TInt iRemainingCapacity;
       
    76 	 	TInt iRemainingPercentageCapacity;
       
    77 	 	};
       
    78 	/** data response package for EGetBatteryInfoCmdId */
       
    79 	typedef TPckgBuf<TBatteryConsumptionResponseData> TBatteryConsumptionResponsePackage;
       
    80 
       
    81 #ifdef SYMBIAN_HWRM_EXTPOWERINFO
       
    82     
       
    83     enum TBatteryChargerType 
       
    84         { 
       
    85         EBatteryChargerUnKnown = 0, 
       
    86         EBatteryChargerDedicated = 1, 
       
    87         EBatteryChargerUsbDedicated = 2,
       
    88         EBatteryChargerUsbHost = 3 
       
    89         };
       
    90 
       
    91     struct TBatteryChargerTypeData
       
    92         {
       
    93         TInt iErrorCode;
       
    94         TBatteryChargerType iChargerType;
       
    95         };
       
    96     
       
    97     typedef TPckgBuf<TBatteryChargerTypeData> TBatteryChargerTypeResponsePackage;
       
    98     
       
    99 #endif //SYMBIAN_HWRM_EXTPOWERINFO
       
   100     
       
   101 	
       
   102     /**
       
   103     * Power(Current and Voltage) Measurement Report structure.
       
   104     * @publishedPartner
       
   105     * @released
       
   106     */
       
   107     struct TBatteryPowerReport 
       
   108     {
       
   109         TInt iErrorCode;
       
   110         TInt iAverageVoltage;
       
   111         TInt iAverageCurrent;
       
   112     };
       
   113 
       
   114     /** data package send for measurements indication EAverageBatteryPowerIndicationId */
       
   115     typedef TPckgBuf<TBatteryPowerReport> TBatteryPowerReportPackage;
       
   116 
       
   117 #ifdef SYMBIAN_HWRM_EXTPOWERINFO
       
   118     
       
   119     struct TBatteryChargeCurrentReport 
       
   120     {
       
   121     TInt iErrorCode;
       
   122     TInt iChargingCurrent;
       
   123     };
       
   124 
       
   125     typedef TPckgBuf<TBatteryChargeCurrentReport> TBatteryChargingCurrentReportPackage;
       
   126 
       
   127     struct TBatteryFullChargingTimeReport 
       
   128     {
       
   129     TInt  iErrorCode;
       
   130     TUint iChargingTime;
       
   131     };
       
   132 
       
   133     typedef TPckgBuf<TBatteryFullChargingTimeReport> TBatteryFullChargingTimeReportPackage;
       
   134     
       
   135 #endif //SYMBIAN_HWRM_EXTPOWERINFO
       
   136     
       
   137  			
       
   138     /** data package used for the following requests
       
   139     * EStartAverageBatteryPowerReportingCmdId
       
   140     * ESetPowerReportingIntervalMultipleCmdId
       
   141     */
       
   142     typedef TPckgBuf<TUint> TPowerIntervalMultiplePackage;
       
   143 
       
   144 
       
   145 #ifdef SYMBIAN_HWRM_EXTPOWERINFO
       
   146     /** data package used for the following request
       
   147     * 
       
   148     * EStartAverageBatteryChargeRateReportingCmdId
       
   149     * EStopAverageBatteryChargeRateReportingCmdId
       
   150     * ESetChargeCurrentIntervalMultipleCmdId
       
   151     */
       
   152     typedef TPckgBuf<TUint> TChrgCurrentIntervalMultiplePackage;
       
   153     
       
   154 #endif //SYMBIAN_HWRM_EXTPOWERINFO
       
   155 	
       
   156 	/**
       
   157     * Command definitions
       
   158     * All commands contain a command id and a set of parameters. The command ids
       
   159     * are defined first and after that parameters for each command.
       
   160     *
       
   161     * This interface is asynchronous. A command is interpreted of being completed
       
   162     * after a response for that command is received.
       
   163     *
       
   164     * The field input means the parameter for the command.
       
   165     * The field output means the parameter for the response.
       
   166 	*
       
   167 	* @publishedPartner
       
   168 	* @released
       
   169     */
       
   170     enum TPowerCmd
       
   171         {
       
   172         /**
       
   173         * No command. May be used for sanity checks, but 
       
   174         * never as an actual command ID.
       
   175         *
       
   176         * input    None   
       
   177         * output   None   
       
   178         */
       
   179         ENoCommandId = 5000,
       
   180         
       
   181         /**
       
   182         * Get Battery Voltage Info.
       
   183         *
       
   184         * input   None
       
   185         * output  TBatteryVoltageResponsePackage
       
   186         *          1. Error code
       
   187         *             - KErrNone if operation succeeds.
       
   188         *          2. Remaining Voltage, Madximum Voltage, Minimum Voltage
       
   189         */
       
   190         EGetBatteryVoltageInfoCmdId,
       
   191         
       
   192         /**
       
   193         * Get Battery Info.
       
   194         *
       
   195         * input   None
       
   196         * output  TBatteryConsumptionResponsePackage
       
   197         *          1. Error code
       
   198         *             - KErrNone if operation succeeds.
       
   199         *          2. Nominal Capacity, Remaining Capacity, Remaining Percentage Capacity
       
   200         */
       
   201         EGetBatteryInfoCmdId,
       
   202 
       
   203 #ifdef SYMBIAN_HWRM_EXTPOWERINFO
       
   204         /**
       
   205         * Start Average Charge Current Rate Reporting.
       
   206         *
       
   207         * input    TUint IntervalMultiple
       
   208         * output   TErrorCodeResponsePackage   Error code     
       
   209         *    KErrNone if operation succeeds.   
       
   210         *    KErrGeneral if there is any problem.
       
   211         */
       
   212         EStartAverageBatteryChargingCurrentReportingCmdId,
       
   213 
       
   214         /**
       
   215         * Stop Average Charge Current Rate Reporting.
       
   216         *
       
   217         * input    None   
       
   218         * output   TErrorCodeResponsePackage   Error code     
       
   219         *    KErrNone if operation succeeds.   
       
   220         *    KErrGeneral if there is any problem.
       
   221         */
       
   222         EStopAverageBatteryChargingCurrentReportingCmdId,
       
   223 
       
   224         /**
       
   225         * Update the time interval used for the average charging current 
       
   226         * measurements. 
       
   227         * input    TChrgCurrentIntervalMultiplePackage   
       
   228         * output   TErrorCodeResponsePackage   Error code     
       
   229         *    KErrNone if operation succeeds.   
       
   230         *    KErrGeneral if there is any problem.
       
   231         */
       
   232 
       
   233         ESetChargeCurrentIntervalMultipleCmdId,
       
   234 
       
   235         /**
       
   236         * Start Battery Full Charging Time Reporting.
       
   237         *
       
   238         * input    CHWRMPower::TIntervalMultiple
       
   239         * output   TErrorCodeResponsePackage   Error code     
       
   240         *    KErrNone if operation succeeds.   
       
   241         *    KErrGeneral if there is any problem.
       
   242         */
       
   243         EStartBatteryFullChargingTimeReportingCmdId,
       
   244 
       
   245         /**
       
   246         * Stop Battery Full Charging Time Reporting.
       
   247         *
       
   248         * input    None   
       
   249         * output   TErrorCodeResponsePackage   Error code     
       
   250         *    KErrNone if operation succeeds.   
       
   251         *    KErrGeneral if there is any problem.
       
   252         */
       
   253         EStopBatteryFullChargingTimeReportingCmdId,
       
   254         
       
   255         
       
   256         /**
       
   257         * Get Charger Type.
       
   258         *
       
   259         * input   None
       
   260         * output  TBatteryChargerTypeResponsePackage
       
   261         *          1. Error code
       
   262         *             - KErrNone if operation succeeds.
       
   263         *          2. Charger Type
       
   264         */        
       
   265         EGetBatteryChargerTypeCmdId,
       
   266         
       
   267 #endif //SYMBIAN_HWRM_EXTPOWERINFO
       
   268         /**
       
   269         * Start Average Battery Power Reporting.
       
   270         *
       
   271         * input    TUint IntervalMultiple
       
   272         * output   TErrorCodeResponsePackage   Error code     
       
   273         *    KErrNone if operation succeeds.   
       
   274         *    KErrGeneral if there is any problem.
       
   275         */
       
   276         EStartAverageBatteryPowerReportingCmdId,
       
   277 
       
   278         /**
       
   279         * Stop Power. 
       
   280         *
       
   281         * input    None   
       
   282         * output   TErrorCodeResponsePackage   Error code     
       
   283         *    KErrNone if operation succeeds.   
       
   284         *    KErrGeneral if there is any problem.
       
   285         */
       
   286         EStopAverageBatteryPowerReportingCmdId,
       
   287 
       
   288         /**
       
   289         * Update the time interval used for the average battery power measurements. 
       
   290         *
       
   291         * input    TUint IntervalMultiple   
       
   292         * output   TErrorCodeResponsePackage   Error code     
       
   293         *    KErrNone if operation succeeds.   
       
   294         *    KErrGeneral if there is any problem.
       
   295         */
       
   296         ESetPowerReportingIntervalMultipleCmdId,
       
   297         };
       
   298         
       
   299         
       
   300 	/**
       
   301 	* Power indications definitions
       
   302 	* All commands contain a indication id and a set of parameters. The indication ids
       
   303 	* are defined first and after that parameters for each incidcation.
       
   304 	*
       
   305 	* These incidcation are used when measurements from the battery are
       
   306 	* reported through a callback.
       
   307 	*
       
   308 	* The field output means the parameter for the response.
       
   309 	*
       
   310 	* @publishedPartner
       
   311 	* @released
       
   312 	*/
       
   313 	enum TPowerIndications
       
   314     	{        
       
   315 #ifdef SYMBIAN_HWRM_EXTPOWERINFO
       
   316         /**
       
   317         * Used by the plugin to send an Average Charging Current Report.
       
   318         * 
       
   319         * output   TBatteryChargeRateReport   Error code     
       
   320         *    KErrNone if operation succeeds.   
       
   321         *    KErrGeneral if there is any problem.
       
   322         */
       
   323         EAverageBatteryChargingCurrentIndicationId,
       
   324 
       
   325         /**
       
   326         * Used by the plugin to send an Average Charging Current Report.
       
   327         * 
       
   328         * output   TBatteryChargeRateReport   Error code     
       
   329         *    KErrNone if operation succeeds.   
       
   330         *    KErrGeneral if there is any problem.
       
   331         */
       
   332         EBatteryFullChargingTimeIndicationId,
       
   333         
       
   334 #endif //SYMBIAN_HWRM_EXTPOWERINFO
       
   335 
       
   336         /**
       
   337         * Used by the plugin to send an Average Battery Power Report.
       
   338         * 
       
   339         * output   TBatteryPowerReportPackage   Error code     
       
   340         *    KErrNone if operation succeeds.   
       
   341         *    KErrGeneral if there is any problem.
       
   342         * 
       
   343         */
       
   344         EAverageBatteryPowerIndicationId 
       
   345 
       
   346     	};
       
   347     }
       
   348 
       
   349 #endif      // HWRMPowerCOMMANDS_H   
       
   350             
       
   351 // End of File