localconnectivityservice/headset/inc/keypresstimer.h
branchRCL_3
changeset 20 4a793f564d72
parent 19 0aa8cc770c8a
child 21 74aa6861c87d
equal deleted inserted replaced
19:0aa8cc770c8a 20:4a793f564d72
     1 /*
       
     2 * Copyright (c) 2004-2009 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:  Hid timeout timer
       
    15  *
       
    16 */
       
    17 
       
    18 #ifndef C_KEYPRESSTIMER_H
       
    19 #define C_KEYPRESSTIMER_H
       
    20 
       
    21 #include <e32base.h>
       
    22 
       
    23 enum TTimerType
       
    24     {
       
    25     EDoubleClickTimer,
       
    26     ELongPressTimer,
       
    27     EScanNextPressTimer,
       
    28     EScanPrevPressTimer
       
    29     };
       
    30 
       
    31 /**
       
    32  * HID headset driver class
       
    33  *
       
    34  * This class specifies the function to be called when a timeout occurs.
       
    35  * Used in conjunction with CTimeOutTimer class
       
    36  * 
       
    37  */
       
    38 class MTimerNotifier
       
    39     {
       
    40 public:
       
    41     /**     
       
    42      * The function to be called when a timeout occurs.
       
    43      *     
       
    44      * @param aTimerType a Type of timer
       
    45      */
       
    46     virtual void TimerExpired( TTimerType aTimerType ) = 0;
       
    47     };
       
    48 
       
    49 /**
       
    50  * HID headset driver class
       
    51  *
       
    52  * This class will notify an object after a specified timeout.
       
    53  *
       
    54  */
       
    55 class CKeyPressTimer : public CTimer
       
    56     {
       
    57 public:
       
    58     /**
       
    59      * Two-phased constructor.     
       
    60      * @param aTimeOutNotify object to notify of timeout event
       
    61      * @param aTimeOutTime a Timeout time
       
    62      * @paran aTimerType a Type of timer
       
    63      * @return keypress timer
       
    64      */
       
    65     static CKeyPressTimer* NewL( MTimerNotifier* aTimeOutNotify,
       
    66             TTimeIntervalMicroSeconds32 aTimeOutTime, TTimerType aTimerType );
       
    67 
       
    68     /**
       
    69      * Two-phased constructor.
       
    70      * @param aTimeOutNotify object to notify of timeout event
       
    71      * @param aTimeOutTime a Timeout time
       
    72      * @paran aTimerType a Type of timer
       
    73      * @return keypress timer 
       
    74      */
       
    75     static CKeyPressTimer* NewLC( MTimerNotifier* aTimeOutNotify,
       
    76             TTimeIntervalMicroSeconds32 aTimeOutTime, TTimerType aTimerType );
       
    77 
       
    78     /**
       
    79      * Destructor
       
    80      */
       
    81     virtual ~CKeyPressTimer();
       
    82 
       
    83 protected:
       
    84 
       
    85     /**
       
    86      * From CTimer
       
    87      * Invoked when a timeout occurs
       
    88      *     
       
    89      */
       
    90     virtual void RunL();
       
    91 
       
    92 private:
       
    93 
       
    94     /**
       
    95      * Constructor
       
    96      * @param aTimeOutNotify object to notify of timeout event
       
    97      * @paran aTimerType a Type of timer
       
    98      */
       
    99     CKeyPressTimer( MTimerNotifier* aTimeOutNotify, TTimerType aTimerType );
       
   100     /**
       
   101      * Two-phased constructor.     
       
   102      * @param aTimeOutTime a Timeout time     
       
   103      */
       
   104     void ConstructL( TTimeIntervalMicroSeconds32 aTimeOutTime );
       
   105 
       
   106 private:
       
   107     // Member variables
       
   108 
       
   109     /**
       
   110      *  The observer for this objects events
       
   111      *  Not own. 
       
   112      */
       
   113     MTimerNotifier* iNotify;
       
   114 
       
   115     /**
       
   116      * Type of timer
       
   117      */
       
   118     TTimerType iTimerType;
       
   119     };
       
   120 #endif // C_KEYPRESSTIMER_H