epoc32/include/hwrmhaptics.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 /*
     2 * Copyright (c) 2008 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:  This file contains the header of the CHWRMHaptics class.
    15 *
    16 */
    17 
    18 
    19 #ifndef C_HWRMHAPTICS_H
    20 #define C_HWRMHAPTICS_H
    21 
    22 #include <e32base.h>
    23 #include <hwrmlogicalactuators.h>
    24 #include <hwrmhapticsobserver.h>
    25 #include <hwrmhapticsactuatorobserver.h>
    26 
    27 /** Minimum magnitude value. */
    28 const TInt KHWRMHapticsMinMagnitude = 0;
    29 
    30 /** Maximum magnitude value. */
    31 const TInt KHWRMHapticsMaxMagnitude = 10000;
    32 
    33 /**
    34 * Minimum device priority.
    35 *
    36 * To be used with SetDeviceProperty().
    37 */
    38 const TInt KHWRMHapticsMinDevicePriority = 0;
    39 
    40 /**
    41 * Maximum device priority.
    42 *
    43 * To be used with SetDeviceProperty().
    44 */
    45 const TInt KHWRMHapticsMaxDevicePriority = 15;
    46 
    47 
    48 /** Minimum strength value. */
    49 const TInt KHWRMHapticsMinStrength = 0;
    50 
    51 /** Maximum strength value. */
    52 const TInt KHWRMHapticsMaxStrength = 10000;
    53 
    54 
    55  /**
    56  * The class used to control the device's haptics feature.
    57  *
    58  * The Haptics API provides the ability to control the device's haptics feature.
    59  * The API provides methods for receiving the current status and effect
    60  * completion of the haptics. The API provides synchronous and asynchronous
    61  * versions of playing methods due to the nature of effect playing
    62  * where multiple calls may be made to play effects.
    63  * Synchronous methods are provided for other API functionality.
    64  * They will block the calling client during their execution.
    65  * The API is meant for all applications which need to control the
    66  * device's haptics feature.
    67  *
    68  * The API consist of the class CHWRMHaptics and related observer classes:
    69  * MHWRMHapticsObserver and MHWRMHapticsActuatorObserver. If the client
    70  * requires up-to-date status information, it can be achieved by deriving
    71  * the client from MHWRMHapticsObserver or MHWRMHapticsActuatorObserver or 
    72  * from both and providing a callback pointer(s) of the implementing class
    73  * for the NewL() method.
    74  *
    75  * @code
    76  *
    77  * // ===================================================================
    78  * // Usage example 1:
    79  * //    - Setting the license key.
    80  * //    - Playing a periodic effect
    81  * //    - Preconditions:
    82  * //        - Haptics feature must be enabled by the system.
    83  * // ===================================================================
    84  *
    85  * #include <hwrmhaptics.h>          // link against hwrmhapticsclient.lib
    86  * #include <hwrmlogicalactuators.h> // enumeration of logical actuators
    87  *
    88  * TInt minPeriod( 0 );
    89  * TInt effectHandle( 0 );
    90  * TInt suppAct( 0 );
    91  *
    92  * CHWRMHaptics* haptics = CHWRMHaptics::NewL( NULL, NULL );
    93  *
    94  * haptics->SupportedActuators( suppAct );
    95  *
    96  * if( EHWRMLogicalActuatorDevice & suppAct )
    97  *     {
    98  *     haptics->OpenActuatorL( EHWRMLogicalActuatorDevice );
    99  *     }
   100  * else if ( EHWRMLogicalActuatorAny & suppAct )
   101  *     {
   102  *     haptics->OpenActuatorL( EHWRMLogicalActuatorAny );
   103  *     }
   104  *
   105  *
   106  * // 3rd party developers can obtain the license key from Forum Nokia
   107  * _LIT8( KLicenseKey,"_this_value_must_be_32_in_length" );
   108  *
   109  * User::LeaveIfError(
   110  *     haptics->SetDeviceProperty( 
   111  *         THWRMHapticsDevicePropertyTypes::EHWRMHapticsLicenseKey,
   112  *         KLicenseKey ) );
   113  *
   114  * // --> now playing effects is possible
   115  *
   116  * CHWRMHaptics::THWRMHapticsPeriodicEffect periodicEff;
   117  *
   118  * periodicEff.iDuration = 5000;
   119  * periodicEff.iMagnitude = 5000;
   120  * periodicEff.iPeriod = minPeriod;
   121  * periodicEff.iStyle = CHWRMHaptics::EHWRMHapticsStyleSharp;
   122  * periodicEff.iAttackTime = 250;
   123  * periodicEff.iAttackLevel = 10000;
   124  * periodicEff.iFadeTime = 250;
   125  * periodicEff.iFadeLevel = 0;
   126  *
   127  * haptics->PlayPeriodicEffect( periodicEff, effectHandle );
   128  *
   129  * // ... something happened in the application and it has lost focus
   130  * // so stop the effect immediately
   131  *
   132  * haptics->StopPlayingEffect( effectHandle );
   133  *
   134  * // ================================================================
   135  * // Usage example 2:
   136  * //    - Loading effect data from a file and playing effects from the
   137  * //      loaded data.
   138  * //    - Preconditions:
   139  * //        - license key is set
   140  * //    - Recommended usage style:
   141  * //        - Effect data file can contain definition(s) of periodic
   142  * //          effects, magsweep effects or a combination of these basic
   143  * //          types called timeline effects, which call basic effects in
   144  * //          sequence thus forming new more complex effects.
   145  * //        - Load the effect data once in the client application.
   146  * //        - Play effects from the loaded data using the effectIndex
   147  * // ================================================================
   148  *
   149  * // Use S60 FileSystem to load the effect data file to a buffer
   150  *
   151  * ...
   152  *
   153  * // Effect data has been read into a descriptor by the user.
   154  * // Load the effect data to be used by the haptic subsystem.
   155  * TInt fileHandle( 0 );
   156  * User::LeaveIfError( haptics->LoadEffectData( data, fileHandle ) );
   157  * 
   158  * TInt effectIndex = 0;
   159  * TInt hapticsStatus = haptics->PlayEffect( fileHandle,
   160  *                                              effectIndex,
   161  *                                              effectHandle );
   162  *                                                
   163  * hapticsStatus = haptics->DeleteEffectData( fileHandle );
   164  *
   165  * if( KErrNone != hapticsStatus )
   166  *     {
   167  *     // do some error handling...
   168  *     }
   169  *
   170  * delete haptics;
   171  * haptics = NULL;
   172  *
   173  * @endcode
   174  *
   175  * Common error codes returned by the Haptics API methods.
   176  *
   177  * KErrArgument Argument is invalid, e.g., malformatted effect data, or too
   178  *              large magnitude value.
   179  * KErrAccessDenied The license key is not set when trying to use some
   180  *                  haptics method.
   181  * KErrNoMemory There is insufficient memory available for the method to 
   182  *              complete.
   183  * KErrNotReady Initialization has not been done properly when trying to use
   184  *              a haptics method.
   185  *
   186  * @lib hwrmhapticsclient.dll
   187  * @since S60 5.1
   188  */
   189 
   190  class CHWRMHaptics : public CBase
   191   {
   192 public:
   193 
   194     /**
   195     * Defines the paramaters used in a magsweep effect.
   196     *
   197     * Used by
   198     * PlayMagSweepEffect(),
   199     * ModifyPlayingMagSweepEffect(),
   200     * GetMagSweepEffectDefinition().
   201     */
   202     struct THWRMHapticsMagSweepEffect
   203         {
   204         /**
   205         * Duration of the effect. Unit is milliseconds.
   206         *
   207         * To specify an infinite duration, the effect duration
   208         * should be set to a value returned by InfiniteDuration().
   209         * For a finite duration, the effect duration is clamped to a value
   210         * from 0 to the value returned by GetDeviceCapability()
   211         * for the EHWRMHapticsMaxEffectDuration capability type.
   212         */
   213         TInt iDuration;
   214 
   215         /**
   216         * Magnitude of the effect.
   217         *
   218         * The effect magnitude is clamped to a value from 
   219         * KHWRMHapticsMinMagnitude to KHWRMHapticsMaxMagnitude.
   220         */
   221         TInt iMagnitude;
   222 
   223         /**
   224         * Style of the effect.
   225         *
   226         * Can be one of THWRMHapticsEffectStyles.
   227         */
   228         TInt iStyle;
   229 
   230         /**
   231         * Attack time of the effect. Unit is milliseconds.
   232         *
   233         * The attack time is clamped to a value from 0 to the value returned
   234         * by GetDeviceCapability() for the EHWRMHapticsMaxEnvelopeTime
   235         * capability type.
   236         */
   237         TInt iAttackTime;
   238 
   239         /**
   240         * Attack level of the effect.
   241         *
   242         * The attack level is clamped to a value from KHWRMHapticsMinMagnitude
   243         * to KHWRMHapticsMaxMagnitude.
   244         */
   245         TInt iAttackLevel;
   246 
   247         /**
   248         * Fade time of the effect. Unit is milliseconds.
   249         *
   250         * The fade time is clamped to a value from 0 to the value returned
   251         * by GetDeviceCapability() for the EHWRMHapticsMaxEnvelopeTime
   252         * capability type.
   253         */
   254         TInt iFadeTime;
   255 
   256         /**
   257         * Fade level of the effect.
   258         *
   259         * The fade level is clamped to a value from KHWRMHapticsMinMagnitude
   260         * to KHWRMHapticsMaxMagnitude inclusive.
   261         */
   262         TInt iFadeLevel;
   263         };
   264 
   265     /**
   266     * Defines the parameters used in a periodic effect.
   267     *
   268     * Used by
   269     * PlayPeriodicEffect(),
   270     * ModifyPlayingPeriodicEffect(),
   271     * GetPeriodicEffectDefinition().
   272     */
   273     struct THWRMHapticsPeriodicEffect
   274         {
   275         /**
   276         * Duration of the effect. Unit is milliseconds.
   277         *
   278         * To specify an infinite duration, the effect duration
   279         * should be set to InfiniteDuration().
   280         * For a finite duration, the effect duration is clamped to a value
   281         * from 0 to the value returned by GetDeviceCapability()
   282         * for the EHWRMHapticsMaxEffectDuration capability type.
   283         */
   284         TInt iDuration;
   285 
   286         /**
   287         * Magnitude of the effect.
   288         *
   289         * The effect magnitude is clamped to a value from
   290         * KHWRMHapticsMinMagnitude to KHWRMHapticsMaxMagnitude.
   291         */
   292         TInt iMagnitude;
   293 
   294         /**
   295         * Period of the effect. Unit is milliseconds.
   296         *
   297         * The period is clamped to a value returned by GetDeviceCapability()
   298         * for EHWRMHapticsMinPeriod capability type to the value returned
   299         * by GetDeviceCapability() for the EHWRMHapticsMaxEnvelopeTime
   300         * capability type.
   301         */
   302         TInt iPeriod;
   303 
   304         /**
   305         * Style of the effect.
   306         *
   307         * Can be one of THWRMHapticsEffectStyles.
   308         */
   309         TInt iStyle;
   310 
   311         /**
   312         * Attack time of the effect. Unit is milliseconds.
   313         *
   314         * The attack time is clamped to a value from 0 to the value returned
   315         * by GetDeviceCapability() for the EHWRMHapticsMaxEnvelopeTime
   316         * capability type.
   317         */
   318         TInt iAttackTime;
   319 
   320         /**
   321         * Attack level of the effect.
   322         *
   323         * The attack level is clamped to a value from KHWRMHapticsMinMagnitude
   324         * to KHWRMHapticsMaxMagnitude.
   325         */
   326         TInt iAttackLevel;
   327 
   328         /**
   329         * Fade time of the effect. Unit is milliseconds.
   330         *
   331         * The fade time is clamped to a value from 0 to the value returned
   332         * by GetDeviceCapability() for the EHWRMHapticsMaxEnvelopeTime
   333         * capability type.
   334         */
   335         TInt iFadeTime;
   336 
   337         /**
   338         * Fade level of the effect.
   339         *
   340         * The fade level is clamped to a value from KHWRMHapticsMinMagnitude
   341         * to KHWRMHapticsMaxMagnitude.
   342         */
   343         TInt iFadeLevel;
   344         };
   345 
   346     /**
   347     * THWRMHapticsDevicePropertyTypes enumeration
   348     * Use SetDeviceProperty() to set properties for the haptics
   349     * and GetDeviceProperty() to get properties currently in use.
   350     */
   351     enum THWRMHapticsDevicePropertyTypes
   352         {
   353         /**
   354         * License key property. Usable with SetDeviceProperty() only.
   355         * Use const TDesC8& overloaded version of the method.
   356         *
   357         * Setting this property to a valid license key unlocks the haptics
   358         * subsystem in the device. Setting this property to an invalid
   359         * license key locks the haptics in the device (for this client). 
   360         * The haptics in the device are locked from clients by default.
   361         * When haptics is locked, all haptics related operations on the 
   362         * device, except for setting the license key and closing the device,
   363         * fail.
   364         * Haptics must be unlocked on a per instance basis.
   365         */
   366         EHWRMHapticsLicensekey = 0,
   367 
   368         /**
   369         * Property used to set/get the priority for effects to played for
   370         * the given haptics instance (i.e., for the given client).
   371         *
   372         * Use TInt overloaded version of the methods SetDeviceProperty()and
   373         * GetDeviceProperty() to use this property.
   374         *
   375         * Different haptics instances can use different priorities
   376         * on the same physical device. The priority determines which haptics
   377         * instance's effects are played when multiple haptics instances
   378         * are attempting to play effects at the same time.
   379         * The default priority is DefaultDevicePriority().
   380         * Priority values can range from KHWRMHapticsMinDevicePriority
   381         * to KHWRMHapticsMaxDevicePriority.
   382         * GetDeviceProperty() returns a value inside
   383         * TInt& aDevicePropertyValue in the range of 
   384         * KHWRMHapticsMinDevicePriority
   385         * to KHWRMHapticsMaxDevicePriority. If the client has not set
   386         * the EHWRMHapticsPriority property GetDeviceProperty() returns
   387         * a value of DefaultDevicePriority().
   388         */
   389         EHWRMHapticsPriority,
   390 
   391         /**
   392         * Property used to disable effects for the client's haptics instance.
   393         *
   394         * Use TBool overloaded version of the methods SetDeviceProperty() and
   395         * GetDeviceProperty() to use this property.
   396         *
   397         * When this property is set to true, any playing effects are
   398         * immediately stopped and subsequent requests to play
   399         * effects are ignored. Applies to the calling client's
   400         * haptics instance only. When this property is set to false,
   401         * subsequent requests to play effects are honored.
   402         * The default value for this property is false.
   403         */
   404         EHWRMHapticsDisableEffects,
   405 
   406         /**
   407         * A property that reduces/increases the magnitude of all effects
   408         * for a particular haptics instance.
   409         *
   410         * Use TInt overloaded version of the methods SetDeviceProperty()and
   411         * GetDeviceProperty() to use this property.
   412 
   413         * Strength values can vary from KHWRMHapticsMinStrength ("mute")
   414         * to KHWRMHapticsMaxStrength.
   415         * The default value for EHWRMHapticsStrength is 
   416         * KHWRMHapticsMaxStrength. If the EHWRMHapticsStrength property is
   417         * not set, the default value is used.
   418         * When reducing/increasing the magnitude of the effects by setting
   419         * the EHWRMHapticsStrength property, it only applies to the haptics
   420         * instance of the client which called the function. If there is a
   421         * second haptics instance held by the same or a different client,
   422         * it is not affected by the setting of the EHWRMHapticsStrength
   423         * property of the first client's haptics instance.
   424         *
   425         * Modifying the EHWRMHapticsStrength property of the haptics instance
   426         * does not affect currently playing effects, only effects played or
   427         * modified after calling the SetDeviceProperty() method using the new
   428         * EHWRMHapticsStrength value.
   429         */
   430         EHWRMHapticsStrength,
   431 
   432         /**
   433         * A property that reduces/increases the magnitude of all effects
   434         * for all haptics instances (whole device).
   435         *
   436         * Use TInt overloaded version of the methods SetDeviceProperty()and
   437         * GetDeviceProperty() to use this property.
   438         *
   439         * Strength values can vary from KHWRMHapticsMinStrength ("mute")
   440         * to KHWRMHapticsMaxStrength.
   441         * The default value for Master Strength is KHWRMHapticsMaxStrength.
   442         * If the client does not set the EHWRMHapticsMasterStrength property
   443         * of the haptics instance, the default value is used.
   444         * When reducing/increasing the magnitude of the effects,
   445         * EHWRMHapticsMasterStrength property affects all playing effects on
   446         * all haptics instances (whole device).
   447         * This means that all the haptics instances, held by other
   448         * clients are affected by the setting of EHWRMHapticsMasterStrength
   449         * property of the first client's haptics instance.
   450         *
   451         * The client which wants to set the EHWRMHapticsMasterStrength
   452         * property must have a haptics instance that has a maximum effect
   453         * priority.
   454         * The haptics client instance must set itself to a maximum priority
   455         * by calling SetDeviceProperty() using EHWRMHapticsPriority property
   456         * type and KMaxDevicePriority value before changing the
   457         * EHWRMHapticsMasterStrength property's value.
   458         *
   459         * Note: A licensee license key, provided to licensees only,
   460         * changes the EHWRMHapticsMasterStrength property.
   461         * A call to SetDeviceProperty( EHWRMHapticsMasterStrength, aValue )
   462         * always returns KErrAccessDenied for haptics instances that are
   463         * not using a licensee license key.
   464         */
   465         EHWRMHapticsMasterStrength
   466         };
   467 
   468     /**
   469     * Device's capability types.
   470     *
   471     * Use TInt& aDeviceCapabilityValue overloaded version of the
   472     * method GetDeviceCapability() unless otherwise mentioned.
   473     */
   474     enum THWRMHapticsDeviceCapabilityTypes
   475         {
   476         /**
   477         * Device category. See THWRMHapticsDeviceCategory enumeration defined
   478         * later in this API header for possible values.
   479         */
   480         EHWRMHapticsDeviceCategory = 0,
   481 
   482         /**
   483         * The maximum number of nested repeat bars supported for Timeline effects.
   484         *
   485         * Any repeat bars nested beyond this level are played only once.
   486         */
   487         EHWRMHapticsMaxNestedRepeats,
   488 
   489         /**
   490         * Number of vibration actuators present in the device.
   491         */
   492         EHWRMHapticsNumActuators,
   493 
   494         /**
   495         * Actuator type See THWRMHapticsActuatorType enumeration defined
   496         * later in this API header for possible values.
   497         */
   498         EHWRMHapticsActuatorType,
   499 
   500         /**
   501         * Number of effect slots.
   502         *
   503         * The number of effect slots represents the maximum number
   504         * of simple effects that can play simultaneously.
   505         * If an attempt is made to play more than this number of effects
   506         * at the same time, some of the simple effects do not play.
   507         */
   508         EHWRMHapticsNumEffectSlots,
   509 
   510         /**
   511         * Supported effect styles, stored as a bitfield. See
   512         * THWRMHapticsSupportedEffectStyles enumeration defined later in this
   513         * API header for possible values.
   514         */
   515         EHWRMHapticsSupportedStyles,
   516 
   517         /**
   518         * Minimum period for Periodic effects.
   519         */
   520         EHWRMHapticsMinPeriod,
   521 
   522         /**
   523         * Maximum period for Periodic effects.
   524         */
   525         EHWRMHapticsMaxPeriod,
   526 
   527         /**
   528         * Maximum duration for MagSweep and Periodic effects measured
   529         * in milliseconds.
   530         */
   531         EHWRMHapticsMaxEffectDuration,
   532 
   533         /**
   534         * Supported effect types. Stored as a bitfield. See 
   535         * THWRMHapticsSupportedEffectTypes enumeration defined later in this
   536         * API header for possible values.
   537         */
   538         EHWRMHapticsSupportedEffects,
   539 
   540         /**
   541         * Device name.
   542         *
   543         * Use TDes8& aDeviceCapabilityValue overloaded version of the
   544         * method GetDeviceCapability().
   545         */
   546         EHWRMHapticsDeviceName,
   547 
   548         /**
   549         * Maximum start time or fade time in milliseconds for
   550         * effect envelopes of MagSweep or periodic effects.
   551         */
   552         EHWRMHapticsMaxEnvelopeTime,
   553 
   554         /**
   555         * Version number of the physical haptics player in the device in
   556         * hexadecimal format.
   557         *
   558         * The format is OxMMNNSSBB, where MM is the major
   559         * version number, NN is the minor version number,
   560         * SS is a special build number and BB is the VTMP build number.
   561         * For example, for the hexadecimal format 0x02000053 the version
   562         * number is 2.0.83
   563         */
   564         EHWRMHapticsAPIVersionNumber,
   565 
   566         /**
   567         * Maximum size in bytes of effect data (buffer) that can be played
   568         * on a non-tethered device. 
   569         */
   570         EHWRMHapticsMaxEffectDataSize = 14
   571         };
   572 
   573     /**
   574     * Device category.
   575     */
   576     enum THWRMHapticsDeviceCategory
   577         {
   578         EHWRMHapticsVirtual = 2,
   579         EHWRMHapticsEmbedded = 3,
   580         };
   581 
   582     /**
   583     * Bitmask for effect support.
   584     *
   585     * To be used to analyze value returned by GetDeviceCapability().
   586     */
   587     enum THWRMHapticsSupportedEffectTypes
   588         {
   589         EHWRMHapticsSupportPeriodic = 1,
   590         EHWRMHapticsSupportMagSweep = 2,
   591         EHWRMHapticsSupportTimeline = 4,
   592         EHWRMHapticsSupportStreaming = 8
   593         };
   594 
   595     /**
   596     * Effect types
   597     */
   598     enum THWRMHapticsEffectTypes
   599         {
   600         EHWRMHapticsTypePeriodic = 0,
   601         EHWRMHapticsTypeMagSweep,
   602         EHWRMHapticsTypeTimeline,
   603         EHWRMHapticsTypeStreaming
   604         };
   605 
   606     /**
   607     * Bitmask for supported effect styles.
   608     *
   609     * To be used to analyze the value returned by GetDeviceCapability().
   610     */
   611     enum THWRMHapticsSupportedEffectStyles
   612         {
   613         EHWRMHapticsSupportSmooth = 1,
   614         EHWRMHapticsSupportStrong = 2,
   615         EHWRMHapticsSupportSharp  = 4
   616         };
   617 
   618     /**
   619     * Effect styles
   620     *
   621     * Used to specify Periodic or MagSweep effect style when calling
   622     * PlayMagSweepEffect(),
   623     * PlayPeriodicEffect(),
   624     * ModifyPlayingMagSweepEffect() and
   625     * ModifyPlayingPeriodicEffect().
   626     */
   627     enum THWRMHapticsEffectStyles
   628         {
   629         EHWRMHapticsStyleSmooth = 0,
   630         EHWRMHapticsStyleStrong,
   631         EHWRMHapticsStyleSharp
   632         };
   633 
   634     /**
   635     * Actuator types.
   636     *
   637     * To be used with GetDeviceCapability().
   638     */
   639     enum THWRMHapticsActuatorTypes
   640         {
   641         /**
   642         * Eccentric Rotating Mass actuator
   643         */
   644         EHWRMHapticsTypeERM = 0,
   645 
   646         /**
   647         * Linear Resonant actuator
   648         */
   649         EHWRMHapticsTypeLRA = 2
   650         };
   651 
   652     /**
   653     * Effect states.
   654     *
   655     * As returned in a call to GetEffectState().
   656     */
   657     enum THWRMHapticsEffectStates
   658         {
   659         EHWRMHapticsEffectNotPlaying = 0,
   660         EHWRMHapticsEffectPlaying,
   661         EHWRMHapticsEffectPaused
   662         };
   663 
   664     /**
   665     * Two-phased constructor.
   666     * Use this method for creating a haptics instance with callbacks.
   667     *
   668     * @param aHapticsCallback Pointer to callback instance. Can be NULL.
   669     * @param aActuatorCallback Pointer to callback instance. Can be NULL.
   670     *
   671     * @return A pointer to a new instance of the CHWRMHaptics class.
   672     *
   673     * @since S60 5.1
   674     */
   675     IMPORT_C static CHWRMHaptics* NewL( 
   676         MHWRMHapticsObserver* aHapticsCallback,
   677         MHWRMHapticsActuatorObserver* aActuatorCallback );
   678     
   679     /**
   680     * @overload
   681     *
   682     * @param[out] aStatus Request status. On completion contains:
   683     *                     KErrNone, if successful,
   684     *                     otherwise one of the other system-wide error codes.
   685     */
   686     IMPORT_C static CHWRMHaptics* NewL( 
   687         MHWRMHapticsObserver* aHapticsCallback,
   688         MHWRMHapticsActuatorObserver* aActuatorCallback,
   689         TRequestStatus& aStatus );
   690 
   691     /**
   692     * Method for opening a logical actuator for use.
   693     *
   694     * This method must be called before using any other methods of this class,
   695     * except when using GetXXX methods.
   696     * The Haptics API supports a limited number of instances of CHWRMHaptics 
   697     * class.
   698     * If all instances are currently in use, the next attempt to call
   699     * OpenActuatorL() from any client fails.
   700     * Applications should not use more instances than necessary as this
   701     * may prevent other applications from instantiating the CHWRMHaptics
   702     * class.
   703     *
   704     * @param aActuator Enumeration of the type of logical actuator the client
   705     *                  wants to use.
   706     *
   707     * @leave TInt KErrNotSupported, if the used logical actuator is not
   708     *              supported by the system.
   709     * @leave TInt KErrAlreadyExists, if the used logical actuator is already
   710     *              opened.
   711     * @leave TInt KErrInUse, if some other actuator is already opened.
   712     * @leave TInt KErrArgument, if aActuator is not valid enumeration value.
   713     *
   714     * @see THWRMLogicalActuators for a list of usable actuators.
   715     *
   716     * @since S60 5.1
   717     */
   718     virtual void OpenActuatorL( THWRMLogicalActuators aActuator ) = 0;
   719 
   720     /**
   721     * Method for getting a bitmask value of supported logical actuators.
   722     *
   723     * Developer needs to evaluate the returned bitmask against
   724     * THWRMLogicalActuators enumeration values to know the
   725     * supported logical actuators.
   726     *
   727     * @param[out] aActuators Bitmask of supported logical actuators.
   728     *
   729     * @return TInt KErrNone, if successful, otherwise one of the other
   730     *              system-wide error codes.
   731     *
   732     * @see THWRMLogicalActuators for a list of usable actuators.
   733     *
   734     * @since S60 5.1
   735     */
   736     virtual TInt SupportedActuators( TUint32& aActuators ) = 0;
   737 
   738     /**
   739     * Reserves haptics feature exclusively for this client.
   740     * A higher priority client may cause lower priority client reservation
   741     * to be temporarily suspended. The suspended client does not get 
   742     * any notification about suspension. If haptics is already reserved 
   743     * by a higher or equal priority client, reserving still succeeds,
   744     * but reservation is immediately suspended. When the reservation 
   745     * is suspended, playing effects do not actually cause the effects to be 
   746     * played. 
   747     * Note: Unless the client has instantiated the Haptics API with the status
   748     * observer, it does not receive any notifications about the fact that its 
   749     * effects are not actually played by the physical player when the client
   750     * has been suspended by a higher priority reservation.
   751     * Note also that even if haptics is reserved by some client, a higher 
   752     * priority client succeeds in playing its effects.
   753     *
   754     * Calling this method is equal to call ReserveHapticsL(EFalse),
   755     * i.e. foreground status is always used to control further reservations.
   756     * However, this is a future feature, and not implemented in current version.
   757     */
   758     virtual void ReserveHapticsL() = 0;
   759 
   760     /**
   761     * Reserves haptics feature exclusively for this client.
   762     * A higher priority client may cause lower priority client reservation
   763     * to be temporarily suspended. The suspended client does not get 
   764     * any notifications about suspension. If haptics is already reserved 
   765     * by a higher or equal priority client, reserving still succeeds,
   766     * but reservation is immediately suspended. When the reservation 
   767     * is suspended, playing effects does not actually cause the effects to be 
   768     * played.
   769     * Note: Unless the client has instantiated the Haptics API with the status
   770     * observer, it does not receive any notifications about the fact that its 
   771     * effects are not actually played by the physical player when the client
   772     * has been suspended by a higher priority reservation.
   773     * Note also that even if haptics is reserved by some client, a higher 
   774     * priority client succeeds in playing its effects.
   775     *
   776     * @param aForceNoCCoeEnv (Note: This is a future feature, and not
   777     *                        implemented in current version.  You can think of
   778     *                        it ETrue always.)
   779     *                        If EFalse, then reservation requires that
   780     *                        this client has the keyboard focus at the time of
   781     *                        reservation and haptics is automatically
   782     *                        released and re-reserved based on the keyboard
   783     *                        focus status of this client.
   784     *                        This also implies that CCoeEnv::Static() != NULL
   785     *                        is required.
   786     *                        If ETrue, the client does not require CCoeEnv to
   787     *                        be present nor does it automatically reserve or
   788     *                        release haptics by depending on the foreground or
   789     *                        background status of the client. Only trusted
   790     *                        clients are allowed to set this flag to ETrue.
   791     *                        The client application is considered trusted if 
   792     *                        it has a priority defined in haptics policy file. 
   793     *                        The policy files can be modified by S60 licensees. 
   794     *
   795     * @leave KErrAccessDenied Parameter aForceNoCCoeEnv is ETrue
   796     *                         and client is not trusted.
   797     * @leave KErrBadHandle Parameter aForceNoCCoeEnv is EFalse
   798     *                      and no CCoeEnv present.
   799     * @leave KErrNotReady Trying to reserve while on background and parameter
   800     *                     aForceNoCCoeEnv is EFalse.
   801     * @leave KErrNoMemory There is a memory allocation failure.
   802     */
   803     virtual void ReserveHapticsL( TBool aForceNoCCoeEnv ) = 0;
   804 
   805     /**
   806     * Releases haptics feature if it was previously reserved for this client.
   807     *
   808     * If this client has not reserved haptics feature, does nothing.
   809     * If haptics is on when it is released and no other client has a suspended
   810     * reservation, haptics is stopped.
   811     */
   812     virtual void ReleaseHaptics() = 0;
   813 
   814     /**
   815     * This method retrieves the current haptics status.
   816     *
   817     * @return THWRMHapticsStatus indicating the current haptics status
   818     *
   819     * @see THWRMHapticsStatus
   820     */
   821     virtual MHWRMHapticsObserver::THWRMHapticsStatus HapticsStatus() const=0;
   822 
   823     /**
   824     * Sets a property of the haptics.
   825     *
   826     * Some properties affect all haptics instances, some only
   827     * the current instance of the haptics. More about that can be found
   828     * in THWRMHapticsDevicePropertyTypes.
   829     *
   830     * @param[in] aDevicePropertyType Property type for the
   831     *            property to be set.
   832     * @param[in] aDevicePropertyValue Value of the property to set.
   833     *
   834     * @return TInt KErrNone if successful, otherwise one of the other
   835     *              system-wide error codes.
   836     *
   837     * @see THWRMHapticsDevicePropertyTypes for a list of valid property types
   838     *
   839     * @since S60 5.1
   840     */
   841     virtual TInt SetDeviceProperty( TInt aDevicePropertyType,
   842                                     TInt aDevicePropertyValue ) = 0;
   843 
   844     /**
   845     * @overload
   846     */
   847     virtual TInt SetDeviceProperty( TInt aDevicePropertyType,
   848                                     const TDesC8& aDevicePropertyValue ) = 0;
   849 
   850     /**
   851     * Gets a property value of the haptics.
   852     *
   853     * @param[in] aDevicePropertyType Property type for the property to get.
   854     * @param[out] aDevicePropertyValue Reference to the variable that 
   855     *                                  receives the requested property
   856     *                                  value of the device.
   857     *
   858     * @return TInt KErrNone if successful, otherwise one of the other
   859     *              system-wide error codes.
   860     *
   861     * @see THWRMHapticsDevicePropertyTypes for a list of the valid property
   862     *      types.
   863     *
   864     * @since S60 5.1
   865     */
   866     virtual TInt GetDeviceProperty( TInt aDevicePropertyType,
   867                                     TInt& aDevicePropertyValue ) = 0;
   868 
   869     /**
   870     * @overload
   871     *
   872     * @return KErrNone if successful, 
   873     *         KErrArgument if the length of the given string is less 
   874     *         than MaxPropertyStringLength(), 
   875     *         otherwise one of the other system-wide error codes.
   876     */
   877     virtual TInt GetDeviceProperty( TInt aDevicePropertyType,
   878                                     TDes8& aDevicePropertyValue ) = 0;
   879 
   880     /**
   881     * Gets a capability value of the haptics.
   882     *
   883     * @param[in] aDeviceCapabilityType Capability type of the
   884     *                                  capability to get.
   885     * @param[out] aDeviceCapabilityValue Reference to the variable that 
   886     *                                    receives the requested capability
   887     *                                    value of the device.
   888     *
   889     * @return TInt KErrNone if successful, 
   890     *              KErrNotReady if no actuator has been opened,
   891     *              otherwise one of the other system-wide error codes.
   892     *
   893     * @see THWRMHapticsDeviceCapabilityTypes
   894     *
   895     * @since S60 5.1
   896     */
   897     virtual TInt GetDeviceCapability( TInt aDeviceCapabilityType,
   898                                       TInt& aDeviceCapabilityValue ) = 0;
   899 
   900     /**
   901     * @overload
   902     * 
   903     * @return TInt KErrNone if successful, 
   904     *              KErrNotReady if no actuator has been opened,
   905     *              KErrArgument if the length of the given string is less 
   906     *              than MaxCapabilityStringLength(), 
   907     *              otherwise one of the other system-wide error codes.
   908     */
   909     virtual TInt GetDeviceCapability( TInt aDeviceCapabilityType,
   910                                       TDes8& aDeviceCapabilityValue ) = 0;
   911 
   912     /**
   913     * Retrieves the status of an effect (playing, not playing, paused).
   914     *
   915     * @param[in] aEffectHandle Handle to the effect which must have been
   916     *                          obtained by calling
   917     *                          PlayMagSweepEffect(),
   918     *                          PlayPeriodicEffect(),
   919     *                          PlayEffect(),
   920     *                          PlayEffectRepeat() or
   921     *                          CreateStreamingEffect()
   922     * @param[out] aEffectState Pointer to the variable that receives
   923     *                          the status bits of the effect.
   924     *
   925     * @return TInt KErrNone if successful, otherwise one of the other
   926     *              system-wide error codes.
   927     *
   928     * @see THWRMHapticsEffectStates for a list of valid effect states.
   929     *
   930     * @since S60 5.1
   931     */
   932     virtual TInt GetEffectState( TInt aEffectHandle, TInt& aEffectState ) = 0;
   933 
   934     /**
   935     * Creates a streaming effect.
   936     *
   937     * Client calls CreateStreamingEffect() to create a new streaming
   938     * effect and gets a new handle for it; it should use that effect handle
   939     * to play a streaming sample by calling PlayStreamingSample().
   940     *
   941     * @param[out] aEffectHandle Reference to the variable that receives
   942     *                           a handle to the streaming effect.
   943     *
   944     * @return TInt KErrNone if successful, otherwise one of the other
   945     *              system-wide error codes.
   946     *
   947     * @since S60 5.1
   948     */
   949     virtual TInt CreateStreamingEffect( TInt& aEffectHandle ) = 0;
   950 
   951     /**
   952     * Plays a streaming sample given in the parameter defining the effect.
   953     *
   954     * Streaming sample can only be played after calling
   955     * CreateStreamingEffect() and by using the effecthandle it returns.
   956     *
   957     * Synchronous method returns when the haptic command has been evaluated
   958     * and the return value is valid.
   959     *
   960     * @param[in] aEffectHandle Handle to the streaming effect to play.
   961     * @param[in] aStreamingSample Reference to streaming sample data
   962     *                             containing the definition of
   963     *                             the effect to play.
   964     *
   965     * @return TInt KErrNone if successful, otherwise one of the other
   966     *              system-wide error codes.
   967     * @return TInt KErrInUse when haptics is reserved for a higher or 
   968     *              equal priority client.
   969     *
   970     * @since S60 5.1
   971     */
   972     virtual TInt PlayStreamingSample( TInt aEffectHandle,
   973                                       const TDesC8& aStreamingSample ) = 0;
   974     /**
   975     * @overload
   976     *
   977     * @param[out] aStatus Request status. On completion contains:
   978     *                     KErrNone, if successful,
   979     *                     KErrInUse when haptics is reserved for a higher or 
   980     *                     equal priority client,
   981     *                     otherwise one of the other system-wide error codes.
   982     */
   983     virtual void PlayStreamingSample( TInt aEffectHandle,
   984                                       const TDesC8& aStreamingSample,
   985                                       TRequestStatus& aStatus ) = 0;
   986 
   987     /**
   988     * Plays a streaming sample with a time offset given in the parameters
   989     * defining the effect.
   990     *
   991     * Client calls CreateStreamingEffect() to create a new streaming
   992     * effect and gets a new handle for it; it should use that effect handle
   993     * to play the streaming sample with this method.
   994     *
   995     * Synchronous method returns when the haptic command has been evaluated
   996     * and the return value is valid.
   997     *
   998     * @param[in] aEffectHandle Handle to the streaming effect to play.
   999     * @param[in] aStreamingSample Reference to streaming sample data
  1000     *                             containing the definition of the
  1001     *                             effect to play.
  1002     * @param[in] aOffsetTime For aOffsetTime values that are greater than 0,
  1003     *                        playback is delayed for aOffsetTime
  1004     *                        in milliseconds.
  1005     *                        For aOffsetTime values that are less than 0,
  1006     *                        sample playback begins in offset time
  1007     *                        in milliseconds into the current sample.
  1008     *
  1009     * @return TInt KErrNone if successful, otherwise one of the other
  1010     *              system-wide error codes.
  1011     * @return TInt KErrInUse when haptics is reserved for a higher or 
  1012     *              equal priority client.
  1013     *
  1014     * @since S60 5.1
  1015     */
  1016     virtual TInt PlayStreamingSampleWithOffset( TInt aEffectHandle,
  1017         const TDesC8& aStreamingSample,
  1018         TInt aOffsetTime ) = 0;
  1019 
  1020     /**
  1021     * @overload
  1022     *
  1023     * @param[out] aStatus Request status. On completion contains:
  1024     *                     KErrNone, if successful,
  1025     *                     KErrInUse when haptics is reserved for a higher or 
  1026     *                     equal priority client,
  1027     *                     otherwise one of the other system-wide error codes.
  1028     */
  1029     virtual void PlayStreamingSampleWithOffset( TInt aEffectHandle,
  1030         const TDesC8& aStreamingSample,
  1031         TInt aOffsetTime,
  1032         TRequestStatus& aStatus ) = 0;
  1033 
  1034     /**
  1035     * Destroys a streaming effect previously created in a successful
  1036     * call to CreateStreamingEffect().
  1037     *
  1038     * @param[in] aEffectHandle Handle to the streaming effect to destroy.
  1039     *
  1040     * @return TInt KErrNone if successful, otherwise one of the other
  1041     *              system-wide error codes.
  1042     *
  1043     * @since S60 5.1
  1044     */
  1045     virtual TInt DestroyStreamingEffect( TInt aEffectHandle ) = 0;
  1046 
  1047     /**
  1048     * Modifies a playing MagSweep effect.
  1049     *
  1050     * Synchronous method returns when the haptic command has been evaluated
  1051     * and the return value is valid.
  1052     *
  1053     * @param[in] aEffectHandle Handle to the playing MagSweep effect
  1054     *                          to modify. The handle to the effect must have
  1055     *                          been obtained by calling
  1056     *                          PlayMagSweepEffect(),
  1057     *                          PlayEffect() or
  1058     *                          PlayEffectRepeat().
  1059     * @param[in] aEffect Reference to a struct defining the effect parameters.
  1060     *
  1061     * @return TInt KErrNone if successful, otherwise one of the other
  1062     *              system-wide error codes.
  1063     *
  1064     * @see THWRMHapticsMagSweepEffect for effect definition.
  1065     *
  1066     * @since S60 5.1
  1067     */
  1068     virtual TInt ModifyPlayingMagSweepEffect( TInt aEffectHandle,
  1069         const CHWRMHaptics::THWRMHapticsMagSweepEffect& aEffect ) = 0;
  1070 
  1071     /**
  1072     * @overload
  1073     *
  1074     * @param[out] aStatus Request status. On completion contains:
  1075     *                     KErrNone, if successful,
  1076     *                     otherwise one of the other system-wide error codes.
  1077     */
  1078     virtual void ModifyPlayingMagSweepEffect( TInt aEffectHandle,
  1079         const CHWRMHaptics::THWRMHapticsMagSweepEffect& aEffect,
  1080         TRequestStatus& aStatus ) = 0;
  1081 
  1082     /**
  1083     * Modifies a playing periodic effect.
  1084     *
  1085     * Synchronous method returns when the haptic command has been evaluated
  1086     * and the return value is valid.
  1087     *
  1088     * @param[in] aEffectHandle Handle to the playing periodic effect
  1089     *                          to modify. The handle to the effect must have
  1090     *                          been obtained by calling
  1091     *                          PlayPeriodicEffect(),
  1092     *                          PlayEffect() or
  1093     *                          PlayEffectRepeat().
  1094     * @param[in] aEffect Reference to a struct defining the effect parameters.
  1095     *
  1096     * @return TInt KErrNone if successful, otherwise one of the other
  1097     *              system-wide error codes.
  1098     *
  1099     * @see THWRMHapticsPeriodicEffect for effect definition.
  1100     *
  1101     * @since S60 5.1
  1102     */
  1103     virtual TInt ModifyPlayingPeriodicEffect( TInt aEffectHandle,
  1104         const CHWRMHaptics::THWRMHapticsPeriodicEffect& aEffect ) = 0;
  1105 
  1106     /**
  1107     * @overload
  1108     *
  1109     * @param[out] aStatus Request status. On completion contains:
  1110     *                     KErrNone, if successful,
  1111     *                     otherwise one of the other system-wide error codes.
  1112     */
  1113     virtual void ModifyPlayingPeriodicEffect( TInt aEffectHandle,
  1114         const CHWRMHaptics::THWRMHapticsPeriodicEffect& aEffect,
  1115         TRequestStatus& aStatus ) = 0;
  1116 
  1117 
  1118     /**
  1119     * Load effect data defined in effect data buffer (obtained e.g. from a
  1120     * file containing the effect data).
  1121     *
  1122     * @param[in] aData Reference to allocated effect data buffer.
  1123     *
  1124     * @param[out] aFileHandle On return contains a handle to the passed
  1125     *                         effect data. This handle is haptics specific,
  1126     *                         i.e., it is not a file system handle but just
  1127     *                         a handle to the loaded effect data buffer.
  1128     *
  1129     * @return TInt KErrNone if successful, otherwise one of the other
  1130     *              system-wide error codes.
  1131     * @return TInt KErrArgument if the effect data is invalid.
  1132     *
  1133     * @since S60 5.1
  1134     */
  1135     virtual TInt LoadEffectData( const TDesC8& aData, TInt& aFileHandle ) = 0;
  1136 
  1137     /**
  1138     * Delete loaded effect data referenced by file handle.
  1139     *
  1140     * @param[in] aFileHandle Handle to file.
  1141     *
  1142     * @return TInt KErrNone if successful, otherwise one of the other
  1143     *              system-wide error codes.
  1144     *
  1145     * @since S60 5.1
  1146     */
  1147     virtual TInt DeleteEffectData( TInt aFileHandle ) = 0;
  1148 
  1149     /**
  1150     * Delete all loaded effect datas.
  1151     *
  1152     * @return TInt KErrNone if successful, otherwise one of the other
  1153     *              system-wide error codes.
  1154     *
  1155     * @since S60 5.1
  1156     */
  1157     virtual TInt DeleteAllEffectData() = 0;
  1158 
  1159     /**
  1160     * Plays an effect defined in loaded effect data buffer.
  1161     *
  1162     * Synchronous method returns when the haptic command has been evaluated
  1163     * and the return value is valid.
  1164     *
  1165     * @param[in] aFileHandle Handle to the loaded effect data.
  1166     *
  1167     * @param[in] aEffectIndex Index of the effect to play. The index of the
  1168     *                         effect must be greater than or equal to 0 and
  1169     *                         less than the number of effects returned by
  1170     *                         GetEffectCount().
  1171     * @param[out] aEffectHandle Reference to the variable that receives
  1172     *                           a handle to the playing effect.
  1173     *
  1174     * @return TInt KErrNone if successful, otherwise one of the other
  1175     *              system-wide error codes.
  1176     * @return TInt KErrInUse when haptics is reserved for a higher or 
  1177     *              equal priority client.
  1178     *
  1179     * @since S60 5.1
  1180     */
  1181     virtual TInt PlayEffect( TInt aFileHandle, 
  1182                              TInt aEffectIndex, 
  1183                              TInt& aEffectHandle ) = 0;
  1184 
  1185     /**
  1186     * @overload
  1187     *
  1188     * @param[out] aStatus Request status. On completion contains:
  1189     *                     KErrNone, if successful,
  1190     *                     KErrInUse when haptics is reserved for a higher or 
  1191     *                     equal priority client,
  1192     *                     otherwise one of the other system-wide error codes.
  1193     */
  1194     virtual void PlayEffect( TInt aFileHandle,
  1195                              TInt aEffectIndex,
  1196                              TInt& aEffectHandle,
  1197                              TRequestStatus& aStatus ) = 0;
  1198 
  1199     /**
  1200     * Repeatedly plays a Timeline effect defined in loaded effect data buffer.
  1201     *
  1202     * The current implementation of PlayEffectRepeat() repeats only
  1203     * Timeline effects. If the given effect index refers to a simple effect,
  1204     * PlayEffectRepeat() ignores the aRepeat parameter and plays the
  1205     * simple effect once. In that case, PlayEffectRepeat() behaves
  1206     * like PlayEffect(). PlayEffectRepeat() does not return a warning
  1207     * when requested to repeat a simple effect.
  1208     *
  1209     * Synchronous method returns when the haptic command has been evaluated
  1210     * and the return value is valid.
  1211     *
  1212     * @param[in] aFileHandle Handle to the loaded effect data.
  1213     * @param[in] aEffectIndex Index of the effect to play. The index of the
  1214     *                         effect must be greater than or equal to 0 and
  1215     *                         less than the number of effects returned by
  1216     *                         GetEffectCount().
  1217     * @param[in] aRepeat Number of times to repeat the effect. To play the
  1218     *                    effect indefinitely, set aRepeat to
  1219     *                    InfiniteRepeat(). To repeat the effect a
  1220     *                    finite number of times, set aRepeat to a value from
  1221     *                    0 to  InfiniteRepeat() - 1.
  1222     *                    The effect can be repeated at most
  1223     *                    InfiniteRepeat() - 1 times.
  1224     *                    Setting aRepeat to 0 plays the effect once (repeats
  1225     *                    the effect zero times) and is equivalent to calling
  1226     *                    PlayEffect().
  1227     *                    To stop the effect before it has
  1228     *                    repeated the requested number of times or to stop
  1229     *                    an effect that is playing indefinitely, call
  1230     *                    StopPlayingEffect() or StopAllPlayingEffects()
  1231     * @param[out] aEffectHandle Reference to the variable that receives
  1232     *                           a handle to the playing effect.
  1233     *
  1234     * @return TInt KErrNone if successful, otherwise one of the other
  1235     *              system-wide error codes.
  1236     * @return TInt KErrInUse when haptics is reserved for a higher or 
  1237     *              equal priority client.
  1238     *
  1239     * @since S60 5.1
  1240     */
  1241     virtual TInt PlayEffectRepeat( TInt aFileHandle,
  1242                                    TInt aEffectIndex,
  1243                                    TUint8 aRepeat,
  1244                                    TInt& aEffectHandle ) = 0;
  1245 
  1246     /**
  1247     * @overload
  1248     *
  1249     * @param[out] aStatus Request status. On completion contains:
  1250     *                     KErrNone, if successful,
  1251     *                     KErrInUse when haptics is reserved for a higher or 
  1252     *                     equal priority client,
  1253     *                     otherwise one of the other system-wide error codes.
  1254     */
  1255     virtual void PlayEffectRepeat( TInt  aFileHandle,
  1256                                    TInt aEffectIndex,
  1257                                    TUint8 aRepeat,
  1258                                    TInt& aEffectHandle,
  1259                                    TRequestStatus& aStatus ) = 0;
  1260 
  1261     /**
  1262     * Plays an effect defined in effect data buffer.
  1263     *
  1264     * Synchronous method returns when the haptic command has been evaluated
  1265     * and the return value is valid.
  1266     *
  1267     * @param[in] aData Reference to effect data buffer containing the 
  1268     *                  definition of the effect to play.
  1269     * @param[in] aEffectIndex Index of the effect to play. The index of the
  1270     *                         effect must be greater than or equal to 0 and
  1271     *                         less than the number of effects returned by
  1272     *                         GetEffectCount().
  1273     * @param[out] aEffectHandle Reference to the variable that receives
  1274     *                           a handle to the playing effect.
  1275     *
  1276     * @return TInt KErrNone if successful, otherwise one of the other
  1277     *              system-wide error codes.
  1278     * @return TInt KErrArgument if the data is invalid.
  1279     * @return TInt KErrInUse when haptics is reserved for a higher or 
  1280     *              equal priority client.
  1281     *
  1282     * @since S60 5.1
  1283     */
  1284     virtual TInt PlayEffect( const TDesC8& aData,
  1285                              TInt aEffectIndex,
  1286                              TInt& aEffectHandle ) = 0;
  1287 
  1288     /**
  1289     * @overload
  1290     *
  1291     * @param[out] aStatus Request status. On completion contains:
  1292     *                     KErrNone, if successful,
  1293     *                     KErrArgument, if the data is invalid,
  1294     *                     KErrInUse when haptics is reserved for a higher or 
  1295     *                     equal priority client,
  1296     *                     otherwise one of the other system-wide error codes.
  1297     */
  1298     virtual void PlayEffect( const TDesC8& aData,
  1299                              TInt aEffectIndex,
  1300                              TInt& aEffectHandle,
  1301                              TRequestStatus& aStatus ) = 0;
  1302 
  1303     /**
  1304     * Repeatedly plays a Timeline effect defined in effect data buffer.
  1305     *
  1306     * The current implementation of PlayEffectRepeat() repeats only
  1307     * Timeline effects. If the given effect index refers to a simple effect,
  1308     * PlayEffectRepeat() ignores the aRepeat parameter and plays the
  1309     * simple effect once. In that case, PlayEffectRepeat() behaves
  1310     * similarly to PlayEffect(). PlayEffectRepeat() does not return a warning
  1311     * when requested to repeat a simple effect.
  1312     *
  1313     * Synchronous method returns when the haptic command has been evaluated
  1314     * and the return value is valid.
  1315     *
  1316     * @param[in] aData Reference to effect data buffer containing the
  1317     *                  definition of the effect to play.
  1318     * @param[in] aEffectIndex Index of the effect to play. The index of the
  1319     *                         effect must be greater than or equal to 0 and
  1320     *                         less than the number of effects returned by
  1321     *                         GetEffectCount().
  1322     * @param[in] aRepeat Number of times to repeat the effect. To play the
  1323     *                    effect indefinitely, set aRepeat to
  1324     *                    InfiniteRepeat(). To repeat the effect a
  1325     *                    finite number of times, set aRepeat to a value from
  1326     *                    0 to InfiniteRepeat() - 1. The effect can
  1327     *                    be repeated at most InfiniteRepeat() - 1
  1328     *                    times.
  1329     *                    Setting aRepeat to 0 plays the effect once (repeats
  1330     *                    the effect zero times) and is equivalent to calling
  1331     *                    PlayEffect().
  1332     *                    To stop the effect before it has
  1333     *                    repeated the requested number of times or to stop
  1334     *                    an effect that is playing indefinitely, call
  1335     *                    StopPlayingEffect() or StopAllPlayingEffects()
  1336     * @param[out] aEffectHandle Reference to the variable that receives
  1337     *                           a handle to the playing effect.
  1338     *
  1339     * @return TInt KErrNone if successful, otherwise one of the other
  1340     *              system-wide error codes.
  1341     * @return TInt KErrArgument if the data is invalid.
  1342     * @return TInt KErrInUse when haptics is reserved for a higher or 
  1343     *              equal priority client.
  1344     *
  1345     * @since S60 5.1
  1346     */
  1347     virtual TInt PlayEffectRepeat( const TDesC8& aData,
  1348                                    TInt aEffectIndex,
  1349                                    TUint8 aRepeat,
  1350                                    TInt& aEffectHandle )=0;
  1351 
  1352     /**
  1353     * @overload
  1354     *
  1355     * @param[out] aStatus Request status. On completion contains:
  1356     *                     KErrNone, if successful,
  1357     *                     KErrArgument, if the data is invalid,
  1358     *                     KErrInUse when haptics is reserved for a higher or 
  1359     *                     equal priority client,
  1360     *                     otherwise one of the other system-wide error codes.
  1361     */
  1362     virtual void PlayEffectRepeat( const TDesC8& aData,
  1363                                    TInt aEffectIndex,
  1364                                    TUint8 aRepeat,
  1365                                    TInt& aEffectHandle,
  1366                                    TRequestStatus& aStatus )=0;
  1367 
  1368     /**
  1369     * Plays a MagSweep effect given in the parameters defining the effect.
  1370     *
  1371     * Synchronous method returns when the haptic command has been evaluated
  1372     * and the return value is valid.
  1373     *
  1374     * @param[in] aEffect Reference to a struct defining the effect parameters.
  1375     * @param[out] aEffectHandle Reference to the variable that receives
  1376     *                           a handle to the playing effect.
  1377     *
  1378     * @return TInt KErrNone if successful, otherwise one of the other
  1379     *              system-wide error codes.
  1380     * @return TInt KErrInUse when haptics is reserved for a higher or 
  1381     *              equal priority client.
  1382     *
  1383     * @see THWRMHapticsMagSweepEffect for effect definition.
  1384     *
  1385     * @since S60 5.1
  1386     */
  1387     virtual TInt PlayMagSweepEffect(
  1388         const CHWRMHaptics::THWRMHapticsMagSweepEffect& aEffect,
  1389         TInt& aEffectHandle ) = 0;
  1390 
  1391     /**
  1392     * @overload
  1393     *
  1394     * @param[out] aStatus Request status. On completion contains:
  1395     *                     KErrNone, if successful,
  1396     *                     KErrInUse when haptics is reserved for a higher or 
  1397     *                     equal priority client,
  1398     *                     otherwise one of the other system-wide error codes.
  1399     */
  1400     virtual void PlayMagSweepEffect(
  1401         const CHWRMHaptics::THWRMHapticsMagSweepEffect& aEffect,
  1402         TInt& aEffectHandle,
  1403         TRequestStatus& aStatus ) = 0;
  1404 
  1405     /**
  1406     * Plays a Periodic effect given in the parameters defining the effect.
  1407     *
  1408     * Synchronous method returns when the haptic command has been evaluated
  1409     * and the return value is valid.
  1410     *
  1411     * @param[in] aEffect Reference to a struct defining the effect parameters.
  1412     * @param[out] aEffectHandle Reference to the variable that receives
  1413     *                           a handle to the playing effect.
  1414     *
  1415     * @return TInt KErrNone if successful, otherwise one of the other
  1416     *              system-wide error codes.
  1417     * @return TInt KErrInUse when haptics is reserved for a higher or 
  1418     *              equal priority client.
  1419     *
  1420     * @see THWRMHapticsPeriodicEffect for effect definition.
  1421     *
  1422     * @since S60 5.1
  1423     */
  1424     virtual TInt PlayPeriodicEffect(
  1425         const CHWRMHaptics::THWRMHapticsPeriodicEffect& aEffect,
  1426         TInt& aEffectHandle ) = 0;
  1427 
  1428     /**
  1429     * @overload
  1430     *
  1431     * @param[out] aStatus Request status. On completion contains:
  1432     *                     KErrNone, if successful,
  1433     *                     KErrInUse when haptics is reserved for a higher or 
  1434     *                     equal priority client,
  1435     *                     otherwise one of the other system-wide error codes.
  1436     */
  1437     virtual void PlayPeriodicEffect(
  1438         const CHWRMHaptics::THWRMHapticsPeriodicEffect& aEffect,
  1439         TInt& aEffectHandle,
  1440         TRequestStatus& aStatus ) = 0;
  1441 
  1442     /**
  1443     * Pauses a playing effect.
  1444     *
  1445     * @param[in] aEffectHandle Handle to the playing effect to pause.
  1446     *                          The handle to the effect must have been
  1447     *                          obtained by calling
  1448     *                          PlayMagSweepEffect(),
  1449     *                          PlayPeriodicEffect() ,
  1450     *                          PlayEffect() ,
  1451     *                          PlayEffectRepeat() or
  1452     *                          CreateStreamingEffect().
  1453     *
  1454     * @return TInt KErrNone if successful, otherwise one of the other
  1455     *              system-wide error codes.
  1456     *
  1457     * @since S60 5.1
  1458     */
  1459      virtual TInt PausePlayingEffect( TInt aEffectHandle ) = 0;
  1460 
  1461     /**
  1462     * Resumes playback on a paused effect from the point where
  1463     * the effect was paused.
  1464     *
  1465     * Depending on the available slots, it is possible that all simple
  1466     * effects from a paused effect data buffer or streaming sample cannot
  1467     * be resumed. The API returns success when it is able to play one of
  1468     * these simple effects.
  1469     *
  1470     * @param[in] aEffectHandle Handle to the paused effect to resume.
  1471     *                          The handle to the effect must have been
  1472     *                          obtained by calling
  1473     *                          PlayMagSweepEffect(),
  1474     *                          PlayPeriodicEffect(),
  1475     *                          PlayEffect(),
  1476     *                          PlayEffectRepeat() or
  1477     *                          CreateStreamingEffect().
  1478     *
  1479     * @return TInt KErrNone if successful, otherwise one of the other
  1480     *              system-wide error codes.
  1481     *
  1482     * @since S60 5.1
  1483     */
  1484     virtual TInt ResumePausedEffect( TInt aEffectHandle ) = 0;
  1485 
  1486     /**
  1487     * Stops a playing effect.
  1488     *
  1489     * @param[in] aEffectHandle Handle to the playing effect to stop.
  1490     *                          The handle to the effect must have been
  1491     *                          obtained by calling
  1492     *                          PlayMagSweepEffect(),
  1493     *                          PlayPeriodicEffect(),
  1494     *                          PlayEffect(),
  1495     *                          PlayEffectRepeat() or
  1496     *                          CreateStreamingEffect().
  1497     *
  1498     * @return TInt KErrNone if successful, otherwise one of the other
  1499     *              system-wide error codes.
  1500     *
  1501     * @since S60 5.1
  1502     */
  1503     virtual TInt StopPlayingEffect( TInt aEffectHandle ) = 0;
  1504 
  1505     /**
  1506     * Stops all playing and paused effects of a haptics instance.
  1507     *
  1508     * @return TInt KErrNone if successful, otherwise one of the other
  1509     *              system-wide error codes.
  1510     *
  1511     * @since S60 5.1
  1512     */
  1513     virtual TInt StopAllPlayingEffects() = 0;
  1514 
  1515     /**
  1516     * Get a number of effects defined in a loaded effect data buffer.
  1517     *
  1518     * @param[in] aFileHandle Handle to the loaded effect data buffer.
  1519     * @param[out] aCount Number of effects in the effect data buffer.
  1520     *
  1521     * @return TInt KErrNone if successful, otherwise one of the other
  1522     *              system-wide error codes.
  1523     *
  1524     * @since S60 5.1
  1525     */
  1526     virtual TInt GetEffectCount ( TInt aFileHandle,
  1527                                   TInt& aCount ) const = 0;
  1528 
  1529     /**
  1530     * Get the duration of an effect defined in a loaded effect data buffer.
  1531     *
  1532     * @param[in] aFileHandle Handle to the loaded effect data buffer.
  1533     * @param[in] aEffectIndex Effect for which the duration is wanted.
  1534     * @param[out] aEffectDuration Reference to the variable that receives
  1535     *                             the requested effect's duration value.
  1536     *                             Duration is in milliseconds.
  1537     *
  1538     * @return TInt KErrNone if successful, otherwise one of the other
  1539     *              system-wide error codes.
  1540     * @since S60 5.1
  1541     */
  1542     virtual TInt GetEffectDuration ( TInt aFileHandle,
  1543                                      TInt aEffectIndex,
  1544                                      TInt& aEffectDuration ) const = 0;
  1545 
  1546     /**
  1547     * Gets the index of an effect defined in a loaded effect data buffer
  1548     * from the name of the effect.
  1549     *
  1550     * @param[in] aFileHandle Handle to the loaded effect data buffer.
  1551     * @param[in] aEffectName Name of the effect for which the index is wanted.
  1552     * @param[out] aEffectIndex Reference to the variable that receives
  1553     *             the requested effect's index value.
  1554     *
  1555     * @return TInt KErrNone if successful, otherwise one of the other
  1556     *              system-wide error codes.
  1557     *
  1558     * @since S60 5.1
  1559     */
  1560     virtual TInt GetEffectIndexFromName ( TInt aFileHandle,
  1561                                           const TDesC8& aEffectName,
  1562                                           TInt& aEffectIndex ) const = 0;
  1563 
  1564     /**
  1565     * Gets the type of an effect defined in loaded effect data buffer.
  1566     *
  1567     * @param[in] aFileHandle Handle to loaded effect data buffer.
  1568     * @param[in] aEffectIndex Index of an effect for which a type is wanted.
  1569     * @param[out] aEffectType Reference to the variable that receives
  1570     *                         the requested effect's type value.
  1571     *
  1572     * @return TInt KErrNone if successful, otherwise one of the other
  1573     *              system-wide error codes.
  1574     *
  1575     * @since S60 5.1
  1576     */
  1577     virtual TInt GetEffectType( TInt aFileHandle,
  1578                                 TInt aEffectIndex,
  1579                                 TInt& aEffectType ) const = 0;
  1580 
  1581     /**
  1582     * Gets the name of an effect defined in a loaded effect data buffer.
  1583     *
  1584     * @param[in] aFileHandle Handle to the loaded effect data buffer.
  1585     * @param[in] aEffectIndex Index of an effect for which a name is wanted.
  1586     * @param[out] aEffectName Reference to the variable that receives
  1587     *                         the requested effect's name. Note that the 
  1588     *                         descriptor's size must be at least the size
  1589     *                         given from MaxPropertyStringLength().
  1590     *
  1591     * @return TInt KErrNone if successful, otherwise one of the other
  1592     *              system-wide error codes.
  1593     *
  1594     * @since S60 5.1
  1595     */
  1596     virtual TInt GetEffectName( TInt aFileHandle,
  1597                                 TInt aEffectIndex,
  1598                                 TDes8& aEffectName ) const = 0;
  1599 
  1600     /**
  1601     * Gets the parameters of a MagSweep effect defined in a loaded effect data
  1602     * buffer.
  1603     *
  1604     * @param[in] aFileHandle Handle to the loaded effect data buffer.
  1605     * @param[in] aEffectIndex Index of an effect for which a definition is
  1606     *                         wanted.
  1607     * @param[out] aEffect Reference to the variable that receives
  1608     *                     the effect definition.
  1609     *
  1610     * @return TInt KErrNone if successful, otherwise one of the other
  1611     *              system-wide error codes.
  1612     *
  1613     * @see THWRMHapticsMagSweepEffect for effect definition.
  1614     *
  1615     * @since S60 5.1
  1616     */
  1617     virtual TInt GetMagSweepEffectDefinition( 
  1618         TInt aFileHandle,
  1619         TInt aEffectIndex,
  1620         CHWRMHaptics::THWRMHapticsMagSweepEffect& aEffect ) const = 0;
  1621 
  1622     /**
  1623     * Gets the parameters of a periodic effect defined in a loaded effect data
  1624     * buffer.
  1625     *
  1626     * @param[in] aFileHandle Handle to the loaded effect data buffer.
  1627     * @param[in] aEffectIndex Index of an effect for which a definition is wanted.
  1628     * @param[out] aEffect Reference to the variable that receives
  1629     *                     the effect definition.
  1630     *
  1631     * @return TInt KErrNone if successful, otherwise one of the other
  1632     *              system-wide error codes.
  1633     *
  1634     * @see THWRMHapticsPeriodicEffect for effect definition.
  1635     *
  1636     * @since S60 5.1
  1637     */
  1638     virtual TInt GetPeriodicEffectDefinition( 
  1639         TInt aFileHandle,
  1640         TInt aEffectIndex,
  1641         CHWRMHaptics::THWRMHapticsPeriodicEffect& aEffect ) const = 0;
  1642 
  1643     /**
  1644     * Gets the value that represents infinite repeats. Method may be used
  1645     * only after an actuator has been opened successfully.
  1646     *
  1647     * @return TInt Value that represents infinite repeats. KErrNotReady, if
  1648     * an actuator has not been opened.
  1649     */
  1650     virtual TInt InfiniteRepeat() const = 0;
  1651 
  1652     /**
  1653     * Gets the value that represents infinite duration. Method may be used
  1654     * only after an actuator has been opened successfully.
  1655     *
  1656     * @return TInt Value that represents infinite duration. KErrNotReady, if
  1657     * an actuator has not been opened.
  1658     */
  1659     virtual TInt InfiniteDuration() const = 0;
  1660 
  1661     /**
  1662     * Gets the maximum length of an effect name stored in a loaded
  1663     * effect data file. Method may be used only after an actuator 
  1664     * has been opened successfully.
  1665     *
  1666     * @return TInt Maximum effect name length. KErrNotReady, if
  1667     * an actuator has not been opened.
  1668     */
  1669     virtual TInt MaxEffectNameLength() const = 0;
  1670 
  1671     /** 
  1672     * Gets the maximum device name length.  Method may be used
  1673     * only after an actuator has been opened successfully.
  1674     *
  1675     * @return TInt Maximum device name length. KErrNotReady, if
  1676     * an actuator has not been opened.
  1677     */
  1678     virtual TInt MaxDeviceNameLength() const = 0;
  1679 
  1680     /**
  1681     * Gets the maximum capability string length. Method may be used
  1682     * only after an actuator has been opened successfully.
  1683     *
  1684     * @return TInt Maximum capability string length. KErrNotReady, if
  1685     * an actuator has not been opened.
  1686     */
  1687     virtual TInt MaxCapabilityStringLength() const = 0;
  1688 
  1689     /**
  1690     * Gets the maximum property string length. Method may be used
  1691     * only after an actuator has been opened successfully.
  1692     *
  1693     * @return TInt Maximum property string length. KErrNotReady, if
  1694     * an actuator has not been opened.
  1695     */
  1696     virtual TInt MaxPropertyStringLength() const = 0;
  1697 
  1698     /**
  1699     * Gets the maximum streaming sample size. Method may be used
  1700     * only after an actuator has been opened successfully.
  1701     *
  1702     * @return TInt Maximum streaming sample size. KErrNotReady, if
  1703     * an actuator has not been opened.
  1704     */
  1705     virtual TInt MaxStreamingSampleSize() const = 0;
  1706 
  1707     /**
  1708     * Gets the default device priority. Method may be used
  1709     * only after an actuator has been opened successfully.
  1710     *
  1711     * @return TInt Default device property. KErrNotReady, if
  1712     * an actuator has not been opened.
  1713     */
  1714     virtual TInt DefaultDevicePriority() const = 0;
  1715     };
  1716 
  1717 #endif