voiceui/vcommand/inc/vcplaybackdialog.h
branchRCL_3
changeset 19 e36f3802f733
parent 0 bf1d17376201
equal deleted inserted replaced
18:cad71a31b7fc 19:e36f3802f733
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Definition of class used for the playback of a voice tag
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef VCPLAYBACKDIALOG_H
       
    20 #define VCPLAYBACKDIALOG_H
       
    21 
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <notecontrol.h>
       
    26 #include <eikprogi.h>
       
    27 #include <AknProgressDialog.h>
       
    28 #include <nssvasmplayeventhandler.h>
       
    29 #include <vcommand.rsg>
       
    30 #include "vcommand.hrh"
       
    31 #include "vcommandconstants.h"
       
    32 
       
    33 // CONSTANTS
       
    34 const TInt KVoiceTagRecordLength = 32;
       
    35 const TInt KVoiceTagIncrement = 1;
       
    36 const TInt KInterval = 1;
       
    37 const TInt KDelay = 1;
       
    38 const TInt KMicroSecondsInterval = 125000;
       
    39 
       
    40 // FORWARD DECLARATIONS
       
    41 class CAknProgressDialog;
       
    42 class CVCommandUiEntry;
       
    43 class CVCommandHandler;
       
    44 class CVCommandUiEntry;
       
    45 
       
    46 
       
    47 // CLASS DECLARATION
       
    48 
       
    49 /**
       
    50 * Dialog for voice command playback using TTS
       
    51 */
       
    52 class CVCPlaybackDialog : public CAknProgressDialog,
       
    53                           public MNssPlayEventHandler
       
    54     {
       
    55     struct VTimerModel
       
    56         {
       
    57         TInt  iFinalValue;
       
    58         TInt  iHundreths;
       
    59         TInt  iIncrement;
       
    60         TBool iRunning;
       
    61         };
       
    62 
       
    63     public: // Constructors and destructor
       
    64 
       
    65         /**
       
    66         * C++ default constructor.
       
    67         */
       
    68         CVCPlaybackDialog( CVCommandHandler& iService,
       
    69                            const CVCommandUiEntry& aCommand );
       
    70 
       
    71         /**
       
    72         * Destructor.
       
    73         */
       
    74         virtual ~CVCPlaybackDialog();
       
    75 
       
    76     protected:  // Functions from base classes
       
    77         
       
    78         /**
       
    79         * From CAknProgressDialog
       
    80         * @see CAknProgressDialog for more information
       
    81         */
       
    82         void PreLayoutDynInitL();
       
    83 
       
    84         /**
       
    85         * From CAknProgressDialog
       
    86         * @see CAknProgressDialog for more information
       
    87         */
       
    88         void PostLayoutDynInitL();
       
    89 
       
    90         /**
       
    91         * From CAknProgressDialog
       
    92         * @see CAknProgressDialog for more information
       
    93         */
       
    94         TBool OkToExitL( TInt aButtonId );
       
    95 
       
    96     private: // functions from base classes
       
    97 
       
    98         /**
       
    99         * From CAknProgressDialog
       
   100         * @see CAknProgressDialog for more information
       
   101         */        
       
   102         TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
       
   103                                      TEventCode aType);
       
   104 
       
   105         /**
       
   106         * Called when playing of a voice tag is completed
       
   107         * @param aErrorCode EVasErrorNone if playing was successfull
       
   108         */     
       
   109         void HandlePlayComplete( TNssPlayResult aErrorCode );
       
   110 
       
   111         /**
       
   112         * Called when playing of a voice tag is started
       
   113         * @param aDuration - the duration of the utterance data
       
   114         */      
       
   115         void HandlePlayStarted ( TTimeIntervalMicroSeconds32 aDuration );
       
   116 
       
   117     private: // New functions
       
   118 
       
   119         /**
       
   120         * Starts the timer for the progress bar
       
   121         */
       
   122         void StartTimerL();
       
   123 
       
   124         /**
       
   125         * Stops the timer for the progress bar
       
   126         */
       
   127         void StopTimer();
       
   128 
       
   129         /**
       
   130         * Called by the timer class for every timer tick
       
   131         * @param aObject Points to same place as the this pointer
       
   132         * @return static TInt
       
   133         */
       
   134         static TInt OnTick( TAny* aObject );
       
   135 
       
   136         /**
       
   137         * Called by OnTick() - updates the progress bar
       
   138         */
       
   139         void DoTick();
       
   140 
       
   141         /**
       
   142         * Displays error note
       
   143         */
       
   144         void DisplayErrorNoteL();
       
   145       
       
   146         /**
       
   147         * Called when HandlePlayError() completes
       
   148         * @param aResult error code from TPlayResult
       
   149         * @return void
       
   150         */
       
   151         void DoHandlePlayErrorL( TNssPlayResult aResult );
       
   152       
       
   153         /**
       
   154         * Called when HandlePlayStarted() completes
       
   155         * @param aDuration Represents a microsecond time interval stored in 32 bits
       
   156         * @return void
       
   157         */
       
   158         void DoHandlePlayStartedL ( TTimeIntervalMicroSeconds32 aDuration );
       
   159         
       
   160     private: // data
       
   161 
       
   162         CPeriodic*                 iProgressBarTimer;
       
   163         CEikProgressInfo*          iProgressInfo;
       
   164         VTimerModel                iTModel;
       
   165         TInt                       iTickCount;
       
   166         TInt                       iExitFlag;
       
   167         TInt                       iExitWhenCalledBack;
       
   168     	TBool					   iOkToExit;
       
   169     	CVCommandHandler&          iService;
       
   170     	const CVCommandUiEntry&    iCommand;
       
   171     };
       
   172 
       
   173 #endif  // VCPLAYBACKDIALOG_H
       
   174 
       
   175 
       
   176 // End of File