resourcemgmt/hwresourcesmgr/server/plugininc/HWRMVibraCommands.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 Vibra plugin API
       
    17 * - Command parameter definitions for HWRM Vibra plugin API
       
    18 * - Response parameter definitions for HWRM Vibra plugin API
       
    19 *
       
    20 */
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 /**
       
    26  @file
       
    27  @publishedPartner
       
    28  @released
       
    29 */
       
    30 
       
    31 
       
    32 #ifndef HWRMVIBRACOMMANDS_H
       
    33 #define HWRMVIBRACOMMANDS_H
       
    34 
       
    35 // Include plugin service so that including only this header is necessary to use Vibra plugin API.
       
    36 #include <hwrm/hwrmpluginservice.h>
       
    37 
       
    38 // CONSTANTS
       
    39 
       
    40 // Identifies the ECom implementation to be used.
       
    41 _LIT8(KHWRMVibraApiEComMatch, "HWRMVibra");
       
    42 
       
    43 
       
    44 /**
       
    45 *  Plugin interface class just encapsulates the Vibra command enumerations.
       
    46 *  Responsible for defining the command IDs for each message.
       
    47 */
       
    48 namespace HWRMVibraCommand
       
    49     {
       
    50     /**
       
    51     * Data structure used to pass vibra intensity and duration.
       
    52     * Used in EPulseVibraCmdId command.
       
    53 	*
       
    54 	* @publishedPartner
       
    55 	* @released
       
    56     */ 
       
    57     struct TVibraData
       
    58    	    {
       
    59    	    // Duration of vibration in milliseconds. 
       
    60         TUint iDuration;
       
    61    	    // Intensity of vibration. 
       
    62    	    TInt8 iIntensity;
       
    63    	    };
       
    64 
       
    65     // typedef'd package of TInt containing the vibra command*/
       
    66     typedef TPckgBuf<TInt> TStartVibraCmdDataPackage;
       
    67     
       
    68        
       
    69     // Data packages for pulse command
       
    70     typedef TPckgBuf<TVibraData> TPulseVibraCmdDataPackage;
       
    71 
       
    72    
       
    73     /** typedef'd package of TInt containing the error code response. */
       
    74     typedef TPckgBuf<TInt> TErrorCodeResponsePackage;
       
    75 
       
    76     /**
       
    77     * Command definitions
       
    78     * All commands contain a command id and a set of parameters. The command ids
       
    79     * are defined first and after that parameters for each command.
       
    80     *
       
    81     * This interface is asynchronous. A command is interpreted of being completed
       
    82     * after a response for that command is received.
       
    83     *
       
    84     * The field input means the parameter for the command.
       
    85     * The field output means the parameter for the response.
       
    86 	*
       
    87 	* @publishedPartner
       
    88 	* @released
       
    89     */
       
    90     enum TVibraCmd
       
    91         {
       
    92         /**
       
    93         * No command. May be used for sanity checks, but 
       
    94         * never as an actual command ID.
       
    95         *
       
    96         * input    None   
       
    97         * output   None   
       
    98         */
       
    99         ENoCommandId = 2000,
       
   100         
       
   101         /**
       
   102         * Start vibra. 
       
   103         *
       
   104         *
       
   105         * input    TStartVibraCmdDataPackage   Intensity  
       
   106         *    Intensity of the vibra in decimal is -100 to 100,
       
   107         *    which shows the percentage of the vibra motor full
       
   108         *    safe rotation speed. When intensity is negative, 
       
   109         *    the vibra motor rotates in the negative direction.
       
   110         *    When intensity is positive, the vibra motor rotates
       
   111         *    in the positive direction. 
       
   112         *    Value 0 effectively stops the vibra.
       
   113         *    Plugin should map intensity to such values that high or 
       
   114         *    low intensities never damage the device even
       
   115         *    if used for extended periods of time.
       
   116         * output   TErrorCodeResponsePackage   Error code
       
   117         *    KErrNone if operation succeeds.  
       
   118         *    KErrNotSupported if device doesn't support user-defined vibra intensity. 
       
   119         *    KErrArgument if intensity is outside allowed range.
       
   120         *    KErrGeneral if there is any problem.
       
   121         */
       
   122         EStartVibraCmdId,
       
   123         
       
   124         /**
       
   125         * Start vibra with device default intensity.
       
   126         *
       
   127         * input    None   
       
   128         * output   TErrorCodeResponsePackage   Error code     
       
   129         *    KErrNone if operation succeeds.   
       
   130         *    KErrGeneral if there is any problem.
       
   131         */
       
   132         EStartVibraWithDefaultSettingsCmdId,
       
   133 
       
   134         /**
       
   135         * Stop vibra. 
       
   136         *
       
   137         * input    None   
       
   138         * output   TErrorCodeResponsePackage   Error code     
       
   139         *    KErrNone if operation succeeds.   
       
   140         *    KErrGeneral if there is any problem.
       
   141         */
       
   142         EStopVibraCmdId,
       
   143         
       
   144         /**
       
   145         * Pulse vibra. Start and stop of vibration must be carried
       
   146         * out internally within plugin or underlying implementation.
       
   147         * If there is vibration ongoing when pulse command is sent,
       
   148         * intensity must be set according to pulse command intensity 
       
   149         * and when specified pulse duration has expired, interrupted
       
   150         * intensity must be restored. Ideally vibrations with varying 
       
   151         * intensity are observable althoug they would overlap.
       
   152         *
       
   153         * input    TPulseVibraCmdDataPackage   iIntensity
       
   154         *    Intensity of the vibra in decimal is 1 to 100,
       
   155         *    which shows the percentage of the vibra motor full
       
   156         *    safe rotation speed.
       
   157         *    Plugin should map intensity to such values that high or 
       
   158         *    low intensities never damage the device even
       
   159         *    if used for extended periods of time.
       
   160         * input    TPulseVibraCmdDataPackage   iDuration
       
   161         *    Duration of the vibra in milliseconds
       
   162         * output   TErrorCodeResponsePackage   Error code     
       
   163         *    KErrNone if operation succeeds.   
       
   164         *    KErrNotSupported if device doesn't support user-defined vibra intensity.
       
   165         *    KErrArgument if intensity or duration is outside allowed range.
       
   166         *    KErrGeneral if there is any problem.
       
   167         */
       
   168         EPulseVibraCmdId
       
   169         };
       
   170     }
       
   171 
       
   172 #endif      // HWRMVIBRACOMMANDS_H   
       
   173             
       
   174 // End of File