systemswstubs/hwrmhapticsstubplugin/inc/hwrmhapticsstubplugin.h
changeset 46 e1758cbb96ac
parent 9 f935d51494d1
child 16 cee235f8aa57
equal deleted inserted replaced
43:e71858845f73 46:e1758cbb96ac
       
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Haptics test (adaptation) plugin header file.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __HWRMHAPTICSSTUBPLUGIN_H_
       
    20 #define __HWRMHAPTICSSTUBPLUGIN_H_
       
    21 
       
    22 #include <hwrmhapticspluginservice.h>
       
    23 #include "hwrmhapticsstubpluginidleresponder.h"
       
    24 
       
    25 /**
       
    26  * Haptics stub plugin.
       
    27  * Stub implementation of Haptics adaptation ECom plugin for clean build(s).
       
    28  *
       
    29  * @since Series S60 5.1
       
    30  */
       
    31 class CHWRMHapticsStubPlugin : public CHWRMHapticsPluginService
       
    32     {
       
    33 public:
       
    34     /**
       
    35      * Static method for instantiating stub plugin objects used by
       
    36      * ECom framework.
       
    37      *
       
    38      * @aCallback Haptics plugin callback instance.
       
    39      * @return Pointer to a new CHWRMHapticsStubPlugin instance.
       
    40      */
       
    41     static CHWRMHapticsStubPlugin* NewL( 
       
    42             MHWRMHapticsPluginCallback* aCallback );
       
    43     
       
    44     /**
       
    45      * Destructor
       
    46      */
       
    47     virtual ~CHWRMHapticsStubPlugin();
       
    48 
       
    49     /**
       
    50      * Method to invoke a particular command in the plugin.
       
    51      * Dummy implementation of the CHWRMHapticsPluginService::ProcessCommandL 
       
    52      * abstract interface method. 
       
    53      *
       
    54      * @see CHWRMHapticsPluginService
       
    55      */
       
    56     virtual void ProcessCommandL( TInt aCommandId,
       
    57                                   TUint8 aTransId,
       
    58                                   TDesC8& aData );
       
    59 
       
    60     /**
       
    61      * Method to cancel a particular command.
       
    62      * Dummy implementation the CHWRMHapticsPluginService::CancelCommandL
       
    63      * abstract interface method. 
       
    64      *
       
    65      * @see CHWRMHapticsPluginService
       
    66      */
       
    67     virtual void CancelCommandL( TUint8 aTransId, 
       
    68                                  TInt aCommandId );
       
    69           
       
    70 
       
    71     /**
       
    72      * The actual response generation method (called from idle responder 
       
    73      * object)
       
    74      *
       
    75      * @param aTransId Transaction Id of the command for which the response 
       
    76      *                 generation is requested.
       
    77      * @param aData    Pointer to the data received in command (based on
       
    78      *                 which the command-specific response is generated).
       
    79      */
       
    80     void GenerateResponseL( TUint8 aTransId,
       
    81                             TUint8* aData );
       
    82 
       
    83     /**
       
    84      * Static method that CIdle calls as callback to remove "spent" responder
       
    85      * objects from their pointer array
       
    86      *
       
    87      * @param aObjectPtr Pointer to the CHWRMHapticsStubPlugin object that
       
    88      *                   started the CIdle runner whose RunL calls this
       
    89      *                   method as callback.
       
    90      * @return TInt      Always returns KErrNone. Required by 
       
    91      *                   CIdle( TCallBack ).
       
    92      */
       
    93     static TInt CollectGarbageIdle( TAny* aObjectPtr );
       
    94     
       
    95     /**
       
    96      * Method that does the actual garbage collection of spent responder
       
    97      * objects
       
    98      */
       
    99     void CollectGarbage();
       
   100      
       
   101 private:
       
   102 
       
   103     /**
       
   104      * Constructor.
       
   105      * 
       
   106      * @aCallback Haptics plugin callback instance.
       
   107      */
       
   108     CHWRMHapticsStubPlugin( MHWRMHapticsPluginCallback* aCallback );
       
   109     
       
   110     /**
       
   111      * Two-phase construction ConstructL
       
   112      */
       
   113     void ConstructL();
       
   114     
       
   115     /**
       
   116      * Method for removing a specific responder object from internal
       
   117      * RPointerArray
       
   118      *
       
   119      * @param aTransId Transaction Id of the responder that is to be removed.
       
   120      */
       
   121     void RemoveResponder( TUint8 aTransId );
       
   122     
       
   123 private: // data
       
   124     
       
   125     /**
       
   126      * Array of pointers to running idle responder objects
       
   127      */
       
   128     RPointerArray<CHWRMHapticsStubPluginIdleResponder> iResponders;
       
   129 
       
   130     /**
       
   131      * CIdle object through which the responders are cleaned (kind of garbage
       
   132      * collection)
       
   133      */
       
   134     CIdle *iIdle;
       
   135     };
       
   136 
       
   137 #endif // __HWRMHAPTICSSTUBPLUGIN_H_