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