localconnectivityservice/headset/inc/keypresstimer.h
author hgs
Thu, 04 Nov 2010 15:31:42 +0800
changeset 60 841f70763fbe
parent 29 3ae5cb0b4c02
permissions -rw-r--r--
201044_04
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
29
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     1
/*
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     2
* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     3
* All rights reserved.
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     8
*
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     9
* Initial Contributors:
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    11
*
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    12
* Contributors:
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    13
*
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    14
* Description:  Hid timeout timer
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    15
 *
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    16
*/
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    17
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    18
#ifndef C_KEYPRESSTIMER_H
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    19
#define C_KEYPRESSTIMER_H
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    20
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    21
#include <e32base.h>
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    22
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    23
enum TTimerType
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    24
    {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    25
    EDoubleClickTimer,
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    26
    ELongPressTimer,
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    27
    EScanNextPressTimer,
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    28
    EScanPrevPressTimer
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    29
    };
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    30
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    31
/**
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    32
 * HID headset driver class
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    33
 *
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    34
 * This class specifies the function to be called when a timeout occurs.
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    35
 * Used in conjunction with CTimeOutTimer class
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    36
 * 
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    37
 */
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    38
class MTimerNotifier
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    39
    {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    40
public:
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    41
    /**     
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    42
     * The function to be called when a timeout occurs.
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    43
     *     
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    44
     * @param aTimerType a Type of timer
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    45
     */
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    46
    virtual void TimerExpired( TTimerType aTimerType ) = 0;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    47
    };
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    48
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    49
/**
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    50
 * HID headset driver class
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    51
 *
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    52
 * This class will notify an object after a specified timeout.
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    53
 *
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    54
 */
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    55
class CKeyPressTimer : public CTimer
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    56
    {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    57
public:
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    58
    /**
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    59
     * Two-phased constructor.     
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    60
     * @param aTimeOutNotify object to notify of timeout event
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    61
     * @param aTimeOutTime a Timeout time
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    62
     * @paran aTimerType a Type of timer
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    63
     * @return keypress timer
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    64
     */
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    65
    static CKeyPressTimer* NewL( MTimerNotifier* aTimeOutNotify,
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    66
            TTimeIntervalMicroSeconds32 aTimeOutTime, TTimerType aTimerType );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    67
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    68
    /**
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    69
     * Two-phased constructor.
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    70
     * @param aTimeOutNotify object to notify of timeout event
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    71
     * @param aTimeOutTime a Timeout time
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    72
     * @paran aTimerType a Type of timer
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    73
     * @return keypress timer 
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    74
     */
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    75
    static CKeyPressTimer* NewLC( MTimerNotifier* aTimeOutNotify,
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    76
            TTimeIntervalMicroSeconds32 aTimeOutTime, TTimerType aTimerType );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    77
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    78
    /**
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    79
     * Destructor
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    80
     */
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    81
    virtual ~CKeyPressTimer();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    82
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    83
protected:
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    84
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    85
    /**
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    86
     * From CTimer
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    87
     * Invoked when a timeout occurs
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    88
     *     
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    89
     */
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    90
    virtual void RunL();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    91
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    92
private:
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    93
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    94
    /**
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    95
     * Constructor
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    96
     * @param aTimeOutNotify object to notify of timeout event
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    97
     * @paran aTimerType a Type of timer
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    98
     */
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    99
    CKeyPressTimer( MTimerNotifier* aTimeOutNotify, TTimerType aTimerType );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   100
    /**
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   101
     * Two-phased constructor.     
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   102
     * @param aTimeOutTime a Timeout time     
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   103
     */
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   104
    void ConstructL( TTimeIntervalMicroSeconds32 aTimeOutTime );
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   105
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   106
private:
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   107
    // Member variables
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   108
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   109
    /**
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   110
     *  The observer for this objects events
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   111
     *  Not own. 
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   112
     */
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   113
    MTimerNotifier* iNotify;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   114
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   115
    /**
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   116
     * Type of timer
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   117
     */
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   118
    TTimerType iTimerType;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   119
    };
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   120
#endif // C_KEYPRESSTIMER_H