systemswstubs/hwrmhapticsstubplugin/inc/hwrmhapticsstubpluginidleresponder.h
changeset 5 6ac4a04c9b06
child 16 cee235f8aa57
equal deleted inserted replaced
4:ac37d08cf88d 5:6ac4a04c9b06
       
     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 the License "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 idle responder header file.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __HWRMHAPTICSSTUBPLUGINIDLERESPONDER_H_
       
    20 #define __HWRMHAPTICSSTUBPLUGINIDLERESPONDER_H_
       
    21 
       
    22 #include <e32base.h>
       
    23 
       
    24 class CHWRMHapticsStubPlugin;
       
    25 
       
    26 /**
       
    27  * Haptics stub plugin idle responder.
       
    28  * Class that initiates response generation after embedded 
       
    29  * CIdle AO gets runtime.
       
    30  *
       
    31  * @since Series S60 5.1
       
    32  */
       
    33 class CHWRMHapticsStubPluginIdleResponder : public CBase
       
    34     {
       
    35 public:
       
    36     /**
       
    37      * Static method for instantiating stub plugin objects used by
       
    38      * ECom framework.
       
    39      *
       
    40      * @param aPlugin     Pointer to the stub plugin object that calls 
       
    41      *                    this instantiation method.
       
    42      * @param aTransId    Transaction Id of the command (that is to be
       
    43      *                    responded when the embedded CIdle object is
       
    44      *                    scheduled to run).
       
    45      * @param aDataPacket Pointer to the received command data.
       
    46      * @return            Pointer to a new instance of idle responder.
       
    47      */
       
    48     static CHWRMHapticsStubPluginIdleResponder* NewL(
       
    49         CHWRMHapticsStubPlugin* aPlugin,
       
    50         TUint8 aTransId,
       
    51         TUint8* aDataPacket );
       
    52     
       
    53     /**
       
    54      * Destructor
       
    55      */
       
    56     virtual ~CHWRMHapticsStubPluginIdleResponder();
       
    57 
       
    58     /**
       
    59      * Response generation method (called as callback from CIdle)
       
    60      *
       
    61      * @param aSelf TAny pointer to the object that started the CIdle
       
    62      *              whose callback method this is.
       
    63      * @return TInt Always returns KErrNone. Required by CIdle(TCallBack).
       
    64      */
       
    65     static TInt GenerateResponse( TAny* aSelf );
       
    66 
       
    67     /**
       
    68      * The actual response generation method.
       
    69      */
       
    70     void GenerateResponseL();
       
    71 
       
    72     /**
       
    73      * Getter for transId
       
    74      * 
       
    75      * @return TUint8 The transaction Id.
       
    76      */
       
    77     TUint8 TransId() const; 
       
    78 
       
    79     /**
       
    80      * Getter for 'active' state
       
    81      *
       
    82      * @return TBool True iff the embedded CIdle AO is currently active.
       
    83      */
       
    84     TBool Active() const; 
       
    85 
       
    86 private:
       
    87 
       
    88     /**
       
    89      * Constructor
       
    90      *
       
    91      * @param aPlugin     See the above NewL method.
       
    92      * @param aTransId    See the above NewL method.
       
    93      * @param aDataPacket See the above NewL method.
       
    94      */
       
    95     CHWRMHapticsStubPluginIdleResponder(
       
    96         CHWRMHapticsStubPlugin* aPlugin,
       
    97         TUint8 aTransId,
       
    98         TUint8* aDataPacket );
       
    99 
       
   100     /**
       
   101      * Two-phase construction ConstructL
       
   102      */
       
   103      void ConstructL();
       
   104     
       
   105 private: // data
       
   106     
       
   107     /**
       
   108      * CIdle active object (through which response generation is done)
       
   109      */
       
   110     CIdle* iIdle;
       
   111     
       
   112     /**
       
   113      * Pointer to the stub plugin object that created this idle responder
       
   114      * and through which the actual response to stub client (i.e., to 
       
   115      * HapticsPluginManager) is sent.
       
   116      */
       
   117     CHWRMHapticsStubPlugin* iPlugin;
       
   118     
       
   119     /**
       
   120      * Transaction Id (of the received command)
       
   121      */
       
   122     TUint8 iTransId;
       
   123     
       
   124     /**
       
   125      * Pointer to raw command data (not owned)
       
   126      */
       
   127     TUint8* iDataPacket;
       
   128     };
       
   129 
       
   130 #endif // __HWRMHAPTICSSTUBPLUGINIDLERESPONDER_H_