vtuis/videotelui/inc/cvtuidtmfbuffer.h
changeset 0 ed9695c8bcbe
child 26 590f6f022902
equal deleted inserted replaced
-1:000000000000 0:ed9695c8bcbe
       
     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:  DTMF buffer definition.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_VTUIDTMFBUFFER_H
       
    20 #define C_VTUIDTMFBUFFER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include "mvtuinumbersource.h"
       
    24 
       
    25 class CCoeEnv;
       
    26 class TKeyEvent;
       
    27 
       
    28 // Maximum size of the DTMF buffer
       
    29 const TInt KVtUiDTMFBufferSize = 64;
       
    30 
       
    31 /**
       
    32 *  TVtUiBaseComponentState
       
    33 *
       
    34 *  Base componentstate definition.
       
    35 *
       
    36 *  @since S60 v5.0
       
    37 */
       
    38 class CVtUiDTMFBuffer : public CActive, public MVtUiNumberSource
       
    39     {
       
    40 
       
    41 public:
       
    42 
       
    43     /**
       
    44     * Static construction method.
       
    45     * @param aCoeEnv Reference to CoeEnv object.
       
    46     * @return Pointer to newly created instance of CVtUiDTMFBuffer.
       
    47     */
       
    48     static CVtUiDTMFBuffer* NewL( const CCoeEnv& aCoeEnv );
       
    49 
       
    50     /**
       
    51     * C++ destructor.
       
    52     */
       
    53     ~CVtUiDTMFBuffer();
       
    54 
       
    55     /**
       
    56     * Append one character to DTMF buffer.
       
    57     * @param aChar Character to append.
       
    58     * @return ETrue if the given character was appended (i.e. it is a DTMF)
       
    59     */
       
    60     TBool Append( TChar aChar );
       
    61 
       
    62     /**
       
    63     * Clears the contents of the DTMF buffer.
       
    64     */
       
    65     void Reset();
       
    66 
       
    67     /**
       
    68     * Promote this instance as current number source.
       
    69     */
       
    70     void Activate();
       
    71 
       
    72     /**
       
    73     * Demote this instance from current number source position.
       
    74     */
       
    75     void Deactivate();
       
    76 
       
    77 public: // from MVtUiNumberSource
       
    78 
       
    79     /**
       
    80     * @see MVtUiNumberSource::GetContents
       
    81     */
       
    82     void GetContents( TDes& aContents ) const;
       
    83 
       
    84 private: // from CActive
       
    85 
       
    86     /**
       
    87     * @see CActive::DoCancel
       
    88     */
       
    89     void DoCancel();
       
    90 
       
    91     /**
       
    92     * @see CActive::RunL
       
    93     */
       
    94     void RunL();
       
    95 
       
    96 private:
       
    97 
       
    98     /**
       
    99     * C++ constructor
       
   100     */
       
   101     CVtUiDTMFBuffer( const CCoeEnv& aCoeEnv );
       
   102 
       
   103     /**
       
   104     * 2nd constructor, may leave.
       
   105     */
       
   106     void ConstructL();
       
   107 
       
   108     /**
       
   109     * Starts buffer modification monitoring timer. If this timer expires,
       
   110     * buffer will be reset. Timer is restarted when new character is added to
       
   111     * the buffer.
       
   112     */
       
   113     void StartTimer();
       
   114 
       
   115     /**
       
   116     * Called when buffer modification monitoring timer has expired.
       
   117     */
       
   118     void TimerExpired( TInt aError );
       
   119 
       
   120     /**
       
   121     * Clears the contents of the DTMF buffer.
       
   122     */
       
   123     void ResetBuffer();
       
   124 
       
   125 private:
       
   126 
       
   127     // Reference to coeenv
       
   128     const CCoeEnv& iCoeEnv;
       
   129 
       
   130     // Timer instance
       
   131     RTimer iTimer;
       
   132 
       
   133     // DTMF buffer
       
   134     TBuf< KVtUiDTMFBufferSize > iBuffer;
       
   135 
       
   136     };
       
   137 
       
   138 #endif // C_VTUIDTMFBUFFER_H