resourcemgmt/hwresourcesmgr/server/plugininc/HWRMLightCommands.h
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 /*
       
     2 * Copyright (c) 2006-2009 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 * This file contains the following sections:
       
    16 * - Command definitions for HWRM Light plugin API
       
    17 * - Command parameter definitions for HWRM Light plugin API
       
    18 * - Response parameter definitions for HWRM Light plugin API
       
    19 *
       
    20 */
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 /**
       
    26  @file
       
    27  @publishedPartner
       
    28  @released
       
    29 */
       
    30 
       
    31 #ifndef HWRMLIGHTCOMMANDS_H
       
    32 #define HWRMLIGHTCOMMANDS_H
       
    33 
       
    34 // Include plugin service so that including only this header is necessary to use Light plugin API.
       
    35 #include <hwrm/hwrmpluginservice.h>
       
    36 
       
    37 // CONSTANTS
       
    38 
       
    39 // Identifies the ECom implementation to be used.
       
    40 _LIT8(KHWRMLightApiEComMatch, "HWRMLight");
       
    41 
       
    42 // CLASS DECLARATION
       
    43 
       
    44 /**
       
    45 *  Plugin interface class just encapsulates the Light command enumerations.
       
    46 *  Responsible for defining the command IDs for each message.
       
    47 */
       
    48 namespace HWRMLightCommand
       
    49     {
       
    50     /**
       
    51     * Enumeration for light targets.
       
    52     * If certain target is not supported by device,
       
    53     * plugin can either return KErrNotSupported or interpret
       
    54     * specified target in some device specific way.
       
    55     *
       
    56     * Light targets can be used as bitmask.
       
    57 	*
       
    58 	* @publishedPartner
       
    59 	* @released
       
    60     */
       
    61     enum TLightTarget
       
    62         {
       
    63         /**
       
    64         No target. Not a valid target value, used only for error checking.
       
    65         */
       
    66         ENoTarget                    = 0x0,      
       
    67         /**
       
    68         Primary display of the device.
       
    69         */
       
    70         EPrimaryDisplay              = 0x1,     
       
    71         /**
       
    72         Primary keyboard of the device. 
       
    73         */
       
    74         EPrimaryKeyboard             = 0x2,     
       
    75         /**
       
    76         Secondary display of the device.
       
    77         */
       
    78         ESecondaryDisplay            = 0x4,   
       
    79         /**
       
    80         Secondary keyboard of the device. 
       
    81         */
       
    82         ESecondaryKeyboard           = 0x8,  
       
    83         /**
       
    84         Device specific custom target 1.
       
    85         */                                    
       
    86         ECustomTarget1               = 0x10,   
       
    87         /**
       
    88         Device specific custom target 2.
       
    89         */
       
    90         ECustomTarget2               = 0x20,    
       
    91         /**
       
    92         Device specific custom target 3.
       
    93         */
       
    94         ECustomTarget3               = 0x40,    
       
    95         /**
       
    96         Device specific custom target 4.
       
    97         */
       
    98         ECustomTarget4               = 0x80,    
       
    99         /**
       
   100         Device specific custom target 5.
       
   101         */
       
   102         ECustomTarget5               = 0x100,   
       
   103         /**
       
   104         Device specific custom target 6.
       
   105         */
       
   106         ECustomTarget6               = 0x200,   
       
   107         /**
       
   108         Device specific custom target 7.
       
   109         */
       
   110         ECustomTarget7               = 0x400,   
       
   111         /**
       
   112         Device specific custom target 8.
       
   113         */
       
   114         ECustomTarget8               = 0x800,   
       
   115         /**
       
   116         Device specific custom target 9.
       
   117         */
       
   118         ECustomTarget9               = 0x1000, 
       
   119         /**
       
   120         Device specific custom target 10.
       
   121         */
       
   122         ECustomTarget10              = 0x2000,  
       
   123         /**
       
   124         Device specific custom target 11.
       
   125         */
       
   126         ECustomTarget11              = 0x4000,  
       
   127         /**
       
   128         Device specific custom target 12.
       
   129         */
       
   130         ECustomTarget12              = 0x8000,
       
   131         /**
       
   132         Device specific custom target 13.
       
   133         */
       
   134         ECustomTarget13              = 0x10000,
       
   135         /**
       
   136         Device specific custom target 14.
       
   137         */
       
   138         ECustomTarget14              = 0x20000,
       
   139         /**
       
   140         Device specific custom target 15.
       
   141         */
       
   142         ECustomTarget15              = 0x40000,
       
   143         /**
       
   144         Device specific custom target 16.
       
   145         */
       
   146         ECustomTarget16              = 0x80000,
       
   147         /**
       
   148         Device specific custom target 17.
       
   149         */
       
   150         ECustomTarget17              = 0x100000,
       
   151         /**
       
   152         Device specific custom target 18.
       
   153         */
       
   154         ECustomTarget18              = 0x200000,
       
   155         /**
       
   156         Device specific custom target 19.
       
   157         */
       
   158         ECustomTarget19              = 0x400000,
       
   159         /**
       
   160         Device specific custom target 20.
       
   161         */
       
   162         ECustomTarget20              = 0x800000,
       
   163         /**
       
   164         Device specific custom target 21.
       
   165         */
       
   166         ECustomTarget21              = 0x1000000,
       
   167         /**
       
   168         Device specific custom target 22.
       
   169         */
       
   170         ECustomTarget22              = 0x2000000,
       
   171         /**
       
   172         Device specific custom target 23.
       
   173         */
       
   174         ECustomTarget23              = 0x4000000,
       
   175         /**
       
   176         Device specific custom target 24.
       
   177         */
       
   178         ECustomTarget24              = 0x8000000,
       
   179         /**
       
   180         Device specific custom target 25.
       
   181         */
       
   182         ECustomTarget25              = 0x10000000,
       
   183         /**
       
   184         Device specific custom target 26.
       
   185         */
       
   186         ECustomTarget26              = 0x20000000,
       
   187         /**
       
   188         Device specific custom target 27.
       
   189         */
       
   190         ECustomTarget27              = 0x40000000,
       
   191         };
       
   192 
       
   193     /**
       
   194     * Data structure used to pass data with ELightsOnCmdId.
       
   195 	*
       
   196 	* @publishedPartner
       
   197 	* @released
       
   198     */ 
       
   199     struct TLightsOnData
       
   200         {
       
   201         /**
       
   202         Light target(s). TLightTargets can be used as bitmask.
       
   203         Command only affects selected targets.
       
   204         */
       
   205         TInt iTarget;
       
   206     
       
   207     	/**
       
   208         Intensity of light as percentage (1-100).
       
   209         If intensity is 0, default intensity is used.
       
   210 		Note: Some devices will not support user defined intensity,
       
   211 		in which case the device will behave in its default fashion.
       
   212 		*/
       
   213         TInt iIntensity;
       
   214         
       
   215         /**
       
   216         Is fade-in used or not when turning lights on.
       
   217 		Note: Some devices will not support fade-in, in which case 
       
   218 		       the device will behave in its default fashion.
       
   219 		*/
       
   220         TBool iFadeIn;
       
   221         };
       
   222 
       
   223     /**
       
   224     * Data structure used to pass data with ELightsOnSensorCmdId.
       
   225 	*
       
   226 	* @publishedPartner
       
   227 	* @released
       
   228     */ 
       
   229     struct TLightsOnSensorData
       
   230         {
       
   231         
       
   232         /**
       
   233         Light target(s). TLightTargets can be used as bitmask.
       
   234         Command only affects selected targets.
       
   235         */
       
   236         TInt iTarget;
       
   237     
       
   238         /**
       
   239         Sensitivity of light sensor as percentage (1-100)
       
   240         If sensitivity is 0, default sensitivity is used.
       
   241 		Note: Some devices will not support user defined sensitivity,
       
   242 		in which case the device will behave in its default fashion.
       
   243 		*/
       
   244         TInt iSensitivity;
       
   245         
       
   246         /**
       
   247         Is fade-in used or not when turning lights on.
       
   248 		Note: Some devices will not support fade-in, in which case 
       
   249 		the device will behave in its default fashion.
       
   250 		*/
       
   251         TBool iFadeIn;
       
   252         };
       
   253 
       
   254     /**
       
   255     * Data structure used to pass data with ELightsBlinkCmdId
       
   256 	*
       
   257 	* @publishedPartner
       
   258 	* @released
       
   259     */ 
       
   260     struct TLightsBlinkData
       
   261         {
       
   262         /**
       
   263         Light target(s). TLightTargets can be used as bitmask.
       
   264         Command only affects selected targets.
       
   265         If any of the selected targets doesn't support lights blink,
       
   266         none are affected and KErrNotSupported is returned.
       
   267         */
       
   268         TInt iTarget;
       
   269     
       
   270     	/**
       
   271         Intensity of light as percentage (1-100). 
       
   272         If intensity is 0, default intensity is used.
       
   273 		Note: Some devices will not support user defined intensity,
       
   274 		in which case the device will behave in its default fashion.
       
   275 		*/
       
   276         TInt iIntensity;
       
   277     
       
   278     	/**
       
   279         Light on cycle duration in milliseconds.
       
   280         If value is 0, use default cycle duration.
       
   281         In that case also iOffCycleDuration must be 0.
       
   282 		Note: Some devices will not support variable blink cycle times,
       
   283 		       in which case a device default blink cycle duration is used.
       
   284 		*/
       
   285         TInt iOnCycleDuration;
       
   286 
       
   287         /**
       
   288         Light off cycle duration in milliseconds.
       
   289         If value is 0, use default cycle duration.
       
   290         In that case also iOnCycleDuration must be 0.
       
   291 		Note: Some devices will not support variable blink cycle times,
       
   292 		       in which case a device default blink cycle duration is use.     
       
   293 		*/
       
   294         TInt iOffCycleDuration;
       
   295         };
       
   296 
       
   297 
       
   298     /**
       
   299     * Data structure used to pass data with ELightsOffCmdId.
       
   300 	*
       
   301 	* @publishedPartner
       
   302 	* @released
       
   303     */
       
   304     struct TLightsOffData
       
   305         {
       
   306         /**
       
   307         Light target(s). TLightTargets can be used as bitmask.
       
   308         Command only affects selected targets.
       
   309         */
       
   310         TInt iTarget;
       
   311     
       
   312         /**
       
   313         Is fade-out used or not when turning lights off.
       
   314 		Note: Some devices will not support fade-out, in which case 
       
   315 		       the device will behave in its default fashion.
       
   316 		*/
       
   317         TBool iFadeOut;
       
   318         };
       
   319         
       
   320     /**
       
   321     * Data structure used to pass data with ESetLightsIntensityCmdId.
       
   322 	*
       
   323 	* @publishedPartner
       
   324 	* @released
       
   325     */
       
   326     struct TLightsIntensityData
       
   327         {
       
   328         
       
   329         /**
       
   330         Light target(s). TLightTargets can be used as bitmask.
       
   331         Command only affects selected targets.
       
   332         */
       
   333         TInt iTarget;
       
   334     
       
   335         /**
       
   336         Intensity to be set for specifies targets.
       
   337 		Note: Some devices will not support user defined intensity,
       
   338 		       in which case the device will behave in its default fashion.
       
   339 		*/
       
   340         TInt iIntensity;
       
   341         };
       
   342 
       
   343     struct TLightsColorData 
       
   344         {
       
   345         /**
       
   346         Light target(s). TLightTargets can be used as bitmask.
       
   347         Command only affects selected targets.
       
   348         */
       
   349         TInt iTarget;
       
   350         
       
   351         TUint8 iRed;
       
   352         
       
   353         TUint8 iGreen;
       
   354         
       
   355         TUint8 iBlue;
       
   356         
       
   357         /**
       
   358         * Set default color if True. R G B values are ignored.
       
   359         */
       
   360         TBool  iDefaultColor; 
       
   361         };
       
   362 
       
   363 
       
   364     // Data packages for commands
       
   365     
       
   366     /** A typedef'd packaged TLightsOnData */ 
       
   367     typedef TPckgBuf<TLightsOnData>        TLightsOnCmdPackage;
       
   368     /** A typedef'd packaged TLightsOnSensorData */
       
   369     typedef TPckgBuf<TLightsOnSensorData>  TLightsOnSensorCmdPackage;
       
   370     /** A typedef'd packaged TLightsBlinkData */
       
   371     typedef TPckgBuf<TLightsBlinkData>     TLightsBlinkCmdPackage;
       
   372     /** A typedef'd packaged TLightsOffData */
       
   373     typedef TPckgBuf<TLightsOffData>       TLightsOffCmdPackage;
       
   374     /** A typedef'd packaged TLightsIntensityData */
       
   375     typedef TPckgBuf<TLightsIntensityData> TLightsIntensityCmdPackage;
       
   376     /** A typedef'd packaged TInt */
       
   377     typedef TPckgBuf<TInt>                 TLightsSensorSensitivityCmdPackage;
       
   378     /** A typedef'd packaged TLightsColorData */
       
   379     typedef TPckgBuf<TLightsColorData>     TLightsColorCmdPackage;
       
   380 
       
   381     /** A typedef'd packaged TInt */
       
   382     typedef TPckgBuf<TInt>                TErrorCodeResponsePackage;
       
   383 
       
   384 
       
   385     /**
       
   386     * Command definitions
       
   387     * All commands contain a command id and a set of parameters. The command ids
       
   388     * are defined first and after that parameters for each command.
       
   389     *
       
   390     * This interface is asynchronous. A command is interpreted of being completed
       
   391     * after a response for that command is received.
       
   392     *
       
   393     * The field input means the parameter for the command.
       
   394     * The field output means the parameter for the response.
       
   395 	*
       
   396 	* @publishedPartner
       
   397 	* @released
       
   398     */
       
   399     enum TLightCmd
       
   400         {
       
   401         /**
       
   402         * No command. May be used for sanity checks, but 
       
   403         * never as an actual command ID.
       
   404         *
       
   405         * input    None   
       
   406         * output   None   
       
   407         */
       
   408         ENoCommandId = 1000,
       
   409         
       
   410         /**
       
   411         * Turns lights on.
       
   412         *
       
   413         * input    TLightsOnCmdPackage         See description above 
       
   414         * output   TErrorCodeResponsePackage   Error code     
       
   415         *    KErrNone if operation succeeds.   
       
   416         *    KErrNotSupported if any target doesn't support lights.
       
   417         *    KErrGeneral if there is any problem.
       
   418         */
       
   419         ELightsOnCmdId,
       
   420 
       
   421         /**
       
   422         * Turns lights on using sensor for intensity control
       
   423         *
       
   424         * input    TLightsOnSensorCmdPackage   See description above 
       
   425         * output   TErrorCodeResponsePackage   Error code     
       
   426         *    KErrNone if operation succeeds.   
       
   427         *    KErrNotSupported if any target doesn't support lights.
       
   428         *    KErrGeneral if there is any problem.
       
   429         */
       
   430         ELightsOnSensorCmdId,
       
   431 
       
   432         /**
       
   433         * Turns lights on in blinking mode
       
   434         *
       
   435         * input    TLightsBlinkCmdPackage      See description above 
       
   436         * output   TErrorCodeResponsePackage   Error code     
       
   437         *    KErrNone if operation succeeds.   
       
   438         *    KErrNotSupported if any target doesn't support lights
       
   439         *        in general or just doesn't support blink.
       
   440         *    KErrGeneral if there is any problem.
       
   441         */
       
   442         ELightsBlinkCmdId,
       
   443 
       
   444         /**
       
   445         * Turns Lights off.
       
   446         *
       
   447         * input    TLightsOffCmdPackage        See description above 
       
   448         * output   TErrorCodeResponsePackage   Error code     
       
   449         *    KErrNone if operation succeeds.   
       
   450         *    KErrNotSupported if any target doesn't support lights.
       
   451         *    KErrGeneral if there is any problem.
       
   452         */
       
   453         ELightsOffCmdId,
       
   454 
       
   455         /**
       
   456         * Set default lights intensity.
       
   457         *
       
   458         * input    TLightsIntensityCmdPackage  Lights intensity percentage
       
   459         * output   TErrorCodeResponsePackage   Error code     
       
   460         *    KErrNone if operation succeeds.   
       
   461         *    KErrGeneral if there is any problem.
       
   462         */
       
   463         ESetLightsIntensityCmdId,
       
   464         
       
   465         /**
       
   466         * Set default lights sensor sensitivity.
       
   467         *
       
   468         * input    TLightsSensorSensitivityCmdPackage  Sensor sensitivity 
       
   469         *                                               percentage
       
   470         * output   TErrorCodeResponsePackage           Error code     
       
   471         *    KErrNone if operation succeeds.   
       
   472         *    KErrGeneral if there is any problem.
       
   473         */
       
   474         ESetLightsSensorSensitivityCmdId,
       
   475         
       
   476         
       
   477         /**
       
   478         * Set the color attribute of the light target.
       
   479         *
       
   480         * input    TLightsColorCmdPackage      See description above 
       
   481         * output   TErrorCodeResponsePackage   Error code     
       
   482         *    KErrNone if operation succeeds.   
       
   483         *    KErrNotSupported if any target doesn't support lights.
       
   484         *    KErrGeneral if there is any problem.
       
   485         */
       
   486         ELightsSetColorCmdId
       
   487 
       
   488         };
       
   489     }
       
   490 
       
   491 #endif      // HWRMLIGHTCOMMANDS_H   
       
   492             
       
   493 // End of File