srsf/vcommandhandler/inc/tagplayer.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:  Plays back voice commands
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19  
       
    20 #ifndef TAGPLAYER_H
       
    21 #define TAGPLAYER_H
       
    22 
       
    23 #include <nssvasmplayeventhandler.h>
       
    24 #include <nssvasmtag.h>
       
    25 #include <nssvasmgettagclient.h>  // for MNssTagListArray
       
    26 #include "vcommandinternalapi.h"
       
    27 
       
    28 /**
       
    29 * Plays back the voice commad
       
    30 */
       
    31 class CTagPlayer : public CBase, public MNssPlayEventHandler
       
    32     {
       
    33     public:
       
    34         
       
    35         static CTagPlayer* NewL();
       
    36         
       
    37         ~CTagPlayer();
       
    38         
       
    39         /**
       
    40         * Attempts to play back the text expected to be recognized. 
       
    41         * This object takes ownership on the aTag and will delete it upon
       
    42         * the playback completion.
       
    43         * This function is asynchronous
       
    44         *
       
    45         * @param aTag Tag to play. Will be deleted (not from VAS) upon the 
       
    46         *        playback completion
       
    47         * @param aPlayEventHandler Entity that handles the playback callbacks
       
    48         * @see NssVasMPlayEventHandler.h
       
    49         *
       
    50         * @leave KErrBadHandle if the current command has not been retrieved 
       
    51         *        from CVCommandHandler (i.e. was not trained for recognition)
       
    52         * @leave KErrNotFound if this command cannot be found in aHandler
       
    53         * @leave KErrNotReady @see nssvasmspeechitem.h MNssSpeechItem::TNssSpeechItemResult 
       
    54         *                                              EVasUnexpectedRequest
       
    55         * @leave KErrInUse @see nssvasmspeechitem.h MNssSpeechItem::TNssSpeechItemResult 
       
    56         *                                              EVasInUse
       
    57         * @leave KErrArgument @see nssvasmspeechitem.h MNssSpeechItem::TNssSpeechItemResult 
       
    58         *                                              EVasInvalidParameter
       
    59         * @leave KErrGeneral @see nssvasmspeechitem.h MNssSpeechItem::TNssSpeechItemResult 
       
    60         *                                             EVasPlayFailed
       
    61         */
       
    62         virtual void PlayTagL( MNssTag* aTag, MNssPlayEventHandler& aPlayEventHandler );
       
    63         
       
    64         /**
       
    65         * Cancels playback. No PlayStarted/PlayComplete after it
       
    66         *
       
    67         * @leave KErrNotReady if playback has never been started
       
    68         */                                   
       
    69         virtual void CancelPlaybackL();
       
    70     
       
    71         // From MNsPlayEventHandler
       
    72 
       
    73         /**
       
    74         * The HandlePlayStarted method is a virtual method implemented by the
       
    75         * client and is called when play is started
       
    76         * @param aDuration - the duration of the utterance data
       
    77         */       
       
    78         virtual void HandlePlayStarted( TTimeIntervalMicroSeconds32 aDuration );
       
    79 
       
    80         /**
       
    81         * The HandlePlayComplete method is a virtual method implemented by the
       
    82         * client and is called when play is completed
       
    83         * @param aErrorCode EVasErrorNone if playing was successfull
       
    84         */       
       
    85         virtual void HandlePlayComplete( TNssPlayResult aErrorCode );        
       
    86         
       
    87     private:
       
    88         // Playback is asynchronous function. 
       
    89         // This variable is used to hold the tag being played back
       
    90         MNssTag*                    iPlaybackTag;
       
    91         
       
    92         // Playback is asynchronous function. 
       
    93         // This variable is used to hold the external play event
       
    94         // handler
       
    95         MNssPlayEventHandler*       iPlayEventHandler;
       
    96 
       
    97     };
       
    98 
       
    99 #endif // TAGPLAYER_H