tactilefeedback/tactilefeedbackresolver/plugins/tactilehapticsplugin/inc/tactilehapticsplayer.h
changeset 0 d54f32e146dd
child 13 a4df7952b706
equal deleted inserted replaced
-1:000000000000 0:d54f32e146dd
       
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Class for producing vibra feedback.
       
    15 * Part of:      Tactile Feedback.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef C_TACTILEHAPTICSPLAYER_H
       
    21 #define C_TACTILEHAPTICSPLAYER_H
       
    22 
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <cenrepnotifyhandler.h>
       
    26 #include <touchlogicalfeedback.h>
       
    27 #include <MProfileChangeObserver.h>
       
    28 
       
    29 #include "tactileplayer.h"
       
    30 
       
    31 class CHWRMHaptics;
       
    32 
       
    33 class MProfileEngine;
       
    34 class CProfileChangeNotifyHandler;
       
    35 /**
       
    36  *  Class for procuding haptics feedback based on logical
       
    37  *  feedback type.
       
    38  *
       
    39  *  @lib tactilehapticsplugin.lib
       
    40  *  @since S60 5.2
       
    41   */
       
    42 
       
    43 NONSHARABLE_CLASS( CTactileHapticsPlayer ): public CTactilePlayer,
       
    44                                             public MCenRepNotifyHandlerCallback,
       
    45                                             public MProfileChangeObserver
       
    46     {
       
    47 public:
       
    48     /**
       
    49      * 2-phased constructor.
       
    50      * @param aRepository - Reference to Central Repository.
       
    51      * @return Instance of CTactileHapticsPlayers.
       
    52      */
       
    53     static CTactileHapticsPlayer* NewL( CRepository& aRepository );
       
    54 
       
    55     /**
       
    56      * Destructor.
       
    57      */
       
    58     virtual ~CTactileHapticsPlayer();
       
    59 
       
    60  // from base class CTactilePlayer
       
    61 
       
    62     /**
       
    63      * @see CTactilePlayer.
       
    64      */
       
    65     TInt PlayFeedback( TTouchLogicalFeedback aFeedback );
       
    66     
       
    67     /**
       
    68      * @see CTactilePlayer.
       
    69      */
       
    70     TInt StartFeedback( TTouchContinuousFeedback aFeedback,
       
    71                         TInt aIntensity );
       
    72 
       
    73     /**
       
    74      * @see CTactilePlayer.
       
    75      */
       
    76     TInt ModifyFeedback( TInt aIntensity );
       
    77 
       
    78     /**
       
    79      * @see CTactilePlayer.
       
    80      */
       
    81     void StopFeedback();    
       
    82 
       
    83     /**
       
    84      * @see CTactilePlayer.
       
    85      */
       
    86     TInt PlayPreviewFeedback( TInt aLevel, TTouchLogicalFeedback aFeedback );
       
    87 
       
    88     /**
       
    89      * @see CTactilePlayer.
       
    90      */
       
    91     TInt StartPreviewFeedback( TInt aLevel,
       
    92                                TTouchContinuousFeedback aFeedback,
       
    93                                TInt aIntensity );
       
    94 
       
    95     /**
       
    96      * @see CTactilePlayer.
       
    97      */
       
    98     void StopPreviewFeedback();                               
       
    99 
       
   100 private: // From MCenRepNotifyHandlerCallback.
       
   101     /**
       
   102      * @see MCenRepNotifyHandlerCallback.
       
   103      */
       
   104     void HandleNotifyGeneric( TUint32 aId );
       
   105 
       
   106 private: // From MProfileChangeObserver
       
   107     /**
       
   108      * @see MProfileChangeObserver.
       
   109      */
       
   110     void HandleActiveProfileEventL( TProfileEvent aProfileEvent, 
       
   111                                     TInt aProfileId );
       
   112 
       
   113 private:
       
   114     /**
       
   115      * Plays haptics effect by logical feedback type.
       
   116      * 
       
   117      */
       
   118     void DoPlayFeedbackL( TTouchLogicalFeedback aFeedback );
       
   119     
       
   120     /**
       
   121      * Reads IVT data from file to buffer. 
       
   122      *
       
   123      */    
       
   124     HBufC8* IVTBufAllocL( const TDesC& aFileName );
       
   125     
       
   126     /**
       
   127      * Get new settings value from Central Repository and 
       
   128      * change haptics property.
       
   129      */
       
   130      void DoHandleNotifyGenericL( TUint32 aId );
       
   131 
       
   132     /**
       
   133      * Profiles engine -related initializations.
       
   134      * (User changeable settings are stored in profiles)
       
   135      */
       
   136     void InitializeProfilesEngineL();
       
   137     
       
   138 private:
       
   139     /**
       
   140      * Constructor.
       
   141      */    
       
   142     CTactileHapticsPlayer( CRepository& aRepository );
       
   143 
       
   144     /**
       
   145      * 2nd phase constructor.
       
   146      */
       
   147     void ConstructL();    
       
   148 
       
   149 private: // data
       
   150 
       
   151     /**
       
   152      * Access to haptics functionality
       
   153      * Own.  
       
   154      */
       
   155     CHWRMHaptics* iHaptics;
       
   156 
       
   157     /**
       
   158      * Current effect handle.
       
   159      */
       
   160     TInt    iEffectHandle;
       
   161     
       
   162     /**
       
   163      * Current effect index.
       
   164      */    
       
   165     TInt    iEffectIndex;
       
   166 
       
   167     /**
       
   168      * Handle to effect data file.
       
   169      */
       
   170     TInt iIVTHandle;
       
   171 
       
   172     /**
       
   173      * Multiplier, which is used for scaling the intenstiy of
       
   174      * continuous feedback.
       
   175      */
       
   176     TInt iMultiplier;
       
   177     
       
   178     /**
       
   179      * Haptics effect strength.
       
   180      */
       
   181     TInt iStrength;
       
   182     
       
   183     /**
       
   184      * Access to settings.
       
   185      * Not own.
       
   186      */    
       
   187     CRepository& iRepository;
       
   188     
       
   189     /**
       
   190      * Utility for listening to changes in configurable parameters.
       
   191      * Own.  
       
   192      */
       
   193     CCenRepNotifyHandler* iCenRepNotifier;    
       
   194     
       
   195     
       
   196     /**
       
   197      * Access to user changeable settings (stored into profiles)
       
   198      * Own.
       
   199      */
       
   200      MProfileEngine* iProfileEng;
       
   201 
       
   202     /**
       
   203      * For listening to changes in profiles.
       
   204      * Own.  
       
   205      */
       
   206     CProfileChangeNotifyHandler* iProfileHandler;
       
   207     };
       
   208 
       
   209 
       
   210 #endif // C_TACTILEHAPTICSPLAYER_H